<!--
// 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 SendTrackID(strText){
	strText += "; path=/;"
	document.cookie = strText;
}
function SendEtID(intID){
	var strText = "leadetid=" + intID + "; path=/;"
	document.cookie = strText;
}
function SendCtID(intID){
	var strText = "leadcid=" + intID + "; path=/;"
	document.cookie = strText; 
}

function Fvalidate(){
//this validation func used by quicksubmit.asp..
	var k=0;

	if (!qform.cBox.length){	//(!undefined) will evalue to true
		var numclients=1;
		if (qform.cBox.checked) k=1;
	}else{
		var numclients=qform.cBox.length;
		for (var n = 0; n < numclients; n++){
			if(qform.cBox[n].checked == true)
			{var k=k+1};
		}
	}
	//window.alert('You selected '+k+' companies');
	if (k>20){ 
		alert("Please limit your selection to maximum of 20 links. You have selected " + k);
		return false;
		}
	else if(k==0){
		alert("Please select at least one listing....");
		return false;
		}
	return true;
} 

function Lenvalidate(vlen){
//this validation func used by quicksubmit.asp..
	var k=0;
	if (vlen == 0)  { vlen = 10}
	if (!qform.cBox.length){	//(!undefined) will evalue to true
		var numclients=1;
		if (qform.cBox.checked) k=1;
	}else{
		var numclients=qform.cBox.length;
		for (var n = 0; n < numclients; n++){
			if(qform.cBox[n].checked == true)
			{var k=k+1};
		}
	}
	//window.alert('You selected '+k+' companies');
	if (k>vlen){
		alert("Please limit your selection to maximum of " + vlen + " links. You have selected " + k);
		return false;
		}
	else if(k==0){
		alert("Please select at least one listing....");
		return false;
		}
	return true;
} 

function Bustframe(){
	if (self != top) {
	top.location = self.location
	}
}

function pageOffset() {
    if (document.layers) {
        document.layers['layerName'].pageX = window.pageXOffset + 599;
        document.layers['layerName'].pageY = window.pageYOffset + 115;
    }
    else if (document.all) {
        document.all['layerName'].style.posLeft = document.body.scrollLeft + 599;
        document.all['layerName'].style.posTop = document.body.scrollTop + 115;
    }
    setTimeout('pageOffset()',100);
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(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];}
}

var cm=null;
document.onclick = new Function("show(null)")
function getPos(el,sProp) {
	var iPos = 0
	while (el!=null) {
		iPos+=el["offset" + sProp]
		el = el.offsetParent
	}
	return iPos

}

function show(el,m) {
	if (m) {
		m.style.display='';
		m.style.pixelLeft = getPos(el,"Left") 
		m.style.pixelTop = getPos(el,"Top") + el.offsetHeight
	}
	if ((m!=cm) && (cm)) cm.style.display='none'
	cm=m
}
function showright(el,m) {
	if (m) {
		m.style.display='';
		m.style.pixelLeft = getPos(el,"Left") 
		m.style.pixelTop = getPos(el,"Top") + el.offsetHeight
	}
	if ((m!=cm) && (cm)) cm.style.display='none'
	cm=m
}
// function for popunder here
var expDays = 1;	// number of days the cookie should last
var page = "/popunders.asp";
var windowprops = "location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes,width=730,height=355";

var exp = new Date();
exp.setUTCHours(23);
exp.setUTCMinutes(59);
exp.setUTCSeconds(0);

function GetCookie (name) {  
	var arg = name + "=";  
	var alen = arg.length;  
	var clen = document.cookie.length;  
	var i = 0;  
	while (i < clen) {    
		var j = i + alen;    
		if (document.cookie.substring(i, j) == arg)      
		return getCookieVal (j);    
		i = document.cookie.indexOf(" ", i) + 1;    
		if (i == 0) break;   
		}  
	return null;
}
function SetCookie (name, value) {  
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (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 = name + "=" + escape (value) + 
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) +  
		((domain == null) ? "" : ("; domain=" + domain)) +    
		((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1); 
	var cval = GetCookie(name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function amt(){
	var count = GetCookie('count')
	if(count == null) {
	SetCookie('count','1')
	return 1
}else {
	var newcount = parseInt(count) + 1;
	DeleteCookie('count')
	SetCookie('count',newcount,exp)
	return count
   }
}
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function winPops (argName, argValue) {
	//.... increamentPopUNwins

	var NBR = GetCookie(argName);
	if (NBR == null)	  NBR=1;
	else{
		if (argValue==null)	NBR++;
			else			NBR= argValue;
	}	
	SetCookie(argName, NBR, exp);
}
function popunder() {
	var count = GetCookie('popUNcnt');
	var iPop = GetCookie('PopUNwins');		//increamented on popup-clicked
	
	//if the page not wrapped in a frame
	 if (self == top && self.name == 'new_popUnders') return;
	 else{
	 if (self == top && self.name != 'new_popUnders') {	 
		//... dont popup, just increament 
		if (count == null)	count=1;
		 else				count++;
		SetCookie('popUNcnt', count, exp);

		// PopUNsess Cookie found then popup already opened, so exit
		count = GetCookie('PopUNsess');
		if  (count != null)  return;
		SetCookie('PopUNsess','1');			//PopUNsess expire when browser closes

		var count1 = GetCookie('popUNcnt');
		if (count1 != null) {	
			if (iPop == null || iPop < 3) {		
				//...if 3 pops-leads clicked-on by user then stop, no more iPop for today
				myWin = window.open(page,'popUnders', windowprops);	
				if (myWin != null)	myWin.blur();
			}
		}	
	}else{
	top.location = self.location
	}
  }	   
}
function OLDpopunder() {
	var count = GetCookie('count');
	//if the page not wrapped in a frame
	if (self == top) {
		
		if (count == null) {
		count=1;
		SetCookie('count', count, exp);
		
		var count1 = GetCookie('count');
			if (count1 != null) {	
				mynewWindow = window.open(page,'popUnder', windowprops);
				mynewWindow.blur()
			}	
		}
		else {
		count++;
		SetCookie('count', count, exp);
		   }
	}
	else {
	top.location = self.location
	}	   
}

function Validatefil(){
	var theform=document.formSelect
	if (theform.selcapital.value == "") {
		 theform.selcapital.value = "0"
		} 
	if (theform.selindustry.value == "") {
		 theform.selindustry.value = "0"
		} 	 
	if ((theform.selcapital.value == "0" ) || (theform.selindustry.value == "0" ))  { 
		alert("Please select an industry and an investment range for better results.");
		theform.selcapital.focus();  
		return false;  
	}
	else
		return true; 
}

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 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 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 verifygen(button)	{
	var formhere=document.frmLeads
	{
		button.value = 'Please Wait';
		button.disabled = true;
		//return true;
		formhere.submit();
	}
}
function bgchbxcolor(checkbox) {
	tr = checkbox.parentNode.parentNode;
	tr.style.backgroundColor = (checkbox.checked) ? "#000000" : "#898989";
}

// End -->