
	//var secureprefix = "http://localhost";
	//var regularprefix = "http://localhost";

	// var secureprefix = "http://192.168.1.253";
	 //var regularprefix = "http://192.168.1.253";

	var secureprefix = "https://www.testmart.com";
	var regularprefix = "http://www.testmart.com";
	var archiveprefix = "http://archive.testmart.com";
	var netprefix	= "http://net.testmart.com";
/*
	var secureprefix = "http://192.168.1.200";
	var regularprefix = "http://192.168.1.200";
	var archiveprefix = "http://192.168.1.200";
	var netprefix	= "http://192.168.1.200";
*/
//	var secure128prefix = "https://secure.testmart.com";
	



/*** This array will defined all the pages that need to 
	be served from http://archive.navicpmart.com 
	that is the Document Server which is in the 
	varaible  archiveserver***/
	var netPages = new Array();
	netPages[0] = "ebverify.cfm";	
	netPages[1] = "additem.cfm";	
	netPages[2] = "eboffverify.cfm";	

	function isRequiredNet(actionTxt,targetPageStr)
	{
		for (var i=0; i < netPages.length ; i++)
		{
			if (((new String(actionTxt)).indexOf(netPages[i]) > -1) || ((new String(targetPageStr)).indexOf(netPages[i]) > -1))
			{
					return true;
			}	
		}
		return false;
	
	}

	
	function trim(txtObj)
	{
		// trim leading spaces
		while(''+txtObj.value.charAt(0)==' ')
			txtObj.value=txtObj.value.substring(1,txtObj.value.length);		
			
		// trim trailing spaces
		while(''+txtObj.value.charAt(txtObj.value.length-1)==' ')
			txtObj.value=txtObj.value.substring(0,txtObj.value.length-1);
			
		return 	txtObj.value;
	}

	function open_window(url) 
	{
		if (((new String(url)).indexOf("http") == -1) && ((new String(url)).indexOf("https") == -1))
			url = "http://" + url;
		
		window.open(url,"win",'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=500,height=450');
	}
	
	function open_noborder(url) 
	{
		if (((new String(url)).indexOf("http") == -1) && ((new String(url)).indexOf("https") == -1))
			url = "http://" + url;
		
		window.open(url,"win",'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=450');
	}

	
	// This function is used for download spec.
	function open_downloadwindow(url)
	{
		var str = navigator.userAgent; 
		if (navigator.appName != 'Microsoft Internet Explorer')
		{
			linkSubmitForm(url);
		}
		else
		{
			if (((new String(url)).indexOf("http") == -1) && ((new String(url)).indexOf("https") == -1))
			url = regularprefix + url;
		
			window.open(url,"win",'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=500,height=450'); 
			
		}
	}
	

/*** This array will defined all the pages that need to 
	be served from http://archive.navicpmart.com 
	that is the Document Server which is in the 
	varaible  archiveserver***/
	var archivePages = new Array();
	archivePages[0] = "mfgdocview.cfm";
	archivePages[1] = "spec.cfm";
	archivePages[2] = "mfgcatalogrslt.cfm";	
	archivePages[3] = "catalogrslt.cfm";	


	function isRequiredArchive(actionTxt,targetPageStr)
	{
		for (var i=0; i < archivePages.length ; i++)
		{
			if (((new String(actionTxt)).indexOf(archivePages[i]) > -1) || ((new String(targetPageStr)).indexOf(archivePages[i]) > -1))
			{
					return true;
			}	
		}
		return false;
	
	}

	function validateEmail(thisObj,emailAddrObj,objValue)
	{
		/*if (trim(emailAddrObj) == "")
			return true;
		
		txt = new String(emailAddrObj.value);
		txt = txt.toLowerCase();
		
		if ((atPos = txt.indexOf("@"))<1)
			return false;

		if ((txt.indexOf(".",atPos) - atPos)<3)
			return false;

		// check to see if in unknown format, if yes return true, coz no way to validate
		if ((txt.indexOf(".com")<0)&&(txt.indexOf(".org")<0)
		&&(txt.indexOf(".gov")<0)&&(txt.indexOf(".net")<0)
		&&(txt.indexOf(".mil")<0)&&(txt.indexOf(".edu")<0)
		&&(txt.indexOf(".co")<0)&&(txt.indexOf(".or")<0)
		&&(txt.indexOf(".go")<0)&&(txt.indexOf(".ne")<0)
		&&(txt.indexOf(".mi")<0)&&(txt.indexOf(".ed")<0))
			return true;

		if (((txt.indexOf(".com",atPos) - atPos)<3)&& ((txt.indexOf(".org",atPos) - atPos)<3)
		&&((txt.indexOf(".gov",atPos) - atPos)<3)&&((txt.indexOf(".net",atPos) - atPos)<3)
		&&((txt.indexOf(".mil",atPos) - atPos)<3)&&((txt.indexOf(".edu",atPos) - atPos)<3)
		&&((txt.indexOf(".co",atPos) - atPos)<3)&&((txt.indexOf(".or",atPos) - atPos)<3)
		&&((txt.indexOf(".go",atPos) - atPos)<3)&&((txt.indexOf(".ne",atPos) - atPos)<3)
		&&((txt.indexOf(".mi",atPos) - atPos)<3)&&((txt.indexOf(".ed",atPos) - atPos)<3))
			return false;
		*/
		return true;
	}

   function isCOTREmail(emailObject){
		var emailString = trim(emailObject);
		
		var extension = emailString.substring(emailString.length - 4,emailString.length);
		extension = extension.toLowerCase();
		
		return  ((extension == ".com") || (extension == ".mil"));
	}

	
	var secPages = new Array();	
	secPages[0] = "personaltmp.cfm";
	secPages[1] = "shippingtmp.cfm";
	secPages[2] = "billingtmp.cfm";
	secPages[3] = "shipdtl.cfm";
	secPages[4] = "payinfo.cfm";
	secPages[5] = "paydtl.cfm";
	secPages[6] = "orderverify.cfm";
	secPages[7] = "reqconfirm.cfm";
	secPages[8] = "loginvalidate.cfm";
	secPages[9] = "registration.cfm";
	secPages[10] = "regconfirm.cfm";
	secPages[11] = "login.cfm";	
	secPages[12] = "shippingmethod.cfm";
	secPages[13] = "creditcard.cfm";
	secPages[14] = "purchaseorder.cfm";
	secPages[15] = "shippinginfo.cfm";
	secPages[16] = "reqcreditaccount.cfm";
	secPages[17] = "otherpayment.cfm";
	secPages[18] = "notices.cfm";
	secPages[19] = "noticestmp.cfm";
	secPages[20] = "myprofile.cfm";
	secPages[21] = "personal.cfm";
	secPages[22] = "shipbill.cfm";	
	secPages[23] = "eblandmine.cfm";	
	secPages[24] = "ebcategories.cfm";
	secPages[25] = "eblistidentity.cfm";
	secPages[26] = "customeraccount.cfm";
	secPages[27] = "profile.cfm";
	secPages[28] = "passwordview.cfm";
	secPages[29] = "password.cfm";
	secPages[30] = "selleqp.cfm";
	secPages[31] = "mdfyeqp.cfm";
	secPages[32] = "sellinventory.cfm";
	secPages[33] = "viewquote.cfm";
	secPages[34] = "salesgenquote.cfm";
	secPages[35] = "corporateaccount.cfm";
	secPages[36] = "verifycontractor.cfm";
	secPages[37] = "verifysupervisor.cfm";
	secPages[38] = "asset.cfm";
	secPages[39] = "cashierscheck.cfm";
	secPages[40] = "companycheck.cfm";
	secPages[41] = "paypal.cfm";
	secPages[42] = "wiretransfer.cfm";
	secPages[43] = "addmodifyuser.cfm";

	function isSecured(actionTxt,targetPageStr)
	{		
		for (var i=0; i < secPages.length ; i++)
			if (((new String(actionTxt)).indexOf(secPages[i]) > -1) || ((new String(targetPageStr)).indexOf(secPages[i]) > -1))
				return true;
				
		return false;
	}
		

	function setStatus(statusTxt)
	{
		// window.status = statusTxt;
		return true;		
	}



	
	function setSubmitValue(actionTxt,targetPageStr)
	{
		document.forms[1].targetPage.value = targetPageStr;	
		if (actionTxt == "")
			actionTxt = document.forms[1].pageName.value;

		if (isSecured(actionTxt,targetPageStr))
			document.forms[1].action = secureprefix + actionTxt;
		else
		if (isRequiredArchive(actionTxt,targetPageStr))
			document.forms[1].action = archiveprefix + actionTxt;
		else
			document.forms[1].action = regularprefix + actionTxt;

		return true;
	}
	function setSubmitValue0(actionTxt,targetPageStr)
	{
		document.forms[0].targetPage.value = targetPageStr;	
		if (actionTxt == "")
			actionTxt = document.forms[0].pageName.value;

		if (isSecured(actionTxt,targetPageStr))
			document.forms[0].action = secureprefix + actionTxt;
		else
			document.forms[0].action = regularprefix + actionTxt;

		return true;
	}
	function linkSubmitForm0(actionTxt,targetPageStr,paramValue1,paramValue2,paramValue3,paramValue4,paramValue5)
	{
		var str = navigator.userAgent; 
		if (navigator.appName != 'Microsoft Internet Explorer')
		{ 
				document.forms[0].targetPage.value = targetPageStr;	
				document.forms[0].param1.value = paramValue1;
				document.forms[0].param2.value = paramValue2;
				document.forms[0].param3.value = paramValue3;
				document.forms[0].param4.value = paramValue4;
				document.forms[0].param5.value = paramValue5;
		}
		else 
		{
			document.forms[0].targetPage.value = targetPageStr;			
			document.forms[0].param1.value = paramValue1;
			document.forms[0].param2.value = paramValue2;
			document.forms[0].param3.value = paramValue3;
			document.forms[0].param4.value = paramValue4;
			document.forms[0].param5.value = paramValue5;
		}
			
		if (actionTxt == "")
			actionTxt = document.forms[0].pageName.value;

		if (isSecured(actionTxt,targetPageStr))
			document.forms[0].action = secureprefix + actionTxt;
		else
		if (isRequiredNet(actionTxt,targetPageStr))
			document.forms[0].action = netprefix + actionTxt;
		else
			document.forms[0].action = regularprefix + actionTxt;
			
		document.forms[0].submit();
	}


	function linkSubmitForm(actionTxt,targetPageStr,paramValue1,paramValue2,paramValue3,paramValue4,paramValue5)
	{
		var str = navigator.userAgent; 
		if (navigator.appName != 'Microsoft Internet Explorer')
		{ 
			//if (targetPageStr != null)
				document.forms[1].targetPage.value = targetPageStr;	
			//if (paramValue1 != null)
				document.forms[1].param1.value = paramValue1;
			//if (paramValue2 != null)
				document.forms[1].param2.value = paramValue2;
			//if (paramValue3 != null)
				document.forms[1].param3.value = paramValue3;
			//if (paramValue4 != null)
				document.forms[1].param4.value = paramValue4;
			//if (paramValue5 != null)
				document.forms[1].param5.value = paramValue5;
		}
		else 
		{
			document.forms[1].targetPage.value = targetPageStr;			
			document.forms[1].param1.value = paramValue1;
			document.forms[1].param2.value = paramValue2;
			document.forms[1].param3.value = paramValue3;
			document.forms[1].param4.value = paramValue4;
			document.forms[1].param5.value = paramValue5;
		}
			
		if (actionTxt == "")
			actionTxt = document.forms[1].pageName.value;

		if (isSecured(actionTxt,targetPageStr))
			document.forms[1].action = secureprefix + actionTxt;
		else
		if (isRequiredArchive(actionTxt,targetPageStr))
			document.forms[1].action = archiveprefix + actionTxt;
		else
		if (isRequiredNet(actionTxt,targetPageStr))
			document.forms[1].action = netprefix + actionTxt;
		else
			document.forms[1].action = regularprefix + actionTxt;
			
		document.forms[1].submit();
	}


	function linkValidateForm(actionTxt,targetPageStr)
	{
		document.forms[1].targetPage.value = targetPageStr;

		if (actionTxt == "")
			actionTxt = document.forms[1].pageName.value;

		if (isSecured(actionTxt,targetPageStr))
			document.forms[1].action = secureprefix + actionTxt;
		else
			document.forms[1].action = regularprefix + actionTxt;

		if (_CF_checkcfForm(document.forms[1]))
			document.forms[1].submit();
	}

	

	//*** this function shows the (xxx.pdf) in a child window 
	//**  if the child window already exists, the same is brought forward  
	function open_pdf_window(url)
	{
		if (((new String(url)).indexOf("http") == -1) && ((new String(url)).indexOf("https") == -1))
			url = "http://" + url;
		
		winPdf1 = window.open(url,"winPdf",'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=400,height=400,screenX=10,screenY=10');
		
		if ( winPdf1 != null )
		{ 
			if ( winPdf1.opener == null ) { winPdf1.opener = self;  } 
			winPdf1.focus(); 
		} 
	}

// This function clears all the 
// Text boxes and select boxes of a form.
function resetForm(formName){
	var length;
	var i;
	length = formName.elements.length;
	for (i=0;i<length;i++){
		// Check if it is a text box
		if (formName.elements[i].type == "text"){
			formName.elements[i].value = "";
		}
		// Check if it is a Select Box 
		else if ( (formName.elements[i].type).indexOf("select") > -1){
			formName.elements[i].selectedIndex = -1;
		}
		
	}
}

	function emailCheck (emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
//	alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
//    alert("The username doesn't seem to be valid.")
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
//	        alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
//	alert("The domain name doesn't seem to be valid.")
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>4) {
   // the address must end in a two letter or three letter word.
   //alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
//   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}

	function subscribeNewsletter(){
		if (trim(document.forms[0].subsremail)== ""){
			alert("Please enter e-mail address");
			document.forms[0].subsremail.focus();
			return;
		}
		
    	   	linkSubmitForm0("/customerservice/customerservicetmp.cfm","../registration/subscription.cfm");
	}


function processenterkey(keypressed) {
        // The Docment Object Model event we need is only available inf Javascript 1.2, MSIE4+ and NN4+
        // This functions is the onKeyPress event handler for the password field

        var key;
        
        // Test of MSIE DOM without all that parsing of the agent string
        // NN and MSIE use different DOMs
        if (document.all) {
            key=window.event.keyCode;
              }
        else {
            key=keypressed.which;
              };
                      
        // Check each key pressed for character code 13 (carriage return), AND
        // then SUBMIT the form for the user
        if (key==13) {
			email = trim(document.forms[0].subsremail);
			if (email==""){
				alert("Please enter the e-mail address");
				return;
			}
			else if (emailCheck(email) == false)
			{
				alert("Please enter a valid e-mail address");
				return;
			}
			else
          //document.Signon.submit();
    	   	subscribeNewsletter();
        }

}

function quicksearch(keypressed) {
        // The Docment Object Model event we need is only available inf Javascript 1.2, MSIE4+ and NN4+
        // This functions is the onKeyPress event handler for the password field

        var key;
        
        // Test of MSIE DOM without all that parsing of the agent string
        // NN and MSIE use different DOMs
        if (document.all) {
            key=window.event.keyCode;
              }
        else {
            key=keypressed.which;
              };
                      
        // Check each key pressed for character code 13 (carriage return), AND
        // then SUBMIT the form for the user
        if (key==13) {
			searchtext = trim(document.forms[0].quiksrch_keywords);
			if (searchtext==""){
				return;
			}
			else	
    	   		linkSubmitForm0('/estore/searchtmp.cfm','../search/sitesearch.cfm','','','','','');
        }

}

function quicksearch_NEW(keypressed) {
        // The Docment Object Model event we need is only available inf Javascript 1.2, MSIE4+ and NN4+
        // This functions is the onKeyPress event handler for the password field

        var key;
        
        // Test of MSIE DOM without all that parsing of the agent string
        // NN and MSIE use different DOMs
        if (document.all) {
            key=window.event.keyCode;
              }
        else {
            key=keypressed.which;
              };
                      
        // Check each key pressed for character code 13 (carriage return), AND
        // then SUBMIT the form for the user
        if (key==13) {
			searchtext = trim(document.forms[0].q);
			if (searchtext==""){
				return;
			}
			else{
				document.forms[0].v.value='0';
				document.forms[0].submit();
			}	
    	   		//linkSubmitForm0('/estore/searchtmp.cfm','../search/sitesearch.cfm','','','','','');
        }

}

function sellsubmit(form,txtbox){
	searchtext = trim(txtbox);
	if (searchtext==""){
		return;
	}
	else{
		document.forms[0].method="post";
		document.forms[0].action='http://search.testmart.com/search/';
		document.forms[0].q.value=searchtext;
		document.forms[0].v.value='2';
		document.forms[0].submit();	
	}
  	   		//linkSubmitForm('/estore/productstmp.cfm','../sell/sellrslt.cfm','','','','','');
}

function sellsearch1(keypressed) {
    var key;
    if (document.all){
        key=window.event.keyCode;
    }
    else {
        key=keypressed.which;
     };
     if (key==13) {
		searchtext = trim(document.forms[1].txtSearch);
		if (searchtext=="")
			return;
		else{
			sellsubmit(document.forms[1],document.forms[1].txtSearch);
			return false;
		}	
	}	
}


function sellsearch(keypressed) {
        // The Docment Object Model event we need is only available inf Javascript 1.2, MSIE4+ and NN4+
        // This functions is the onKeyPress event handler for the password field

        var key;
        
        // Test of MSIE DOM without all that parsing of the agent string
        // NN and MSIE use different DOMs
        if (document.all) {
            key=window.event.keyCode;
              }
        else {
            key=keypressed.which;
              };
                      
        // Check each key pressed for character code 13 (carriage return), AND
        // then SUBMIT the form for the user
        if (key==13) {
			searchtext = trim(document.forms[0].txtSearch);
			if (searchtext==""){
				return;
			}
			else	
    	   		linkSubmitForm('/estore/productstmp.cfm','../sell/sellrslt.cfm','','','','','');
        }

}
function sellsearch_NEW(keypressed) {
        // The Docment Object Model event we need is only available inf Javascript 1.2, MSIE4+ and NN4+
        // This functions is the onKeyPress event handler for the password field

        var key;
        
        // Test of MSIE DOM without all that parsing of the agent string
        // NN and MSIE use different DOMs
        if (document.all) {
            key=window.event.keyCode;
              }
        else {
            key=keypressed.which;
              };
                      
        // Check each key pressed for character code 13 (carriage return), AND
        // then SUBMIT the form for the user
        if (key==13) {
			searchtext = trim(document.forms[0].txtSearch);
			if (searchtext==""){
				return;
			}
			else{
				document.forms[0].action='http://search.testmart.com/search/';
				document.forms[0].q.value=searchtext;
				document.forms[0].v.value='2';
				document.forms[0].submit();			
			}
    	   		//linkSubmitForm('/estore/productstmp.cfm','../sell/sellrslt.cfm','','','','','');
        }

}

function entercatalog(keypressed) {
        // The Docment Object Model event we need is only available inf Javascript 1.2, MSIE4+ and NN4+
        // This functions is the onKeyPress event handler for the password field
        var key;
        
        // Test of MSIE DOM without all that parsing of the agent string
        // NN and MSIE use different DOMs
        if (document.all) {
            key=window.event.keyCode;
              }
        else {
            key=keypressed.which;
              };
                      
        // Check each key pressed for character code 13 (carriage return), AND
        // then SUBMIT the form for the user
        if (key==13) {
		  flag = false;
		  usertype = document.forms[1].usertype;
		  for (i=0;i<usertype.length;i++){
		  	if(usertype[i].checked){
				flag = true;
				break;
			}
		  }
		  
		  if (!flag){
		    alert("Please select 'employee' or 'contractor'");
			return false;
		  }
			searchtext = trim(document.forms[1].catalogemail);
			if (searchtext==""){
				return;
			}
			else	
    	   		vldCat1();
        }

}
function agsrch(keypressed) {
        var key;
        if (document.all) {
            key=window.event.keyCode;
              }
        else {
            key=keypressed.which;
              };
        if (key==13) {
			searchtext = trim(document.forms[0].searchCriteria);
			if (searchtext==""){
				return;
			}
			else{
				box=document.forms[0].quotefilter;
				eval('document.forms[0].'+box.options[box.selectedIndex].value+'.value=document.forms[0].searchCriteria.value');
    	   		linkSubmitForm0('/estore/reqlisttmp.cfm','../reqlist/quotemanagement.cfm','','','','','');
			}	
        }
}

function genericValidation(fname,fields,messages,targetPage,param1,param2,param3,param4,param5){
 allFields = mockSplit(fields,",");
 allMessages = mockSplit(messages,",");
 
 for (i=0; i < fname.elements.length;i++){
	validateFlag = false;
	tempName = fname.elements[i].name;
	
	for (j=0; j<allFields.length; j++){
		if (tempName == allFields[j]){
			validateFlag = true;
			break;
		}// end of if	
	}// end of inner for
	
	if (validateFlag){
	// validate the field
//		alert(fname.elements[i].type);
		if ( (fname.elements[i].type == "text") || (fname.elements[i].type == "password") || (fname.elements[i].type == "textarea") ){
			if (trim(fname.elements[i]) == ""){
				alert(allMessages[j]);
				fname.elements[i].focus();
				return;
			}// end of if (fname.elements[i])	
			
			// e-mail validation 
			if ( ((fname.elements[i].name.indexOf("email")) > -1 )
				|| (fname.elements[i].name == "reg_user_name")
				|| (fname.elements[i].name == "dotmildotgov")
				){
				if (!emailCheck(fname.elements[i].value)){
					alert("Please enter a valid e-mail address");				
					fname.elements[i].focus();
					return;
				}
			}
			
			if (fname.elements[i].name == "dotmildotgov"){
				dotmilgov = trim(fname.elements[i]);
				dotmilgov = dotmilgov.toLowerCase();
				milgovlen = dotmilgov.length;

				if (dotmilgov.indexOf("@testmart.com") < 0 ){
					if (milgovlen > 4){
						last4 = dotmilgov.substr((milgovlen-4),milgovlen);
						if (( last4 != ".mil" ) && (last4 != ".gov")){
							alert("Please enter a valid .mil / .gov e-mail address");
							fname.elements[i].focus();
							return;
						}
					}else{
						alert("Please enter a valid .mil / .gov e-mail address");
						fname.elements[i].focus();
						return;
					}
				}
				
			}
		}// end of if
		else
		if (fname.elements[i].type == "radio"){

			flag = false;
			for (k = 0; k < fname.elements[i].length; k++){
					if( fname.elements[i][k].checked )
					{	
						flag = true;
						break; 
					}
			}// end of for

			if (!flag){
				alert(allMessages[j]);
				fname.elements[i].focus();
				return;
			}
		}// end of if else type
		else
		if ((fname.elements[i].type.indexOf("select")) > -1 ){
			if (fname.elements[i][fname.elements[i].selectedIndex].value == ""){
				alert(allMessages[j]);
				fname.elements[i].focus();
				return;
			}
		}// end of select tag
     }// end of if (validateFlag)
 }// end of the for statement
 
	linkSubmitForm('/customerservice/customerservicetmp.cfm',targetPage,param1,param2,param3,param4,param5);

}


function mockSplit(strSourceString,strChar){
	var noOfChars = 1;
	for (var i=0; i<strSourceString.length; i++){
		if (strSourceString.charAt(i) == strChar)
			noOfChars++;					
	} // end of for statement		

	arr = new Array(noOfChars);
	i = 0; 
	var fromChar = 0;

	for (var j=0; j<strSourceString.length; j++){
		if (strSourceString.charAt(j) == strChar){
			arr[i++] = strSourceString.substring(fromChar,j);
			fromChar = j + 1;
		}	
	} // end of for statement		

	arr[i] = strSourceString.substring(fromChar);
	return arr;

}// end of function mockSplit

function inventoryOverride(){
	var pagename = "overrideinventory";
	curdate = new Date();
	WindowName = curdate.setTime(Date.parse(curdate));

	var wtop  = ( screen.height - 450)/2;
	var wleft = ( screen.width - 550)/2 ;

	var windowprops = 'toolbar=0,location=0,directories=0,status=0,titlebar=no' +
			'menubar=0,scrollbars=1,resizable=0,width=550,height=450,top='+wtop+',left='+wleft;
	self.name = WindowName;
	overrideWindow = window.open("/reqlist/overrideinventory.cfm","overrideinventory",windowprops);

			if ( overrideWindow != null )
			{
				if ( overrideWindow.opener == null )
				{ overrideWindow.opener = self;  } 
			
				if (arguments.length == 3){
					document.forms[1].param1.value = arguments[0];
					document.forms[1].param2.value = arguments[1];
					document.forms[1].param3.value = arguments[2];
					document.forms[1].param4.value = '../reqlist/reqlist.cfm';
				}
				else if (arguments.length == 4){
					document.forms[1].param1.value = arguments[0];
					document.forms[1].param2.value = arguments[1];
					document.forms[1].param3.value = arguments[2];
					document.forms[1].param4.value = arguments[3];
				}
				else{
					document.forms[1].param1.value = "";
					document.forms[1].param2.value = "";
					document.forms[1].param3.value = "";
					document.forms[1].param4.value = '../reqlist/reqlist.cfm';
				}	
				document.forms[1].action="/estore/reqlisttmp.cfm?ttype=";
				document.forms[1].targetPage.value = "../reqlist/overrideinventory.cfm";
				document.forms[1].target="overrideinventory";
				document.forms[1].method="post";
				document.forms[1].submit();
				overrideWindow.focus(); 
			}
	overrideWindow.opener = self;  
	overrideWindow.focus();
}		
/*  
	Leonid Alzhin
	10/02/2007
*/

function open_customwindow(prm_trgpage, prm_pagename, prm_width, prm_heigth)
{

	var wtop  = (screen.height-prm_heigth)/2;
	var wleft = (screen.width-prm_width)/2 ;

	var windowprops = 'toolbar=0,location=0,directories=0,status=0,titlebar=no' +
			'menubar=0,scrollbars=1,resizable=1,width='+prm_width+',height='+prm_heigth+',top='+wtop+',left='+wleft;

	overrideWindow = window.open(prm_trgpage,prm_pagename,windowprops);
	//overrideWindow = window.open(prm_trgpage,prm_pagename);
	document.forms[1].action=prm_trgpage;
	document.forms[1].target=prm_pagename;
	document.forms[1].method="post";

	document.forms[1].submit();
	overrideWindow.opener = self;  
	overrideWindow.focus();
	

}

//Leonid Alzhin - this function to add functionality to override multiple items
function inventoryOverride_Multiple(){
	var pagename = "overrideinventory_multiple";
	curdate = new Date();
	WindowName = curdate.setTime(Date.parse(curdate));

	var wtop  = ( screen.height - 450)/2;
	var wleft = ( screen.width - 550)/2 ;

	var windowprops = 'toolbar=0,location=0,directories=0,status=0,titlebar=no' +
			'menubar=0,scrollbars=1,resizable=0,width=850,height=450,top='+wtop+',left='+wleft;
	self.name = WindowName;
	overrideWindow = window.open("/reqlist/overrideinventory_multiple.cfm","overrideinventory_multiple",windowprops);

			if ( overrideWindow != null )
			{
				if ( overrideWindow.opener == null )
				{ overrideWindow.opener = self;  } 
			
				if (arguments.length == 3){
					document.forms[1].param1.value = arguments[0];
					document.forms[1].param2.value = arguments[1];
					document.forms[1].param3.value = arguments[2];
					document.forms[1].param4.value = '../reqlist/reqlist.cfm';
				}
				else if (arguments.length == 4){
					document.forms[1].param1.value = arguments[0];
					document.forms[1].param2.value = arguments[1];
					document.forms[1].param3.value = arguments[2];
					document.forms[1].param4.value = arguments[3];
				}
				else{
					document.forms[1].param1.value = "";
					document.forms[1].param2.value = "";
					document.forms[1].param3.value = "";
					document.forms[1].param4.value = '../reqlist/reqlist.cfm';
				}	
				document.forms[1].action="/estore/reqlisttmp.cfm?ttype=";
				document.forms[1].targetPage.value = "../reqlist/overrideinventory_multiple.cfm";
				document.forms[1].target="overrideinventory_multiple";
				document.forms[1].method="post";
				document.forms[1].submit();
				overrideWindow.focus(); 
			}
	overrideWindow.opener = self;  
	overrideWindow.focus();
}		
//Leonid Alzhin - modification ends

	//** function blipImgWindow(ImagePath) is to show the larger product image.
	function blipImgWindow(ImagePath) 
	{
			 msgWindow=window.open("","displayWindow","titlebar=no,menubar=no,width=500,height=290,resizable=no");
			
			 if ( msgWindow != null )
			 {
			 	msgWindow.close();
				msgWindow=window.open("","displayWindow","titlebar=no,menubar=no,width=500,height=290,resizable=no");
			 }
   			 msgWindow.document.write("<HEAD><TITLE>Larger Image View</TITLE>");
			 msgWindow.document.write("</HEAD>");
			 msgWindow.document.write('<BODY bgcolor=#ffffff><div align="center">');
			 msgWindow.document.write('<form action=" "  method="post">');
			 msgWindow.document.write('<table cellspacing="0" cellpadding="0"><tr><td align="center"><img src= ' + ImagePath + '></td></tr>');
			 msgWindow.document.write('<tr><td align="center"><br><a href="javascript:self.close();"><input type="image" src="/webdata/img/close.gif" border="0" value="Close" onclick="self.close()"></a></td></tr></table>');
			 msgWindow.document.write("</form></div></body>");
	}
	
var genpopup=null;
function showpopup(){

  var section = "";	
  var hash = "";
  var product_line = "";
  var manufacturer_code = "";
  var product_id = "";
  
  section = arguments[0];
   if (arguments.length > 1)
	  hash = "#"+arguments[1];
	  
   if (arguments.length == 5){
   	product_line = arguments[2];
	manufacturer_code = arguments[3];
	product_id	= arguments[4];
   }  
   
	var pagename = "genpopup";
	WindowName = pagename + document.forms[1].sessionID.value;
	self.name = WindowName;

	if ((genpopup == null)||(genpopup.closed)){
		var wtop  = ( screen.height - 465)/2;
		var wleft = ( screen.width - 400)/2 ;
		
		if (arguments.length == 5)
			genpopup = window.open(regularprefix+ '/include/popup.cfm?param1='+section+'&product_line='+product_line+'&manufacturer_code='+manufacturer_code+'&product_id='+product_id+hash,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=465,top='+wtop+',left='+wleft);
		else
			genpopup = window.open(regularprefix+ '/include/popup.cfm?param1='+section+hash,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=400,height=465,top='+wtop+',left='+wleft);
		genpopup.opener = self;
		genpopup.focus();
	}
	else{
		genpopup.focus();
	}

}

function vldCat1(){
 if (document.forms[1].FOREDU.value == 'NO'){
 
  flag = false;
  usertype = document.forms[1].usertype;
  for (i=0;i<usertype.length;i++){
  	if(usertype[i].checked){
		flag = true;
		break;
	}
  }
  
  if (!flag){
    alert("Please select 'employee' or 'contractor'");
	return;
  }
 } 
  
  email = trim(document.forms[1].catalogemail);
  if (email == ""){
  	alert("Please enter email address");
	document.forms[1].catalogemail.focus();
	return;
  }
  
  if (!emailCheck(email)){
  	alert("Please enter a valid email address");
	document.forms[1].catalogemail.focus();
	return;
  }
  
  linkSubmitForm('/estore/productstmp.cfm','../estore/reqcatalog.cfm','catalogemail','','','','');

}

function validateCDReqForm(){

	if (document.forms[1].catalogtype == undefined)  
		junk = '';
	else 
	if (document.forms[1].catalogtype.length == undefined)
		junk = '';
	else
	if 	(isNaN(document.forms[1].catalogtype.length))
		junk = '';
	else{
		flag = false;
		for (i=0; ((i<document.forms[1].catalogtype.length) && (!flag)); i++)
			if (document.forms[1].catalogtype[i].checked)
				flag = true;
		
		if (!flag){
			alert("Please select catalog type");
			return;
		}		
	}
	
	if (trim(document.forms[1].catalogemail) == "")
	{
			alert("Please enter E-mail");
			document.forms[1].catalogemail.focus();
			return;
	}

	else
	if (!emailCheck(document.forms[1].catalogemail.value)){
			alert("Please enter a valid e-mail address");
			document.forms[1].catalogemail.focus();
			return;
	}	
	else
	if(trim(document.forms[1].phone) == "")
		{
			alert("Please enter Phone");
			document.forms[1].phone.focus();
			return;
		}
	else
	if(trim(document.forms[1].name) == "")
		{
			alert("Please enter First name");
			document.forms[1].name.focus();
			return;
		}
	else
	if (trim(document.forms[1].lastname) == "")
	{
			alert("Please enter Last name");
			document.forms[1].lastname.focus();
			return;
	}
	else
	if (trim(document.forms[1].organization) == "")
	{
			alert("Please enter Organization");
			document.forms[1].organization.focus();
			return;
	}
	else
	if (trim(document.forms[1].address6) == "")
	{
		alert("Please enter the Street");
		document.forms[1].address6.focus();
		return;
	}
	else
	if(trim(document.forms[1].city) == "")
		{
			alert("Please enter City");
			document.forms[1].city.focus();
			return;
		}				
	else
	if(trim(document.forms[1].zip) == "")
		{
			alert("Please enter Zip");
			document.forms[1].zip.focus();
			return;
		}				

		linkSubmitForm('/estore/productstmp.cfm','../estore/reqcatalog.cfm','fromsubmit');

}

function validateNotify(){
	
	if(trim(document.forms[1].sname) == "")
		{
			alert("Please enter your name");
			document.forms[1].sname.focus();
			return;
		}
	else
	if (trim(document.forms[1].semail) == "")
		{
			alert("Please enter your E-mail address");
			document.forms[1].semail.focus();
			return;
		}
	else
	if (trim(document.forms[1].remails) == "")
		{
			alert("Please enter send to E-mail address");
			document.forms[1].remails.focus();
			return;
		}
	else
	if(trim(document.forms[1].notes) == "")
		{
			alert("Please enter your Comments/Questions");
			document.forms[1].notes.focus();
			return;
		}
		else
		{
			cmmArr = mockSplit(document.forms[1].remails.value,',');
			for (i=0; i<cmmArr.length; i++)
			{
				//alert("before calling email check for " + cmmArr[i]);
				tempEmail = trimVar(cmmArr[i]);
				if ( tempEmail.length == 0)
					continue;
					
				if  (!emailCheck(tempEmail)){
					alert("Please enter valid e-mail addresses");
					return;
				}
			}
			linkSubmitForm('/estore/productstmp.cfm','../estore/notifyothers.cfm');
		}
	
}

function vldSendQuote(){
  flag = false;
  producttype = document.forms[1].producttype;
  for (i=0;i<producttype.length;i++){
  	if(producttype[i].checked){
		flag = true;
		break;
	}
  }
  
  if (!flag){
    alert("Please select the product type");
	return;
  }
  

  manufacturer = trim(document.forms[1].manufacturer);
  if (manufacturer == ""){
  	alert("Please enter manufacturer");
	document.forms[1].manufacturer.focus();
	return;
  }

  model = trim(document.forms[1].model);
  if (model == ""){
  	alert("Please enter model number");
	document.forms[1].model.focus();
	return;
  }

  name = trim(document.forms[1].name);
  if (name == ""){
  	alert("Please enter your name");
	document.forms[1].name.focus();
	return;
  }

  email = trim(document.forms[1].email);
  if (email == ""){
  	alert("Please enter email address");
	document.forms[1].email.focus();
	return;
  }
  
  if (!emailCheck(email)){
  	alert("Please enter a valid email address");
	document.forms[1].email.focus();
	return;
  }
  
  phone = trim(document.forms[1].phone);
  if (phone == ""){
  	alert("Please enter your phone");
	document.forms[1].phone.focus();
	return;
  }

  if (document.forms[1].country.options[document.forms[1].country.selectedIndex].value == ""){
  	alert("Please select a valid country");
	document.forms[1].country.focus();
	return;
  }
  
  linkSubmitForm('/estore/productstmp.cfm','../customerservice/qtrequest.cfm','fromsubmit','','','','');

}
function seParameters(actionTxt,targetPageStr,param1,param2,param3,param4,param5)
{
			document.forms[1].targetPage.value = targetPageStr;
			
			if (actionTxt == "")
				actionTxt = document.forms[1].pageName.value;
			
			if (isSecured(actionTxt,targetPageStr))
				document.forms[1].action = secureprefix + actionTxt;
			else
				document.forms[1].action = regularprefix + actionTxt;
			
			document.forms[1].param1.value = param1;
			document.forms[1].param2.value = param2;
			document.forms[1].param3.value = param3;
			document.forms[1].param4.value = param4;
			document.forms[1].param5.value = param5;
}
function alternate(id){
  if(document.getElementsByTagName){
    var table = document.getElementById(id);
    var rows = table.getElementsByTagName("tr");
    for(i = 1; i < rows.length; i++){
      //manipulate rows
      if(i % 2 == 0){
        rows[i].className = "offgrey";
        rows[i].onmouseover = function() { this.className='ongrey' };
        rows[i].onmouseout = function() { this.className='offgrey' };
      }else{
        rows[i].className = "off";
        rows[i].onmouseover = function() { this.className='on' };
        rows[i].onmouseout = function() { this.className='off' };
      }
    }
  }
}

function vldProfile(){

	noOfQuestions = document.forms[1].noofquestions.value;
	if (isNaN(noOfQuestions))
		return false;
	numQuestions = 	parseInt(noOfQuestions);
	
	if (numQuestions <= 0)
		return false;
	
	for (i=1;i<=numQuestions;i++){
	// for each question perform the following
		eval("answerRadio = document.forms[1].answer"+i);
		flag = false;
		for (j=0; j<answerRadio.length; j++){
			if (answerRadio[j].checked)
			{
				flag = true;
				break;  
			}
		}// end of answers for
		
		if (flag){
		// answer selected for this ith question.
			selectedAns = answerRadio[j].value;
			
			if ( (selectedAns.length >=4 ) && ( selectedAns.substr(0,5) == "other" ) ){
				eval('othertext = document.forms[1].answer'+i+'other');
				if (trim(othertext) == ""){
					alert("Please specify the answer");
					othertext.focus();
					return false;
				}
			}// end of if answer == 'other'

		 // End of answer selected for this i th question	
		}else
		{
			eval("ismandatory = document.forms[1].question"+i+"mandatory");
			if (ismandatory.value == "Y"){
				questionText = eval("document.forms[1].questionText"+i+".value");
				alert("Please select an answer for this question:\n" + questionText);
				return false;
			}
		
		}
		
	}// end of questions for
//	linkSubmitForm(templ,targetPage,param1,param2,param3,param4,param5);
	return true;
}// end of vldProfile1

function open_pdf_window(ixc,pdf){
	if (ixc == 'catalog')
		pdfurl = regularprefix + '/webdata/mfr_promo/' + pdf;
	else
		pdfurl = regularprefix + '/webdata/' + ixc + '/' + pdf;

	window.open("/catalog/download.cfm?pdfurl="+pdfurl,"pdfwindow",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=450');
}		
