/* $Id: common.js,v 1.147 2011/12/19 09:58:43 siddik Exp $ */
// global variables
notesobject = null;
function $ID(id){
	return document.getElementById(id);
}
function $Val(id){
	return $ID(id).value;
}
function startList() {
	if (document.all&&document.getElementById) {
		var ulelems = document.getElementsByTagName("ul");
		for(var k=0; k<ulelems.length; k++) {
			if(ulelems[k].id == 'nav') {
				navRoot = ulelems[k];
				for (i=0; i<navRoot.childNodes.length; i++) {
					node = navRoot.childNodes[i];
					if (node.nodeName=="LI") {
						node.onmouseover=function() {
							this.className+=" over";
						}
						node.onmouseout=function() {
							this.className=this.className.replace(" over", "");
						}
					}
				}
			}
		}
	}
}

function openInParent(url, viewFull)
        {
        	if(viewFull!=null && viewFull)
        	{
        		window.opener.location.href=url;
        		window.close();
        	}
        	else
        	{
        		window.location.href=url;
        	}
        	
        }

function addNotes(url, id)
{
    notesobject = $ID(id);
    var now = new Date();
    var timedURL = url+"&ct="+now.getTime();
    showURLInDialog(timedURL,'width=350px');
}

function updateNotesIcon()
{
    if(notesobject.parentNode.className.indexOf('evenRow') != -1)
    {
        notesobject.parentNode.className="notesicon evenRow";
    }
    else if(notesobject.parentNode.className.indexOf('oddRow') != -1)
    {
        notesobject.parentNode.className="notesicon oddRow";
    }
    else
    {
        notesobject.parentNode.className="notesicon";
    }
    notesobject = null; 
}

function selectUser(form, userId)
{
    form.userList.value = userId;
    form.submit();
}

function setReqNameID(dropDownValue,dropDownID)
{
	$ID("reqSearch").value = dropDownValue;//NO i18n
	$ID("requesterID").value = dropDownID;//NO i18n	
}

function showOwner()
{
	var id = $ID('assignTech');//NO i18n
	var id1 = $ID('assignQueue');//NO i18n
	if(document.WorkOrderForm.assignTo.value == 'Technician')
	{
		if (id.style.display == "none")
		{
			id.style.display = "block";
		}
		if (id1.style.display == "block")
		{
			id1.style.display = "none";
		}
	}
	else if(document.WorkOrderForm.assignTo.value == 'Queue')
	{
		if (id.style.display == "block")
		{
			id.style.display = "none";
		}
		if (id1.style.display == "none")
		{
			id1.style.display = "block";
		}
	}
	else if(document.WorkOrderForm.assignTo.value == 'None')
	{
		if (id.style.display == "block")
		{
			id.style.display = "none";
		}
		if (id1.style.display == "block")
		{
			id1.style.display = "none";
		}
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

var oPrevElement;
// click hover normal
function styleSwap(oElement, sEvent, sOff, sOn) {
	var cssClass
		if(sEvent == 'click') {
			if(oPrevElement != null) {
				oPrevElement.className = sOff;
			}
			if (oElement) { oElement.className = sOff; }
			oPrevElement = oElement; 
		}
		else {

			if (sEvent=='hover') cssClass = sOn;
			else cssClass = sOff;
			if (oPrevElement==null) {
				oElement.className = cssClass;
			}
			else {
				if(oPrevElement.id != oElement.id) {
					oElement.className = cssClass;
				}
			}
		}
}


function loader(did){
	var mid = $ID(did);
	if(readCookie(mid)=="show"){
		mid.style.display = 'block';

	}else if(readCookie(mid)=="hide"){
		mid.style.display = 'none';
	}
}



function ShowHide(divId)
{
	var id = $ID(divId);
	if(id != null){
		if (id.style.display == "none")
		{
			createCookie(id, 'show', 30);
			id.style.display = 'block';
		}
		else
		{
			createCookie(id, 'hide', 30);
			id.style.display = 'none';
		}
	}
}

function ShowReqTab(divIdToShow)
{
	var idToShow = $ID(divIdToShow);
	if(divIdToShow=="reqDetails")
	{
		var idToHide = $ID("reqHistory");//NO i18n
		idToHide.style.display = 'none';
		var idToHide = $ID("resolution");//NO i18n
		idToHide.style.display = 'none';
	}
	else if(divIdToShow=="resolution")
	{
		var idToHide = $ID("reqDetails");//NO i18n
		idToHide.style.display = 'none';
		var idToHide = $ID("reqHistory");//NO i18n
		idToHide.style.display = 'none';
	}
	else if(divIdToShow=="reqHistory")
	{
		var idToHide = $ID("reqDetails");//NO i18n
		idToHide.style.display = 'none';
		var idToHide = $ID("resolution");//NO i18n
		idToHide.style.display = 'none';
	}

	idToShow.style.display = 'block';
}


function ShowProductTab(divIdToShow)
{
	var idToShow = $ID(divIdToShow);
	if(divIdToShow=="productDetails")
	{
		var idToHide = $ID("associatedVendors");//NO i18n
		idToHide.style.display = 'none';
	}
	else if(divIdToShow=="associatedVendors")
	{
		var idToHide = $ID("productDetails");//NO i18n
		idToHide.style.display = 'none';
	}
	else if(divIdToShow=="vendorDetails")
	{
		var idToHide = $ID("associatedProducts");//NO i18n
		idToHide.style.display = 'none';
	}
	else if(divIdToShow=="associatedProducts")
	{
		var idToHide = $ID("vendorDetails");//NO i18n
		idToHide.style.display = 'none';
	}

	idToShow.style.display = 'block';
}

function createCookie(name, value, days)
{
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
  var ca = document.cookie.split(';');
  var nameEQ = name + "=";
  for(var i=0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
  return null;
}

function eraseCookie(name)
{
  createCookie(name, "", -1);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;}
  
function checkinteger(order)
{
	var x=order.value

	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (x!=null && x!="" && anum.test(x))
	{	
		testresult=true
		if(x.indexOf(".")>=0)
		{
			testresult=false
		}
		maxVal = Math.max(x,2147483648);
		if(maxVal!=2147483648 || x==maxVal)
		{
			testresult=false
		}
	}
	else
	{
		testresult=false
	}
	return (testresult)
}

function checkintegervalue(x)
{
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (x!=null && x!="" && anum.test(x))
	{	
		testresult=true
		if(x.indexOf(".")>=0)
		{
			testresult=false
		}
		maxVal = Math.max(x,2147483648);
		if(maxVal!=2147483648 || x==maxVal)
		{
			testresult=false
		}
	}
	else
	{
		testresult=false
	}
	return (testresult)
}

function checklong(order)
{
	var x=order.value;

	var anum=/(^\d+$)|(^\d+\.\d+$)/;
	if (x!=null && x!="" && anum.test(x))
	{	
		testresult=true;
		if(x.indexOf(".")>=0)
		{
			testresult=false;
		}
		maxVal = Math.max(x,9223372036854775808);
		if(maxVal!=9223372036854775808 || x==maxVal)
		{
			testresult=false;
		}
	}
	else
	{
		testresult=false;
	}
	return (testresult)
}

function checknumber(order)
{
	var x=order.value;

	var anum=/(^\d+$)|(^\d+\.\d+$)/;
	if (x!=null && x!="" && anum.test(x))
	{	
		testresult=true;
	}
	else
	{
		alert($ID('invalidnumber').value);//NO i18n
		testresult=false;
	}
	return (testresult);
}

function Show(divId)
{
	var id = $ID(divId);
	if (id.style.display == "none")
	{
		createCookie(id, 'show', 30);
		id.style.display = 'block';
	}
	else
	{
		createCookie(id, 'hide', 30);
		id.style.display = 'block';
	}
}

function quickReqValidateContact(form , fromLeftNav)
{
	if(trim(form.title.value)=="")
	{
		alert($ID("askreqtitle").value);//NO i18n
		form.title.focus();
		return false;
	}

	return true;
}
function quickReqValidate(form , fromLeftNav)
{
	if(trim(form.reqName.value)=="")
	{
		alert($ID("askreqname").value);//NO i18n
		form.reqName.focus();
		return false;
	}
	if(trim(form.title.value)=="")
	{
		alert($ID("askreqtitle").value);//NO i18n
		form.title.focus();
		return false;
	}
	var email = form.email.value;
	
	var doc = document;
	
        var custElementID = "customerName";//No I18N
        var accElementID = "accountName";//No I18N
	var reqSearchID = "reqSearch";//No I18N
	var requesterID = "requesterID";//No I18N
	if(fromLeftNav == "false")
	{
		custElementID = "customerName1";//No I18N
       	  	accElementID = "accountName1";//No I18N
		reqSearchID = "reqSearch1";//No I18N
		requesterID = "requesterID1";//No I18N

		
	}

	var acc = $ID(custElementID).value;
	if(fromLeftNav == "true")
	{
		if(acc == null || acc == '')
		{
			$ID('editAccountName').value="false";//No I18N
			$ID('customerName').value="";
		}
		else
		{
			$ID("accountName").value = acc;//NO i18n
			$ID('editAccountName').value="true";//No I18N
		}

	}
	else
	{
		if(acc == null || acc == '')
		{
			$ID('editAccountName1').value="false";//No I18N
			$ID('customerName1').value="";//NO i18n
		}
		else
		{
			$ID("accountName1").value = acc;//NO i18n
			$ID('editAccountName1').value="true";//No I18N
		}

	}

	if(!(trim(email)==""))
	{
		email = trimAll(email);
		var str = email;
		var leading = /^\s*/g;
		var trailing =/\s*$/g;

		leadingremoved = str.replace(leading,"");
		str = leadingremoved.replace(trailing,"");
		if (str.length > 0)
		{
			var posadr1 = 0;
			var posdot = str.indexOf(".");
			var posadr = str.indexOf("@");
			posadr1=str.lastIndexOf("@");
			var userID = $ID(requesterID).value;
			var name=$ID(reqSearchID).value
				var encodedContactName=encodeURIComponent(name);
			var url = "/servlet/ClientUtilServlet?action=getContactID&contactName="+encodedContactName;//No I18N
			var contactIDchk = AjaxValidate(url);
			if(contactIDchk == 'false')
			{
				userID = "";
				$ID(requesterID).value = userID;
			}
			if(userID != null && userID != "")
			{
				var url = "/servlet/ClientUtilServlet?action=getContactName&contactID="+userID;//No I18N
				var contactName = AjaxValidate(url);
				if(contactName != name)
				{
					if(contactName == 'false')
					{
						userID = "";
						$ID(requesterID).value == "";
					}
					url = "/servlet/ClientUtilServlet?action=getContactIDFromEmail&contactEmail="+str;//No I18N
					var contactID = AjaxValidate(url);
					if(contactID != 'false')
					{
						url = "/servlet/ClientUtilServlet?action=getContactName&contactID="+contactID;//No I18N
						contactName = AjaxValidate(url);
						userID = contactID;
						$ID(requesterID).value = contactID;
						$ID(reqSearchID).value = contactName;
					}
				}
			}
			var url1 = "";
			if(userID != null && userID != "")
			{
				url1 = "/servlet/ClientUtilServlet?action=checkForEmail&contactEmail="+str+"&contactID="+userID; //No I18N	
			}
			else
			{
				url1 = "/servlet/ClientUtilServlet?action=checkForEmail&contactEmail="+str;//No I18N
			}
			var checkemailresult = AjaxValidate(url1);
			if(checkemailresult == "true")
			{
				alert($ID('existingemail').value);//NO i18n
				return false;
			}
			if ( (posdot < 0) || (posadr < 0) || (posadr1 != posadr) )
			{
				alert($ID('invalidemail').value);//NO i18n
				form.email.focus();
				return false;
			}
		}
		var j = email.length;
		var strobj = new String(email);
		if (strobj.charAt(j-1)=="." || strobj.charAt(0)=="@" || strobj.charAt(j-1)=="@" || strobj.charAt(0)=="." || strobj.charAt(0)=="-" || strobj.charAt(0)=="_" || strobj.charAt(j-1)=="-" || strobj.charAt(j-1)=="_" || strobj.charAt(j-2)=="." || strobj.charAt(j-2)=="-" || strobj.charAt(j-2)=="_")
		{
			alert($ID('invalidemail').value);//NO i18n
			form.email.focus();
			return false;
		}
		form.email.value = email;
	}
	else
	{
		if(fromLeftNav == "true")
		{
			$ID(requesterID).value = "";
		}
	}
	// if the validation is for FCR no need to ask for conformation for new contact and account addtion
	if(fromLeftNav == "false")
	{
		if((trim(acc)==""))
		{
			$ID('reqSearch').value = $ID('reqSearch1').value;//NO i18n
			checkUserExists(form);
		}
		else
		{
			$ID('reqSearch').value = $ID('reqSearch1').value;//NO i18n
			$ID('customerName').value = $ID('customerName1').value;//NO i18n
			checkAccountExists(form);
		}
	}
	else
	{
		return true;
	}
	
	return false;
}
function AjaxValidate(url)
{       
    if (window.XMLHttpRequest)
    { // Non-IE browsers
        AJAX = new XMLHttpRequest();
    }
    else
    {                                 
            AJAX=new ActiveXObject("Microsoft.XMLHTTP");
      }
    if (AJAX)
    {
        AJAX.open("GET", url, false);                            
            AJAX.send(null);
             return AJAX.responseText;                                        
      }
    else
    {
             return "false";
      }
}


function confirmSubmit(confirmStr)
{
	var agree=confirm(confirmStr);
	if(agree)
	{
		return true ;
	}
	else
	{
		return false ;
	}
}


function loadme()
{
	var e=document.getElementsByTagName("div");
	var temp1 = document.getElementsByName("tabName")[0];
	var temp2 = document.getElementsByName("loggedUserID")[0];
	if(temp1 != null && temp2 != null)
	{
	var module = document.getElementsByName("tabName")[0].value;
	var userID = document.getElementsByName("loggedUserID")[0].value;
	for(var i=0;i<e.length;i++)
	{
		if(e[i].id!=null)
		{
			var bulletObj=MM_findObj("bullet"+e[i].id);
			if(readCookie(userID+module+e[i].id)==e[i].id+"show" )
			{
				e[i].style.display = 'block';
                                if(bulletObj != null)
                                {
        				bulletObj.src="/images/actionitems_expand.gif";
                                }
			}
			if(readCookie(userID+module+e[i].id)==e[i].id+"hide" )
			{
				e[i].style.display = 'none';
                                if(bulletObj != null)
                                {
        				bulletObj.src="/images/actionitems_collapse.gif";
                                }
			}
		}
	}
	}
}

function loadmeadmin()
{
	div1 = $ID('helpcoll');//NO i18n
	div2 = $ID('helpexp');//NO i18n

	var module = document.getElementsByName("tabName")[0].value;
	var userID = document.getElementsByName("loggedUserID")[0].value;
	if(readCookie(userID+module+div1.id)==div1.id+"show" )
	{
		div1.style.display = 'block';
		div2.style.display = 'none';
	}
	else if(readCookie(userID+module+div2.id)==div2.id+"show" )
	{
		div1.style.display = 'none';
		div2.style.display = 'block';
	}
	else
	{
		div1.style.display = 'block';
		div2.style.display = 'none';
		swap2LayerC('helpexp','helpcoll');
	}
}

function toggleSwipe(gName)
{
	var selRowObj = $ID(gName);
	var module = document.getElementsByName("tabName")[0].value;
	var userID = document.getElementsByName("loggedUserID")[0].value;
	var bulletObj=MM_findObj("bullet"+gName);
	if (selRowObj.style.display == 'none')
	{
		selRowObj.style.display = 'block';
		bulletObj.className = "view_minimize";
	}
	else if(selRowObj.style.display == 'block')
	{
		selRowObj.style.display = 'none';
		bulletObj.className = "view_maximize";	
	}
	else if(selRowObj.style.display == '')
	{
		selRowObj.style.display = 'none';
		bulletObj.className = "view_minimize";
	}
}

function toggleSwipe1(gName)
{
	var selRowObj = $ID(gName);
	var module = document.getElementsByName("tabName")[0].value;
	var userID = document.getElementsByName("loggedUserID")[0].value;
	if (selRowObj.style.display == 'none')
	{
		selRowObj.style.display = 'block';
	}
	else if(selRowObj.style.display == 'block')
	{
		selRowObj.style.display = 'none';
	}
	else if(selRowObj.style.display == '')
	{
		selRowObj.style.display = 'none';
	}
}

function swapLayer(showDiv,HideDiv)
{
	$ID(showDiv).style.display = 'block';
	$ID(HideDiv).style.display = 'none';
}

function onClickSwapLayer(showDiv,HideDiv)
{
	swapLayer(showDiv,HideDiv);
	var id1 = $ID("success_message");//No i18N
	if(id1!=null)
	{
		id1.style.display = 'none';
	}

	var id2 = $ID("error_message");//No i18N
	if(id2!=null)
	{
		id2.style.display = 'none';
	}
}

function swap2Layer(toShow,toHide)
{
   var idToShow = $ID(toShow);
   var idToHide = $ID(toHide);
   idToShow.style.display = 'block';
   idToHide.style.display = 'none';
}

function swapLayer3(toShow,toHide1,toHide2)
{
   swap2Layer(toShow,toHide1);
   var idToHide2 = $ID(toHide2);
   idToHide2.style.display = 'none';
}

function swapLayer4(toShow,toHide1,toHide2,toHide3)
{
   swap2Layer(toShow,toHide1);
   var idToHide2 = $ID(toHide2);
   idToHide2.style.display = 'none';
   var idToHide3 = $ID(toHide3);
   idToHide3.style.display = 'none';

   var module = document.getElementsByName("tabName")[0].value;   
   var userID = document.getElementsByName("loggedUserID")[0].value;

   createCookie(userID+module+toShow, toShow+'show', 30);
   createCookie(userID+module+toHide1, toHide1+'hide', 30);
   createCookie(userID+module+toHide2, toHide2+'hide', 30);
   createCookie(userID+module+toHide3, toHide3+'hide', 30);
}

function swap2LayerC(showDiv,HideDiv)
{
   var showdiv = $ID(showDiv);
   var hidediv = $ID(HideDiv);
   var module = document.getElementsByName("tabName")[0].value;   
   var userID = document.getElementsByName("loggedUserID")[0].value;
   if(showdiv!=null && showdiv!='')
   {
	showdiv.style.display = 'block';
   }
   if(hidediv!=null && hidediv!='')
   {
   	hidediv.style.display = 'none';
   }
   createCookie(userID+module+showDiv, showDiv+'show', 30);
   createCookie(userID+module+HideDiv, HideDiv+'hide', 30);
}

function trimAll(str)
{
	/*************************************************************
	  Input Parameter :str
Purpose         : remove all white spaces in front and back of string
Return          : str without white spaces    
	 ***************************************************************/

	//check for all spaces
	var objRegExp =/^(\s*)$/;
	if (objRegExp.test(str))
	{
		str = str.replace(objRegExp,''); 
		if (str.length == 0)
			return str; 
	} 

	//  check for leading and trailling spaces
	objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
	if(objRegExp.test(str))
	{
		str = str.replace(objRegExp, '$2');
	}
	return str;
}

function beforePOCancel()
{
	if(window.confirm($ID("confirmMsg").value))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function checkForUDFNumeric()
{
	from =document.getElementsByName("FROM")[0];
	if(from!=null && from.value=='INLINE')
	{
	num1 = trimAll(document.getElementsByName("UDF_LONG1")[0]);
	num2 = trimAll(document.getElementsByName("UDF_LONG2")[0]);
	num3 = trimAll(document.getElementsByName("UDF_LONG3")[0]);
	num4 = trimAll(document.getElementsByName("UDF_LONG4")[0]);
	}
	else
	{
	num1 = document.getElementsByName("udfName1")[0];
	num2 = document.getElementsByName("udfName2")[0];
	num3 = document.getElementsByName("udfName11")[0];
	num4 = document.getElementsByName("udfName12")[0];
	num5 = document.getElementsByName("globalUdfName1")[0];
	num6 = document.getElementsByName("globalUdfName2")[0];
	num7 = document.getElementsByName("globalUdfName11")[0];
	num8 = document.getElementsByName("globalUdfName12")[0];
	}
	if(num1!=null && num1.value!=null && num1.value!='')
	{
		if(!checklong(num1))
		{
			num1.focus();
			return false;
		}
	}
	
	if(num2!=null && num2.value!=null && num2.value!='')
	{
		if(!checklong(num2))
		{
			num2.focus();
			return false;
		}
	}
	
	if(num3!=null && num3.value!=null && num3.value!='')
	{
		if(!checklong(num3))
		{
			num3.focus();
			return false;
		}
	}
	
	if(num4!=null && num4.value!=null && num4.value!='')
	{
		if(!checklong(num4))
		{
			num4.focus();
			return false;
		}
	}

	if(num5!=null && num5.value!=null && num5.value!='')
	{
		if(!checklong(num5))
		{
			num5.focus();
			return false;
		}
	}

	if(num6!=null && num6.value!=null && num6.value!='')
	{
		if(!checklong(num6))
		{
			num6.focus();
			return false;
		}
	}

	if(num7!=null && num7.value!=null && num7.value!='')
	{
		if(!checklong(num7))
		{
			num7.focus();
			return false;
		}
	}

	if(num8!=null && num8.value!=null && num8.value!='')
	{
		if(!checklong(num8))
		{
			num8.focus();
			return false;
		}
	}

	return true;
}

function validateIP(ip)
{
	val = trimAll(ip.value);
	if(val.indexOf(".")>0)
	{
		val1 = val.substring(0,val.indexOf("."));
		if(checkintegervalue(val1))
		{
			max2 = Math.max(val1,256);
			if(max2!=256 || val1==max2)
			{
				ip.focus();
				return false;
			}
		}
		else
		{
			ip.focus();
			return false;
		}
		val = val.substring(val.indexOf(".")+1,val.length);
		if(val.indexOf(".")>0)
		{
			val1 = val.substring(0,val.indexOf("."));
			if(checkintegervalue(val1))
			{
				max2 = Math.max(val1,256);
				if(max2!=256 || val1==max2)
				{
					ip.focus();
					return false;
				}
			}
			else
			{
				ip.focus();
				return false;
			}
			val = val.substring(val.indexOf(".")+1,val.length);
			if(val.indexOf(".")>0)
			{
				val1 = val.substring(0,val.indexOf("."));
				if(checkintegervalue(val1))
				{
					max2 = Math.max(val1,256);
					if(max2!=256 || val1==max2)
					{
						ip.focus();
						return false;
					}
				}
				else
				{
					ip.focus();
					return false;
				}
				val = val.substring(val.indexOf(".")+1,val.length);
				if(checkintegervalue(val))
				{
					max2 = Math.max(val,256);
					if(max2!=256 || val==max2)
					{
						ip.focus();
						return false;
					}
				}
				else
				{
					ip.focus();
					return false;
				}
			}
			else
			{
				ip.focus();
				return false;
			}
		}
		else
		{
			ip.focus();
			return false;
		}
	}
	else
	{
		ip.focus();
		return false;
	}
	return true;
}

function checkForIntegerZero(order)
{
	var x=order.value;
	if(!checkinteger(order))
	{
		return false;
	}
  	for(var i=0; i < x.length; i++)
	{
		y = x.charAt(i);
		if(y=='0')
		{
			x = x.substring(i+1,x.length);
			i--;
			if(i<0 && x.length==0)
			{
				break;
			}
		}
		else
		{
			break;
		}
	}
	order.value=x;
	if(x==null || x=='')
	{
		return false;
	}
	else
	{
		return true;
	}
}

function ruleSelection(oElement, val)
{
	ele1 = $ID('operatorID'+val);//No i18N
	ele2 = $ID('rowTextID'+val);//No i18N
	sOff = 'rowselected';
	textC = 'formStyleTextSel';
	if(oElement)
	{
		oElement.className = sOff;
	}
	if(ele1)
	{
		ele1.className = textC;
	}
	if(ele2)
	{
		ele2.className = textC;
	}
}


function openWindow(theURL,winName,features,w,h) { //v2.0

	 LeftPosition=(screen.width)?(screen.width-w)/2:100;
	 TopPosition=(screen.height)?(screen.height-h)/2:100;
	 features = features + ',top='+TopPosition+',left='+LeftPosition;
	 window.open(theURL,winName,features);
}


function disableForDemo()
{
	alert("This feature is disabled for the Online Demo");
	return false;
}

function formChoose(labelId, onclass, offclass)
{
	var id = $ID(labelId);
	var e=document.getElementsByTagName("label");
	for(var i=0;i<e.length;i++)
	{
		if(e[i].id!=null)
		{
			var bulletObj=MM_findObj(e[i].id);
			bulletObj.className= offclass;

		}
	}

	id.className = onclass ;
}


function selectRow(elementId, onclass, offclass)
{
	var eid = $ID(elementId);
	var e=document.getElementsByTagName("tr");
	for(var i=0;i<e.length;i++)
	{
		if(eid[i].id!=null)
		{
			var eObj=MM_findObj(eid[i].id);
			eObj.className= offclass;

		}
	}

	eid.className = onclass ;

}


function threadShowhide(gName)
{
	var selRowObj = $ID(gName);
	var bulletObj=MM_findObj("bullet"+gName);
	if (selRowObj.style.display == 'none')     
	{
		selRowObj.style.display = 'block';
		bulletObj.src="/images/threadcollapse.gif";
	}
	else if(selRowObj.style.display == 'block')     
	{
		selRowObj.style.display = 'none';
		bulletObj.src="/images/threadexpand.gif";
	}
	else if(selRowObj.style.display == '')      
	{
		selRowObj.style.display = 'block';
		bulletObj.src="/images/threadcollapse.gif";
	}
}


function threadinit()
{
	window.name="main";
	var e=document.getElementsByTagName("div");
	var module = document.getElementsByName("tabName")[0].value;
	for(var i=0;i<e.length;i++)
	{
		if(e[i].id!=null)
		{
			var bulletObj=MM_findObj("bullet"+e[i].id);
			if(readCookie(module+e[i].id)==e[i].id+"show" )
			{
				e[i].style.display = 'block';
				bulletObj.src="/images/threadcollapse.gif";
			}
			if(readCookie(module+e[i].id)==e[i].id+"hide" )
			{
				e[i].style.display = 'none';
				bulletObj.src="/images/threadexpand.gif";
			}
		}
	}
}

function threadshowhide(val)
{
	window.name="main";
	var e=document.getElementsByTagName("div");
	var module = document.getElementsByName("tabName")[0].value;
	for(var i=0;i<e.length;i++)
	{
		divID = e[i].id;
		ind = divID.indexOf("thread");
		if(e[i].id!=null && ind==0)
		{
			var bulletObj=MM_findObj("bullet"+e[i].id);
			if(val!=null && val=='show')
			{
				e[i].style.display = 'block';
				bulletObj.src="/images/threadcollapse.gif";
			}
			else if(val!=null && val=='hide')
			{
				e[i].style.display = 'none';
				bulletObj.src="/images/threadexpand.gif";
			}
		}
	}
}


function addIt(picklist,tf)
{
 /* uncomment this to see what it is adding as it is adding it */
 /* alert(picklist.picklist1.options.length+"\n"+picklist.t1.value+"\n"+picklist.t0.value); */

    // empty items cannot be added..
    if(tf.value == "")
    {
        return false;
    }

 var NI = picklist.options.length++;
picklist.options[NI].text=tf.value;
tf.value = "";
return true;
}

function deSelect(picklist)
{
if(picklist.selectedIndex>=0)
    picklist.selectedIndex = -1;
else
    alert($ID('noselection').value);//No i18N
}


function removeFromList(listField) {
   if ( listField.length == -1) {  // If the list is empty
      alert($ID('nopicklist').value);//No i18N
   } else {
      var selected = listField.selectedIndex;
      if (selected == -1) {
         alert($ID('choosepicklist').value);//No i18N
      } else {  // Build arrays with the text and values to remain
         var replaceTextArray = new Array(listField.length-1);
         var replaceValueArray = new Array(listField.length-1);
         for (var i = 0; i < listField.length; i++) {
            // Put everything except the selected one into the array
            if ( i < selected) { replaceTextArray[i] = listField.options[i].text; }
            if ( i > selected ) { replaceTextArray[i-1] = listField.options[i].text; }
            if ( i < selected) { replaceValueArray[i] = listField.options[i].value; }
            if ( i > selected ) { replaceValueArray[i-1] = listField.options[i].value; }
         }
         listField.length = replaceTextArray.length;  // Shorten the input list
         for (i = 0; i < replaceTextArray.length; i++) { // Put the array back into the list
            listField.options[i].value = replaceValueArray[i];
            listField.options[i].text = replaceTextArray[i];
         }
      } // Ends the check to make sure something was selected
   } // Ends the check for there being none in the list
}


function chooseType(toShow,toHide1,toHide2)
{
   var idToShow = $ID(toShow);
   var idToHide1 = $ID(toHide1);
   var idToHide2 = $ID(toHide2);

   idToShow.style.display = 'block';
   idToHide1.style.display = 'none';
   idToHide2.style.display = 'none';


   var module = document.getElementsByName("tabName")[0].value;  
}

function selectArowAlone(elementId, onclass, offclass)
{
	var eid = $ID(elementId);
	var eObj=MM_findObj(eid.id);
	if(eObj.className==onclass)
		eObj.className=offclass;
	else
		eObj.className=onclass;
}



function selectArowAndCheck(string,elementId, onclass, offclass,quantity)
{
	var eid = $ID(elementId);
	var roweid = $ID("row"+elementId);//No i18N
	var eObj=MM_findObj(roweid.id);

	if (string.indexOf("quanedit") == -1)
	{
		eid.checked = true;
		eObj.className=onclass;
	}
	else
	{
		eid.checked = false;
		eObj.className=offclass;
		$ID("QuanOf"+elementId).value=quantity;//No i18N
	}
}






function checkAll(thisForm, checkBoxCompName)
{
	toSelectAll = false;
	if(thisForm.CheckAllItems.checked)
	{
		toSelectAll = true;
	}
	var count =0;
	for(var i=0; i<thisForm.elements.length; i++)
	{
		if(thisForm.elements[i].type == checkBoxCompName)
		{
			thisForm.elements[i].checked = toSelectAll;
			var e = thisForm.elements[i].getAttribute("id");
			if(e  == "RememberMe327")
			{
				continue;
			}
			if (count%2 == 0)
			{
				if (toSelectAll)
				{
					selectArow("row"+ e , 'rowHiliteb');
				}
				else
				{
					selectArow("row"+ e , 'rowoddn');
				}
			}
			else
			{
				if (toSelectAll)
				{
					selectArow("row"+e, 'rowHiliteb');
				}
				else
				{
					selectArow("row"+e, 'rowevenn');
				}
			}
			count = count + 1;
		}
	}
}

function selectArow(elementId, onclass)
{
	var eid = $ID(elementId);
	var eObj=MM_findObj(eid.id);
	eObj.className=onclass;
}


function checkValue(thisForm,quanAvailable,elementId,itemName)
{
	var eid = $ID(elementId);
	var eidVal = eid.value;
	if (eidVal == 0)
    	{
        	alert($ID('zeroitems').value);//No i18N
	        eid.value = quanAvailable;
        	eid.focus();
    	}
	var quantityAvailable = parseInt(quanAvailable);
	if (eidVal > quantityAvailable)
	{
		alert("Only "+quanAvailable+" of the item "+itemName+" are yet to be received");
		eid.value = quanAvailable;
		eid.focus();
	}

}

// I18N functions
/**
 *
 */
function loadMessageForKeys(keysList) {
	var xmlHttp = getXMLHttpRequest();
	var url = "/jsp/FetchMessage.jsp?";
	for(var i=0; i<keysList.length; i++) {
		url = url + "KEY=" + keysList[i] + "&";
	}
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState == 4) {
			var newObj = document.createElement("DIV");
			if(browser_ie){
				newObj.style.display = "none";
			}
			else if (browser_nn4 || browser_nn6){
				newObj.setAttribute("style","display:none;");
			}
			document.body.appendChild(newObj);
			newObj.innerHTML = xmlHttp.responseText;
		}
	}
	xmlHttp.send(null);
}

/**
 *
 */
function geti18nString( key )
{
	return callSjaxRequest("/CustomReportHandler.do","module=geti18nkey&key=" + key).responseText; //No I18N
}
function getMessageForKey(key) {
	var divObj = $ID(key);
	if(divObj != null) {
		return divObj.innerHTML;
	}
	return key;
}

function showAll(elementId, elementName)
{
	var elements = document.getElementsByTagName(elementName);
	var isFirst = true;
	var firstId = null;
	for(var i=0; i<elements.length; i++) {
		if(elements[i].id != null && elements[i].id.indexOf(elementId) >= 0 ){
			if(isFirst) {
				isFirst = false;
				firstId = elements[i];
			}
			var selRowObj = elements[i];
			var gName = elements[i].id;
			var bulletObj=MM_findObj("bullet"+gName);
			selRowObj.className = 'show';
			if(bulletObj != null){
				bulletObj.src="/images/threadcollapse.gif";
			}
		}
	}
	new Effect.ScrollTo(firstId);
}

function hideAll(elementId, elementName)
{
	var elements = document.getElementsByTagName(elementName);
	for(var i=0; i<elements.length; i++) {
		if(elements[i].id != null && elements[i].id.indexOf(elementId) >= 0 ){
			var selRowObj = elements[i];
			var gName = elements[i].id;
			var bulletObj=MM_findObj("bullet"+gName);
			selRowObj.className = 'hide';
			if(bulletObj != null){
				bulletObj.src="/images/threadexpand.gif";
			}
		}
	}
}

var mcTableKeys = new Array('sdp.leftpanel.search.title','sdp.leftpanel.search.go');

function setSearchTitle(title, val) {
       for(var i=0; i<document.forms.length;i++) {
                var formObj = document.forms[i];
                for(var j=0; j<formObj.elements.length;j++) {
                        var element = formObj.elements[j];
                        if(element.name == "searchSubmit") {
                                element.title= title;
                                element.value= val;
                        }
                }
        }
}

function historyShowhide(gName)
{
	var selRowObj = $ID("HIST_" + gName);//No i18N
	var textC = $ID("HTC_" + gName);//No i18N
	var textE = $ID("HTE_" + gName);//No i18N
	if (selRowObj.className == 'hide')     
	{
		selRowObj.className = 'show';
		textC.className = 'show';
		textE.className = 'hide';
	}
	else if(selRowObj.className == 'show')     
	{
		selRowObj.className = 'hide';
		textC.className = 'hide';
		textE.className = 'show';
	}
	else if(selRowObj.className == '')      
	{
		selRowObj.className = 'show';
		textC.className = 'show';
		textE.className = 'hide';
	}
}

function loadChineseStyle(win) {
        var xmlHttp = getXMLHttpRequest();
        var url = "/jsp/LoadStyle.jsp?";
        xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState == 4) {
			var elems = win.document.getElementsByTagName("link");
			if(xmlHttp.responseText.indexOf("style") >= 0) {
				for(var i=0; i<elems.length;i++) {
					var linkEl = elems[i];
					if(linkEl.href.indexOf('/style/style.css') >= 0) {
						linkEl.href = xmlHttp.responseText; 
					}
				}
			}
		}
	}
        xmlHttp.send(null);
}

function getXMLHttpRequest(){
        var xmlhttp=false;
        try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
                try {
                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (E) {
                        xmlhttp = false;
                }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest();
        }
        return xmlhttp;
}
function accordion(toShow,toHide1,toHide2)
{
   var idToShow = $ID(toShow);
   var idToHide1 = $ID(toHide1);
   var idToHide2 = $ID(toHide2);
   //var idToHide3 = $ID(toHide3);
   
   idToShow.style.display = 'block';
   idToShow.style.overflow = 'auto';

   idToHide1.style.display = 'none';
   idToHide2.style.display = 'none';

}



function accordionState()
{
	window.name="main";
	var e=document.getElementsByTagName("div");
	var module = document.getElementsByName("module")[0].value;
	for(var i=0;i<e.length;i++)
	{
		if(e[i].id!=null)
		{

			if(readCookie(module+e[i].id)==e[i].id+"show" )
			{
				e[i].style.display = 'block';
				e[i].style.height = '300px';
				e[i].style.overflow = 'auto';


				
			}
			if(readCookie(module+e[i].id)==e[i].id+"hide" )
			{
				e[i].style.display = 'none';
			}
		}
	}
}

function constructActionBar() {
        if (document.all&&document.getElementById) {
                var ulelems = document.getElementsByTagName("ul");
                for(var k=0; k<ulelems.length; k++) {
                        if(ulelems[k].id == 'nav') {
                                navRoot = ulelems[k];
                                for (i=0; i<navRoot.childNodes.length; i++) {
                                        node = navRoot.childNodes[i];
                                        if (node.nodeName=="LI") {
                                                node.onmouseover=function() {
                                                        this.className+=" over";
                                                }
                                                node.onmouseout=function() {
                                                        this.className=this.className.replace(" over", "");
                                                }
                                        }
                                }
                        }
                }
        }
}

function checkApprovalForm(formObj) {
	var mailIds = trimAll(formObj.TO.value);
	if(mailIds == "" || mailIds == null)
	{
		alert(getMessageForKey("sdp.emailcheck.mailjserror"));
		formObj.TO.focus();
		return false;
	}
	if(mailIds.indexOf(";") > 0) {
		mailIds = mailIds.replace(/\;/g,",");
		formObj.TO.value = mailIds;
	}
	var mails = mailIds.split(",");
	for(var i = 0; i < mails.length; i++) {
		var index1 = trimAll(mails[i]).indexOf("@");
		var index2 = trimAll(mails[i]).indexOf(".");
		if(index1 < 0 || index2 < 0) {
			alert(getMessageForKey("sdp.emailcheck.invalidmailjserror"));
			formObj.TO.focus();
			return false;
		}
	}

	var apprDesc = approvalEditor.getContent();
	if(apprDesc.indexOf("$ApprovalLink") < 0) {
		alert(getMessageForKey("sdp.approve.linkerror"));
		return false;
	}
        formObj.DESCRIPTION.value = apprDesc;
	formObj.submit();
	return true;
}

function changeNotificationTab(id, id1, id2, id3, params){
        $ID(id).className = "show";
        $ID(id + "_tab").className = "subtabon";
        $ID(id1).className = "hide";
        $ID(id1 + "_tab").className = "subtaboff";
	$ID(id2).className = "hide";
        $ID(id2 + "_tab").className = "subtaboff";
	$ID(id3).className = "hide";
        $ID(id3 + "_tab").className = "subtaboff";
}

/**
 * Used to switch the selection in a checkbox by using a nearby image. Any
 * linked enabling or disabling can also be done. The field to be enabled
 * should be specified using the notType argument. The constraint here is that
 * the image should have an id like <fieldName>_IMG.
 * The parents to be chosen while selecting a child
 * should be specified as an array to the linkedParentsToOpen argument and the
 * childs to be closed while closing a parent should be specified using the
 * linkedChildsToClose argument.
 *
 * @notType	DOM id of the field Name to be checked/unchecked
 * @linkedParentsToOpen	array of DOM id of the parents to be checked along with the current child.
 * @linkedChildsToClose	array of DOM id of the childs to be unchecked along with the current parent.
 * 
 * for onclick event. No onChange event for checkbox in IE*/
function changeNotificationSelection(notType, linkedParentsToOpen, linkedChildsToClose) {
	if($ID(notType) != null && $ID(notType).checked) {
        $ID(notType).checked = false;
        $ID(notType+"_IMG").src = "/images/checked_no.gif";
		if(linkedChildsToClose != null) {
			for(var i=0; i<linkedChildsToClose.length; i++) {
				$ID(linkedChildsToClose[i]).checked = false;
                $ID(linkedChildsToClose[i]+"_IMG").src = "/images/checked_no.gif";
			}
		}
    }
    else {
        $ID(notType).checked = true;
        $ID(notType+"_IMG").src = "/images/checked_yes.gif";
        if(linkedParentsToOpen != null) {
            for(var i=0; i<linkedParentsToOpen.length; i++) {
                $ID(linkedParentsToOpen[i]).checked = true;
                $ID(linkedParentsToOpen[i]+"_IMG").src = "/images/checked_yes.gif";
            }
        }
    }
}

function populateCategory(catObj,subCatObj,itemObj, catId, subCatId, itemId) {
	if(catObj != undefined){
		var catRows = parent["CAT_LIST"];
		for(var categoryId in catRows) {
			var catName = catRows[categoryId];
			catObj.options[catObj.options.length] = new Option(catName, categoryId, true, false);
			if(catId != null && catId == categoryId) {
				catObj.options[catObj.options.length - 1].selected = true;
			}
		}
		if(subCatId != null )
		{
			populateSubCategory(catObj,subCatObj,itemObj, catId, subCatId, itemId);
		}
	}
} 

function populateSubCategory(catObj,subCatObj,itemObj, catId, subCatId, itemId) {
    if(subCatObj == null || subCatObj.options == null)
    {
        return;
    }
    var catId = catObj.value;
    for(var j = 0; j < subCatObj.options.length; j++) {
        if(subCatObj.options[j].value != "0" && subCatObj.options[j].value != "-1") {
            subCatObj.options[j] = null;
            j--;
        }
    }
    var itemObj = itemObj;
    if(itemObj != null && itemObj.options != null)
    {
        for(var j = 0; j < itemObj.options.length; j++) {
            if(itemObj.options[j].value != "0" && itemObj.options[j].value != "-1") {
                itemObj.options[j] = null;
                j--;
            }
        }
    }
    
    if(catId == "0") {
        for(var j = 0; j < subCatObj.options.length; j++) {
            if(subCatObj.options[j].value == "0") {
                subCatObj.options[j].selected = true;
            }
        }
        if(itemObj != null && itemObj.options != null)
        {
            for(var j = 0; j < itemObj.options.length; j++) {
                if(itemObj.options[j].value == "0") {
                    itemObj.options[j].selected = true;
                }
            }
        }
        return;
    }
    var catRows = parent["CAT_" + catId];
    if(catRows == null) {
	    var url = "/workorder/GetCSIList.jsp?TYPE=SUBCAT&CATEGORYID=" + catId;
	    var subCatResp = AjaxValidate(url);
	    if(subCatResp != "false"){
                var catDiv = $ID("SUBCAT_DIV");//No i18N
                if (catDiv  == null) {
                    catDiv = document.createElement("DIV");
                    catDiv.id = "SUBCAT_DIV";
                    document.body.appendChild(catDiv);
                }
                catDiv.innerHTML = subCatResp;
                var scripts = catDiv.getElementsByTagName("script");
                for(var i=0; i<scripts.length; i++) {
                    eval(scripts[i].innerHTML);
                }
                catRows = parent["CAT_" + catId];
                populateCSIList(subCatObj, catRows, subCatId);
                if(itemId != null)
                {
                    populateItem(catObj,subCatObj,itemObj, catId, subCatId, itemId);
                }
	    }
    }
    else {
        populateCSIList(subCatObj, catRows, subCatId);
        if(itemId != null)
        {
            populateItem(catObj,subCatObj,itemObj, catId, subCatId, itemId);
        }
    }
}

function populateListCategory() {
    var catRows = parent["CAT_LIST"];
    for(var categoryId in catRows) {
        var catName = catRows[categoryId];
	var catObj = $ID('categoryField');//No i18N
	if(catObj != null){
        	catObj.options[catObj.options.length] = new Option(catName, categoryId, true, false);
	}
    }
}

function populateItem(catObj,subCatObj,itemObj, catId, subCatId, itemId) {
    if(itemObj == null || itemObj.options == null)
    {
        return;
    }
    var subCatId = subCatObj.value;
    for(var j = 0; j < itemObj.options.length; j++) {
        if(itemObj.options[j].value != "0" && itemObj.options[j].value != "-1") {
            itemObj.options[j] = null;
            j--;
        }
    }
    if(subCatId == "0") {
        for(var j = 0; j < itemObj.options.length; j++) {
            if(itemObj.options[j].value == "0") {
                itemObj.options[j].selected = true;
            }
        }
        //itemObj.options[0].selected = true;
        return;
    }
    var subCatRows = parent["SUBCAT_" + subCatId];
    if(subCatRows == null) {
	    var url = "/workorder/GetCSIList.jsp?TYPE=ITEM&SUBCATEGORYID=" + subCatId;
	    var itemResp = AjaxValidate(url);
	    if(itemResp != "false"){
                var itemDiv = $ID("ITEM_DIV");//No i18N
                if (itemDiv  == null) {
                    itemDiv = document.createElement("DIV");
                    itemDiv.id = "ITEM_DIV";
                    document.body.appendChild(itemDiv);
                }
                itemDiv.innerHTML = itemResp;
                var scripts = itemDiv.getElementsByTagName("script");
                for(var i=0; i<scripts.length; i++) {
                    eval(scripts[i].innerHTML);
                }
                subCatRows = parent["SUBCAT_" + subCatId];
                populateCSIList(itemObj, subCatRows, itemId);
	    }
    }
	else {
        populateCSIList(itemObj, subCatRows, itemId);
    }
}

function populateCSIList(selObj, rows, checkId) {
    for(var i in rows) {
        var catName = rows[i];
        selObj.options[selObj.options.length] = new Option(catName, i, true, false);
        if(checkId != null && checkId == i) {
            selObj.options[selObj.options.length - 1].selected = true;
        }
    }
}

function highlight(divClass) {
        $$(divClass).each( function(e) { e.visualEffect('highlight',{duration:3,startcolor:"#48FF48",endcolor:"#E5EDE6"}) })
}

function confBulkOperation(type,commonList) {
        var formObj = document.ConfListForm;
        var selVals = getSelectedCheckBoxes(document.ConfListForm);
        if(selVals.length == 0) {
                alert(getMessageForKey("sdp.setup.stage.selectone"));
                return;
        }
	if(type == "DELETE") {
		var result = confirm(getMessageForKey("sdp.setup.stage.confirm"));
		if(!result) {
			return;
		}
	}
        var url = "/setup/CommonDef.jsp?TYPE=" + type+"&forwardTo="+commonList;
        for(var i = 0; i < selVals.length; i++) {
                url = url + "&COMMONID=" + selVals[i];
        }
        frames["CONF_FRAME"].location.href = url;
	invokeProgressIndicator('DeleteStage','sdp.common.delete');
return;
}

function validateConfForm(formObj) {
	var name = formObj.NAME.value;
	if(name == "") {
		alert(getMessageForKey("sdp.setup.stage.name"));
		return false;	
	}
	return handleStateForForm(formObj);
}

function showConfForm(commonList) {
        window.frames['CONF_FRAME'].location.href = "/setup/CommonDefForm.jsp?forwardTo="+commonList;
}
// TASKS RELATED METHODES STARTS HERE
function updateTaskDetailsView(selObj)
{
	
	var val = selObj.value;
	var reqParams = "";
	var prevParams = getState('ShowTaskDetails','_D_RP');
	if(prevParams != null) {
		reqParams = prevParams + "&TYPE=" + val+"&CHANGED=true";
	}
	else {
		reqParams = prevParams;
	}
	updateState('ShowTaskDetails','_D_RP',reqParams);
	refreshSubView('ShowTaskDetails');
	selectTaskView(selObj,selObj.value);	
}

function selectTaskView(selObj, type) {
	var options =  selObj.options;
	for(var i=0; i<options.length;i++) {
		if(options[i].value == type) {
			options[i].selected = true;
			
		}
	}
}



function taskDetailsOperation(type,frameName) {
	
        var formObj = document.TaskDetailsForm;
        var selVals = getSelectedCheckBoxes(document.TaskDetailsForm);
        if(selVals.length == 0) {
               	if(type == "DELETE"){
			alert($ID("showalldelete").value);//No i18N
                	return;
		}
		else {
			alert($ID("showallclose").value);//No i18N
			return;
		}
        }
		if(type == "DELETE") {
	var result = confirm($ID("showallconfirm").value);//No i18N
			if(!result) {
				return;
			}
		}
        var url = "/tasks/TaskListBulkOperation.jsp?TYPE=" + type;
        for(var i = 0; i < selVals.length; i++) {
                url = url + "&TASKID=" + selVals[i];
        }
	if (frameName != null)
	{
		frames[frameName].location.href = url;	
	}
	else
	{	
        	frames["TaskFrame"].location.href = url;
	}
	var wait = $ID('pleasewait').value;//No i18N
        showDialog("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td class='actiontooltipbg'><table border='0' cellspacing='0' cellpadding='0'><tr><td><img id='ProImage' src='../images/processing.gif' hspace='6' vspace='6'></td><td id='OperationStatus' class='tooltip_working'>"+wait+"</td></tr></table></td></tr></table>","position=relative,closeButton=no,left=-60,top=-75,srcElement=" + type);

}
// TASKS RELATED METHODS ENDS HERE


var css_browser_selector = function() {
        var
                ua=navigator.userAgent.toLowerCase(),
                is=function(t){ return ua.indexOf(t) != -1; },
                h=document.getElementsByTagName('html')[0],
                b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
                os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
        var c=b+os+' js';
        h.className += h.className?' '+c:c;
}();


function showMenuInDialog(holder, source) {
        var holderObj = $ID(holder);
        var posX = findPosX(holderObj);
        var posY = findPosY(holderObj);
        var finalY = posY + holderObj.offsetHeight - document.body.scrollTop;
        showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=yes,left=' + posX + ',top=' + finalY);
}

function showHeaderMenuInDialog(holder, source) {
        var holderObj = $ID(holder);
        var posX = findPosX(holderObj);
        var posY = findPosY(holderObj);
        var finalX = posX - document.body.scrollLeft;
        var finalY = posY + holderObj.offsetHeight - document.body.scrollTop;
        showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=yes,left=' + finalX + ',top=' + finalY);//NO I18N
}

function showHeaderBUMenuInDialog(holder, source, innerdiv) {
		var doc = document;
		$ID(source).className="show";
		var setBUDivHeight = $ID(innerdiv).scrollHeight; 
		$ID(source).className="hide";
		$ID(innerdiv).style.height = (setBUDivHeight >= 301)? "300px" : "auto";
        var holderObj = $ID(holder);
        var posX = findPosX(holderObj);
        var posY = findPosY(holderObj);
        var finalX = posX - doc.body.scrollLeft;
        var finalY = posY + holderObj.offsetHeight - doc.body.scrollTop;
        showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=yes,left=' + finalX + ',top=' + finalY );//NO I18N
}

function showlistviewhelpicon(holder, source) { 
	 var holderObj = $ID(holder);
        var posX = findPosX(holderObj);
        var posY = findPosY(holderObj);
        var finalX = posX - $ID('MickeyScrollTable').scrollLeft; //No i18N
        var finalY = posY + holderObj.offsetHeight - $ID('MickeyScrollTable').scrollTop;//No i18N
        showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=yes,left=' + finalX + ',top=' + finalY);//NO I18N
}

function showCopyToMenuInDialog(holder, source, innerdiv) {
	var selectallDiv = document.getElementById('selectall');
	var selectall = null;
	if(selectallDiv !=null)
	{
		selectall = document.getElementById('selectall').value;
	}
	if(selectall =="" || selectall == null || selectall == "null")
	{
		var parentDiv = parent['ParentListViewDiv'];//No I18N 
		var doc = document; 
		$ID(source).className="show";
		var setBUDivHeight = $ID(innerdiv).scrollHeight; 
		$ID(source).className="hide";
		$ID(innerdiv).style.height = (setBUDivHeight >= 301)? "300px" : "auto";
		var holderObj = $ID(holder);
		var posX = findPosX(holderObj);
		var posY = findPosY(holderObj);
		if(parentDiv != null)
		{
			var ParentDivX = $ID(parentDiv).scrollLeft;
			var ParentDivY = $ID(parentDiv).scrollTop;
			var finalX = posX - doc.body.scrollLeft - ParentDivX;	
			var finalY = posY + holderObj.offsetHeight - doc.body.scrollTop - ParentDivY;
		}
		else 
		{  
			var finalX = posX - doc.body.scrollLeft; 
			var finalY = posY + holderObj.offsetHeight - doc.body.scrollTop;
		}
		showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=yes,left=' + finalX + ',top=' + finalY );//NO I18N
	}
} 

function displayReminders(holder) {
        var holderObj = $ID(holder);
        var posX = findPosX(holderObj);
        var posY = findPosY(holderObj);
        var finalX = posX + holderObj.offsetWidth - 331;
        showURLInDialog('/jsp/Reminder.jsp','closeButton=no,position=relative,closeOnBodyClick=yes');
}


function displayRoboQuestion(holder, questionPage, params) {
        var holderObj = $ID(holder);
        var posX = findPosX(holderObj);
        var posY = findPosY(holderObj);
        var finalX = posX + holderObj.offsetWidth - 375;
        if(params == null)
        {
            showURLInDialog('/jsp/'+questionPage+'.jsp','position=absolute,width=400,left='+finalX+',top='+posY);
        }
        else
        {
            showURLInDialog('/jsp/'+questionPage+'.jsp?'+params,'position=absolute,width=400,left='+finalX+',top='+posY);
        }
}
function showConvInDialog(holder, source, xPos, yPos) {
        var holderObj = $ID(holder); 
        var posX = findPosX(holderObj);
        var posY = findPosY(holderObj); 
				if (xPos == '' || xPos == null)
				{
					xPos = 0;
				}
				if (yPos == '' || yPos == null)
				{
					yPos = 0;
				} 
        var finalY = posY + holderObj.offsetHeight - document.body.scrollTop + yPos;
	var finalX = posX - holderObj.offsetWidth - document.body.scrollLeft + xPos; 
	if (browser_ie)  
        {		
        	showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=no,left=' + finalX + ',top=' + finalY);//No I18N 
	}		
        else if (browser_nn4 || browser_nn6) 
	{
    		showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=yes,left=' + finalX + ',top=' + finalY); //No I18N
	}
    
	if (browser_ie) 
	{         	 
        	document.onmousedown = function(ev) 
		{  	
		        if($ID(source) != null)
			{	
                	ShowHide(source);  	 
                        var sourceObjHeight = $ID(source).offsetHeight + 10; 	 
                        var sourceObjWidth = $ID(source).offsetWidth + 10;   	 
                        ShowHide(source);  	 
                                  	 
                 	var srcEl = window.event.srcElement;                 	 
                 	var x = window.event.x; 	 
                 	var y = window.event.y;
	 
			if ((x < finalX || x >= finalX + sourceObjWidth) || (y < finalY || y >= finalY + sourceObjHeight))
			{
				closeDialog();
			}
			}	 
          	 
 		} 	 
 	}
}

function showConvInDialogRight(holder, source) {
        var holderObj = $ID(holder);
        ShowHide(source);
        var sourceObj = $ID(source).offsetWidth;
        ShowHide(source);
        var posX = findPosX(holderObj);
        var posY = findPosY(holderObj);
        var finalY = posY + holderObj.offsetHeight - document.body.scrollTop;
    	var finalX = posX - sourceObj + 29;
	if (browser_ie)
	{		
		showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=no,left=' + finalX + ',top=' + finalY); //No I18N
	}		
	else if (browser_nn4 || browser_nn6) 
	{
		showDialog($ID(source).innerHTML, 'position=absolute,closeButton=no,closeOnBodyClick=yes,left=' + finalX + ',top=' + finalY); //No I18N
	}
	if (browser_ie) 
	{         	 
		document.onmousedown = function(ev) 
		{  	 
			ShowHide(source);  	 
			var sourceObjHeight = $ID(source).offsetHeight + 10; 	 
			var sourceObjWidth = $ID(source).offsetWidth + 10;   	 
			ShowHide(source);  	 

			var srcEl = window.event.srcElement;                 	 
			var x = window.event.x; 	 
			var y = window.event.y;

			if ((x < finalX || x >= finalX + 148) || (y < finalY || y >= finalY + 101))
        		{
            			closeDialog();
        		}
				 

		} 	 
	}
}


/**
 * Invokes a progress indicator near the element specified by the source
 * attribute. The text to be displayed can be passed using the key attribute.
 * If not passed, this defaults to a string 'Processing. Please Wait', else the
 * i18ned values will be fetched using the getMessageForKey method. If source is passed
 * _____________________________
 * |                           |
 * --  -------------------------
 *   \/   
 * 
 * @source	the element id near which the indicator should be displayed.
 * @key		the key of the key to be displayed.
 * @type	progress | completed where for progress a processing image will
 * 		be dislpayed and for completed a tick image will be displayed.
 * @image	the url of the image that should be displayed. The url should
 * 		be relative to the context.
 */
function invokeProgressIndicator(source, key, type, imageUrl) {
	

	var outerTable = "<table border=0 cellspacing=0 cellpadding=0><tr><td height=35></td><td id='OperationStatus' nowrap='nowrap' class='sloading'>&nbsp;</td></tr></table>";
	
	if(source != null) {
		var holderObj = $ID(source);
		if(holderObj != null) {
			var posX = findPosX(holderObj);
			var posY = findPosY(holderObj);
			var finalY = posY - 60 - document.body.scrollTop;
			var finalX = posX - 35;
	//		new Effect.ScrollTo('SITE_LIST');
			showDialog(outerTable,"position=absolute,closeButton=no,width=450, height=50, left=" + finalX + ",top=" + finalY);
		} else {
			showDialog(outerTable,"position=absmiddle,closeButton=no,width=450, height=50, top=1000px");
		}
	}
	else {
		showDialog(outerTable,"position=absmiddle,closeButton=no,width=450, height=50, top=1000px");
	}
	// The Key is not set to the td while constructing itself, so that any
	// problems due to ' and " could be avoided while assigning then.
	$ID('OperationStatus').innerHTML= getMessageForKey(key);//No i18N
}

/**
 * Closes the progress indicator, after checking whether the operation is a
 * success or failure which should be indicated by the result parameter. The
 * text to be displayed can be specified through the key parameter. The
 * indicator will be closed after a time gap of 1sec.
 *
 * @key		The i18n key for the key.
 * @result	true | false [true]
 */
function closeProgressIndicator(key, result) {
	if(result == null) {
		result = true;
	}
	
	$ID('OperationStatus').innerHTML = getMessageForKey(key);//No i18N
	if(result) {
		setTimeout("parent.closeDialog();",1000);
	}
}


var reqToProKeys = new Array('sdp.common.processing','sdp.common.processcomp');
var udfErrorKeys = new Array('sdp.jserror.requestcustomfields');

function selectRemDate( value ){
	var len = document.CUDTask.REMDATE.options.length;
	for( var i=0 ; i<len ; i++){
		var opt = document.CUDTask.REMDATE.options[i];
		if( opt.value == value){
			opt.selected = true;	
		}
	}
}

function selectStatus( value ){
	var len = document.CUDTask.STATUSID.options.length;
	for( var i=0 ; i<len ; i++){
		var opt = document.CUDTask.STATUSID.options[i];
		if( opt.value == value){
			opt.selected = true;	
		}
	}
}

function showMessageAndClose( value, timeout){
	invokeProgressIndicator(null,value,"completed");
	if(timeout == null)
    {
        setTimeout("closeDialog();", 2000);
    }
    else
    {
        setTimeout("closeDialog();", timeout);
    }
}

function showAttachedMessageAndClose(holder, value, timeout){
	invokeProgressIndicator(holder, value, "completed");
	setTimeout("closeDialog();",timeout);
}

function showFailureMessageAndClose(value, timeout){
	invokeProgressIndicator(null, value, "completed", '/images/invalidoperationicon.gif');
    if(timeout == null)
    {
        setTimeout("closeDialog();", 2000);
    }
    else
    {
        setTimeout("closeDialog();", timeout);
    }
}

// Methods for Site Definition screen in Setup.
// Start
function showSiteForm() {
        window.frames['SITE_FRAME'].location.href = "/SiteDefForm.do";
}

function siteBulkOperation(type) {
        var formObj = document.SiteListForm;
        var selVals = getSelectedCheckBoxes(document.SiteListForm);
        if(selVals.length == 0) {
                alert(getMessageForKey("sdp.setup.site.selectone"));
                return;
        }
	if(type == "DELETE") {
		var result = confirm(getMessageForKey("sdp.setup.site.confirm"));
		if(!result) {
			return;
		}
	}
        var url = "/SiteDefForm.do?TYPE=" + type;
        for(var i = 0; i < selVals.length; i++) {
                url = url + "&SITEID=" + selVals[i];
        }
        frames["SITE_FRAME"].location.href = url;
	invokeProgressIndicator('DeleteSite', "sdp.common.processing");
	return;
}
// End

// Methods for the clock in the bar below the main tabs
// Start
function TimeTick()
{
	time = time+1000;
	if(rTimer) {
		clearTimeout(rTimer);
	}
	rTimer = setTimeout('TimeTick()', 1000);
}

function updateClock()
{
	var date = new Date();
	date.setTime(time);
	var min = date.getMinutes();
	var hrs = date.getHours();
	var sec = date.getSeconds();
	if(min <= 9) {
		min = "0" + min;
	}
	if(hrs <= 9) {
		hrs = "0" + hrs;
	}
	if(sec <= 9) {
		sec = "0" + sec;
	}
	$ID('Timer').innerHTML=date.getDate() + " " + monthMap[date.getMonth()] + " " + date.getFullYear() + " "+hrs+":"+ min;//No I18N
	if(uTimer)
	{
		clearTimeout(uTimer);
	}
	uTimer = setTimeout('updateClock()', 1000);
}

var time = 0;
var rTimer,uTimer;
var monthMap = new Object();

function displayClock(curTime) {
	time = curTime;
	monthMap["0"] = "Jan";
	monthMap["1"] = "Feb";
	monthMap["2"] = "Mar";
	monthMap["3"] = "Apr";
	monthMap["4"] = "May";
	monthMap["5"] = "Jun";
	monthMap["6"] = "Jul";
	monthMap["7"] = "Aug";
	monthMap["8"] = "Sep";
	monthMap["9"] = "Oct";
	monthMap["10"] = "Nov";
	monthMap["11"] = "Dec";
	TimeTick();
	updateClock();
}
// End

// Methods for Keep me signed in. Moved from Header.jspf file
// Start
function signedIn()
{
    //alert("signed in");
    var sso = null;
    sso = getCookie("singlesignon");
    if(sso!=null)
    {
        var expDate = new Date();
        expDate.setTime(expDate.getTime()+(24*60*60*1000*365));
        var sin="true";
        document.cookie="signedin= "+ sin +";expires= "+((expDate).toGMTString());
    }
}

function preLogout()
{
    deleteCookie("singlesignon");
    deleteCookie("username");
    deleteCookie("password");
    deleteCookie("signedin");
    window.location="jsp/Logout.jsp";
}
// End

//Method for converting the long date value to time in seconds.
//start
function getLongDate(date){
	var tmp = date.split(",");
	var tmp1 = tmp[0].split(" ");
	var tmp2 = tmp[1].split(":");

	var dt = new Date();
	dt.setYear(tmp1[2]);
	dt.setMonth(intMonth(tmp[1]));
	dt.setDate(tmp1[0]);
	dt.setHours(tmp2[0]);
	dt.setMinutes(tmp2[1]);
	dt.setSeconds(0);
	return dt.getTime();
}

function intMonth(month){
	if( month == 'Jan'){
		return 0;
	}if( month == 'Feb'){
		return 1;
	}
	if( month == 'Mar'){
		return 2;
	}
	if( month == 'Apr'){
		return 3;
	}
	if( month == 'May'){
		return 4;
	}
	if( month == 'Jun'){
		return 5;
	}
	if( month == 'Jul'){
		return 6;
	}
	if( month == 'Aug'){
		return 7;
	}
	if( month == 'Sep'){
		return 8;
	}
	if( month == 'Oct'){
		return 9;
	}
	if( month == 'Nov'){
		return 10;
	}
	if( month == 'Dec'){
		return 11;
	}
}

function reminderDateCheck(formObj){
	var date1Value = formObj.date1.value;
	var time1Value = formObj.time1.value;
	var date2Value = formObj.date2.value;

	if(date1Value != "")
	{	
		var dt = new Date();
		var tmp = date1Value.split("-");
		var tmp1 = time1Value.split(" ");
		var tmp2 = tmp1[0].split(":");
		dt.setYear(tmp[0]);
		dt.setMonth(tmp[1]-1);
		dt.setDate(tmp[2]);
		if(tmp1[1] == "AM"){
			dt.setHours(tmp2[0]);
		}
		if(tmp1[1] == "PM"){
			if(tmp2[0] != "12"){
				var xyz = parseInt(tmp2[0])+12;
				dt.setHours(xyz);
			}
			else{
				dt.setHours(12);
			}
		}
		dt.setMinutes(tmp2[1]);
		dt.setSeconds(0);
		dt.getTime();
		if( dt.getTime() < serverdt.getTime()){
			alert(getMessageForKey("sdp.reminder.currenttimeerr"));
			return false;
		}
		if(date2Value != "0"){
			var datedt = dt.getTime() - date2Value;
			if( datedt < serverdt.getTime()){
				alert(getMessageForKey("sdp.reminder.remtimeerr"));
				return false;
			}

		}
	}
	return true;
}


function customerSelectQuickCreate()
{
	var element = $ID("showacDropdownquickreq");//No i18N
	var elementarrow = $ID("custarrowpull");//No i18N	
	if(element.style.visibility == 'visible')
	{		
		element.style.visibility = 'hidden';
		elementarrow.className= "combo_arrow";		
	}
	else
	{
		url = "/servlet/ClientUtilServlet?action=searchAllCust&from=request";
	
		if (window.XMLHttpRequest)
		{ // Non-IE browsers
			req = new XMLHttpRequest();
			if(req)
			{
				try
				{
					req.onreadystatechange = processcustomerSelectQuickCreate;
					req.open("GET", url, true);
				} 
				catch (e) 
				{
					alert(e);
				}
				req.send(null);
			}
		} 
		else if (window.ActiveXObject)  // IE
		{
			try
			{
				req = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{
				alert("ee "+e);
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			if (req) 
			{
				req.onreadystatechange = processcustomerSelectQuickCreate;
				try
				{
					req.open("GET", url, true);
				}
				catch(e)
				{
					alert(e);
				}
				req.send(null);
			}
		}
	}
}

function processcustomerSelectQuickCreate()
{
	if (req.readyState == 4)
	{ // Complete
		if (req.status == 200)
		{ // OK response
			var valueUser = req.responseText;
			if (document.getElementById) // Netscape 6 and IE 5+
			{	
				var element = $ID("showacDropdownquickreq");//No i18N
				var elementarrow = $ID("custarrowpull");//No i18N				
				if(element.style.visibility == 'visible')
				{	elementarrow.className= "combo_arrow";	
					element.style.visibility = 'hidden';
				}
				else if(element.style.display == '')
				{
					elementarrow.className= "combo_arrowhovr";
					element.innerHTML = valueUser;
					element.style.visibility = 'visible';
					setmaxheightforIE("showacDropdownquickreq"); //No I18N
				}
			}
			
		} 
		else 
		{
			alert("Problem: " + req.statusText);
		}
	}
}

function setQuickCreateCust(dropDownValue)
{
	var element = $ID("customerName");//No i18N
	var dropdownelement = $ID("showacDropdownquickreq");//No i18N
	var elementarrow = $ID("custarrowpull");//No i18N
	element.value = dropDownValue;	
	elementarrow.className= "combo_arrow";
	dropdownelement.style.visibility = 'hidden';
}

function fillContactDetails()
{
	var reqName = $ID("reqSearch").value;//No i18N
	if(reqName == "")
	{
		var info = "<img src='images/contact_info_na.gif' width='23' height='16' hspace='0' vspace='0' border='0'>";
		var title = $ID("info").value;//No i18N
		var str = "<a href='javascript:void(0)' title='"+title+"'>"+info+"</a>";	
		$ID("quickCreateReqInfo").innerHTML = str;//No i18N
	}
	var userName = encodeURIComponent(reqName);
        var userID = $ID("requesterID").value;//No i18N
	url = "/servlet/AJaxServlet?action=getUserDetails&search="+userName+"&reqID="+userID;
	if (window.XMLHttpRequest)
	{ // Non-IE browsers
		req1 = new XMLHttpRequest();
		if(req1)
		{
			try
			{
				req1.onreadystatechange = processContactDetails;
				req1.open("GET", url, true);
			} 
			catch (e) 
			{
				alert(e);
			}
			req1.send(null);
		}
	} 
	else if (window.ActiveXObject)  // IE
	{
		try
		{
			req1 = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			alert("ee "+e);
			req1 = new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (req1) 
		{
			req1.onreadystatechange = processContactDetails;
			try
			{
				req1.open("GET", url, true);
			}
			catch(e)
			{
				alert(e);
			}
			req1.send(null);
		}
	}
}

function processContactDetails()
{
	if (req1.readyState == 4)
	{ // Complete
		if (req1.status == 200)
		{ // OK response

			contactNumber = '';
            		acc = '';
			email = '';
			mobile = '';
			var value = req1.responseText;

			len = value.length;
			index00 = value.indexOf("REQUESTERID");
			index01 = value.indexOf("REQUESTERIDEND");
			ind11 = value.indexOf("USER_CONTACT");
            		ind21 = value.indexOf("USER_ACCOUNT");
			ind31 = value.indexOf("USER_EMAIL");
			ind41 = value.indexOf("USER_MOBILE");	
			var requestID = value.substring(index00+11,index01);
			if(ind11!=-1 && ind21==-1 && ind31==-1 && ind41==-1)
			{
				contactNumber = value.substring(ind11+12,len+1);
			}
			else if(ind11==-1 && ind21!=-1 && ind31==-1 && ind41==-1)
			{
				acc = value.substring(ind21+12,len+1);
			}
			else if(ind11==-1 && ind21==-1 && ind31!=-1 && ind41==-1)
			{
				email = value.substring(ind31+10,len+1);
			}
			else if(ind11==-1 && ind21==-1 && ind31==-1 && ind41!=-1)
			{
				mobile = value.substring(ind41+11,len+1);
			}
			else if(ind11!=-1 && ind21!=-1 && ind31==-1 && ind41==-1)
			{
				contactNumber = value.substring(ind11+12,ind21);
				acc = value.substring(ind21+12,len+1);
			}
			else if(ind11!=-1 && ind21==-1 && ind31!=-1 && ind41==-1)
			{
				contactNumber = value.substring(ind11+12,ind31);
				email = value.substring(ind31+10,len+1);
			}
			else if(ind11!=-1 && ind21==-1 && ind31==-1 && ind41!=-1)
			{
				contactNumber = value.substring(ind11+12,ind41);
				mobile = value.substring(ind41+11,len+1);
			}
			else if(ind11==-1 && ind21!=-1 && ind31!=-1 && ind41==-1)
			{
				acc = value.substring(ind21+12,ind31);
				email = value.substring(ind31+10,len+1);
			}
			else if(ind11==-1 && ind21!=-1 && ind31==-1 && ind41!=-1)
			{
				acc = value.substring(ind21+12,ind41);
				mobile = value.substring(ind41+11,len+1);
			}
			else if(ind11==-1 && ind21==-1 && ind31!=-1 && ind41!=-1)
			{
				email = value.substring(ind31+10,ind41);
				mobile = value.substring(ind41+11,len+1);
			}
			else if(ind11!=-1 && ind21!=-1 && ind31!=-1 && ind41==-1)
			{
				contactNumber = value.substring(ind11+12,ind21);
				acc = value.substring(ind21+12,ind31);
				email = value.substring(ind31+10,len+1);
			}
			else if(ind11!=-1 && ind21!=-1 && ind31==-1 && ind41!=-1)
			{
				contactNumber = value.substring(ind11+12,ind21);
				acc = value.substring(ind21+12,ind41);
				mobile = value.substring(ind41+11,len+1);
			}
			else if(ind11!=-1 && ind21==-1 && ind31!=-1 && ind41!=-1)
			{
				contactNumber = value.substring(ind11+12,ind31);
				email = value.substring(ind31+10,ind41);
				mobile = value.substring(ind41+11,len+1);
			}
			else if(ind11==-1 && ind21!=-1 && ind31!=-1 && ind41!=-1)
			{
				acc = value.substring(ind21+12,ind31);
				email = value.substring(ind31+10,ind41);
				mobile = value.substring(ind41+11,len+1);
			}
			else if(ind11!=-1 && ind21!=-1 && ind31!=-1 && ind41!=-1)
			{
				contactNumber = value.substring(ind11+12,ind21);
				acc = value.substring(ind21+12,ind31);
				email = value.substring(ind31+10,ind41);
				mobile = value.substring(ind41+11,len+1);
			}
			$ID("contactNoField").value = contactNumber;//No i18N
			if(acc == null || acc == '')
			{
				$ID("accountrow").style.display = "none";
				$ID("editaccountrow").style.display = "block";
				$ID('editAccountName').value="true";
				$ID('customerName').value=""
			}
			else
			{
				$ID("editaccountrow").style.display = "none";
				$ID("accountrow").style.display = "block";
				$ID("accountName").value = acc;//No i18N
				$ID('editAccountName').value="false";
			}
			$ID("mobile").value = mobile;//No i18N
			$ID("email").value = email;//No i18N
			if(requestID != null && requestID != "" && requestID != "null")
			{
				var image = "<img src='images/contact_info.gif' width='23' height='16' hspace='0' vspace='0' border='0'>";
				var titletext = $ID("info").value;//No i18N
				var str1 = "<a href='javascript:void(0)' title='"+titletext+"' onclick=\"javascript:NewWindow('/ListRequests.do?id="+requestID+"&popUserDetails=true&mode=edit','UserDefined','800','350','yes','center')\" >"+image+"</a>";
				$ID("quickCreateReqInfo").innerHTML = str1;//No i18N
			}
			
		} 
		else 
		{
			alert("Problem: " + req1.statusText);
		}
	}
}

function setQuickReqID(dropDownValue,dropDownID)
{
	$ID("reqSearch").value = dropDownValue;//No i18N
	$ID("requesterID").value = dropDownID;//No i18N
	var info = "<img src='images/contact_info.gif' width='23' height='16' hspace='0' vspace='0' border='0'>";
	var title = $ID("info").value;//No i18N
	var str = "<a href='javascript:void(0)' title='"+title+"' onclick=\"javascript:NewWindow('/ListRequests.do?id="+dropDownID+"&popUserDetails=true&mode=edit','UserDefined','800','350','yes','center')\" >"+info+"</a>";
	$ID("quickCreateReqInfo").innerHTML = str;//No i18N
}
//End


var requestOne;
var ajax_request_id;
/*
 * Function for calling ajax request
 * @param url - request URL
 * @param params - request parameter(s)
 * @param requestID - to identify the ajax request
 * author Murugesan K
*/
function callAjaxRequest(url, params, requestID) {
	requestOne = getXMLHttpRequest();
	ajax_request_id = requestID;
	if(requestOne)
	{
		try
		{
			requestOne.open("POST", url, true);
			requestOne.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
			requestOne.setRequestHeader("Content-length", params.length);
			requestOne.onreadystatechange = updateAjaxRequest;
			requestOne.send(params);
		}
		catch(e)
		{
			alert("Error while sending the request : " + e.message);
		}
	}
}

/*
 * Function for calling sjax request [ Synchronous AJAX ]
 * @param url - request URL
 * @param params - request parameter(s)
 * author Murugesan K
*/
var srequestOne;
function callSjaxRequest(url, params) {
	srequestOne = getXMLHttpRequest();
	if(srequestOne)
	{
		try
		{
			srequestOne.open("POST", url, false);
			srequestOne.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
			srequestOne.setRequestHeader("Content-length", params.length);
			srequestOne.send(params);
			return srequestOne;
		}
		catch(e)
		{
			alert("Error while sending the request : " + e.message);
		}
	}
}

/*
 * Function for handling ajax response
 * This function will invoke the ajaxRequestOnSuccess function if the ajax request success else it will
 * invoke the ajaxRequestOnFailure
 * User(s) have to implement these functions and it will give the two parameter(s) one will contain respose object
 * and other will contain you ajax request identification number
 * @author Murugesan K
*/
function updateAjaxRequest() {
	// only if req shows "loaded"
	try {
		if (requestOne.readyState == 4) {
			if (requestOne.status == 200) {
				ajaxRequestOnSuccess(requestOne, ajax_request_id);
			}
			else {
				ajaxRequestOnFailure(requestOne, ajax_request_id);
			}
		}
	}
	catch(e) {
		alert("Error while fetching ajax response : " + e.message);
	}
}

/*
 * Function for constructing parameter name & value(s) for the requested form
 * @param formName - request parameter(s) to be constructed for the form name
 * @return this will return the chain of param name & value pair
*/
function constructParameters( formName ) {
	var params = "";
	try {
		var elements_list = formName.elements;
		var length = elements_list.length;
		var element_type;
		for( i=0; i<length; i++ ) {
			element_type = elements_list[i].type;
			if( element_type == 'textarea' || element_type == 'text' || element_type == 'select-one' || element_type == 'password' ) {
				params += "&" + elements_list[i].name + "=" + encodeURIComponent(elements_list[i].value);
			}
			else if( element_type == 'checkbox' && elements_list[i].checked ) {
				params += "&" + elements_list[i].name + "=" + encodeURIComponent(elements_list[i].value);
			}
			else if( element_type == 'select-multiple' ) {
				var size = elements_list[i].options.length;
				for( j=0 ;j<size; j++ ) {
					if( elements_list[i].options[j].selected) {
						params += "&" + elements_list[i].name + "=" + encodeURIComponent(elements_list[i].options[j].value);
					}
				}
			}
			else if( element_type == 'radio' )
			{
				if(elements_list[i].checked)
				{
					params += "&" + elements_list[i].name + "=" + encodeURIComponent(elements_list[i].value);
				}
			}
		}
	}
	catch(e) {
		alert( "Error while constructing request parameter : " + e.message );
	}
	return params;
}

// LeftNav Script Begin-
function showLeftNav(state) {
	var url="/jsp/getLeftNav.jsp?LeftNav=" + state;
	stateChanged(state);
	if(parent["toBeShown"] != null) {
		parent.checkAndLoadTypes();
	}
	window.open(url, "SDPHeaderFrame");
}

function stateChanged(status) {
	if(status == 'Open') {
		$ID('LeftOpen').style.display = 'none';
		$ID('Left-Section').style.display = 'block';
	}
	else {
		$ID('Left-Section').style.display = 'none';
		$ID('LeftOpen').style.display = 'block';
	}
} 
// LeftNav Script Ends-

function collapsecontent(from,id)
{
	if($ID(from).style.display == "none")
	{
		$ID(id).className = "view_minimize";
	}
	else
	{
		$ID(id).className = "view_maximize";
	}
	jQuery('#' +from).slideFadeToggle();
}

function showThisView(view,module)
{
	view = encodeURIComponent(view);
	if(module == "Requests")//No I18N
	{
		var scrollval = $ID('listview').scrollTop;//No i18N
		window.location.href = "/WOListView.do?viewName=" + view + "&requestViewChanged=true&scrollval="+scrollval;
	}
	else if(module == "Solutions")//No I18N
	{
		window.location.href = "/SolutionsHome.do?viewName=" + view + "&ViewChanged=true&";
	}
	else if(module == "Contacts")//No I18N
	{
		window.location.href = "/ContactListView.do?viewName=" + view + "&ViewChanged=true&";
	}
	else if(module == "Contracts")//No I18N
	{
		window.location.href = "/ServiceContractView.do?viewName=" + view + "&ViewChanged=true&";
	}
	else if(module == "Accounts")//No I18N
	{
		window.location.href = "/CustomerListView.do?viewName=" + view + "&ViewChanged=true&";
	}
	else if(module == "Activity")//No I18N
	{
		window.location.href = "/Activity.do?viewName=" + view + "&ViewChanged=true&";
	}
	else if(module == "Product")//No I18N
	{
		window.location.href = "/Product.do?action=productListView&viewName=" + view;
	}
	else if(module == "Timesheets")//No I18N
	{
		window.location.href = "/RequestCharges.do?action=timesheets&viewName=" + view + "&ViewChanged=true&";
	}
}
function checkMandatoryFields()
{
        var accountCheck=$ID('customerName').value;//No i18N

	if(accountCheck ==-1)
	{
		alert($ID('mapAccountName').value);//No i18N
		return false;

	}
	else
	{
		return true;
	}

}
function checkSalesMandatoryFields()
{
	var accCheck=$ID('customername').value;//No i18N
	var productCheck=$ID('productname').value;//No i18N
	if(accCheck ==-1)
	{	
		alert($ID('mapaccountname').value);//No i18N
		return false;

	}
	if(productCheck ==-1)
	{
		alert($ID('mapproductname').value);//No i18N
		return false;

	}	
	else
	{
		return true;
	}
}
function checkProductMandatoryFields()
{
	var prodCheck=$ID('productName').value;//No i18N
	var productTypeCheck=$ID('productTypeName').value;//No i18N
	if(prodCheck==-1)
	{	
		alert($ID('mapProductName').value);//No i18N
		return false;


	}
	if(productTypeCheck ==-1)
	{
		alert($ID('mapProductTypeName').value);//No i18N
		return false;

	}	
	else
	{
		return true;

	}
}


/*CSS Expressions Removed from Style sheet using this methods by Vijay 26-06-09 */
function setmaxheightforIE(a){
	var container = $ID(a); 
	container.style.height = ($ID(a).scrollHeight >= 251)? "250px" : "auto";  
} 

function setmaxheightforIEfix(){ 
	var container = $ID("showacDropdown");//No i18N
	container.style.height = ($ID("showacDropdown").scrollHeight >= 251)? "250px" : "auto";
} 

function setmaxwidthforIEfix(){ 
	var container = $ID("admindeptsetleftnav");//No i18N
	aa = container.style.width = ($ID("admindeptsetleftnav").scrollWidth <= 221)? "220px" : "auto"; 
}
 

function setmaxHeightAssigntoIEfix()
{
	var doc = document;
	container = $ID("assignrep"); //No i18N
	container.style.height = ($ID("assignrep").scrollHeight <= 21)? "20px" : "auto";
	container.style.height = ($ID("assignrep").scrollHeight >= 251)? "250px" : "auto"; 
}


function setmaxHeightCannedResIEfix()
{ 
	var doc = document;
	container = $ID("showtemDropdown"); //No i18N
	container.style.height = ($ID("showtemDropdown").scrollHeight <= 21)? "20px" : "auto";
	container.style.height = ($ID("showtemDropdown").scrollHeight >= 251)? "250px" : "auto"; 
}

<!-- Mickey Client Table scrolling script 01-07-09 by Vijay -->
function mickeyScrollTable() {
  var doc = document;
  var screenWidth = 0, screenHeight = 0; 
  if( typeof( window.innerWidth ) == 'number' ) {
    //For Firefox
   doc.body.style.overflow='hidden';
    screenWidth = window.innerWidth;
    screenHeight = window.innerHeight;
  } 
  else if( doc.documentElement && ( doc.documentElement.clientWidth || doc.documentElement.clientHeight ) ) {
    //IE 6
	doc.body.style.overflow='hidden';
    screenWidth = doc.documentElement.clientWidth;
    screenHeight = doc.documentElement.clientHeight;
	doc.body.style.overflow='auto';
  }
else if( doc.body && ( doc.body.clientWidth || doc.body.clientHeight ) ) {
    //For IE
	doc.body.style.overflow='hidden';
    screenWidth = doc.body.clientWidth;
    screenHeight = doc.body.clientHeight;
	doc.body.style.overflow='auto';
  } 
  headerwidth = $ID('headerposition').scrollWidth;//No i18N
  headerheight = $ID('headerposition').scrollHeight;//No i18N
  mctablewidth = screenWidth - 2;
  mctableheight = (screenHeight - headerheight); 
   if (headerwidth > screenWidth )
  {
	  $ID('MickeyScrollTable').style.width = 'auto';
	  $ID('MickeyScrollTable').style.height = 'auto';
	  $ID('MickeyScrollTable').style.position = 'relative';
	  $ID('MickeyScrollTable').style.overflow = 'auto';
	  $ID('isscrollenabled').value = 'false';//No I18N
	  doc.body.style.overflow='auto';
	  $ID('searchText').style.width = '220px';
  }
  else
  {
	  $ID('MickeyScrollTable').style.width = mctablewidth;
	  $ID('MickeyScrollTable').style.height = mctableheight;
	  $ID('isscrollenabled').value = 'true';//No I18N
  }  
}

<!-- DashBoard popup Script start -->
function getDocObj(id)
{
	return $ID(id);
}

function hideNewRequestDiv(id, disid)
{
	$ID(id).style.display = 'none';
	if($ID(disid) != null)
	{	
		$ID(disid).style.display = 'none';
	}
	$ID('DashBoardPopCont').style.display = 'none';
}

function dragdrop(ev, id)
{
	captureSB(ev,id);
}

function detailviewPopup(tit, cont, wid, hei,ev)
{
	var content = $ID("CAcontent");//No i18N
	var title = $ID("CAtitle");//No i18N
	var mainContainer = $ID("viewContainer");//No i18N
	var header = $ID("CAheader");//No i18N
	title.innerHTML = tit;
	content.innerHTML = $ID(cont).innerHTML;
	
	mainContainer.style.width = wid + "px";
	mainContainer.style.height = hei + "px";
	mainContainer.style.display = 'block';

	var mainTable = $ID("PorTalPopDiv");//No i18N
	mainTable.style.width = wid + "px";

	$ID(cont).innerHTML = "";
	var disDiv = $ID("disableDiv");//No i18N
	if(disDiv != null){
		disDiv.style.display = 'block';
	}
	center(mainContainer);
}


  function center(object)
 { 
 var doc = document;
  var screenWidth = 0, screenHeight = 0; 
   if( typeof( window.innerWidth ) == 'number' ) {	   
  	screenWidth = parseInt (window.innerWidth);
    screenHeight = parseInt (window.innerHeight); 
   }
   else if( doc.documentElement && ( doc.documentElement.clientWidth || doc.documentElement.clientHeight ) ) {
    //IE 6
	screenWidth = doc.documentElement.clientWidth;
    screenHeight = doc.documentElement.clientHeight;
   }
   
   else if( doc.body && ( doc.body.clientWidth || doc.body.clientHeight ) ) {
    //For IE 
    screenWidth = doc.body.clientWidth;
    screenHeight = doc.body.clientHeight; 
  }  
   
	objwidth = parseInt (object.style.width);
	objheight = parseInt (object.style.height);
 
	aa = screenWidth - objwidth;
	aah = screenHeight - objheight; 
	objleft = parseInt (aa/2) + "px"; //No I18N
	topscroll = parseInt (document.body.scrollTop); 
	objheight1 = parseInt (aah/2); 
	objheight = objheight1 + topscroll + "px"; //No I18N
	object.style.left = objleft;
	object.style.top = objheight;
 
 }
 

function goToSearchResults(searchStr)
{
	var searchString = encodeURIComponent(searchStr);
	window.open('/HomePage.do?forwardedFrom='+searchString,'_parent');
}

function collapsecontent1(from,id)
{
	if($ID(from).style.display == "none")
	{
		$ID(id).className = "arrowview_maximize";
	}
	else
	{
		$ID(id).className = "arrowview_minimize";
	}
	jQuery('#' +from).slideFadeToggle();
}

/*Select Option dropdown ui issue script begin*/
var isIE = (navigator.appName=="Microsoft Internet Explorer");
var spanobj = null;
var curObj = null;
function openIt(obj)
{   
	  if(isIE) { 
 if(spanobj) return;
      if (obj.scrollWidth >= 240)
	  {
	  spanobj = document.createElement("span");
      spanobj.style.width = obj.offsetWidth;
      spanobj.style.height = obj.offsetHeight;
      spanobj.style.display = "none";
      obj.parentNode.insertBefore(spanobj, obj);
      
      obj.style.left  = getAbsPos(obj, "Left");
      obj.style.top  = getAbsPos(obj, "Top");
      obj.style.position  = "static";
      obj.style.width = obj.scrollWidth;
      obj.focus();
      spanobj.style.display = "none";
      curObj = obj; 
	  }
}  
}
function closeIt()
{
      if(spanobj)
      {
            spanobj.parentNode.removeChild(spanobj);
            spanobj = null;
      }
      if(curObj)
      {
            curObj.style.width = "240px";
            curObj.style.position  = "static";
      }
}
function getAbsPos(o,p){var i=0;while(o!=null){i+=o["offset"+p];o=o.offsetParent;}return i;}
/*Select Option dropdown ui issue script Ends*/

//Lucene
function logQuickRequestForUser(userID,ev)
{
	var url =  "WorkOrder.do?logQuickreq=logRequest&requestFor=user&userID="+userID; //No I18N
	AjaxAPI.sendRequest({METHOD:"POST",URL:url,TARGET:"_div_DashBoardPopCont",EFFECT:null}); //No I18N
	setTimeout("detailviewPopup('Add Request','DashBoardPopCont','540','480');",700);
}
function logQuickRequestWithAccount(accID)
{
	var url =  "WorkOrder.do?logQuickreq=logRequest&requestFor=account&accID="+accID; //No I18N
	AjaxAPI.sendRequest({METHOD:"POST",URL:url,TARGET:"_div_DashBoardPopCont",EFFECT:null}); //No I18N
	setTimeout("detailviewPopup('Add Request','DashBoardPopCont','540','480');",700);
}
//Lucene 

function selecttxtfield(id)
{
    $ID(id).focus();
    $ID(id).select();
}

//For module search
function enableSearchEnterKey(e,module)
{
	var keycode;
	if(window.event)
	{
		keycode = window.event.keyCode;     //IE
	}
	else
	{
		keycode = e.which;     //firefox
	}
	if(keycode == 13)
	{
		validateModuleSearchText(module);
	}
}
function validateModuleSearchText(module)
{
	var doc = document;
	var searchText = "";
	var dummyText = "";
	if(module == 'Request')
	{
		searchText = $ID('searchRequestText').value;//No i18N
		dummyText = $ID('gotoRequestSearchBox').value;//No i18N
		if(isEmpty($ID('searchRequestText').value) || searchText == dummyText)
		{
			alert($ID("emptySearchMSG").value);//No i18N
			$ID('searchRequestText').focus();//No i18N
			return false;
		}
		SearchNForm.selectName.value = $ID('requestSelectNameValue').value;//No i18N
	}
	else if(module == 'Account')
	{
		searchText = $ID('searchAccountText').value;//No i18N
		dummyText = $ID('gotoAccountSearchBox').value;//No i18N
		if(isEmpty($ID('searchAccountText').value) || searchText == dummyText)
		{
			alert($ID("emptySearchMSG").value);//No i18N
			$ID('searchAccountText').focus();//No i18N
			return false;
		}
		SearchNForm.selectName.value = $ID('accountSelectNameValue').value;//No i18N
	}
	else if(module == 'Contact')
	{
		searchText = $ID('searchContactText').value;//No i18N
		dummyText = $ID('gotoContactSearchBox').value;//No i18N
		if(isEmpty($ID('searchContactText').value) || searchText == dummyText)
		{
			alert($ID("emptySearchMSG").value);//No i18N
			$ID('searchContactText').focus();//No i18N
			return false;
		}
		SearchNForm.selectName.value = $ID('contactSelectNameValue').value;//No i18N
	}
	else if(module == 'Contract')
	{
		searchText = $ID('searchContractText').value;//No i18N
		dummyText = $ID('gotoContractSearchBox').value;//No i18N
		if(isEmpty($ID('searchContractText').value) || searchText == dummyText)
		{
			alert($ID("emptySearchMSG").value);//No i18N
			$ID('searchContractText').focus();//No i18N
			return false;
		}
		SearchNForm.selectName.value = $ID('contractSelectNameValue').value;//No i18N
	} 
	else if(module == 'Solution')
	{
		searchText = $ID('searchSolutionText').value;//No i18N
		dummyText = $ID('gotoSolutionSearchBox').value;//No i18N
		if(isEmpty($ID('searchSolutionText').value) || searchText == dummyText)
		{
			alert($ID("emptySearchMSG").value);//No i18N
			$ID('searchSolutionText').focus();//No i18N
			return false;
		}
		SearchNForm.selectName.value = $ID('solutionSelectNameValue').value;//No i18N
	}
	else if(module == 'Product')
	{
		searchText = jQuery('#searchProductText').val();
		dummyText = jQuery('#gotoProductSearchBox').val();
		if(isEmpty(jQuery('#searchProductText').val()) || searchText == dummyText)
		{
			alert(jQuery('#emptySearchMSG').val());
			$ID('searchProductText').focus();//No i18N
			return false;
		}
		SearchNForm.selectName.value = jQuery('#productSelectNameValue').val();
	}
	SearchNForm.searchText.value = searchText;
	SearchNForm.action = "/SearchN.do";
        SearchNForm.submit();
	return true;
}
function hideSearchTxt(module)
{
	var doc = document;
	if(module == 'Request')
	{
		if($ID('searchRequestText').value == $ID('gotoRequestSearchBox').value)
		{
			$ID('searchRequestText').value= "";
		}
	}
	else if(module == 'Account')
	{
		if($ID('searchAccountText').value == $ID('gotoAccountSearchBox').value)
		{
			$ID('searchAccountText').value= "";
		}
	}
	else if(module == 'Contact')
	{
		if($ID('searchContactText').value == $ID('gotoContactSearchBox').value)
		{
			$ID('searchContactText').value= "";
		}
	}
	else if(module == 'Contract')
	{
		if($ID('searchContractText').value == $ID('gotoContractSearchBox').value)
		{
			$ID('searchContractText').value= "";
		}
	}
	else if(module == 'Solution')
	{
		if($ID('searchSolutionText').value == $ID('gotoSolutionSearchBox').value)
		{
			$ID('searchSolutionText').value= "";
		}
	}
	else if(module == 'ActivityEvents')
	{
		if($ID('emailIds').value == $ID('gotoAddEmailIdsInBox').value)
		{
			$ID('emailIds').value= "";
		}
	}
	else if(module == 'Product')
	{
		if(jQuery('#searchProductText').val() == jQuery('#gotoProductSearchBox').val())
		{
			jQuery('#searchProductText').val("");
		}
	}
}
function showSearchTxt(module)
{
	var doc = document;
	if(module == 'Request')
	{
		if($ID('searchRequestText').value == "")
		{
			$ID('searchRequestText').value= $ID('gotoRequestSearchBox').value;//No i18N
			$ID('searchRequestText').className = "formStyle inputgreytxt";
		}
		else
		{
			$ID('searchRequestText').className = "formStyle";
		}
	}
	else if(module == 'Account')
	{
		if($ID('searchAccountText').value == "")
		{
			$ID('searchAccountText').value= $ID('gotoAccountSearchBox').value;//No i18N
			$ID('searchAccountText').className = "formStyle inputgreytxt";
		}
		else
		{
			$ID('searchAccountText').className = "formStyle";
		}
	}
	else if(module == 'Contact')
	{
		if($ID('searchContactText').value == "")
		{
			$ID('searchContactText').value= $ID('gotoContactSearchBox').value;//No i18N
			$ID('searchContactText').className = "formStyle inputgreytxt";
		}
		else
		{
			$ID('searchContactText').className = "formStyle";
		}
	}
	else if(module == 'Contract')
	{
		if($ID('searchContractText').value == "")
		{
			$ID('searchContractText').value= $ID('gotoContractSearchBox').value;//No i18N
			$ID('searchContractText').className = "formStyle inputgreytxt";
		}
		else
		{
			$ID('searchContractText').className = "formStyle";
		}
	}
	else if(module == 'Solution')
	{
		if($ID('searchSolutionText').value == "")
		{
			$ID('searchSolutionText').value= $ID('gotoSolutionSearchBox').value;//No i18N
			$ID('searchSolutionText').className = "formStyle inputgreytxt";
		}
		else
		{
			$ID('searchSolutionText').className = "formStyle";
		}
	}
	else if(module == 'ActivityEvents')
	{
		if($ID('emailIds').value == "")
		{
			$ID('emailIds').value= $ID('gotoAddEmailIdsInBox').value;//No i18N
			$ID('emailIds').className = "formStyle inputgreytxt";
		}
		else
		{
			$ID('emailIds').className = "formStyle";
		}
	}
	else if(module == 'Product')
	{
		if(jQuery('#searchProductText').val() == "")
		{
			jQuery('#searchProductText').val(jQuery('#gotoProductSearchBox').val());
			jQuery('#searchProductText').removeClass().addClass('formStyle inputgreytxt');
		}
		else
		{
			jQuery('#searchProductText').removeClass().addClass('formStyle');
		}
	}
	
}


//Forgot Password Scripts Start
function changeUserPassword(emailID, token)
{
	var pwd1 = $ID('user_password').value;//No i18N
	var pwd2 = $ID('user_password_confirm').value;//No i18N
	if(pwd1 == "" || pwd2 == "")
	{
		$ID('passwordMatch').style.display = "none";
		$ID('enterPassword').style.display = "block";
		return false;
	}
	if(pwd1 == pwd2)
	{
		emailID = encodeURIComponent(emailID);
		token = encodeURIComponent(token);
		pwd1 = encodeURIComponent(pwd1);
		var url =  "/sd/ResetPwd.sd?action=changePwd&emailID="+emailID+"&token="+token+"&newPwd="+pwd1;//No I18N
		AjaxAPI.sendRequest({METHOD:"POST",URL:url,ONSUCCESSFUNC:"changePwdResponse"});//No I18N
	}
	else
	{
		$ID('enterPassword').style.display = "none";
		$ID('passwordMatch').style.display = "block";
		return false;
	}
}
changePwdResponse = function responseType(resp,reqOptions)
{
	var response = resp.responseText;
	$ID("changePwd").style.display = "none";
	if(response == "true"){
		$ID("successChange").style.display = "block";
	}
	else{
		$ID("sorryMail").style.display = "block";
	}

}
function sendInstructions()
{
	var emailID = $ID('emailValue').value;//No i18N
	if(inlineEmailCheck(emailID)){
		emailID = encodeURIComponent(emailID);
		var url = "/sd/ResetPwd.sd?action=resetPwd&emailID="+emailID;//No i18N
		AjaxAPI.sendRequest({METHOD:"POST",URL:url,ONSUCCESSFUNC:"showResetPwdResponse"});//No I18N
	}
}
showResetPwdResponse = function responseType(resp,reqOptions)
{
    var response = resp.responseText;
    if(response == "true"){
        jQuery('#resetPwd').slideFadeOut();//NO I18N
        jQuery('#sucessMail').slideFadeIn();//NO I18N
    }
    else{
        jQuery('#sorryMail').slideFadeIn();//NO I18N
    }
}

function callSendInstructions(e)
{
	var key;
	if(window.event){
		key = window.event.keyCode;     //IE
	}
	else{
		key = e.which;     //firefox
	}
	if(key == 13){
		sendInstructions();
	}
}
function inlineEmailCheck(email)
{
	var leading = /^\s*/g;
	var trailing =/\s*$/g;
	var str = email;
	str = trimString(str);
	if(str=="")
	{
		$ID("invalidemail").style.display = "none";
		jQuery('#enteremail').slideFadeIn();//NO I18N
		$ID('emailValue').focus();//No i18N
		return false;
	}

	leadingremoved = str.replace(leading,"");
	str = leadingremoved.replace(trailing,"");

	if (str.length > 0)
	{
		var posadr1 = 0;
		var posdot = str.indexOf(".");
		var posadr = str.indexOf("@");
		posadr1=str.lastIndexOf("@");
		if ( (posdot < 0) || (posadr < 0) || (posadr1 != posadr) )
		{
			$ID("enteremail").style.display = "none";
			jQuery('#invalidemail').slideFadeIn();//NO I18N
			$ID('emailValue').focus();//No i18N
			return false;
		}
	}
	var j = str.length;
	var strobj = new String(str);
	if (strobj.charAt(j-1)=="." || strobj.charAt(0)=="@" || strobj.charAt(j-1)=="@" || strobj.charAt(0)=="." || strobj.charAt(0)=="-" || strobj.charAt(0)=="_" || strobj.charAt(j-1)=="-" || strobj.charAt(j-1)=="_" || strobj.charAt(j-2)=="." || strobj.charAt(j-2)=="-" || strobj.charAt(j-2)=="_")
	{
		$ID("enteremail").style.display = "none";
		jQuery('#invalidemail').slideFadeIn();//NO I18N
		$ID('emailValue').focus();//No i18N
		return false;
	}
	return true;
}
//Forgot Password Scripts end

function verifyWithCaptcha(num1,num2,type)
{
	var doc = document;
	var num1 =num1;
	var num2 =num2;
	var res1 =num1+num2;
	var res2 =$ID('result').value;//No i18N
	var result =false;
	jQuery('#invalidemail,#enteremail,#regWrongCode,#regEnterCode,#enterSubject').hide();
	if(type == "register"){
		result = verifyRegister(false);
	}
	else if(type == "submitTicket"){
		result = verifySubmitTicket(false);
	}
	if(result === true){
		if(res2 == null || res2 == ""){
			jQuery('#regEnterCode').slideFadeIn();//NO I18N
			return false;
		}
		if(res1 == res2){
			freezeSCP(null,$ID('saving').value);//No i18N
			return true;
		}else{
			jQuery('#regWrongCode').slideFadeIn();//NO I18N
			return false;
		}
	}else{
		return false;
	}

}
function verifySubmitTicket(isFreeze)
{
	var doc = document;
	jQuery('#invalidemail,#enteremail,#regWrongCode,#regEnterCode,#enterSubject').hide();
	var email = doc.NonLoginRequestForm.emailID.value;
	var title =doc.NonLoginRequestForm.title.value;
	title = trimString(title);
	var result = validateNLDepartment();
	if(result === false){return false}
	if(title=="" || title == null)
	{
		jQuery('#enterSubject').slideFadeIn();//NO I18N
		return false
	}
	if(!inlineEmailCheck(email))
	{
		return false
	}
	if(isFreeze)
	{
		freezeSCP(null,$ID('saving').value);//No i18N
	}
	return true;
}
function trimString(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function verifyRegister(isFreeze)
{
	var doc= document;
	jQuery('#regEnterName,#invalidemail,#enteremail,#regWrongCode,#regEnterCode').hide();
	var email = doc.SolutionHomeForm.email.value;
	var name =doc.SolutionHomeForm.name.value;
	name = trimString(name);
	var result = validateNLDepartment();
	if(result === false){return false}
	if(name=="" || name == null)
	{
		jQuery('#regEnterName').slideFadeIn();//NO I18N
		return false
	}
	if(!inlineEmailCheck(email))
	{
		return false
	}
	if(isFreeze)
	{
		freezeSCP(null,$ID('saving').value);//No i18N
	}
	return true;
}
function validateNLDepartment()
{
	var doc = document
	jQuery('#selectDept').hide();//NO I18N
	if($ID('deptId') != null){
		var deptVal = $ID('deptId').value;//No i18N
		if(deptVal == '0'){
			jQuery('#selectDept').slideFadeIn();//NO I18N
			return false;
		}
	}
}
function checkSearchText(thisform)
{
	var st = thisform.searchText.value;
        if(st == null || st== "")
 	{
 		alert($ID("solutionsSearchError").value);//No i18N
 	        thisform.searchText.focus();
 	        return false;
 	}
 	return true;
}

function HMenuOver(a)
	{
		aa = $ID(a).id;
		$ID(aa).className = "movertab"; 
	}
	
function HMenuOut(a)
	{
		aa = $ID(a).id;
		$ID(aa).className = " "; 
	}
	
 <!-- Text Area Expandable Script Begin -->	 
 /*
 e.g. <textarea name="textarea1" rows="3" cols="40" class="expand"></textarea>
 Or assign a class of "expandMIN-MAX" to set the <textarea> minimum and maximum height.
 e.g. <textarea name="textarea1" rows="3" cols="40" class="expand50-200"></textarea>
 */
(function(jQuery) { 
	// jQuery plugin definition
	jQuery.fn.TextAreaExpander= function(minHeight, maxHeight) {

		var CheckH = !(jQuery.browser.msie || jQuery.browser.opera);

		// resize a textarea
		function Textareasize(e) {

			// event or initialize element?
			e = e.target || e;

			// find content length and box width
			var findlength = e.value.length, ewidth = e.offsetWidth;
			if (findlength != e.valLength || ewidth != e.boxWidth) {

				if (CheckH && (findlength < e.valLength || ewidth != e.boxWidth)) e.style.height = "0px";
				var h = Math.max(e.expandMin, Math.min(e.scrollHeight, e.expandMax));

				e.style.overflow = (e.scrollHeight > h ? "auto" : "hidden");
				e.style.height = h + "px";

				e.valLength = findlength;
				e.boxWidth = ewidth;
			}

			return true;
		};

		// initialize
		this.each(function() {

			// is a textarea?
			if (this.nodeName.toLowerCase() != "textarea") return;

			// set height restrictions
			var p = this.className.match(/expand(\d+)\-*(\d+)*/i);
			this.expandMin = minHeight || (p ? parseInt('0'+p[1], 10) : 0);
			this.expandMax = maxHeight || (p ? parseInt('0'+p[2], 10) : 99999);

			// initial resize
			Textareasize(this);

			// zero vertical padding and add events
			if (!this.Initialized) {
				this.Initialized = true;
				jQuery(this).css("padding-top", 0).css("padding-bottom", 0);//NO I18N
				jQuery(this).bind("keyup", Textareasize).bind("focus", Textareasize);//NO I18N
			}
		});

		return this;
	};

})(jQuery); 

// initialize all expanding textareas
jQuery(document).ready(function() {
	jQuery("textarea[class*=expand]").TextAreaExpander();//NO I18N
}); 
<!-- Text Area Expandable Script Ends -->	


function showwidgetinnerdiv(widgetID)
{
	$ID("widgetActionsRow_"+widgetID).className = "show";
	jQuery("#aboutwidgetdesc_"+widgetID).hide();
	jQuery("#dbwidgetinnerdiv_"+widgetID).show();
	jQuery("#html_"+widgetID).hide();
	closeDialog();
}

function aboutwidgetdesc(widgetID)
{ 
	$ID("widgetActionsRow_"+widgetID).className = "show"; 
	jQuery("#dbwidgetinnerdiv_"+widgetID).hide();
	jQuery("#aboutwidgetdesc_"+widgetID).show();
	jQuery("#html_"+widgetID).hide();
	closeDialog();
 
}

function showhtmldiv(widgetID)
{ 
	$ID("widgetActionsRow_"+widgetID).className = "show"; 
	jQuery("#dbwidgetinnerdiv_"+widgetID).hide();
	jQuery("#aboutwidgetdesc_"+widgetID).hide();
	jQuery("#html_"+widgetID).show();
	closeDialog();
 
}
function hideWidgetActionsRow(widgetID)
{
	$ID("widgetActionsRow_"+widgetID).className = "hide"; 
	jQuery("#dbwidgetinnerdiv_"+widgetID).hide();
	jQuery("#aboutwidgetdesc_"+widgetID).hide();
	jQuery("#html_"+widgetID).hide();
}


/*Popup div in Page Center Position with Overlay effect Script Begin*/
  	 
  	 
  	 jQuery(document).ready(function() {
  	         (function(sdiv){
  	           sdiv.fn.positionCenter = function(options) {
  	             var pos = {
  	               sTop : function() {
  	                 return window.pageYOffset || document.documentElement && document.documentElement.scrollTop ||    document.body.scrollTop;
  	               },
  	               wHeight : function() {
  	                 return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.clientHeight;
  	               }
  	             };
  	             return this.each(function(index) {
  	               if (index == 0) {
  	                 var sdivthis = sdiv(this);
  	                 var elHeight = sdivthis.outerHeight();
  	                 var elTop = pos.sTop() + (pos.wHeight() / 2) - (elHeight / 2);
  	                 sdivthis.css({
  	                   position: 'absolute',//No I18N
  	                   margin: '0',
  	                   top: elTop,
  	                   left: ((sdiv(window).width() - sdivthis.outerWidth()) / 2) + 'px'//No I18N
  	                 });
  	               }
  	             });
  	           };
  	         })(jQuery);
  	       });
  	      
  	       function PageCenterDiv(id, pageDisable){
  	     var status = jQuery('#'+id).css("display");//No I18N
		 
		 var Disable =  true;
	if(pageDisable != null) {
		Disable = pageDisable;
	}
  	                 if(status == 'none'){
  	                          jQuery('#'+id).positionCenter().show();
							  if(pageDisable){
  	                          jQuery('.productmaintable').fadeTo("slow", 0.2);//No I18N
							  }
  	                 }else{
  	                         jQuery('#'+id).hide();
  	                           jQuery('.productmaintable').fadeTo("slow", 1.0);//No I18N
  	                 }
  	 
  	 }
  	 /*Popup div in Page Center Position with Overlay effect Script Ends*/
	 
/*Dragable Div Script Begin*/
function dragablediv(source, holder)
{ 
	var doc = document;
	var sourcediv = $ID(source);
	var holderdiv = $ID(holder); 
	new Draggable(sourcediv, {handle: holderdiv, starteffect: effectFunction(sourcediv)});  
}

function effectFunction(element)
{
   new Effect.Opacity(element, {from:1, to:1});
} 
/*Dragable Div Script Ends*/

	 
function validateCCList()
{
	var className = $ID('ccList').className;//No i18N
	var CcText = $ID("ccList").value;//No i18N
	CcText = trimAll(CcText);
	if(CcText != '' && CcText != geti18nString("sdp.admin.notifiactionrules.autocc.emails"))
	{
		if(CcText.charAt(CcText.length-1) == ',')
		{
			CcText = CcText.slice(0,CcText.length-1);
		}
		if(validateCCAddList(CcText))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		$ID('error').style.display = "none";	
		return true;
	}
}	
function validateCCAddList(varEmails)
{
	var email = varEmails.split(',');
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z])+$/;
	for(var i = 0 ; i < email.length; i++ )
	{
		var address = email[i];
		if(reg.test(address) == false) 
		{
			jQuery('#error').hide();
			var msg = $ID("invalidEmail").value;//No i18N
			jQuery('#error').addClass("errorRedTxt normalbold");//No I18N
			jQuery('#error').fadeIn(500);//No I18N
			jQuery('#error').html(msg);//No I18N
			$ID('ccList').focus();//No i18N
			return false;
		}
	}
	$ID('error').style.display="none";
	return true;
}

function changebgcolor(relatedTo,selectmodule)
{
	module = $ID(relatedTo).value;
	if (module == selectmodule)
	{
		$ID('divbg').style.backgroundColor = 'transparent';
	}
	else
	{
		$ID('divbg').style.backgroundColor = '#ffffbf';
	}
}
function showCalendarForWorkorder(id1,id2){
	Calendar.setup({
		inputField     :    id1,     // id of the input field
		ifFormat       :    "%d %b %Y, %H:%M:00",      //NO I18N
		showsTime      :    true,
		button         :    id2,  // trigger for the calendar (button ID)
		align          :    "Tl",           //NO I18N
		singleClick    :    true
	});
}

function isNumericDouble(input){
    var RE = /^-{0,1}\d*\.{0,1}\d+$/;
    return (RE.test(input));
}
function removeDefaultText()
{
	var checkCCValue = $ID('ccList').value;//No i18N
	if(checkCCValue == geti18nString("sdp.admin.notifiactionrules.autocc.emails"))
	{
		$ID('ccList').value = "";
	}
}
function restoreDefaultText()
{
	var checkCCValue = $ID('ccList').value;//No i18N
	if(checkCCValue == "")
	{
		$ID('ccList').value = geti18nString("sdp.admin.notifiactionrules.autocc.emails");
	}
}

/*Show Hide Div in dialog script begin*/
function ShowHideDivInDialog(holder, source, aClose, xPos, yPos) {
	document.onmousemove = capturePos;

	var autoClose =  true;
	if(aClose != null) {
		autoClose = aClose;
	}
	
	if (xPos == '' || xPos == null)
				{
					xPos = 0;
				}
				if (yPos == '' || yPos == null)
				{
					yPos = 0;
				} 
				
        var posX = findPosX($ID(holder));
        var posY = findPosY($ID(holder));
	var finalY = posY + $ID(holder).offsetHeight - document.body.scrollTop + yPos;
	var finalX = posX - document.body.scrollLeft + xPos;
	if(autoClose) {
		showDialog($ID(source).innerHTML,'position=absolute,closeButton=no,left=' + finalX + ',top=' + finalY); // No I18N
		setTimeout("closeMenusDialog('" + source + "')", 1000); // No I18N
	}
	else {
		showDialog($ID(source).innerHTML,'position=absolute,closeOnBodyClick=yes,closeButton=no,left=' + finalX + ',top=' + finalY); // No I18N
	}
}

var xposition,yposition;


function capturePos(e) {
	if (window.ActiveXObject)
	{
		xposition = window.event.clientX;
		yposition = window.event.clientY;
	}	
	else
	{
		xposition = e.pageX;	
		yposition = e.pageY;	
	}
}



function closeMenusDialog(source)
{
	var dialogElement = $ID("_DIALOG_LAYER");//No i18N
	var reqX = findPosX(dialogElement);
	var reqY = findPosY(dialogElement);
	var offsetHeight = dialogElement.offsetHeight;
	var offsetWidth = dialogElement.offsetWidth;
	// the below check is done without proper understanding, just done on a trial and error basis.
	if (window.ActiveXObject)
	{
		reqY = reqY - document.body.scrollTop;
		reqX = reqX - document.body.scrollLeft;
	}	

	var reqEndX = reqX + offsetWidth;
	var reqEndY = reqY + offsetHeight;

	if(xposition < reqEndX && xposition > reqX && yposition < reqEndY && yposition > (reqY-20)) {
		setTimeout("closeMenusDialog('" + source + "')", 1000); // No I18N
	}
	else {
		closeDialog();
	}
}

function switchDepartment(deptID,tabName)
{
		tabName = encodeURIComponent(tabName);
		var url =  "/servlet/ClientUtilServlet?action=setSelectedDeptSession&deptID="+deptID+"&tabName="+tabName;
		AjaxAPI.sendRequest({METHOD:"GET",URL:url,ONSUCCESSFUNC:"showalldeptResponse"});
}
showalldeptResponse = function responseType(response,reqOptions)
{
	var showalldept = response.responseText;
	if(showalldept != "false")
	{
		var link = window.location.href;
		if(showalldept.indexOf("DashBoard") >= 0)
		{
			window.location = link;
		}
		else
		{
			window.location = showalldept;	
		}
	}
	else
	{
		alert("Exception while Switching the Business Unit");//NO i18N
	}
}
function numericTestWithDecimal(eve) 
{
	var charCode = (eve.which) ? eve.which : eve.keyCode
	if(charCode > 45 && (charCode < 46 || charCode > 57))
	{ 
		alert (geti18nString("scp.activity.numberFormatErrMsg")); 
        	return false;
	} 
	return true;
}

/*Show Hide Div in dialog script ends*/ 

/* Show Hide Input Text Value on focus Begin */
function hideshowinpval(sval,hval)
{
       
       var element = $ID(sval);
       if(element.value == $ID(hval).value)
       {
       		element.value=""; 
       }
}

function showhideinpvals(sval,hval)
{
	var element = $ID(sval);
       if(element.value == "")
       {
       		element.value = $ID(hval).value; 
       }
}  
/* Show Hide Input Text Value on focus Ends*/


function loadMCNavigator(uniqueId, rowCount) {
	// null check added because in some places these methods can be called without the main view being invoked.
	var doc = document;
	if($ID(uniqueId + '_Navig') != null) {
		if(parent.$ID(uniqueId + '_NAV') == null){
			$ID(uniqueId + '_NAV').innerHTML = $ID(uniqueId + '_Navig').innerHTML;//No i18N
			if($ID(uniqueId + '_NAV_BOT') != null) {
				$ID(uniqueId + '_NAV_BOT').innerHTML = $ID(uniqueId + '_Navig').innerHTML;//No i18N
			}
		}else{
			parent.$ID(uniqueId + '_NAV').innerHTML = $ID(uniqueId + '_Navig').innerHTML;//No i18N
			if(parent.$ID(uniqueId + '_NAV_BOT') != null) {
				parent.$ID(uniqueId + '_NAV_BOT').innerHTML = $ID(uniqueId + '_Navig').innerHTML;//No i18N
			}
			if(parent.$ID(uniqueId + '_BOT') != null) {
				if(rowCount > 15) {
					parent.$ID('botNavSH').className = "show";
				}else {
					parent.$ID('botNavSH').className = "hide";
				}
			}
		}
	}
}

function saveTabOrder()
{
	var enableTabsUi = (jQuery('#column1').contents().text()).split(jQuery("#disKey").val()),enableTabs = "";
	for(var i = 0; i < enableTabsUi.length; i++){
		enableTabs += (enableTabs != "") ? ","+enableTabsUi[i] : ""+enableTabsUi[i];
	}
	var disTabsUi = (jQuery('#disabledTab').contents().text()).split(jQuery("#enableKey").val()),disTabs = "";
	for(var i = 0; i < disTabsUi.length; i++){
			disTabs += (disTabs != "") ? ","+disTabsUi[i] : ""+disTabsUi[i];
	}
	jQuery('#enableTabList').val(enableTabs);
	if(disTabs != jQuery('#noTabMsg').val()) {
		jQuery('#disTabList').val(disTabs);
	}
}

function disableTab(tabId, disabledTab)
{
	jQuery("#noTab,#"+tabId).remove();
	jQuery('#disabledTab').append("<li class=\"tabdisabled\" id=\"" + tabId + "\"><div class=\"orgtabsmdis\"><span class=\"orgtabsimgd floatLeft\" ><img src=\"images/spacer.gif\" class=\"\" /></span><span class=\"tabtxt\">" + disabledTab + "</span><div class=\"enabledisabletab cursourPointer\" onclick=\"enableTab('" + tabId +"','" + disabledTab + "')\">"+jQuery('#enableKey').val()+"</div></div></li>");
}
function enableTab(disTabId, enabledTab)
{
	jQuery("#"+disTabId).remove();
	jQuery('#column1').append("<li id=\"" + disTabId + "\"><div class=\"orgtabsm\" id=\"orgtabsm" + disTabId + "\" onMouseOver=\"orgtabimg('orgtabsm" + disTabId + "')\" onMouseOut=\"orgtabimgmout('orgtabsm" + disTabId + "')\" ><span class=\"orgtabsimg\" ><img src=\"images/spacer.gif\" class=\"\" /></span><span class=\"tabtxt\" id=\"tabNameOnly\">" + enabledTab + "</span><div class=\"enabledisabletab cursourPointer\" onclick=\"disableTab('" + disTabId +"','" + enabledTab + "')\">"+jQuery('#disKey').val()+"</div></div></li>");
	if(jQuery('#disabledTab').children().size() < 1) {
		jQuery("#disabledTab").append("<li id=\"noTab\"><div align=\"center\" style=\"width:100%; text-align:center;\" class=\"bx_Msgtxt\">"+jQuery('#noTabMsg').val()+"</div></li>");//No I18N
	}
}
function manageTab(hmenu,chmenu) {
	hmenutxt = jQuery('#'+hmenu).html();
	chmenutxt = jQuery('#'+chmenu).html(); 
	jQuery('#'+hmenu).html(chmenutxt);
	jQuery('#'+chmenu).html(hmenutxt);
	closeDialog()
}
function changeTabWhileLoad()
{
	if(window.name == "organizeTab") {
		window.name = "tabChanged";
		jQuery('#language,#changepass').css('display','none');//No I18N
		jQuery('#organizetab').css('display','block');//No I18N
	}
	if(jQuery('#disTabsIsEmpty').val() == "true") {
		jQuery("#disabledTab").append("<li id=\"noTab\"><div align=\"center\" style=\"width:100%; text-align:center;\" class=\"bx_Msgtxt\">"+jQuery('#noTabMsg').val()+"</div></li>");
	}
}

/* This function will create the freeze layer*/
function freezeSCP(holder,val)
{
	var _doc = document,
	    _body = _doc.body,
	    _freeze_div =$ID("scp_freeze");//No i18N

	if(_freeze_div)
	{
		var _style = _freeze_div.style;
		_style.height = Math.max(_body.scrollHeight,_doc.documentElement.scrollHeight)+"px";
		_style.width = _body.clientWidth+"px";
		_style.display="";
	}
	else
	{
		var _div = _doc.createElement("div"), _body = _doc.getElementsByTagName('body') [0];
		    _style = _div.style;
		_div.id = _div.className = "scp_freeze";
		_style.height = Math.max(_body.scrollHeight,_doc.documentElement.scrollHeight)+"px";
		_style.width = _body.clientWidth+"px";
		_body.appendChild(_div);
	}
	parent.invokeProgressIndicator(holder,val,'progress');//No I18N
	
}

/* This function will hide the freeze layer*/
function hideFreezeSCP()
{
	var _freeze_div = $ID("scp_freeze");//No i18N
	(_freeze_div) && (_freeze_div.style.display="none");
}

function MOverNOut(selTab,lastTab,action)
{
	if(selTab != lastTab) {
		if(action == 'over') {
			jQuery('#lastTab').removeClass().addClass('movertab');
		} else {
			jQuery('#lastTab').removeClass();
		}
	} else {
		jQuery('#lastTab').removeClass().addClass('selectedTab');
	}
}


