<!--
// 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 cssjsmenu(menuid)
{
  var i;
  var j;
  var node;
  var child;
  var parent;

  // if the browser doesn't even support
  // document.getElementById, give up now.
  if (!document.getElementById)
  {
    return true;
  }

  // check for downlevel browsers
  // Opera 6, IE 5/Mac are not supported

  var version;
  var offset;

  offset = navigator.userAgent.indexOf('Opera');
  if (offset != -1)
  {
    version = parseInt('0' + navigator.userAgent.substr(offset + 6), 10);
    if (version < 7)
    {
      return true;
    }
  }

  offset = navigator.userAgent.indexOf('MSIE');
  if (offset != -1)
  {
    if (navigator.userAgent.indexOf('Mac') != -1)
    {
      return true;
    }
  }

  var menudiv = document.getElementById(menuid);

  // ul
  var ul = new Array();

  for (i = 0; i < menudiv.childNodes.length; i++)
  {
    node = menudiv.childNodes[i];
    if (node.nodeName == 'UL')
    {
      ul[ul.length] = node;
    }
  }

  // ul > li
  var ul_gt_li = new Array();

  for (i = 0; i < ul.length; i++)
  {
    node = ul[i];
    for (j = 0; j < node.childNodes.length; j++)
    {
      child = node.childNodes[j];
      if (child.nodeName == 'LI')
      {
        ul_gt_li[ul_gt_li.length] = child;
        child.style.display = 'inline';
        child.style.listStyle = 'none';
        child.style.position = 'static';
      }
    }
  }

  // ul > li > ul
  var ul_gt_li_gt_ul = new Array();

  for (i = 0; i < ul_gt_li.length; i++)
  {
    node = ul_gt_li[i];
    for (j = 0; j < node.childNodes.length; j++)
    {
      child = node.childNodes[j];
      if (child.nodeName == 'UL')
      {
        ul_gt_li_gt_ul[ul_gt_li_gt_ul.length] = child;
		child.style.position = 'absolute';
        //   child.style.position = 'relative';
        child.style.left = '-13em';
       // child.style.left = '-10px';
       child.style.bottom = '0px';
       child.style.visibility = 'hidden';

        // attach hover to parent li
        parent = child.parentNode;
        parent.onmouseover = function (e)
        {
          var i;
          var child;
          var point;

          // stop the pure css hover effect
          this.style.paddingBottom = '0';

          for (i = 0; i < this.childNodes.length; i++)
          {
            child = this.childNodes[i];
            if (child.nodeName == 'UL')
            {
              point = getPageXY(this);
              setPageXY(child, point.x, point.y + this.offsetHeight);
              child.style.visibility = 'visible';
            }
          }
          return false;
        };
        parent.onmouseout = function (e)
        {
          var relatedTarget = null;
          if (e)
          {
            relatedTarget = e.relatedTarget;
            // work around Gecko Linux only bug where related target is null
            // when clicking on menu links or when right clicking and moving
            // into a context menu.
	    if (navigator.product == 'Gecko' && navigator.platform.indexOf('Linux') != -1 && !relatedTarget)
	    {
	      relatedTarget = e.originalTarget;
	    }
          }
          else if (window.event)
          {
            relatedTarget = window.event.toElement;
          }

          if (elementContains(this, relatedTarget))
          {
            return false;
          }

          var i;
          var child;
          for (i = 0; i < this.childNodes.length; i++)
          {
            child = this.childNodes[i];
            if (child.nodeName == 'UL')
            {
                child.style.visibility = 'hidden';
            }
          }
          return false;
        };
      }
    }
  }
  return true;
}



function elementContains(elmOuter, elmInner)
{
  while (elmInner && elmInner != elmOuter)
  {
    elmInner = elmInner.parentNode;
  }
  if (elmInner == elmOuter)
  {
    return true;
  }
  return false;
}

function getPageXY(elm)
{
  var point = { x: 0, y: 0 };
  while (elm)
  {
    point.x += elm.offsetLeft;
    point.y += elm.offsetTop;
    elm = elm.offsetParent;
  }
  return point;
}


function setPageXY(elm, x, y)
{
  var parentXY = {x: 0, y: 0 };

  if (elm.offsetParent)
  {
    parentXY = getPageXY(elm.offsetParent);
  }

  elm.style.left = (x - parentXY.x) + 'px';
  elm.style.top  = (y - parentXY.y) + 'px';
}

function init()
  {
    cssjsmenu('navbar');
    if (document.getElementById)
    {
      var kill = document.getElementById('hoverJS'); 
      kill.disabled = true;
    }
  }
  function init1()
  {
    cssjsmenu('navbar1');
    if (document.getElementById)
    {
      var kill = document.getElementById('hoverJS'); 
      kill.disabled = true;
    }
  }
  function init2()
  {
    cssjsmenu('navbar2');
    if (document.getElementById)
    {
      var kill = document.getElementById('hoverJS'); 
      kill.disabled = true;
    }
  }
//----------------------------
//-s popup code
//----------------------------
var pgName = "/popRender.cfm";
var WDWprops = "location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes,width=635,height=440";

// midnight 
var endDT = new Date();
endDT.setUTCHours(23);
endDT.setUTCMinutes(58);
endDT.setUTCSeconds(59);

function RenderWIN (cName, cValue) {
	//.... increament the RenderCnt pop counter

	var iCnt = SeekCookie(cName);
//  alert('RenderCnt=' + iCnt);
	if (iCnt == null)	  iCnt=1;
	else{
		if (cValue==null)	iCnt++;
			else			iCnt= cValue;
	}	
	KeepCookie(cName, iCnt, endDT);
}
function SeekCookie (cName){
    //----  Function returns value of cookie specified by "cName".
    //----    name - String object containing the cookie name.
    //----    returns - String object containing the cookie value, or null if cookie does not exist.

	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 TextCookie(j);
			
		n = document.cookie.indexOf(" ", n) + 1;    
		if (n == 0) break;   
	}
return null;
}
function KeepCookie (cName, cValue) {  
	var argv = KeepCookie.arguments;  
	var argc = KeepCookie.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;  

	//.. alert('Cookie/aexpire=' + aexpire +'\n GMT='+ aexpire.toGMTString() );
	document.cookie = cName + "=" + escape (cValue) + 
	((aexpire == null) ? "" : ("; expires=" + aexpire.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}
function EraseCookie (cName){
	var cValue = SeekCookie(cName);  
	document.cookie = cName + "=" + cValue + "; expires=" + endDT.toGMTString();
}
function NBRoCookie(){
	var iCnt = SeekCookie('FFScnt')
	if(iCnt == null) {
		KeepCookie('FFScnt','1')
		return 1
	}else {
	var newcount = parseInt(iCnt) + 1;
	EraseCookie('FFScnt')
	KeepCookie('FFScnt',newcount,endDT)
	return iCnt
   }
}
function TextCookie(offset) {
	var iStr = document.cookie.indexOf (";", offset);
	if (iStr == -1)  iStr = document.cookie.length;
return unescape(document.cookie.substring(offset, iStr));
}
function popRender() { 
	var iCnt = SeekCookie('FFScnt');
	var iWin = SeekCookie('RenderCnt');		//increamented only when pop-leads clicked-on by user
	
	if (self == top && self.name == 'new_popRender') return;
	else{	
	 if (self == top && self.name != 'new_popRender') {
		//... dont popup another if window=new_popRender  -which is a pop-lead clicked-on
		if (iCnt == null)	iCnt=1;
		 else				iCnt++;
		KeepCookie('FFScnt', iCnt, endDT);

		//-- RenderSess Cookie found then popup already opened, so exit
		iCnt = SeekCookie('RenderSess');
		if  (iCnt != null)  return;
		KeepCookie('RenderSess','1');			//-- RenderSess cookie expires when browser session closes

		var iCnt1 = SeekCookie('FFScnt');
		if (iCnt1 != null) {	
		//.. alert ('iWin=' +iWin);
			if (iWin == null || iWin < 3) {		
				//...if 3 pops-leads clicked-on by user then stop, no more popups for today
				myWindow = window.open(pgName,'popRender', WDWprops);			
				if (myWindow != null)	myWindow.blur();
			}
		}	
	}else{
	top.location = self.location
	 }
	}	   
}

var win=null;
var mypage= "/pop800.cfm";
var myname= "ffspop";
var w= "318";
var h= "200";
var pos= "center";
var infocus= "back";
function pop800() {
if (self == top && self.name == 'new_ffs') return;
	 else{
	 if (self == top && self.name != 'new_ffs') {	 
	
		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
		}
	}
} 

function Validatefran(){
	var theform=document.formSelect
	if (theform.selindustry.value == "") {
		 theform.selindustry.value = "0"
		} 	 
	if (theform.selcapital.value == "") {
		 theform.selcapital.value = "0"
		} 
	if ((theform.selcapital.value == "0" ) || (theform.selindustry.value == "0" ))  { 
		alert("Please select an industry and an investment range for target results.");
		theform.selcapital.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 bgchbxcolor(checkbox) {
	tr = checkbox.parentNode.parentNode;
	tr.style.backgroundColor = (checkbox.checked) ? "#296b8b" : "#898989";
}
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 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)';
			}
		}
	}
}		

//-e

-->