<!--
// this page will going to store the commonly use javascript functions.

function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 

function checkframe(){
	if (self != top) {
	top.location = self.location
	}
}

function SetQueryString(txt){
    document.cookie = txt;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		Platinum_over = newImage("images/platinum2.gif");
		Gold_over = newImage("images/gold2.gif");
		Silver_over = newImage("images/silver2.gif");
		Bronze_over = newImage("images/bronze2.gif");
		Platinum_Inside_over = newImage("images/platinum2-inside.gif");
		Gold_Inside_over = newImage("images/gold2-inside.gif");
		Silver_Inside_over = newImage("images/silver2-inside.gif");
		Bronze_Inside_over = newImage("images/bronze2-inside.gif");
		preloadFlag = true;
	}
}

function ValidateSelectLength(fieldLength){ //this func validates how may records has been selected
		var theform=document.multirequest
		
	if (fieldLength == 0) {fieldLength = 10}
	var k=0; 

	if (!theform.ZorID.length){	//(!undefined) will evalue to true
		var numclients=1;
		if (theform.ZorID.checked) k=1;
	}else{
		var numclients=theform.ZorID.length;	
		for (var n=0; n<numclients; n++){
			if(theform.ZorID[n].checked) k=k+1;
		}
	}

	if (k>fieldLength){
		alert("Please limit your selection to maximum of " + fieldLength + ". You have selected " + k);
		return false;
		}
	else if(k==0){
		alert("Please select at least one...");
		return false;
		}
	return true;
}

function ValidateCapCat(){
	var theform=document.frmCapCat
	if (theform.CategoryID.value == "") {
		 theform.CategoryID.value = "0"
		} 
	if (theform.CapRangeID.value == "") {
		 theform.CapRangeID.value = "0"
		} 	 
	if ((theform.CategoryID.value == "0" ) || (theform.CapRangeID.value == "0" ))  { 
		alert("For better matches, please pick an industry and an investment range before submit.");
		theform.CategoryID.focus();  
		return false;  
	}
	else
		return true; 
}

function verify1(button)	{
	var formhere=document.frmInstantInfo
	if (verify(formhere)){
		button.value = 'Please Wait';
	    button.disabled = true;
	    //return true;
	   formhere.submit();
	} else {
        return false;
    }
}		

function reloadCaptchaImage()
		{
		var rnum = parseInt(Math.random()*10);
		img = document.getElementById('Captcha'); 
		var newImgName = img.src +  "&rnum="+rnum;
		img.src = newImgName;
		}
		function InitiatePageRefresh()
		{
		var sURL = unescape(window.location.pathname);
		window.location.href = sURL;
		}

function bgchbxcolor(checkbox) {
	tr = checkbox.parentNode.parentNode;
	//tr.style.backgroundColor = (checkbox.checked) ? "#509320" : "#898989";
	tr.style.backgroundColor = (checkbox.checked) ? "#3BB9FF" : "#898989";
}
function verifygen(button)	{
	var formhere=document.frmLeads
	{
		button.value = 'Please Wait';
		button.disabled = true;
		//return true;
		formhere.submit();
	}
}
function showHide(ID) {

	var theseDivs = document.getElementById(ID).childNodes;
	for(var j=1; j<theseDivs.length;j++) {
		if(theseDivs[j].className=='tab_inner') {
			if(theseDivs[j].style.display=="block")  {
			theseDivs[j].style.display="none";
			document.getElementById(ID).firstChild.style.backgroundImage='url(/images/plus.gif)';
			}
		else  {
			theseDivs[j].style.display="block";
			document.getElementById(ID).firstChild.style.backgroundImage='url(/images/minus.gif)';
			}
		}
	}
}	
function verify2(button)	{
	var formhere=document.multirequest
	if (verify(formhere)){
		button.value = 'Please Wait';
	    button.disabled = true;
	    //return true;
	   formhere.submit();
	} else {
        return false;
    }
}
function showProvince(theProvince) {
var province = document.getElementById("prov");
//alert(theProvince.options[theProvince.selectedIndex].value);
	if (theProvince.options[theProvince.selectedIndex].value != "203") {
	province.style.display = "";
	}
	else {
	province.value="";
	province.style.display = "none";
	}
}				
function ValidateQuickSbm(vLgth){ //this func validates how may records has been selected
	var multirequest=document.multirequest
	
	if (vLgth == 0) {vLgth = 10}
	var k=0;

	if (!multirequest.ZorID.length){	//(!undefined) will evalue to true
		var numclients=1;
		if (multirequest.ZorID.checked) k=1;
	}else{
		var numclients=multirequest.ZorID.length;	
		for (var n=0; n<numclients; n++){
			if(multirequest.ZorID[n].checked) k=k+1;
		}
	}

	if (k>vLgth){
		alert("Please limit your selection to maximum of " + vLgth + ". You have selected " + k);
		return false;
		}
	else if(k==0){
		alert("Please select one or more listing.");
		return false;
		}
	return true;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
	x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; 
   if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
}
function sendcookie(name) {
	name += "; path=/;"
	document.cookie = name;
}

function SendEtcookie(intID){
	var strText = "FoodType=" + intID + "; path=/;"
	document.cookie = strText;
}
function SendCtcookie(intID){
	var strText = "FoodCat=" + intID + "; path=/;"
	document.cookie = strText;
}

 
//-----------------------
// start- popup functions
//-----------------------
var pgName = "/popups.asp";
var wdwSetting = "location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes,width=730,height=355";

var iexpire = new Date(); 
iexpire.setUTCHours(23);
iexpire.setUTCMinutes(59);
iexpire.setUTCSeconds(0);

function CookieGrab (cName){
	var argv = cName + "=";  
	var ilen = argv.length;  
	var vlen = document.cookie.length;  
	var n = 0;  
	while (n < vlen){
		var j = n + ilen;
		if (document.cookie.substring(n, j) == argv)
			return CookieContent(j);
		n = document.cookie.indexOf(" ", n) + 1;    
		if (n == 0) break;   
		}
	return null;
}
function CookiePut (cName, cValue) {  
	var argv = CookiePut.arguments;  
	var argc = CookiePut.arguments.length;  
	var aexpire = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  

	document.cookie = cName + "=" + escape (cValue) + 
	((aexpire == null) ? "" : ("; expires=" + aexpire.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}
function CookiePurge (cName){
	var aexpire = new Date();
	aexpire.setTime (aexpire.getTime() - 1); 
	var cValue = CookieGrab(cName);  
	document.cookie = cName + "=" + cValue + "; expires=" + aexpire.toGMTString();
}
function CookieCount(){
	var icount = CookieGrab('FDcount')
	if(icount == null) {
	CookiePut('FDcount','1')
	return 1
	}
else {
	var newcount = parseInt(icount) + 1;
	CookiePurge('FDcount')
	CookiePut('FDcount',newcount,iexpire)
	return icount
   }
}
function CookieContent(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)  endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function winPopups (argName, argValue) {
	//.... increamentFDwins

	var NBR = CookieGrab(argName);
	if (NBR == null)	  NBR=1;
	else{
		if (argValue==null)	NBR++;
			else			NBR= argValue;
	}	
	CookiePut(argName,NBR,iexpire);
}
function popit() {
	var icount = CookieGrab('FDcount');
	var iPop = CookieGrab('FDwins');		//increamented on popup-clicked
	
	//if the page not wrapped in a frame
	 if (self == top && self.name == 'new_popups') return;
	 else{
	 if (self == top && self.name != 'new_popups') {	 
		//... dont popup, just increament 
		if (icount == null)	icount=1;
		 else				icount++;
		CookiePut('FDcount', icount, iexpire);

		// FDsess Cookie found then popup already opened, so exit
		icount = CookieGrab('FDsess');
		if  (icount != null)  return;
		CookiePut('FDsess','1');			//FDsess expire when browser closes

		var icount1 = CookieGrab('FDcount');
		if (icount1 != null) {	
			if (iPop == null || iPop < 3) {		
				//...if 3 pops-leads clicked-on by user then stop, no more iPop for today
				myWin = window.open(pgName,'popit', wdwSetting);	
				if (myWin  != null)	myWin.blur();
			}
		}	
	}else{
	top.location = self.location
	}
  }	   
}
var win=null;
var mypage= "/popfood.asp";
var myname= "popfood";
var w= "516";
var h= "400";
//var pos= "center";
var pos= "top";
var infocus= "back";
function popback() {
if (self == top && self.name == 'new_popfood') return;
	 else{
	 if (self == top && self.name != 'new_popfood') {	 
	
		if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
		if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
		settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
		my_window=window.open(mypage,myname,settings);
		if (my_window != null)	my_window.blur(); 
		}else{
		top.location = self.location
		}
	}
} 
// -end	

function ValidateFranMatch(){
	var theform=document.frmCapCat
	var theCategoryID = theform.CategoryID.value 
	var theCapRangeID = theform.CapRangeID.value 
	var theStateID =  theform.StateID.value 
	
	if (theCategoryID == "") {
		theCategoryID = "0"
		} 
	if (theCapRangeID == "") {
		 theCapRangeID = "0"
		} 	
	if (theStateID == "") {
		 theStateID = "0"
		} 
	 	 
	if ((theCategoryID == "0") && (theCapRangeID == "0") && (theStateID == "0"))  { 
		alert("For better matches, please pick an industry or an investment range or a state before submit.");
		theform.CategoryID.focus();  
		return false;  
	}
	else
		return true; 
}
		
-->