/***********************************/
/*          ORDER SCRIPTS          */
/***********************************/
function saveOptions() {
	document.orderOptions.method.value="saveOptions";
	document.orderOptions.submit();
}
function checkOut() {
	document.orderOptions.method.value="checkout";
	document.orderOptions.submit();
}

/***********************************/
/*           NODE SCRIPTS          */
/***********************************/

function showTab(obj){
document.getElementById(obj).style.visibility='visible';
document.getElementById("childNode0").style.display='block';
document.getElementById("childNode1").style.display='block';
document.getElementById("childNode2").style.display='block';
document.getElementById("childNode3").style.display='block';
}
function hidechild()
{
document.getElementById("childNode0").style.display='none';
document.getElementById("childNode1").style.display='none';
document.getElementById("childNode2").style.display='none';
document.getElementById("childNode3").style.display='none';
}
function hideTab(obj){
document.getElementById(obj).style.visibility='hidden';
}
function setBookOn(bookNumber) {
	var nextBookNumber=bookNumber+1;
	document.getElementById('book'+bookNumber+'L').className ='leftSelected'+bookNumber ;
	document.getElementById('book'+bookNumber+'M').className ='middleSelected'+bookNumber ;
	document.getElementById('book'+bookNumber+'R').className ='rightSelected'+bookNumber ;		
}
function setBookOff(bookNumber) {
	var nextBookNumber=bookNumber+1;
	document.getElementById('book'+bookNumber+'L').className ='left'+bookNumber ; ;
	document.getElementById('book'+bookNumber+'M').className ='middle'+bookNumber ;;
	document.getElementById('book'+bookNumber+'R').className ='right'+bookNumber ;;	
}

/********tab scripts**********/
/*****************************/
function tabrollover(obj)
{
	if (document.getElementById('tableft'+obj).className =='leftSelected')
	{		document.getElementById('tableft'+obj).className ='leftSelected';
			document.getElementById('tabmiddle'+obj).className ='middleSelected';
			document.getElementById('tabright'+obj).className ='rightSelected';
	}
	else{
			document.getElementById('tableft'+obj).className ='leftOver';
			document.getElementById('tabmiddle'+obj).className ='middleOver';
			document.getElementById('tabright'+obj).className ='rightOver';
	}
}
function tabrollout(obj)
{
if (document.getElementById('tableft'+obj).className =='leftSelected')
	{
		document.getElementById('tableft'+obj).className ='leftSelected';
		document.getElementById('tabmiddle'+obj).className ='middleSelected';
		document.getElementById('tabright'+obj).className ='rightSelected';
	}
	else{
		document.getElementById('tableft'+obj).className ='left';
		document.getElementById('tabmiddle'+obj).className ='middle';
		document.getElementById('tabright'+obj).className ='right';
	}
}
/************************************************/
/* hide search box on rollover of topNode0 only */
/************************************************/
function hidesearch(obj)
{
	var topnodevalue = obj;
	document.getElementById("txtHintBox").style.display="none";
}
/***********************************/
/*           AJAX SCRIPTS          */
/***********************************/
function showStuff(id) {
     document.getElementById(id).style.display='block';
 		}
function hideStuff(id) {
      document.getElementById(id).style.display='none';
      }
      


 /*
  * Get the second options by calling a Struts action
  */
 var t;
 var locale;
 function retrieveTfgsCheck(str,localeString){
 locale=localeString;
 	if  (str.length>=3){
		t=setTimeout("retrieveTfgs()",500);
  	} else {
		document.getElementById("txtHint").innerHTML="";
		document.getElementById("txtHintBox").style.display="none";			
		return	
	}
 }  
 
function stopCount(){
	clearTimeout(t)
}
 
 var req;
 function retrieveTfgs(){

   		var searchTerm = document.getElementById('searchTerm').value;
		
		if (searchTerm.length==0){
		document.getElementById("txtHint").innerHTML="";
		document.getElementById("txtHintBox").style.display="none";			
		return
		}

       //var url="/web/search/searchBrowseAction.html?method=predictTfgs&searchTerm="+ encodeURIComponent(searchTerm);
       
        // Invoke the Servlet For Predictive Search
    	var url="/predictivesearch/predSearch?startsWith="+ encodeURIComponent(searchTerm) +"&locale=" +encodeURIComponent(locale);
    	
	    //Do the Ajax call
	    if (window.XMLHttpRequest) { // Non-IE browsers
	      req = new XMLHttpRequest();
	      //A call-back function is define so the browser knows which function to call after the server gives a reponse back
	      req.onreadystatechange = populateTfgs;
	      try {
	      	req.open("GET", url, true); //was get
	      } catch (e) {
	         alert("Cannot connect to server");
	      }
	      req.send(null);
	    } else if (window.ActiveXObject) { // IE      
	      req = new ActiveXObject("Microsoft.XMLHTTP");
	      if (req) {
	        req.onreadystatechange = populateTfgs;
	        req.open("GET", url, true);
	        req.send();
	      }
    	}

	
  }
  
    //Callback function
 function populateTfgs(){
 var userTerm = document.searchForm.searchTerm.value;
 userTerm = userTerm.replace(" ","%20");
  var tfgList = "";
   if (req.readyState == 4) { // Complete
	var textToSplit = req.responseText;
	
	/* check for the session expired */
	var checkSession = textToSplit.split("><");
	if(checkSession[0]=="<html")
	{		
		return;
	}
	
		returnElements = textToSplit.split("||");
		if(returnElements[0] == "") {
		 	return;
		}
 	  	for ( var i=0; i<returnElements.length; i++ ){
		        valueLabelPair = returnElements[i].split("|");
				var tfgName = valueLabelPair[0];
				var tfgId = valueLabelPair[1]; 
		tfgList = tfgList +"<li class=dropDown><a href='/web/search/searchBrowseAction.html?method=retrieveTfg&tfgSearch=Y&N="+tfgId+"&searchTerm="+tfgName+"&cm_sp=Predictive_search-_-Pedictive_search-_-"+ tfgName +"'>"+ tfgName +"</a></li>";
	 }
	document.getElementById("txtHintBox").style.display="block";
	document.getElementById("txtHint").innerHTML=tfgList;

   }
} 

/***********************************/
/* Function to Trim a String       */
/***********************************/

function trim(str) {
		if (str != null) {
			if(str.charAt(0) == " " || str.charAt(str.length-1) == " ") {
				while(str.charAt(0) == " ") {
					str = str.substring(1);
				}
				while(str.charAt(str.length-1) == " ") {
					str = str.substring(0,str.length-1);
				}
		    }
		}
		return str;
   }
/***********************************/
/*           LOGIN                 */
/***********************************/

function setUser(){
	with (document.forms.login){
		j_username.value = prefix.value + username.value
	}
}

/***********************************/
/*        Image Zoom               */
/***********************************/
function moreImages(pictureName,imageFile)
    {
	document.getElementById(pictureName).src = imageFile;
	}

	
/***********************************/
/*       CAMPAIGN SCRIPTS          */
/***********************************/	
function showProduct(stockNo){
window.location="/web/search/searchBrowseAction.html?method=getProduct&R="+stockNo;
}

function showGeneral(campaign){
window.location="/web/generalDisplay.html?id="+campaign;
}

function showGeneralPopup(id,file,windowName,windowFeatures){
var URL="/web/generalDisplay.html?id=" + id +"&file=" + file;
//window.alert(URL)
window.open(URL, windowName, windowFeatures);
}


function doSearchLink(term){
window.location="/web/search/searchBrowseAction.html?method=searchProducts&Ntk=I18NAll&searchTerm=" + term;
}

function brandSearch(brand){
window.location="/web/search/searchBrowseAction.html?method=searchProducts&Ntk=I18NBrand&searchTerm=" + brand;
}	

function showDoco(stockNo){
 openDataSheet(stockNo);
}

function openDataSheet(stockNumber) {
   var url = "/web/search/searchBrowseAction.html?method=getTechDocs&productNumber="+stockNumber;
   window.open(url);
 }
 
/* code for warning before deletion.*/
function confirmDelete(obj) {   
	var msg =  obj;
	ans = confirm(msg);
	if (ans) {
		return true;
	} else {
	    return false;
	}
}

/* code for  quick order form.*/
var flag=true;
function setForm(){ 
	var content = document.getElementById('deleteText').value;
	if(flag){
		document.getElementById('deleteText').value="";
		flag=false;
	}
	content = document.getElementById('deleteText').value;
	document.getElementById('hideAdd').style.display  = "block";
}

/**************************************/
/*       REGISTRATION SCRIPTS         */
/**************************************/	

var Temp;
Temp = "";
altCurHour ="";
now = new Date();
var CurHour = now.getHours();
var CurMinute = now.getMinutes();
var CurSecond = now.getSeconds();
CurHour = 10 + CurMinute * CurSecond ;
Temp = CurHour;
altCurHour = "_" + CurMinute * CurMinute;



function countUsername(usernameStr){
 	if  (usernameStr.length>=5 && usernameStr.length<60){
		showStuff('checkUsername');
  	} else {
	hideStuff('checkUsername');
	}
}
var req;

function checkUsernameAvailability()
{
	// If the user performs two checks with the same result then there is no visual que that anything has happened on the second check.
	// Therefore we blank the message before we make the ajax call so the user see's it "flash".
	// Maybe something better should be implemented by the GUI developers?
	var usernameAvailabilityStatusObj = document.getElementById( "usernameAvailabilityStatus" );
	if (usernameAvailabilityStatusObj) {
		usernameAvailabilityStatusObj.innerHTML = "";
	}
		
	if (window.XMLHttpRequest) { // Non-IE browsers
		try {
			req = new XMLHttpRequest();
		} catch(e) {
			req = false;
		}
	} else if (window.ActiveXObject) { // IE
		try {      
			req = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
			req = false;
		}
	}

	if (req) {
		// Get the enter username from the input field
		var usernameObj = document.getElementById( "reg_username" );

		if( usernameObj ) {
			// Create url adding the username as a parameter
			var url = "/web/registration/registrationPageOneAction.html?method=checkUsername&username=" + encodeURIComponent(usernameObj.value);

			req.onreadystatechange = updateAvailabilityResult;
			req.open("GET", url, true);
			req.send(null);			
		}
	}
	
	return false;
}

function updateAvailabilityResult()
{
	if (req.readyState == 4) { // Complete
		if (req.status == 200) {
			var messageXML = req.responseXML.documentElement;
			var userExists = req.responseXML.getElementsByTagName("userexists")[0].childNodes[0].nodeValue;
			var messageText = req.responseXML.getElementsByTagName("messagetouser")[0].childNodes[0].nodeValue;
			
			var usernameAvailabilityStatusObj = document.getElementById( "usernameAvailabilityStatus" );
			if (usernameAvailabilityStatusObj) {
				// Update the username availability status
				usernameAvailabilityStatusObj.innerHTML = messageText;
				// Make the paragraph tag visible
				usernameAvailabilityStatusObj.style.display = "block";
				document.getElementById("userNameSuggest").style.display="none";
				// Set the style class
				if (userExists == "true") {
					usernameAvailabilityStatusObj.className = "error";
					document.origonalUserName.origonalName.value =  document.registrationActionFormOne.username.value;
					document.getElementById( "failedName" ).innerHTML=document.origonalUserName.origonalName.value;
					document.getElementById( "failedName2" ).innerHTML=document.origonalUserName.origonalName.value;
					document.getElementById("userNameSuggest").style.display="block";
				} else {
					usernameAvailabilityStatusObj.className = "";
				}
				
				// Check to see if there is already an error being displayed by the server side validation
				nextSiblingNode = usernameAvailabilityStatusObj.nextSibling;
				while (nextSiblingNode && nextSiblingNode.nodeType == 3) { // Ignore whitespace elements that could be interpreted as DOM elements
					nextSiblingNode = nextSiblingNode.nextSibling;
				}
	
				if (nextSiblingNode) {
					if (nextSiblingNode.tagName == "P") {
						nextSiblingNode.style.display = "none";
					}
				}
			}
		}
	}
}

function tryUserName(alt){
document.registrationActionFormOne.username.value = document.origonalUserName.origonalName.value + alt;
checkUsernameAvailability();
}

/********************************************************/
/*       OrderOptions Default highlight SCRIPTS         */
/********************************************************/
/**************Delivery Address	************************/
function checkcell(obj,obj1){
	var tdid = 'td' + obj;
	var tdid1 = 'td' + obj1;
	if(document.getElementById('currentSelect1')!=null){	  
	document.getElementById(tdid1).className = "tdClass";
	var obj2 = document.getElementById('currentSelect1').value
	var tdid2 = 'td' + obj2;
	document.getElementById(tdid2).className = "tdClass";
	}
	else{
		var input = document.createElement("input");
		input.setAttribute("type", "hidden");
		input.setAttribute("id", "currentSelect1");
		input.setAttribute("value", "currentSelect1");
		document.getElementById("normalDel").appendChild(input);
		}
	document.getElementById('currentSelect1').value = obj;
	document.getElementById(tdid).className = "tdClassbg";
	}

/**************Blanket Orders 	************************/
function blanketcheckcell(obj,obj1){
	var tdid = 'blank' + obj;

	if(document.getElementById('blanketcurrentSelect1') != null){
	var tdid1 = 'blank' + obj1;
	document.getElementById(tdid1).className = "";
	var obj2 = document.getElementById('blanketcurrentSelect1').value
	var tdid2 = 'blank' + obj2;
	document.getElementById(tdid2).className = "";
	}else{
	var input = document.createElement("input");
	input.setAttribute("type", "hidden");
	input.setAttribute("id", "blanketcurrentSelect1");
	input.setAttribute("value", "blanketcurrentSelect1");
	document.getElementById("normalBO").appendChild(input);
	}
	document.getElementById('blanketcurrentSelect1').value = obj;
	document.getElementById(tdid).className = "addressbg";

		// Update the 'Your Order Number' field with the Blanket Order Number if
		// the setBOAsOrderNumber flag is set.
		var setBOAsOrderNumberObj = document.getElementById("setBOAsOrderNumber");
		if (setBOAsOrderNumberObj && setBOAsOrderNumberObj.value == "true") {
			var orderNoObjs = document.getElementsByName("orderNo");

			var boNameObj = document.getElementById("bo_name_" + obj);
			if (boNameObj == null) {
				orderNoObjs[0].value = "";
				document.getElementById("ordername").readOnly = false;
			} else if (boNameObj && orderNoObjs[0]) {
				orderNoObjs[0].value = boNameObj.value;
				document.getElementById("ordername").readOnly = true;
			}
		}
	}

/**************Cost Centers 		************************/
function costcheckcell(obj,obj1){
	var tdid = 'cost' + obj;
	var tdid1 = 'cost' + obj1;

	if(document.getElementById('costcurrentSelect1')!=null){
	document.getElementById(tdid1).className = "";
	var obj2 = document.getElementById('costcurrentSelect1').value
	var tdid2 = 'cost' + obj2;
	document.getElementById(tdid2).className = "";
	}else{
		var input = document.createElement("input");
		input.setAttribute("type", "hidden");
		input.setAttribute("id", "costcurrentSelect1");
		input.setAttribute("value", "costcurrentSelect1");
		document.getElementById("normalCC").appendChild(input);
	}
	document.getElementById('costcurrentSelect1').value = obj;
	document.getElementById(tdid).className = "addressbg";
	}
/*************** GL CODE ***********************************/
	function glcodecheckcell(obj,obj1){
	   var tdid = 'gl' + obj;
	   var tdid1 = 'gl' + obj1;

	   if(document.getElementById('glcodecurrentSelect1')!=null){	   
	   document.getElementById(tdid1).className = "";
	   var obj2 = document.getElementById('glcodecurrentSelect1').value
	   var tdid2 = 'gl' + obj2;
	   document.getElementById(tdid2).className = "";
	   }else{
		   var input = document.createElement("input");
			input.setAttribute("type", "hidden");
			input.setAttribute("id", "glcodecurrentSelect1");
			input.setAttribute("value", "glcodecurrentSelect1");
			document.getElementById("normalGL").appendChild(input);
	   }
	   document.getElementById('glcodecurrentSelect1').value = obj;
	   document.getElementById(tdid).className = "addressbg";
	}


/**************Invoice Address 		************************/

function invcheckcell(obj,obj1){
var tdid = 'inv' + obj;
var tdid1 = 'inv' + obj1;
if(document.getElementById('invcurrentSelect1')!=null){	  
document.getElementById(tdid1).className = "tdClass";
var obj2 = document.getElementById('invcurrentSelect1').value
var tdid2 = 'inv' + obj2;
document.getElementById(tdid2).className = "tdClass";
}else{
	   var input = document.createElement("input");
		input.setAttribute("type", "hidden");
		input.setAttribute("id", "invcurrentSelect1");
		input.setAttribute("value", "invcurrentSelect1");
		document.getElementById("normalInv").appendChild(input);
}
document.getElementById('invcurrentSelect1').value = obj;
document.getElementById(tdid).className = "tdClassbg";
}

/************** Script for Payment Method starts here ************************/
function selectedCard(cardId, showCustCostCentreMandFlag, showCustCostRefForVisaMandFlag, showCustCostRefForAmexMandFlag){
	/** NOTE: This function is only used by Purchasing Manager users. */

	var custRefObj = document.getElementById("customerReference");
	
	var custCostRefObj = document.getElementById("custCostRef");
	var custCostRefMandObj = document.getElementById("custCostRefMand");
	
	var custCostCentreObj = document.getElementById("custCostCentre");
	var custCostCentreMandObj = document.getElementById("custCostCenterMand");
	
	// If we don't have the customerReference object available then do nothing
	if (!custRefObj) {
		return;
	}
	
	// If a non corp card is selected then remove the customerReference fields from the display
	if (cardId != '200' && cardId != '201') {
		custRefObj.style.display = "none";
		
		// Blank the values out
		if (custCostRefObj) {
			custCostRefObj.value = "";
		}
		if (custCostCentreObj) {
			custCostCentreObj.value = "";
		}
	} else {
		custRefObj.style.display = "inline";
		
		// A corp card is selected so we need to show/hide the mandatory flags as
		// configured within Purchasing Manager
		if (cardId == '200' && custCostRefMandObj) { // Amex
			// If a customer cost reference is required for Amex then show the mandatory flag
			if (showCustCostRefForAmexMandFlag) {
				custCostRefMandObj.style.display = "inline";
			} else {
				custCostRefMandObj.style.display = "none";
			}
		}
		
		if (cardId == '201' && custCostRefMandObj) { // Visa
			// If a customer cost reference is required for Visa then show the mandatory flag
			if (showCustCostRefForVisaMandFlag) {
				custCostRefMandObj.style.display = "inline";
			} else {
				custCostRefMandObj.style.display = "none";
			}
		}
		
		// If a customer cost centre is required then show the mandatory flag
		if (showCustCostCentreMandFlag && custCostCentreMandObj) {
			custCostCentreMandObj.style.display = "inline";
		} else if (custCostCentreMandObj) {
			custCostCentreMandObj.style.display = "none";
		}
	}
}

function paycheckcell(obj,obj1){
	var tdid = 'pay' + obj;
	var tdid1 = 'pay' + obj1;
	if(document.getElementById('paycurrentSelect1')!=null){	
	document.getElementById(tdid1).className = "tdClass";
	var obj2 = document.getElementById('paycurrentSelect1').value
	var tdid2 = 'pay' + obj2;
	document.getElementById(tdid2).className = "tdClass";
	}else{
	   var input = document.createElement("input");
		input.setAttribute("type", "hidden");
		input.setAttribute("id", "paycurrentSelect1");
		input.setAttribute("value", "paycurrentSelect1");
		document.getElementById("normalPayment").appendChild(input);
	}
	document.getElementById('paycurrentSelect1').value = obj;
	document.getElementById(tdid).className = "tdClassbg";
}
/************** Script for Payment Method Ends here ************************/

/************* Script for Invoive page starts here *************************/
var isIE = document.all ? true : false;
document.onmousemove = getMousePosition;
function getMousePosition(e) { // the function to get the mouse click page on invoice list page
	
	
if(navigator.appName != "Microsoft Internet Explorer")
{
	/* track the scroll amount for Mozilla */
				var scrOfX = 0, scrOfY = 0;
			  if( typeof( window.pageYOffset ) == 'number' ) {
				//Netscape compliant
				scrOfY = window.pageYOffset;
				scrOfX = window.pageXOffset;
			  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
				//DOM compliant
				scrOfY = document.body.scrollTop;
				scrOfX = document.body.scrollLeft;
			  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
				//IE6 standards compliant mode
				scrOfY = document.documentElement.scrollTop; // vertical scroll amount 
				scrOfX = document.documentElement.scrollLeft; // horozontal scroll amount 
			  }
	}
				var _x;
				var _y;
				if (!isIE) {
					_x = e.pageX;
					_y = e.pageY;
				}
				if (isIE) {
					_x = event.clientX   -450;
					_y = event.clientY - 50;
			
				}
				posX = _x;
				posY = _y;				
				return true;	
}

function showMailAddress(documentNumber,x,y,redirectTo) { // The function to position the email pop-up on invoice list page

	/* track the scroll amount for IE */
var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop; // vertical scroll amount 
    scrOfX = document.documentElement.scrollLeft; // horozontal scroll amount 
  }
  if(navigator.appName == "Microsoft Internet Explorer")
  {
		 x = x + scrOfX;
		 y = y + scrOfY; 
  }
 else
   {
		 x = x;
		 y = y;	   
   }
  
	var divObject = document.getElementById("mailAddress");
	if(divObject.style.display == "none") {
		divObject.style.display = "block";
	}
	document.forms['mailDocumentForm'].documentNumber.value=documentNumber;
	document.forms['mailDocumentForm'].redirectTo.value=redirectTo;
	document.getElementById('document').innerHTML = documentNumber;
	var box = document.getElementById('zoomwindow');
	box.style.display = 'block';
	if(x!=0 && y!=0) {
		if(navigator.appName == "Microsoft Internet Explorer")
		{		
		box.style.left = x + 20 +'px'; // asign the X co-ordinate to the window
		box.style.top = y + 30 +'px'; // asign the Y co-ordinate to the window
		}
		else {
			
		box.style.left = x - 420 +'px'; // asign the X co-ordinate to the window
		box.style.top = y +'px'; // asign the Y co-ordinate to the window
			
			}
		
	} else {
		var scrolledX, scrolledY;
		if( self.pageYoffset ) 
			{
			scrolledX = self.pageXoffset;
			scrolledY = self.pageYoffset;
			}
		 else if( document.documentElement && document.documentElement.scrollTop ) 
			{
			scrolledX = document.documentElement.scrollLeft;
			scrolledY = document.documentElement.scrollTop;
			}
		 else if( document.body ) 	
			{
			scrolledX = document.body.scrollLeft;
			scrolledY = document.body.scrollTop;
			}	
		// Next, determine the coordinates of the center of browser's window
		var centerX, centerY;
		if( self.innerHeight ) 
			{
			centerX = self.innerWidth;
			centerY = self.innerHeight;
			}
		 else if( document.documentElement && document.documentElement.clientHeight ) 
			{
			centerX = document.documentElement.clientWidth;
			centerY = document.documentElement.clientHeight;
			} 
		else if( document.body ) 
			{
			centerX = document.body.clientWidth;
			centerY = document.body.clientHeight;
			}
		// div passed as arguments to the function:
		var leftoffset = scrolledX + (centerX - 375) / 2;
		var topoffset = scrolledY + (centerY - 200) / 2;

		box.style.left = leftoffset+'px'; // asign the X co-ordinate to the window
		box.style.top = topoffset+'px'; // asign the Y co-ordinate to the window
	}
}

function showMailAddressdetails(documentNumber,x,y,redirectTo) { // The function to position the email pop-up on invoice list page

	var divObject = document.getElementById("mailAddress");
	if(divObject.style.display == "none") {
		divObject.style.display = "block";
	}
	document.forms['mailDocumentForm'].documentNumber.value=documentNumber;
	document.forms['mailDocumentForm'].redirectTo.value=redirectTo;
	document.getElementById('document').innerHTML = documentNumber;
	var box = document.getElementById('zoomwindow');
	box.style.display = 'block';

}
function hideMailAddress() { // Function to hide the email popup
	var divObject = document.getElementById("mailAddress");
	divObject.style.display = "none";
	document.getElementById("zoomwindow").style.display = "none";
}
/************* Script for Invoive page ends here *************************/

/************* browse hover border fix *************************/

function liBorder(liId){
document.getElementById(liId).style.borderColor="#cc0000";
}
function liBorderOff(liId){
document.getElementById(liId).style.borderColor="silver";
}



/************* Parcel Tracking functions *************************/
function newWindow(nurl) 
{
  var title = "Tracking";
  var wins = window.open(nurl,title,"width=1000,height=600,resizable=yes,location=no,status=no,scrollbars=yes,toolbar=no");
}

function clearDateFormat(formElement){ 
	var content = document.getElementById(formElement).value="";
}


/*** eCustomerOpinions survey code v5.0.6 ****/
/* Copyright (c) 2008 eDigitalResearch Ltd   */
/* Please refer to our Terms & Conditions    */
/* for conditions of use.                    */
/* Do NOT modify this code unless directed   */
/* to do so by a member of eDigitalResearch  */
/* staff.                                    */
/*********************************************/

var cookie_firstparty = true; /* change to 'false' to not use first-party cookies */

var ecos_data = '';
var ecos_data2 = '';
var ecos_data3 = '';
var ecos_test = 0;

var ecos_sid = 753774182;
var ecos_host = 'ecustomeropinions.com';
var ecos_vault = '_';
var ecos_ver = '506';
var ecos_nc = '';
var ecos_go = 0;
var ecos_pu = 0;
var ecos_hm = 0;
var ecos_pm = 0;
var ecos_survey_size_x = 550;
var ecos_survey_size_y = 400;
var ecos_jscode = '';
var ecos_runjs = 'ecos_run();';
var ecos_proportion = 1.0;

var brok = false;
if (parseInt(navigator.appVersion.charAt(0)) >= 4)
	brok = true;


function ecos_buildurl(destpage) {
	var ecos_url = ecos_host + '/survey/' + destpage + '.php?sid=' + ecos_sid;

	ecos_url = ((document.location.protocol == 'https:') ? 'https://' : 'http://') + ecos_url;

	if (ecos_test > 0)
		ecos_url = ecos_url + '&test=1';
	
	ecos_url += '&v=' + ecos_ver + '&r=' + Math.round(Math.random() * 100000);
	if (ecos_vault.index != '_')
		ecos_url += '&vlt=' + ecos_vault;
	
	var myvar2 = '';
	myvar = window.location.href;

	var icount = 0;
	for (i=0; i<myvar.length; i++) {
		if (myvar.charAt(i) == '/')
			icount++;
		if (icount >= 3)
			myvar2 += myvar.charAt(i);
	};

	if (ecos_data.length > 0)	ecos_url += '&data=' + ecos_data;
	if (ecos_data2.length > 0)	ecos_url += '&data2=' + ecos_data2;
	if (ecos_data3.length > 0)	ecos_url += '&data3=' + ecos_data3;

	if ((screen.width > 0) && (screen.height > 0))
		ecos_url += '&xres=' + screen.width + '&yres=' + screen.height;

	if (screen.colordepth > 0)
		ecos_url += '&depth=' + screen.colordepth;
	
	if (ecos_proportion < 1.0) ecos_url += '&mult=' + ecos_proportion;
	ecos_url += '&url=' + escape(myvar2.substring(0,100));
	ecos_url += '&referrer=' + escape(document.referrer.substring(0,100));
	
	ecos_nukecookie('ecos'); // kill any no-path ver
	var ck;
	if (ck = ecos_getcookie('ecos'))
		ecos_url += '&ecos_cookie=' + ck;
	
	if (navigator.userAgent.indexOf("Safari") >= 0)
		ecos_url += '&fullurl=' + escape(window.location.href);
	
	return ecos_url;
};


function ecos_popup_popup() {
	
	var ua = navigator.userAgent;
	if ((ua.indexOf('NT 5.1') > 0) && (ua.indexOf(' SV1') > 0))
		return false;

	var sw = window.open(ecos_buildurl('survey'), 'surveywin', 'location=0,toolbar=no,width=' + ecos_survey_size_x + ',height=' + ecos_survey_size_y + ',directories=no,status=no,scrollbars=yes,resizable=yes');

	if ((ecos_pu) && (sw))
		sw.blur();

	return sw;
}


function ecos_popup_layer() {
	if (!document.getElementById)
		return false;

	var url = ecos_buildurl('layer') + '&inlayer=1';
	var t = '<SCR' + 'IPT LANGUAGE="Javascript" SRC="' + url + '"></SCR' + 'IPT>';

	var b, a = document.getElementById("ecos_iframe2");
	if (a.contentDocument)
		b = a.contentDocument;
	else if (a.contentWindow)
		b = a.contentWindow.document;
	else if (a.document)
		b = a.document;
	else
		return false;

	b.open();
	b.write(t);
	b.close();

	return true;
}


function ecos_layer_run() {
	eval(ecos_jscode);
}

function ecos_getcookie(name)
{
	var cks = document.cookie.split(';');
	for (var i = 0; i < cks.length; i++)
	{
		var c = cks[i];
		while (c.charAt(0) == ' ') c = c.substring(1, c.length);
		if (c.indexOf(name + '=') == 0) return c.substring(name.length+1, c.length);
	}
	return '';
}

function ecos_nukecookie(name, path)
{
	var ck = name + '=x';
	var dt = new Date();
	dt.setTime(dt.getTime() - 3600);
	if (path) ck += '; path=' + escape(path);
	ck += '; expires=' + dt.toGMTString();
	return (document.cookie = ck);
}


function ecos_layer_gono() {
	document.getElementById('ecos_surveylayer').style.visibility = 'hidden';
};


function ecos_layer_gosurveysize() {
	ecos_layer_gono();
	var full_survey_url = ecos_buildurl('survey') + '&doneperm=1';
	sw = window.open(full_survey_url, 'surveywin',
		'location=0,toolbar=no,width=' + ecos_survey_size_x + ',height=' + ecos_survey_size_y + ',directories=no,status=no,scrollbars=yes,resizable=yes');
	if ((ecos_pu) && (sw))
		sw.blur();
	return sw;
};


function ecos_layer_golater() {
	sw = ecos_layer_gosurveysize();
	if (sw)
		sw.blur();
	return sw;
};


var runcounter = 0;
function ecos_popup() {

	if (document.getElementById)
		if (!document.getElementById("ecos_iframe"))
			if (runcounter < 10) {
				runcounter++;
				setTimeout('ecos_popup()', 100);
				return;
			};

	if (ecos_go) {

		switch (ecos_pm) {
		case 0 : ecos_popup_popup(); break;
		case 1 : ecos_popup_layer(); break;
		case 2 : if (!ecos_popup_popup()) ecos_popup_layer(); break;
		case 3 : if (!ecos_popup_layer()) ecos_popup_popup();
		};
	};
};


function ecos_run() {
	if (ecos_go) {
		if (ecos_hm == 0)
			ecos_popup();
		else if ((ecos_hm == 1) && (brok)) {
			ecos_pm = 0;
			window.onunload = ecos_popup;
		};
	};
};


function ecos_i() {
	eval(ecos_runjs);
	var dt = new Date();
	if (ecos_nc != '' && cookie_firstparty)
	{
		var ck = ecos_getcookie('ecos');
		if (ck == '')
			ck = escape(ecos_nc);
		else
		{
			var cksid = ecos_nc.split('-', 2)[0];
			var ckre = new RegExp(cksid + '-\\d+');
			var ckmatches = ck.match(ckre);
			if ((!ckmatches) || ckmatches.length == 0)
				ck = ck + '.' + escape(ecos_nc);
			else
				ck = ck.replace(ckre, escape(ecos_nc));
		}
		dt.setDate(dt.getDate() + 7300);
		document.cookie = 'ecos=' + ck + ';path=/;expires=' + dt.toGMTString();
	}
};


var runcounter2 = 0;
function ecos_load() {
	var a, b;
	if (!(a = document.getElementById("ecos_iframe"))) {
		if (++runcounter2 < 10)
			setTimeout('ecos_load()', 100);
		return;
	};

	var t = '<SCR' + 'IPT LANGUAGE="Javascript" SRC="' + ecos_buildurl('i') + '"></SCR' + 'IPT>';
	if (a.contentDocument)
		b = a.contentDocument;
	else if (a.contentWindow)
		b = a.contentWindow.document;
	else if (a.document)
		b = a.document;
	if (b) {
		b.open();
		b.write(t);
		b.close();
	};
};

var ecos_allow = ecos_getcookie('ecos_allow');
if (document.location.toString().match('ECOS_SHOW_SURVEY')) {
	ecos_allow = 'y';
} else {
	if (ecos_allow.length < 1) {
		if (ecos_proportion < 1.0) {
			ecos_allow = (Math.random() < ecos_proportion) ? 'y' : 'n';
			document.cookie = 'ecos_allow=' + ecos_allow + ';path=/';
		} else {
			ecos_allow = 'y';
		}
	}
}
if (ecos_allow == 'y') {
if ((document.getElementById) && (window.frames)) {
	ecos_load();
} else {
	ecos_img = new Image;
	ecos_img.src = ecos_buildurl('i') + '&nosup=1';
}}


/************* homepage functions *************************/
function showApprovers(){
document.getElementById("myApprovers").style.display='block';
}
/************* Login functions *************************/
function disableLoginButton() {
	document.getElementById('enabled').style.display='none';
	document.getElementById('disabled').style.display='block';	
}