/**
 */
function getSelectd(selectId)
{ 
	try{
		
		
		assets = new Array();
		selectedAssets = document.getElementById(selectId);
		 
		for(i=0; i< selectedAssets.options.length; i++)
		{ 
			assets.push(selectedAssets.options[i].value);
		}

		myForm = selectedAssets.form;
		if(selectedAssets.length > 0)
		{
			document.getElementById('selectedAssetsArray').value = assets;
			return true;
		}
		document.getElementById('selectedAssets').style.background = "#C00";
		document.getElementById("error").innerHTML = "Select assets for contract";
		document.getElementById("error").style.display = "block";
		return false;
	}catch(e){
		alert(e);
//		jQuery.jGrowl(e, { sticky: false } , { life: 100 });
		}
}


function getSelectdEdit(selectId,contractId)
{
	try{
		assets = new Array();
		selectedAssets = document.getElementById(selectId);
		myForm = selectedAssets.form; 
		for(i=0; i< selectedAssets.options.length; i++)
		{ 
			assets.push(selectedAssets.options[i].value);
		}
		if(assets.length > 0)
		{
			document.getElementById('selectedAssetsArray').value = assets;
//			myForm.action = myForm.action + "/update/"+contractId+"?assetId=" + assets;
			return true;
		}
		document.getElementById('selectedAssets').style.background = "#C00";
		document.getElementById("error").innerHTML = "Select assets for contract";
		return false;
	}catch(e){
		jQuery.jGrowl(e, { sticky: false } , { life: 100 });
		}
}


function listbox_selectall(listID, isSelect) {
	var listbox = document.getElementById(listID);
	for(var count=0; count < listbox.options.length; count++) {
		listbox.options[count].selected = isSelect;
	}
}

var deSelectedAssets = new Array();
function removeFromArray(arrayName,arrayElement)
{
   for(var i=0; i<arrayName.length;i++ )
    { 
       if(arrayName[i]==arrayElement)
           arrayName.splice(i,1); 
     } 
 }
function listbox_moveacross(sourceID, destID) {
var i = deSelectedAssets.length;

	var src = document.getElementById(sourceID);
	var dest = document.getElementById(destID);
	if(sourceID == "selectAssets")
	{
		document.getElementById("error").style.display = "none";
		document.getElementById("selectedAssets").style.background = "#EAEFFE";
	}
	
	for(var count=0; count < src.options.length; count++) {
 
	if(src.options[count].selected == true) {
		var option = src.options[count]; 
		var newOption = document.createElement("option");
		newOption.value = option.value;
		newOption.text = option.text;
		newOption.selected = true;
		try {
			aryElement = "<option value="+option.value+">"+option.text+"</option>";
			if(sourceID == "selectedAssets")
			{
				deSelectedAssets[i++]  =  aryElement;
			}
			else
				removeFromArray(deSelectedAssets,aryElement);
			dest.add(newOption, null); //Standard
			src.remove(count, null);
		}catch(error) {
			alert(error);
			dest.add(newOption); // IE only
			src.remove(count);
		}
		count--;
		}
	}
//	blur(dest);
	k="";
	for(j=0; j<deSelectedAssets.length; j++)
		k+=deSelectedAssets[j];
}
var hex=255;
function blur(elmt)
{
	try{
	if(hex>0) { //If color is not black yet
		hex-=6; // increase color darkness
		elmt.style.color="rgb("+hex+","+hex+","+hex+")";
		setTimeout("blur(elmt)",20); 
		}
		else
		{
			hex=255; //reset hex value
			jQuery.jGrowl(elmt, { sticky: false } , { life: 100 });
		}
	}catch(e){
		jQuery.jGrowl(e, { sticky: false } , { life: 100 });
		}
}

function applyFilter(s, l, g,a,contractId,selectedId)
{
	try{
	status = document.getElementById(s).value;
	assetLocation = document.getElementById(l).value;
	group = document.getElementById(g).value;
	assets = new Array();
	if(status=="")
		status="any";
	
	if(assetLocation=="")
		assetLocation="any";
	
	if(group=="")
		group="any";
	
	selectedAssets = document.getElementById(selectedId);
	myForm = selectedAssets.form; 
	for(i=0; i< selectedAssets.options.length; i++)
	{ 
		//alert(selectedAssets.options[i].value);
		assets.push(selectedAssets.options[i].value);
	}
	
	var par = status+","+assetLocation+","+group+","+a+","+contractId+","+assets;
	if(a=="copy")
	{
		new AjaxUpdater('filteredAssets','../applyFilter/'+par,{asynchronous:true, evalScripts:true});
	}
	else
	{
		new AjaxUpdater('filteredAssets','applyFilter/'+par,{asynchronous:true, evalScripts:true});
	}
	/*
	 * Mahendran, 9-April-2010
	 * To Add the deselected assets from selectedAssets to selectAssets 
	 * */
	if(a!="new")
	{
		for(i = 0; i< deSelectedAssets.length; i++)
		{
			deSelect = false;
			selectAssets = document.getElementById('selectAssets');
			myForm = selectAssets.form; 
			for(j=0; j< selectAssets.options.length; j++)
			{ 
				aryElement = "<option value="+selectAssets.options[j].value+">"+selectAssets.options[j].text+"</option>";
				if (aryElement==deSelectedAssets[i])
				{
					deSelect = true;
				} 
			}
			if(deSelect == false)
			 document.getElementById("selectAssets").innerHTML += deSelectedAssets[i];
			
		}
	}
	
	}catch(e){
		//alert(e);
		jQuery.jGrowl(e, { sticky: false } , { life: 100 });

		}
	return 1;
}

function loginsign(sectionName)
{
 try{
 my_form = document.getElementById("new_user_session");
 

 /*
  * (c) Venkat Mangudi Consulting
  * Author      : Radhika Dhanapal 
  * Date        : 07-Jan-2009
  * Description : Email validation and field not null.
  */

 var filter = /^.+@.+\..{2,3}$/
 if(sectionName == "login")
 {
	 
	 var email = document.getElementById("user_session_email").value ;
	 message = "";
	 var flag = false;
	 act = my_form.action;
/*	 my_form.action="/user_session/"; */
	 if(document.getElementById("user_session_email").value == "")
	 {
//		 message = "Please enter email address\n"
		 
		 showErrorMsg("user_session_email");
	 }
	 
	 if(document.getElementById("user_session_email").value != "")
	 {
		 if (filter.test(email))
		 {
			 flag = true;
		 }
		 else 
		 {
			 
//			 message = message + "Invalid email address\n";
//			 document.getElementById("user_session_email").value = "";
			 showErrorMsg("user_session_email");
		 }
	 }
	 
	 if(document.getElementById("user_session_email").value != ""  && document.getElementById("user_session_password").value == "")
	 {
		 //alert("Please enter your password!");
//		 document.getElementById("user_session_password").value = "";
//		 message = message + "Please enter your password\n";
		 showErrorMsg("user_session_password");
	 }
	 
	 if(flag == true && message=="")
	 {
		 try{
//		 document.getElementById('loadingDiv').style.visibility = "visible";
		 document.getElementById("errormsgDiv").innerHTML = "<font color='#006600'>Logging you in...</font>";
		 url = "/user_sessions/create/1?user_session[email]="+document.getElementById("user_session_email").value+"&user_session[password]="+document.getElementById("user_session_password").value;
		 response = AjaxResponse(url);
//		 document.getElementById("loadingDiv").style.display="none";
		 if(response == "tickets")
		 {
//			 window.location = "/tickets/";
			 my_form.disabled=true;
			 jumpTo("/tickets");
		 }
		 else if(response == "dashboard")
		 {
//			 window.location = "/dashboards/";
			 my_form.disabled=true;
			 jumpTo("/dashboards");
		 }
		 else{
			 document.getElementById('errormsgDiv').style.visibility = "visible";
			 document.getElementById("errormsgDiv").innerHTML = "<font color='red'>Login unsuccessful!<br><small>The email id may be unregistered or the password is wrong</small></font>";
			 document.getElementById("user_session_password").value = "";
			 document.getElementById("user_session_email").focus();
		 }
//		 my_form.submit();
//		 document.getElementById("user_session_email").value="";
//		 document.getElementById('loadingDiv').style.visibility = "hidden";
		 }catch(e){alert(e);}
	 }
	 else 
	 {
		 //alert(message);
		 
		 //jQuery.jGrowl(message, { sticky: false } , { life: 1000 });
		 document.getElementById('errormsgDiv').style.visibility = "visible";
		 document.getElementById("errormsgDiv").innerHTML = "<font color='red'>"+message+"</font>";

		 //document.getElementById("errors").innerHTML = message;
		 return;
	 }
 }
 else if(sectionName == "signup")
 {
	 email = document.getElementById("user_email").value;
//	 email = document.getElementById("user_email").value;
	 if (filter.test(email))
	 { try{
		 
		 document.getElementById('loadingDivSignup').style.display = "block";
		 document.getElementById('loadingDivSignup').innerHTML= "<center><font color='#000'>Processing...</font></center>";
		 new AjaxCheckAccount('signupformdiv','/signup/checkID/1?email='+document.getElementById("user_email").value,{asynchronous:true, evalScripts:true});
		 new AjaxUpdater('signupformdiv','/signup/create/1?email='+document.getElementById("user_email").value,{asynchronous:true, evalScripts:true});
//		 document.getElementById("user_email").value="";
		 document.getElementById('loadingDivSignup').style.display = "none";
		 if(document.getElementById('signupbg'))
		 {
			 setTimeOut('$j("#BackgroundPopup").fadeOut(700);$j("#signupbg").fadeOut("slow");', 4000);
		 }
	 }catch(e){
		 alert(e);
//			jQuery.jGrowl(e, { sticky: false } , { life: 100 });

		 }
	 }
	 else
	 {
	    //alert("Please enter a valid email address!")
		 //jQuery.jGrowl('Please enter a valid email address!', { sticky: true });

		 //document.getElementById("errors").innerHTML = "Please enter a valid email address";
		 document.getElementById("user_email").value = "";
		 showErrorMsg("user_email");
		 //document.getElementById('errorMsgDiv').style.visibility = "visible";
		 //document.getElementById("errorMsgDiv").innerHTML = "<center><font color='red'>Invalid Email Id!<br></font></center>";
		 
	    return;
	 }
	
 }

}catch(e){
	//alert(e);
	//jQuery.jGrowl(e, { sticky: false } , { life: 100 });

	}
}


function AjaxCheckAccount(elementId, url, options)
{
	try{
	newVal = $j.ajax({ url: url, async: false }).responseText;
	if(newVal=="")
	{
		document.getElementById('loadingDivSignup').innerHTML= "<center><font color='orange'>Sending Mail...</font></center>";
	}
		
	}catch(e){}
}

function goToByScroll(id){
		      $j('html,body').animate({scrollTop: $j("#"+id).offset().top},'slow');
		}

function img_Toggle(divTag)
{
	image = divTag.src;
	if(image.indexOf("la.jpeg")>0)
	{
		divTag.src="/images/web-app-theme/ra.jpeg";
		document.getElementById("sidebarButton").name = "sidebarButton1";
	}
	else
	{
		divTag.src="/images/web-app-theme/la.jpeg";
		document.getElementById("sidebarButton").name = "sidebarButton";
	}
	
}





/*
 * (c) Venkat Mangudi Consulting
 * Author      : Radhika Dhanapal 
 * Date        : 04-Jan-2009
 * Description : Validate User Registration field
 */

function submitUserform()
{
    try
    {
	var message = "";
    var passwordConfirmationMsg = "";
	if (document.getElementById('user_password').value != "")
	{
		if (document.getElementById('user_password').value.length < 6) 
		{
			passwordConfirmationMsg = "Password cannot be less than six characters.<br>";
			document.getElementById("error_password").style.display = "block";
		}
		else
			document.getElementById("error_password").style.display = "none";
	}
	if (document.getElementById('user_password').value != "" && document.getElementById('user_password_confirmation').value != "")
	{
		if (document.getElementById('user_password_confirmation').value != document.getElementById('user_password').value) 
		{
			passwordConfirmationMsg = "Confirm Password is incorrect.<br>";
			document.getElementById("error_password_confirmation").style.display = "block";
			passwordConfirmationMsg = passwordConfirmationMsg + passwordConfirmationMsg;
		}
		else
			document.getElementById("error_password_confirmation").style.display = "none";
	}
		
    if (passwordConfirmationMsg != "") 
        return false;
    else
    	return true;
	}    
	catch(e)
	{
		//alert(e);
	}
}



function submitUserEditForm()
{
    var message = "";
    var messageAddress =""; 
	if (document.getElementById('user_password').value != "")
	{
		if (document.getElementById('user_password').value.length < 6) 
		{
			document.getElementById("error_password").style.display = "block";
			message = message + "Password cannot be less than six characters.<br>";
		}
		else
			document.getElementById("error_password").style.display = "none";
	}
	if (document.getElementById('user_password').value != "" && document.getElementById('user_password_confirmation').value == "") 
	{
		document.getElementById("error_password_confirmation").style.display = "block";
		document.getElementById("error_password_confirmation").innerHTML = "Please fill in the Confirm Password";
        message = message + "Please fill in the Confirm Password.<br>";
	}
	else
		document.getElementById("error_password_confirmation").style.display = "none";
	
	if (document.getElementById('user_password').value != "" && document.getElementById('user_password_confirmation').value != "")
	{
		if (document.getElementById('user_password_confirmation').value != document.getElementById('user_password').value) 
		{
			document.getElementById("error_password_confirmation").style.display = "block";
			document.getElementById("error_password_confirmation").innerHTML = "Should match the Password Entered";
			message = message + "Confirm Password is incorrect.<br>";
		}
		else
			document.getElementById("error_password_confirmation").style.display = "none";
	}
		
    if (message != "") 
    	return false;
    else
       	return true;
    
	
}


/* To Hide and unhide the login details for the Technician
 * Radhika
*/


function showLoginforTechnician()
{
	   
       if (document.getElementById('login').checked) 
		{
    	   if (document.getElementById('technician_email').value=="")
    	   {
    		   //jQuery.jGrowl("Please Enter Email ID!", { sticky: false } , { life: 1000 });
    		   document.getElementById('error_email').style.display = "block";
    		   document.getElementById("error_email").innerHTML = "Please Enter Email ID";
    		   document.getElementById("technician_email").focus();
    		   document.getElementById('login').checked = false;
    		   return false;
    	   }
    	   else
    	   {
    		   document.getElementById('logindiv').style.display = "block";
    		   $j(".pwd").addClass("required");
    	   }
        }
		else
		{
			$j(".pwd").removeClass("required");
			$j(".pwd").removeClass("error");
			$j(".pwd").next("label.error").css({display: "none"});
			document.getElementById('logindiv').style.display = "none";
			document.getElementById('error_email').style.display = "none";
		}
}

function showRequired()
{
	if (document.getElementById('user_requestedlabel').checked) 
	{
		document.getElementById('requiredDiv').style.visibility = "visible";
		document.getElementById("requiredDiv").innerHTML = "Please fill the Adrress fields"
		$j(".adrs").addClass("required");
    }
	else
	{
		document.getElementById('requiredDiv').style.visibility = "hidden";
		$j(".adrs").removeClass("required");
		$j(".adrs").removeClass("error");
		$j(".adrs").next("label.error").css({display: "none"});
	}
	
}

/*function submitTechnicianform(action)
{
	message = "";
	if (document.getElementById('login').checked) 
	{
		if (document.getElementById('technician_password').value=="")
		{
			message = message + "Please fill in the Password.<br>";
		}
		if (document.getElementById('technician_password').value != "")
		{
			if (document.getElementById('technician_password').value.length < 6) 
	        message = message + "Password cannot be less than six characters.<br>";
		}
		if (document.getElementById('technician_password').value!="" && document.getElementById('technician_password_confirmation').value == "") 
	        message = message + "Please fill in the Confirm Password.<br>";
		if (document.getElementById('technician_password_confirmation').value != "")
		{
			if (document.getElementById('technician_password_confirmation').value != document.getElementById('technician_password').value) 
				message = message + "Confirm Password is incorrect.<br>";
		}
		
    }
	if(message == "")
	{
		if(action=="new")
		{
			newVal = $j.ajax({ url:"technicians/checkLoginID/1?email="+document.getElementById("technician_email").value, async: false }).responseText;
			if(newVal=="")
			{
				document.forms['technician'].submit();
			}
			else
			{
				document.getElementById('pwderr').innerHTML = ""; 
				document.getElementById('errorMsgDiv').innerHTML = "<font color='red'>"+newVal+"</font>";  
			}
		}
		else
		{
			document.forms['technician'].submit();
		}
	}
	else
	{
		document.getElementById('errorMsgDiv').innerHTML = "";
		document.getElementById('pwderr').innerHTML = "<font color='red'>"+message+"</font>"; 
		//jQuery.jGrowl(message, { sticky: false } , { life: 100 });
		return;
	}
}*/


function submitTechnicianform(action)
{
	message = "";
	if (document.getElementById('login').checked) 
	{
		if (document.getElementById('technician_password').value != "")
		{
			if (document.getElementById('technician_password').value.length < 6) 
			{
				document.getElementById('error_password').style.display = "block";
				message = message + "Password cannot be less than six characters.<br>";
			}
			else
			{
				document.getElementById('error_password').style.display = "none";
			}
	        
		}
		if (document.getElementById('technician_password').value!="" && document.getElementById('technician_password_confirmation').value != "")
		{
				if (document.getElementById('technician_password_confirmation').value != document.getElementById('technician_password').value)
				{
					document.getElementById('error_password_confirmation').style.display = "block";
					//document.getElementById("error_password_confirmation").innerHTML = "Should match the Password Entered";
					message = message + "Confirm Password is incorrect.<br>";
				}
	        
		}
		
    }
	if(message == "")
	{
		if(action=="new")
		{
			newVal = $j.ajax({ url:"technicians/checkLoginID/1?email="+document.getElementById("technician_email").value, async: false }).responseText;
			if(newVal=="")
			{
				//document.forms['technician'].submit();
				document.getElementById('error_email').style.display = "none";
				return true;
			}
			else
			{
				document.getElementById('error_email').style.display = "block";
				document.getElementById('error_email').innerHTML = newVal;
				return false;
				//document.getElementById('errorMsgDiv').innerHTML = "<font color='red'>"+newVal+"</font>";  
			}
		}
		else
		{
			//document.forms['technician'].submit();
			return true;
		}
	}
	else
	{
		/*document.getElementById('errorMsgDiv').innerHTML = "";
		document.getElementById('pwderr').innerHTML = "<font color='red'>"+message+"</font>"; */
		//jQuery.jGrowl(message, { sticky: false } , { life: 100 });
		return false;
	}
}


function submitEditTechnicianform()
{
		document.forms['technician'].submit();
}




function togleText(l)
{
	if(l.innerHTML == "Hide ToolBar")
		l.innerHTML = "Show ToolBar";
	else
		l.innerHTML = "Hide ToolBar";
}


	var cod=new Array();
	var sym=new Array();
	cod[0]='ALL';sym[0]='&#76;&#101;&#107;';
	cod[1]='USD';sym[1]='&#36;';
	cod[2]='AFN';sym[2]='&#1547;';
	cod[3]='ARS';sym[3]='&#36;';
	cod[4]='AWG';sym[4]='&#402;';
	cod[5]='AUD';sym[5]='&#36;';
	cod[6]='AZN';sym[6]='&#1084;&#1072;&#1085;';
	cod[7]='BSD';sym[7]='&#36;';
	cod[8]='BBD';sym[8]='&#36;';
	cod[9]='BYR';sym[9]='&#112;&#46;';
	cod[10]='BEF';sym[10]='&#8355;';
	cod[11]='BZD';sym[11]='&#66;&#90;&#36;';
	cod[12]='BMD';sym[12]='&#36;';
	cod[13]='BOB';sym[13]='&#36;&#98;';
	cod[14]='BAM';sym[14]='&#75;&#77;';
	cod[15]='BWP';sym[15]='&#80;';
	cod[16]='BGN';sym[16]='&#1083;&#1074;';
	cod[17]='BRL';sym[17]='&#82;&#36;';
	cod[18]='BRC';sym[18]='&#8354;';
	cod[19]='GBP';sym[19]='&#163;';
	cod[20]='BND';sym[20]='&#36;';
	cod[21]='KHR';sym[21]='&#6107;';
	cod[22]='CAD';sym[22]='&#36;';
	cod[23]='KYD';sym[23]='&#36;';
	cod[24]='CLP';sym[24]='&#36;';
	cod[25]='CNY';sym[25]='&#20803;';
	cod[26]='COP';sym[26]='&#36;';
	cod[27]='CRC';sym[27]='&#8353;';
	cod[28]='HRK';sym[28]='&#107;&#110;';
	cod[29]='CUP';sym[29]='&#8369;';
	cod[30]='CYP';sym[30]='&#163;';
	cod[31]='CZK';sym[31]='&#75;&#269;';
	cod[32]='DKK';sym[32]='&#107;&#114;';
	cod[33]='DOP';sym[33]='&#82;&#68;&#36;';
	cod[34]='XCD';sym[34]='&#36;';
	cod[35]='EGP';sym[35]='&#163;';
	cod[36]='SVC';sym[36]='&#36;';
	cod[37]='GBP';sym[37]='&#163;';
	cod[38]='EEK';sym[38]='&#107;&#114;';
	cod[39]='EUR';sym[39]='&#8364;';
	cod[40]='XEU';sym[40]='&#8352;';
	cod[41]='FKP';sym[41]='&#163;';
	cod[42]='FJD';sym[42]='&#36;';
	cod[43]='FRF';sym[43]='&#8355;';
	cod[44]='GHC';sym[44]='&#162;';
	cod[45]='GIP';sym[45]='&#163;';
	cod[46]='GRD';sym[46]='&#8367;';
	cod[47]='GTQ';sym[47]='&#81;';
	cod[48]='GGP';sym[48]='&#163;';
	cod[49]='GYD';sym[49]='&#36;';
	cod[50]='NLG';sym[50]='&#402;';

	cod[51]='HNL';sym[51]='&#76;';
	cod[52]='HKD';sym[52]='&#72;&#75;&#36;';
	cod[53]='HKD';sym[53]='&#22291;';
	cod[54]='HKD';sym[54]='&#22291;';
	cod[55]='HKD';sym[55]='&#20803;';
	cod[56]='HUF';sym[56]='&#70;&#116;';
	cod[57]='ISK';sym[57]='&#107;&#114;';
	cod[58]='INR';sym[58]='&#82;&#115;';
	cod[59]='IDR';sym[59]='&#82;&#112;';
	cod[60]='IRR';sym[60]='&#65020;';
	cod[61]='IEP';sym[61]='&#163;';
	cod[62]='IMP';sym[62]='&#163;';
	cod[63]='ILS';sym[63]='&#8362;';
	cod[64]='ITL';sym[64]='&#8356;';
	cod[65]='JMD';sym[65]='&#74;&#36;';
	cod[66]='JPY';sym[66]='&#165;';
	cod[67]='JEP';sym[67]='&#163;';
	cod[68]='KZT';sym[68]='&#1083;&#1074;';
	cod[69]='KPW';sym[69]='&#8361;';
	cod[70]='KRW';sym[70]='&#8361;';
	cod[71]='KGS';sym[71]='&#1083;&#1074;';
	cod[72]='LAK';sym[72]='&#8365;';
	cod[73]='LVL';sym[73]='&#76;&#115;';
	cod[74]='LBP';sym[74]='&#163;';
	cod[75]='LRD';sym[75]='&#36;';
	cod[76]='CHF';sym[76]='&#67;&#72;&#70;';
	cod[77]='LTL';sym[77]='&#76;&#116;';
	cod[78]='LUF';sym[78]='&#8355;';
	cod[79]='MKD';sym[79]='&#1076;&#1077;&#1085;';
	cod[80]='MYR';sym[80]='&#82;&#77;';
	cod[81]='MTL';sym[81]='&#76;&#109;';
	cod[82]='MUR';sym[82]='&#8360;';
	cod[83]='MXN';sym[83]='&#36;';
	cod[84]='MNT';sym[84]='&#8366;';
	cod[85]='MZN';sym[85]='&#77;&#84;';
	cod[86]='NAD';sym[86]='&#36;';
	cod[87]='NPR';sym[87]='&#8360;';
	cod[88]='ANG';sym[88]='&#402;';
	cod[89]='NLG';sym[89]='&#402;';
	cod[90]='NZD';sym[90]='&#36;';
	cod[91]='NIO';sym[91]='&#67;&#36;';
	cod[92]='NGN';sym[92]='&#8358;';
	cod[93]='KPW';sym[93]='&#8361;';
	cod[94]='NOK';sym[94]='&#107;&#114;';
	cod[95]='OMR';sym[95]='&#65020;';
	cod[96]='PKR';sym[96]='&#8360;';
	cod[97]='PAB';sym[97]='&#66;&#47;&#46;';
	cod[98]='PYG';sym[98]='&#71;&#115;';
	cod[99]='PEN';sym[99]='&#83;&#47;&#46;';
	cod[100]='PHP';sym[100]='&#80;&#104;&#112;';



	cod[101]='PLN';sym[101]='&#122;&#322;';
	cod[102]='QAR';sym[102]='&#65020;';
	cod[103]='RON';sym[103]='&#108;&#101;&#105;';
	cod[104]='RUB';sym[104]='&#1088;&#1091;&#1073;';
	cod[105]='SHP';sym[105]='&#163;';
	cod[106]='SAR';sym[106]='&#65020;';
	cod[107]='RSD';sym[107]='&#1044;&#1080;&#1085;&#46;';
	cod[108]='SCR';sym[108]='&#8360;';
	cod[109]='SGD';sym[109]='&#36;';
	cod[110]='SKK';sym[110]='&#83;&#73;&#84;';
	cod[111]='EUR';sym[111]='&#8364;';
	cod[112]='SBD';sym[112]='&#36;';
	cod[113]='SOS';sym[113]='&#83;';
	cod[114]='ZAR';sym[114]='&#82;';
	cod[115]='KRW';sym[115]='&#8361;';
	cod[116]='ESP';sym[116]='&#8359;';
	cod[117]='LKR';sym[117]='&#8360;';
	cod[118]='SEK';sym[118]='&#107;&#114;';
	cod[119]='CHF';sym[119]='&#67;&#72;&#70;';
	cod[120]='SRD';sym[120]='&#36;';
	cod[121]='SYP';sym[121]='&#163;';
	cod[122]='TWD';sym[122]='&#78;&#84;&#36;';
	cod[123]='THB';sym[123]='&#3647;';
	cod[124]='TTD';sym[124]='&#84;&#84;&#36;';
	cod[125]='TRY';sym[125]='&#89;&#84;&#76;';
	cod[126]='TRL';sym[126]='&#8356;';
	cod[127]='TVD';sym[127]='&#36;';
	cod[128]='UAH';sym[128]='&#8372;';
	cod[129]='GBP';sym[129]='&#163;';
	cod[130]='USD';sym[130]='&#36;';
	cod[131]='UYU';sym[131]='&#36;&#85;';
	cod[132]='UZS';sym[132]='&#1083;&#1074;';
	cod[133]='VAL';sym[133]='&#8356;';
	cod[134]='VEB';sym[134]='&#66;&#115;';
	cod[135]='VND';sym[135]='&#8363;';
	cod[136]='YER';sym[136]='&#65020;';
	cod[137]='ZWD';sym[137]='&#90;&#3;';
	
	function AjaxUpdater(elementId, url, options)
	{
		try{
		newVal = $j.ajax({ url: url, async: false }).responseText;

		element = document.getElementById(elementId);
		if(element)
		{
			element.innerHTML=newVal;
		}
		}catch(e){alert(e);}
	}
	
	function AjaxResponse(url)
	{
		try{
			newVal = $j.ajax({ url: url, async: false }).responseText;
			return newVal;
		}catch(e){alert(e);}
	}

	function getDimensions() {
		var el = $j(window);

		// fix a jQuery/Opera bug with determining the window height
		var h = $j.browser.opera && $j.browser.version > '9.5' && $j.fn.jquery <= '1.2.6' ? document.documentElement['clientHeight'] :
			$j.browser.opera && $j.browser.version < '9.5' && $j.fn.jquery > '1.2.6' ? window.innerHeight :
			el.height();

		return [h, el.width()];
	}
	
	/*
	 * (c) Venkat Mangudi Consulting
	 * Author : Radhika Dhanapal
	 * Date : 20-Jan_2010
	 * reset Password 
	*/
	
	function resetPassword()
	{
		document.getElementById('errormsgDiv').style.visibility = "hidden";
		try{

			 var filter = /^.+@.+\..{2,3}$/
		     var email = document.getElementById("user_session_email").value ;
				 message = "";
				 var flag = false;
				 if(document.getElementById("user_session_email").value == "")
				 {
					// alert("Please enter email address!");
					 message = message + "Please enter email address!\n";
				 }
				 
				 if(document.getElementById("user_session_email").value != "")
				 {
					 if (filter.test(email))
					 {
						 flag = true;
					 }
					 else 
					 {
						 document.getElementById("user_session_email").value = "";
						 message = message + "Please enter a valid email address\n";
					 }
				 }
				 
				 
				 if(flag == true && message=="")
				 {
					 document.getElementById('loadingDiv').style.display = "block";
					 document.getElementById("loadingDiv").innerHTML = "<center><b>Sending...</b></center>";
					 //new AjaxUpdater('flash','/signup/create/1?email='+document.getElementById("user_email").value,{asynchronous:true, evalScripts:true});
					 new AjaxUpdater('msgDiv','users/changePasswordRequest/1?email='+document.getElementById("user_session_email").value,{asynchronous:true, evalScripts:true});
					 document.getElementById("user_session_email").value="";
					 document.getElementById('loadingDiv').style.display = "none";
				 }
				 else 
				 {
					 //jQuery.jGrowl(message, { sticky: false } , { life: 1000 });
					 document.getElementById('errormsgDiv').style.visibility = "visible";
					 document.getElementById("errormsgDiv").innerHTML = "<font color='red'>"+message+"</font>";
					 return;
				 }
			 }
		     catch(e)
		     {
alert(e);
		    	 jQuery.jGrowl(e, { sticky: false } , { life: 100 });

			 }
		
	}
	
	function checkOS() {
   if(navigator.userAgent.indexOf('Linux') != -1)
     { var OpSys = "Linux"; }
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('95') != -1))
     { var OpSys = "Windows"; }//Windows95
   else if((navigator.userAgent.indexOf('Win') != -1) &&
   (navigator.userAgent.indexOf('NT') != -1)) 
     { var OpSys = "Windows"; }//Windows NT
   else if(navigator.userAgent.indexOf('Win') != -1) 
    { var OpSys = "Windows"; }//Windows 3.1
   else if(navigator.userAgent.indexOf('Mac') != -1)
     { var OpSys = "Macintosh"; }
   else { var OpSys = "operating system not recognised"; }
   return OpSys;
 }
	
	function updateProviderTechnician(assetId)
	{
		provTech = $j.ajax({ url: "/assets/assetProvTech/"+assetId, async: false }).responseText;
		w = provTech.split(',');
		if(w[0]!=null && w[0]!="")
		{
			document.getElementById('ticket_company_id').value = w[0];
			selectTech();
			document.getElementById('ticket_person_id').value = w[1];
		}		
	}
	
	function isNumberKey(evt, obj)
    {
       var charCode = (evt.which) ? evt.which : event.keyCode
    		   if(charCode == 46)
    		   {
    			   val = obj.value;
    			   if(val.indexOf('.')<0)
    				   return true;
    			   return false;
    		   }

       if (charCode > 31 && (charCode < 48 || charCode > 57))
          return false;
       return true;
    }

	function showErrorMsg(id)
	{try{
		obj = document.getElementById(id);
		errorObj = document.getElementById("error_"+id);
		obj.style.border = "2Px solid #CC0000";
		errorObj.style.display = "block";
	}catch(e){alert(e);}
	}
	function hideErrorMsg(id)
	{
		obj = document.getElementById(id);
		errorObj = document.getElementById("error_"+id);
		obj.style.border = "none";
		errorObj.style.display = "none";
	}

	function jumpTo(url)
	{
		//alert(url);
		try{
			document.location = url;
		}catch(e){alert(e);}
	}

	
	function sform()
	{
		document.getElementById("SN").value= true;
		return true;
	}

/* (c) Venkat Mangudi Consulting Pvt Ltd
   Radhika Dhanapal, 28-April-2010
   State list With Country Codes 
*/
	var state = "\
		US:AK:Alaska|\
		US:AL:Alabama|\
		US:AR:Arkansas|\
		US:AS:American Samoa|\
		US:AZ:Arizona|\
		US:CA:California|\
		US:CO:Colorado|\
		US:CT:Connecticut|\
		US:DC:D.C.|\
		US:DE:Delaware|\
		US:FL:Florida|\
		US:FM:Micronesia|\
		US:GA:Georgia|\
		US:GU:Guam|\
		US:HI:Hawaii|\
		US:IA:Iowa|\
		US:ID:Idaho|\
		US:IL:Illinois|\
		US:IN:Indiana|\
		US:KS:Kansas|\
		US:KY:Kentucky|\
		US:LA:Louisiana|\
		US:MA:Massachusetts|\
		US:MD:Maryland|\
		US:ME:Maine|\
		US:MH:Marshall Islands|\
		US:MI:Michigan|\
		US:MN:Minnesota|\
		US:MO:Missouri|\
		US:MP:Marianas|\
		US:MS:Mississippi|\
		US:MT:Montana|\
		US:NC:North Carolina|\
		US:ND:North Dakota|\
		US:NE:Nebraska|\
		US:NH:New Hampshire|\
		US:NJ:New Jersey|\
		US:NM:New Mexico|\
		US:NV:Nevada|\
		US:NY:New York|\
		US:OH:Ohio|\
		US:OK:Oklahoma|\
		US:OR:Oregon|\
		US:PA:Pennsylvania|\
		US:PR:Puerto Rico|\
		US:PW:Palau|\
		US:RI:Rhode Island|\
		US:SC:South Carolina|\
		US:SD:South Dakota|\
		US:TN:Tennessee|\
		US:TX:Texas|\
		US:UT:Utah|\
		US:VA:Virginia|\
		US:VI:Virgin Islands|\
		US:VT:Vermont|\
		US:WA:Washington|\
		US:WI:Wisconsin|\
		US:WV:West Virginia|\
		US:WY:Wyoming|\
		US:AA:Military Americas|\
		US:AE:Military Europe/ME/Canada|\
		US:AP:Military Pacific|\
		CA:AB:Alberta|\
		CA:MB:Manitoba|\
		CA:AB:Alberta|\
		CA:BC:British Columbia|\
		CA:MB:Manitoba|\
		CA:NB:New Brunswick|\
		CA:NL:Newfoundland and Labrador|\
		CA:NS:Nova Scotia|\
		CA:NT:Northwest Territories|\
		CA:NU:Nunavut|\
		CA:ON:Ontario|\
		CA:PE:Prince Edward Island|\
		CA:QC:Quebec|\
		CA:SK:Saskatchewan|\
		CA:YT:Yukon Territory|\
		AU:AAT:Australian Antarctic Territory|\
		AU:ACT:Australian Capital Territory|\
		AU:NT:Northern Territory|\
		AU:NSW:New South Wales|\
		AU:QLD:Queensland|\
		AU:SA:South Australia|\
		AU:TAS:Tasmania|\
		AU:VIC:Victoria|\
		AU:WA:Western Australia|\
		BR:AC:Acre|\
		BR:AL:Alagoas|\
		BR:AM:Amazonas|\
		BR:AP:Amapa|\
		BR:BA:Baia|\
		BR:CE:Ceara|\
		BR:DF:Distrito Federal|\
		BR:ES:Espirito Santo|\
		BR:FN:Fernando de Noronha|\
		BR:GO:Goias|\
		BR:MA:Maranhao|\
		BR:MG:Minas Gerais|\
		BR:MS:Mato Grosso do Sul|\
		BR:MT:Mato Grosso|\
		BR:PA:Para|\
		BR:PB:Paraiba|\
		BR:PE:Pernambuco|\
		BR:PI:Piaui|\
		BR:PR:Parana|\
		BR:RJ:Rio de Janeiro|\
		BR:RN:Rio Grande do Norte|\
		BR:RO:Rondonia|\
		BR:RR:Roraima|\
		BR:RS:Rio Grande do Sul|\
		BR:SC:Santa Catarina|\
		BR:SE:Sergipe|\
		BR:SP:Sao Paulo|\
		BR:TO:Tocatins|\
		NL:DR:Drente|\
		NL:FL:Flevoland|\
		NL:FR:Friesland|\
		NL:GL:Gelderland|\
		NL:GR:Groningen|\
		NL:LB:Limburg|\
		NL:NB:Noord Brabant|\
		NL:NH:Noord Holland|\
		NL:OV:Overijssel|\
		NL:UT:Utrecht|\
		NL:ZH:Zuid Holland|\
		NL:ZL:Zeeland|\
		GB:AVON:Avon|\
		GB:BEDS:Bedfordshire|\
		GB:BERKS:Berkshire|\
		GB:BUCKS:Buckinghamshire|\
		GB:CAMBS:Cambridgeshire|\
		GB:CHESH:Cheshire|\
		GB:CLEVE:Cleveland|\
		GB:CORN:Cornwall|\
		GB:CUMB:Cumbria|\
		GB:DERBY:Derbyshire|\
		GB:DEVON:Devon|\
		GB:DORSET:Dorset|\
		GB:DURHAM:Durham|\
		GB:ESSEX:Essex|\
		GB:GLOUS:Gloucestershire|\
		GB:GLONDON:Greater London|\
		GB:GMANCH:Greater Manchester|\
		GB:HANTS:Hampshire|\
		GB:HERWOR:Hereford & Worcestershire|\
		GB:HERTS:Hertfordshire|\
		GB:HUMBER:Humberside|\
		GB:IOM:Isle of Man|\
		GB:IOW:Isle of Wight|\
		GB:KENT:Kent|\
		GB:LANCS:Lancashire|\
		GB:LEICS:Leicestershire|\
		GB:LINCS:Lincolnshire|\
		GB:MERSEY:Merseyside|\
		GB:NORF:Norfolk|\
		GB:NHANTS:Northamptonshire|\
		GB:NTHUMB:Northumberland|\
		GB:NOTTS:Nottinghamshire|\
		GB:OXON:Oxfordshire|\
		GB:SHROPS:Shropshire|\
		GB:SOM:Somerset|\
		GB:STAFFS:Staffordshire|\
		GB:SUFF:Suffolk|\
		GB:SURREY:Surrey|\
		GB:SUSS:Sussex|\
		GB:WARKS:Warwickshire|\
		GB:WMID:West Midlands|\
		GB:WILTS:Wiltshire|\
		GB:YORK:Yorkshire|\
		EI:CO ANTRIM:County Antrim|\
		EI:CO ARMAGH:County Armagh|\
		EI:CO DOWN:County Down|\
		EI:CO FERMANAGH:County Fermanagh|\
		EI:CO DERRY:County Londonderry|\
		EI:CO TYRONE:County Tyrone|\
		EI:CO CAVAN:County Cavan|\
		EI:CO DONEGAL:County Donegal|\
		EI:CO MONAGHAN:County Monaghan|\
		EI:CO DUBLIN:County Dublin|\
		EI:CO CARLOW:County Carlow|\
		EI:CO KILDARE:County Kildare|\
		EI:CO KILKENNY:County Kilkenny|\
		EI:CO LAOIS:County Laois|\
		EI:CO LONGFORD:County Longford|\
		EI:CO LOUTH:County Louth|\
		EI:CO MEATH:County Meath|\
		EI:CO OFFALY:County Offaly|\
		EI:CO WESTMEATH:County Westmeath|\
		EI:CO WEXFORD:County Wexford|\
		EI:CO WICKLOW:County Wicklow|\
		EI:CO GALWAY:County Galway|\
		EI:CO MAYO:County Mayo|\
		EI:CO LEITRIM:County Leitrim|\
		EI:CO ROSCOMMON:County Roscommon|\
		EI:CO SLIGO:County Sligo|\
		EI:CO CLARE:County Clare|\
		EI:CO CORK:County Cork|\
		EI:CO KERRY:County Kerry|\
		EI:CO LIMERICK:County Limerick|\
		EI:CO TIPPERARY:County Tipperary|\
		EI:CO WATERFORD:County Waterford|\
		IN:IN-AN:Andaman and Nicobar Islands|\
		IN:IN-AP:Andra Pradesh|\
		IN:IN-AR:Arunachal Pradesh|\
		IN:IN-AS:Assam|\
		IN:IN-BR:Bihar|\
		IN:IN-CH:Chandigarh|\
		IN:IN-CT:Chhattisgarh|\
		IN:IN-DN:Dadra And Nager Haveli|\
		IN:IN-DD:Daman And Diu|\
		IN:IN-GA:Goa|\
		IN:IN-GJ:Gujrat|\
		IN:IN-HR:Haryana|\
		IN:IN-HP:Himachal Pradesh|\
		IN:IN-JK:Jammu And Kashmir|\
		IN:IN-JH:Jharkhand|\
		IN:IN-KA:Karnataka|\
		IN:IN-KL:Kerala|\
		IN:IN-LD:Lakshadweep|\
		IN:IN-MP:Madya Pradesh|\
		IN:IN-MH:Maharastra|\
		IN:IN-MN:Manipuri|\
		IN:IN-ML:Meghalaya|\
		IN:IN-MZ:Mizoram|\
		IN:IN-NL:Nagaland|\
		IN:IN-ND:New Delhi|\
		IN:IN-OR:Orissa|\
		IN:IN-PY:Pondicherry|\
		IN:IN-PB:Punjab|\
		IN:IN-RJ:Rajasthan|\
		IN:IN-SK:Sikkim|\
		IN:IN-TN:Tamilnadu|\
		IN:IN-TR:Tripura|\
		IN:IN-UP:Uttar Pradesh|\
		IN:IN-UT:Uttranchal|\
		IN:IN-WB:West Bengal|\
		";
		
/* (c) Venkat Mangudi Consulting Pvt Ltd
   Radhika Dhanapal, 28-April-2010
   Description : Function to get the state list in the dropdown when the form loads and when country is changed
*/		
		function TrimString(sInString) {
			   
			   if ( sInString ) {

			      sInString = sInString.replace( /^\s+/g, "" );// strip leading
			      return sInString.replace( /\s+$/g, "" );// strip trailing
			   }
			}
		function selectState(country,strState,id)
		{
			if(country=="")
				country="IN";
			var stateLineArray   = state.split("|");  
			var options = "<option value=''></option>";
			for (var loop = 0; loop < stateLineArray.length; loop++) 
			{
				
			      lineArray = stateLineArray[loop].split(":");
			      countryCode  = TrimString(lineArray[0]);
			      country = TrimString(country);
			      if(strState!="")
			    	  strState = TrimString(strState);
			      stateCode    = TrimString(lineArray[1]);
			      stateName    = TrimString(lineArray[2]);
			      
			      if(country==countryCode)
			      {
			    	  if(countryCode=="IN" && strState=="")
			    		  if(stateName=="Karnataka")
			    			  options= options + "<option value="+stateCode+" selected>"+stateName+"</option>";
			    		  else
			    			  options= options + "<option value="+stateCode+">"+stateName+"</option>";
			    	  else
			    		  if(stateCode==strState)
			    			  options= options + "<option value="+stateCode+" selected>"+stateName+"</option>";
			    		  else
			    			  options= options + "<option value="+stateCode+">"+stateName+"</option>";
			      }
			      
			      
			}
			document.getElementById(id).innerHTML =options;
		      return;
		}

/* (c) Venkat Mangudi Consulting Pvt Ltd
   Radhika Dhanapal, 28-April-2010
   Description : Function to get the state name for the code to display in the show pages
*/			
		function getState(stateCode,id)
		{
			var value = stateCode;
			var strState ="";
			if(value!="")
		    	  value = TrimString(value);
			var stateLineArray   = state.split("|");  
			if(value!="")
			{
				for (var loop = 0; loop < stateLineArray.length; loop++) 
				{
				
					lineArray = stateLineArray[loop].split(":");
			      	stateCodeArray    = TrimString(lineArray[1]);
			      	stateName    = TrimString(lineArray[2]);
			      
			      if(stateCodeArray==value)
			      {
			    	  strState = stateName;
			      }
			      
			  }
			}
			if(strState=="")	
			    	  strState = value;
			document.getElementById(id).value =strState;
			document.getElementById(id).innerHTML = strState;
		    return;
		}

