<!--// this page stores 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 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.frmRequest
	if (verify(formhere)){
		button.value = 'Please Wait';
	    button.disabled = true;
	    //return true;
	   formhere.submit();
	} else {
        return false;
    }
}		
function verifygen(button)	{
	var formhere=document.frmLeads
	{
		button.value = 'Please Wait';
		button.disabled = true;
		//return true;
		formhere.submit();
	}
}
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";
}
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";
	}
}						
-->
