<!--
// this page will going to store the commonly use javascript functions.
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) {
		home_over = newImage("images/home2.gif");
		industries_over = newImage("images/industries2.gif");
		bulletin_over = newImage("images/topbulletin2.gif");
		contactus_over = newImage("images/contactus2.gif");
		search_over = newImage("images/search2.gif");
		franchises_over = newImage("images/franchises2.gif");
		leftprime_over = newImage("images/leftprime2.gif");
		leftselect_over = newImage("images/leftselect2.gif");
		leftstandard_over = newImage("images/leftstandard2.gif");
		leftindustry_over = newImage("images/leftindustry2.gif");
		leftindustries_over = newImage("images/leftindustries2.gif");
		lefthotbusinesses_over = newImage("images/lefthotbusinesses2.gif");
		leftfranchises_over = newImage("images/leftfranchises2.gif");
		leftbizopps_over = newImage("images/leftbusinesses2.gif");
		leftresource_over = newImage("images/leftresource2.gif");
		leftneedaloan_over = newImage("images/l-needaloan2.gif");
		leftifranchise_over = newImage("images/ifranchise2.gif");
		leftsba_over = newImage("images/leftsba2.gif");
		leftscore_over = newImage("images/leftscore2.gif");
		leftwomensassocs_over = newImage("images/leftwomensassocs2.gif");
		leftsmalloffice_over = newImage("images/leftsmalloffice2.gif");
		leftrequestinfo_over = newImage("images/leftrequestinfo2.gif");
		leftcontactus_over = newImage("images/leftcontactus2.gif");
		ladvertising_over = newImage("images/l-advertising2.gif");
		lautomotive_over = newImage("images/l-automotive2.gif");
		lbusinessservices_over = newImage("images/l-businessservices2.gif");
		lcomputer_over = newImage("images/l-computer2.gif");
		leducational_over = newImage("images/l-educational2.gif");
		lfood_over = newImage("images/l-food2.gif");
		lhealthandbeauty_over = newImage("images/l-healthandbeauty2.gif");
		lhomebased_over = newImage("images/l-homebased2.gif");
		lmobile_over = newImage("images/l-mobile2.gif");
		lretail_over = newImage("images/l-retail2.gif");
		lsales_over = newImage("images/l-sales2.gif");
		lspecialty_over = newImage("images/l-specialty2.gif");
		ltanning_over = newImage("images/l-tanning2.gif");
		lvending_over = newImage("images/l-vending2.gif");
		lmoreindustries_over = newImage("images/l-moreindustries2.gif");
		lbusconsulting_over = newImage("images/leftbusconsulting2.gif");
		lbookmark_over = newImage("images/bookmark2.gif");
		lspecificopp_over = newImage("images/l-specificopp2.gif");
		preloadFlag = true;
	}
}
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 addToFavorites(strURL, strText) { 

	if (window.external) {
		window.external.AddFavorite (strURL,strText);
	}
	else { 
		if (navigator.appCodeName == "Mozilla") {
			bktext = open("", "displayWindow", "width=200,height=100,status=no,toolbar=no,menubar=no");
			bktext.document.open();
			bktext.document.write("<html><body bgcolor='white' text='black'>"
			+"<font face='Verdana, Arial' size='2'>In order to Bookmark this Page, "
			+"please <a href='javascript:self.close();'>Click Here</a> to <a href='javascript:self.close();'>Close this window</a>"
			+", then Press CTRL+D after closing.");
			bktext.document.write("</font></body></html>");
			bktext.document.close() ;
		}
		else {
			alert("Sorry! Your browser doesn't support this function.");
		}	
	}
} 

function checkframe(){
	if (self != top) {
		top.location = self.location
	}
}

function sendQue(cookie) {
	cookie += "; path=/;"
	document.cookie = cookie;
}

function pageOffset() {
    if (document.layers) {
        document.layers['layerName'].pageX = window.pageXOffset + 16;
        document.layers['layerName'].pageY = window.pageYOffset + 520;
    }
    else if (document.all) {
        document.all['layerName'].style.posLeft = document.body.scrollLeft + 16;
        document.all['layerName'].style.posTop = document.body.scrollTop + 520;
    }
    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 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.left = '-13em';
        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-YVL function for popunder here
//------------------------------------------------
var pgName = "/popShow.asp";
var wdwSetting = "location=no,directories=no,status=no,menubar=no,toolbar=no,scrollbars=no,resizable=no,width=635,height=430";

//calc today - midnight 
var iexpire = new Date();
iexpire.setUTCHours(23);
iexpire.setUTCMinutes(59);
iexpire.setUTCSeconds(0);

function winPut (cName, cValue) {
	//.... increament the SBFWincnt pop counter

	var icount = CookieGrab(cName);
//  alert('SBFWincnt=' + icount);
	if (icount == null)	  icount=1;
	else{
		if (cValue==null)	icount++;
			else			icount= cValue;
	}	
	CookiePut(cName, icount, iexpire);
}
function CookieGrab (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 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;  

	//.. 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 CookiePurge (cName){
	var cValue = CookieGrab(cName);  
	document.cookie = cName + "=" + cValue + "; expires=" + iexpire.toGMTString();
}
function CookieCount(){
	var icount = CookieGrab('SBFcnt')
	if(icount == null) {
		CookiePut('SBFcnt','1')
		return 1
	}else {
	var newcount = parseInt(icount) + 1;
	CookiePurge('SBFcnt')
	CookiePut('SBFcnt',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 popShow() {
	var icount = CookieGrab('SBFcnt');
	var iWin = CookieGrab('SBFWincnt');		//increamented only when pop-leads clicked-on by user
	
	//if the page not wrapped in a frame
	if (self == top && self.name == 'new_window') return;
	else{	
	 if (self == top && self.name != 'new_window') {
		//... dont popup another if window=new_window  -which is a pop-lead clicked-on
		if (icount == null)	icount=1;
		 else				icount++;
		CookiePut('SBFcnt', icount, iexpire);

		//-- SBFwinSess Cookie found then popup already opened, so exit
		icount = CookieGrab('SBFwinSess');
		if  (icount != null)  return;
		CookiePut('SBFwinSess','1');			//-- SBFwinSess cookie expires when browser session closes

		var icount1 = CookieGrab('SBFcnt');
		if (icount1 != null) {	
		//.. alert ('iWin=' +iWin);
			if (iWin == null || iWin < 3) {		
				//...if 3 pops-leads clicked-on by user then stop, no more popups for today
				mynewWindow = window.open(pgName,'popShow', wdwSetting);			
				if (mynewWindow != null)	mynewWindow.blur();
			}
		}	
	}else{
	top.location = self.location
	 }
	}	   
}
var win=null;
var mypage= "/popSBF.asp";
var myname= "sbfpop";
var w= "312";
var h= "400";
var pos= "center";
var infocus= "back";
function popPhone() {
if (self == top && self.name == 'new_sbf') return;
	 else{
	 if (self == top && self.name != 'new_sbf') {	 
	
		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 ValidateSLen(fieldLength){ //this func validates how may records has been selected
	if (fieldLength == 0) {fieldLength = 10}
	var k=0;

	if (!multirequest.StrZor.length){	//(!undefined) will evalue to true
		var numclients=1;
		if (multirequest.StrZor.checked) k=1;
	}else{
		var numclients=multirequest.StrZor.length;	
		for (var n=0; n<numclients; n++){
			if(multirequest.StrZor[n].checked) k=k+1;
		}
	}

	if (k>fieldLength){
		alert("Please limit your selection up to " + fieldLength + ". You have selected " + k);
		return false;
		}
	else if(k==0){
		alert("Please make at least one selection.");
		return false;
		}
	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 verify2(button)	{
	var formhere=document.multirequest
	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) ? "#09517B" : "#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 verifygen(button)	{
	var formhere=document.frmLeads
	{
		button.value = 'Please Wait';
		button.disabled = true;
		//return true;
		formhere.submit();
	}
}	
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";
	}
}					
// -->
