		var form_submitted = false;
		
		function submit_form()
		{
		  if ( form_submitted )
		  {
		    alert ( "Your form has already been submitted. Please wait..." );
		    return false;
		  }
		  else
		  {
		    form_submitted = true;
		    document.getElementById("demoregister").disabled = true;
		    return true;
		  }
		}

		var ActiveSubMenuId;
		function imageRollover(callerId, newSrc) {
	        document.getElementById(callerId).src = newSrc;
		}
		function showSubMenu(divid) {
			showDiv(divid);
		}    
		   		           		
		function showDiv(id){
			var div = document.getElementById(id);
			if (!div) return;
			div.style.visibility = 'visible';
			div.style.position = 'absolute';
			div.style.padding = '0';
		}
		
		function cursorOnFirstName(){
    document.RegisterForm.firstName.focus();
    }
		function hideSubMenu(submenuid){
			hideDiv(submenuid);
		}				
		function hideDiv(id){
			var div = document.getElementById(id);
			if (!div) return;
			div.style.visibility = 'hidden';
			div.style.position = 'absolute';
		}				
		function ShowBar(pSubMenuId) {	  
			if(ActiveSubMenuId!=null){
				document.getElementById(ActiveSubMenuId).className = 'hidebar';
			}
			ActiveSubMenuId = pSubMenuId;
			document.getElementById(pSubMenuId).className = 'showbar';
		}
	    function HideBar() {
			if(ActiveSubMenuId!=null)
				document.getElementById(ActiveSubMenuId).className = 'hidebar';
		}
	
		/*non-digit characters which are allowed in phone numbers*/
		var phoneNumberDelimiters = "()- ";
		/* characters which are allowed in international phone numbers
		   (a leading + is OK)*/
		var validWorldPhoneChars = phoneNumberDelimiters + "+";
		/*Minimum no of digits in an international phone no.*/
		var minDigitsInIPhoneNumber = 10;

		function isInteger(s){   
			var i;
			for (i = 0; i < s.length; i++){   
				/*Check that current character is number.*/
				var c = s.charAt(i);
				if (((c < "0") || (c > "9"))) return false;
			}
			/*All characters are numbers.*/
			return true;
		}

		function stripCharsInBag(s, bag){   
			var i;
			var returnString = "";
			/* Search through string's characters one by one.
			If character is not in bag, append to returnString.
			*/
			for (i = 0; i < s.length; i++){   
				/*Check that current character isn't whitespace.*/
				var c = s.charAt(i);
				if (bag.indexOf(c) == -1) returnString += c;
			}
			return returnString;
		}

		function checkInternationalPhone(strPhone){
			s=stripCharsInBag(strPhone,validWorldPhoneChars);
			return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
		}

		function checkForm() {
			if (document.RegisterForm.firstName.value == "") {
				alert('Please enter a first name');
				selectObj(document.RegisterForm.firstName);
				return false;
			}
			if (document.RegisterForm.lastName.value == "") {
				alert('Please enter a last name');
				selectObj(document.RegisterForm.lastName);
				return false;
			}
			if (document.RegisterForm.address.value == "") {
				alert('Please enter an address');
				selectObj(document.RegisterForm.address);
				return false;
			}
			if (document.RegisterForm.city.value == "") {
				alert('Please enter a city');
				selectObj(document.RegisterForm.city);
				return false;
			}
			if (document.RegisterForm.state.value == "XX") {
				alert('Please enter a state');
				selectObj(document.RegisterForm.state);
				return false;
			}
			if (document.RegisterForm.zip.value == "") {
				alert('Please enter a zip code');
				//alert('am in zip');
				selectObj(document.RegisterForm.zip);
				return false;
			}
			if (document.RegisterForm.phone.value == "") {
				alert('Please enter a phone number');
				selectObj(document.RegisterForm.phone);
				//alert('am entering phone number');
				return false;
			}else if (checkInternationalPhone(document.RegisterForm.phone.value)==false){
				alert("Please Enter a Valid Phone Number")
				selectObj(document.RegisterForm.phone);
				//alert('am in phone number checking');
				return false;
			}
			if (document.RegisterForm.email.value == "") {
				alert('Please enter a E-mail');
				selectObj(document.RegisterForm.email);
				return false;
			}

			if (document.RegisterForm.infoType[0].checked == false && document.RegisterForm.infoType[1].checked == false){
				alert('Please select the type of service.');
				return false;
			}		
			
			//Added by RAP 11-08-2009 for eliminating multiple form submition
			return submit_form();
		}	
		
		
		
		function selectObj(obj)	{
			if(window.focus) {
				obj.focus();
			}
		}
	  function validateForm(){
	   	if(document.ClientLoginActionForm.clientLoginId.value==""){
	  		alert("Please enter your LogIn Id.");
	  		return false;
	  	}else if(document.ClientLoginActionForm.clientLoginPassword.value==""){
	  		alert("Please enter your password");
	  		return false;
	  	}else
	  		return true;
	  }
	  function checkDateValue(){
	  	if (document.CustomerAccountInfoForm.dateFrom.value == ""){
			alert("Please select from date .");
		   	return false;
		}else if (document.CustomerAccountInfoForm.dateTo.value == "") {
			alert("Please select to date .");
		   	return false;
	    }else if (Date.parse(document.CustomerAccountInfoForm.dateFrom.value) > Date.parse(document.CustomerAccountInfoForm.dateTo.value)) {
		   	alert("To date must be greater than from date");
		    return false;
		}else
			return true;
      }
      function checkMessageDateValue(){
      	if (document.CustomerMessageForm.dateFrom.value == ""){
			alert("Please select from date .");
		   	return false;
		}else if (document.CustomerMessageForm.dateTo.value == "") {
			alert("Please select to date .");
		   	return false;
	    }else if (Date.parse(document.CustomerMessageForm.dateFrom.value) > Date.parse(document.CustomerMessageForm.dateTo.value)) {
		   	alert("To date must be greater than from date");
		    return false;
		}else
			return true;
      }
      function goViewBillPage(pUrl,divid,newSrc){
      	document.getElementById(divid).src = newSrc;
      	var url=pUrl+"/customerAccountInfo.do?method=initialViewBill";
      	location.href=url;
      }
      function getNewPassword(pUrl){
      	var lCustomerId=document.ClientLoginActionForm.clientLoginId.value;
      	if(lCustomerId==""){
	  		alert("Please enter your LogIn Id.");
	  	}else{
	      	var url=pUrl+"/clientlogin.do?method=getNewPassword&CustomerId="+lCustomerId+"";
	      	location.href=url;
      	}
      }
      
      
    function showpdf(url){
   
       window.open(url,'_blank');
    }
    
    function changeText(id,flag){
		var div = document.getElementById(id,flag);
		if(flag==1)
		  div.className="rightlinkover";
		else
		  div.className = "rightlink";
	}

    function goAccountPage(){
      var url="/customerAccountInfo.do?method=getAccountInfo";
      location.href=url;
    }
function changeRollOver(num){
    var theImageId='topten'+num;
    document.getElementById(theImageId).src ='/images/Top10-button-roll.gif';
    var theDivId='imagehdr'+num;
    document.getElementById(theDivId).className="mout" ;
}
function changeRollOut(num){
    var theImageId='topten'+num;
    document.getElementById(theImageId).src ='/images/Top10-button.gif';
    var theDivId='imagehdr'+num;
    document.getElementById(theDivId).className="mover" ;
}


  function changeFooter(id,flag){
   var div=document.getElementById(id);
   if(flag==1)
     div.className="footerTopTen";
    else
     div.className="footerTopTenOver";
  }
 
 	var gFunction;
	var lStoreHistoryClassname;
  	var lStoreHistoryId;
  	var gCount;
	function showHistory(pHistoryID,pCount){
		gFunction="showHistory";
		var url="/customerMessage.do?method=getHistoryDetailByHistoryId&historyid="+pHistoryID;
		if(lStoreHistoryId!=null && gCount!=null){
	    	document.getElementById(lStoreHistoryId).className = lStoreHistoryClassname;
	    	document.getElementById(lStoreHistoryId+"_show").src = '/images/leftHistoryArrow'+gCount+'.jpg';
		}
		gCount = pCount;
	    lStoreHistoryClassname=document.getElementById(pHistoryID).className;
	    lStoreHistoryId = pHistoryID;
	    document.getElementById(pHistoryID+"_show").src = '/images/leftHistoryArrow_clicked.jpg';
	    document.getElementById(pHistoryID).className = 'messageclicked';
		try {
			document.getElementById('historyDetail').innerHTML = '<img src="/images/Loading.gif">';
			loadXMLDoc(url);
	  	}catch(e) {
			var msg = (typeof e == "string") ? e : ((e.message) ? e.message : "Unknown Error");
			alert("Unable to get XML data:\n" + msg);
			return;
       }
	}
	function showSubHistory(pHistoryID){
		gFunction="showSubHistory";
	    var url="/customerMessage.do?method=getSubHistory&historyid="+pHistoryID;
	    try {
			document.getElementById('subHistory').innerHTML = '<img src="/images/Loading.gif">';
			loadXMLDoc(url);
	  	}catch(e) {
			var msg = (typeof e == "string") ? e : ((e.message) ? e.message : "Unknown Error");
			alert("Unable to get XML data:\n" + msg);
			return;
       }
 	}
	function loadXMLDoc(url) {
	     if (window.XMLHttpRequest) {
         req = new XMLHttpRequest();
         req.onreadystatechange = processReqChange;
         req.open("GET", url, true);
         req.send(null);
      } else if (window.ActiveXObject) {
         isIE = true;
         req = new ActiveXObject("Microsoft.XMLHTTP");
         if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET", url, true);
            req.send();
         }
      }
   	}
   	function processReqChange() {
      if (req.readyState == 4) {
         if (req.status == 200) {
			populateTopicList();
         } else {
            alert("There was a problem retrieving the XML data:\n" +req.statusText);
         }
      }
    }
    function populateTopicList(){
    	if(gFunction=='showHistory'){
    		//prompt('showHistory Text ',req.responseText);
    		document.getElementById("historyDetail").innerHTML = req.responseText;
    		showSubHistory(lStoreHistoryId);
    	}else if(gFunction=='showSubHistory'){
    		//prompt('showSubHistory Text ',req.responseText);
    		document.getElementById("subHistory").innerHTML = req.responseText;
    	}
    }
var x = 0;
var y = 0;
function ShowFloatingDiv(id,event) {
    if(screen.width == 1280){
        x=event.clientX - 500;
        y=event.clientY - 200;
    }else{
        x=event.clientX - 240;
        y=event.clientY - 10;
    }
    document.getElementById("popupbox_"+id).style.display='block';
    document.getElementById("popupbox_"+id).style.left = x;
    document.getElementById("popupbox_"+id).style.top = y;
}
function showMessage(pHistoryId){
	document.getElementById("div_"+pHistoryId).className='showdiv';
}
function HideFloatingDiv(id){
    document.getElementById(id).className='hidediv';
}


function checkFieldValue(){
	alert("I am in checkFieldValue");
	if(document.getElementsByName("companyName").value==""){
		alert("please enter companyName");
		return false;
	}
	}
function manageclientmenu(id,imgsrc,flag){
   var menudiv = document.getElementById("clientmenu"+id);
   var menuimg = document.getElementById("clientmenuimg"+id);
		if(flag==1){
		  menudiv.style.visibility="visible";
		  menuimg.src=imgsrc;
		}else{
		  menudiv.style.visibility="hidden";
		  menuimg.src=imgsrc;
		}
}

var gStorePDFRowClass;
function changemouseovercss(id){
  gStorePDFRowClass = document.getElementById(id).className;
  document.getElementById(id).className = "pdfmouseover";
}
function changemouseoutcss(id){
  document.getElementById(id).className = gStorePDFRowClass;
}