var MenuOn=0, MenuSH = new Array, TimeId, MainDivs=new Array('about','search','resources','careers'),Divs1=new Array();


browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; }
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; }
else { roll = 'false'; }


function over(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
function out(img,ref)  { if (roll == 'true') { document.images[img].src = ref; } }


function preloadImg(file){
  image = new Image();
  image.src = file;
}

function rol_img() {
	
	if (isMSIE) {
		self.scrollTo(0);
//		preloadImg('img/doctors/1-on.gif');
	}
	dh=getDocumentHeight();
	wh=getWindowHeight();
	//alert(document.body.scrollHeight);
  if ( (getDocumentHeight()<664)&&(isMSIE) ) {
  	//document.body.clientHeight="660px";
  	document.getElementById('fi4a1').style.height="664px"; 
  	h2=664;
  	//alert('p3');
  } else {
  	if (wh>664) {  		
  		//alert('p1');
	  	document.getElementById('fi4a2').style.height=0+"px";
  		document.getElementById('fi4a3').style.height=0+"px";

  		document.getElementById('fi4a1').style.height=wh+"px"; 	
     	h3=document.getElementById('fi4a1').offsetHeight;	
        //alert('h3='+h3);  
        if (h3>wh) {
    	    h2=document.getElementById('fi4a1').clientHeight;
        } else {
  	        h2=document.getElementById('fi4a1').style.height;
        }
  	}else {
  		//alert('p2');
  		document.getElementById('fi4a1').style.height="100%"; 
  		h2=document.getElementById('fi4a1').clientHeight;
  	}
    //alert('h2='+h2);  
    h2=parseInt(h2);	
  }
  h1=h2-77-225-7-20;
  //alert(h2);
  //if (isMSIE) {
  	document.getElementById('fi4a2').style.height=h1+"px";
  	document.getElementById('fi4a3').style.height=h1+"px";
  //}
}

function rol_img1() {
//	preloadImg('img/menu/home-on.gif');
}




function navig_d (par,type,nIdDiv,source) {
var lay=document.getElementById(par);

if (type==0) {
MenuSH[par]=1;
MenuOn=1;
clearTimeout(TimeId);
//lay.style.visibility="visible";
if (nIdDiv=='') {
	lay.style.display="block";
}
lay.style.visibility="visible";
} //end if type=0

if (type==1) {
MenuSH[par]=0;
if (source=="div") {
	MenuOn=0;
	clearTimeout(TimeId);
	TimeId=setTimeout('HideAllDivs("'+nIdDiv+'")',400);
} else {
	if (MenuOn) {
		clearTimeout(TimeId);
		TimeId=setTimeout('MenuOff("'+par+'","'+nIdDiv+'")',400);
	}

}
}//end if type==1

}
function hideChild(arr,nIdDiv) {
		for (i=0; i < arr.length; i++) {	
			if (nIdDiv=='') {
				document.getElementById(arr[i]).style.display="none";
			}
			document.getElementById(arr[i]).style.visibility="hidden";
		}
}

function HideAllDivs (nIdDiv) {
	if (!MenuOn) {
		for (i=0; i < MainDivs.length; i++) {
			if (nIdDiv=='') {
				document.getElementById(MainDivs[i]).style.display="none";
			}
			document.getElementById(MainDivs[i]).style.visibility="hidden";
		}
	}
}

function MenuOff (lid,nIdDiv) {
	if ( (!MenuSH[lid]) ) {	
		if (nIdDiv=='') {
			document.getElementById(lid).style.display="none";
		}
		document.getElementById(lid).style.visibility="hidden";
	}
}

function HideShow (par,t) {
var lay=document.getElementById(par);
if (t==0) { 
	//lay.style.display="block";
	lay.style.visibility="visible"; 
	}
if (t==1) {
	//lay.style.display="none"; 
	lay.style.visibility="hidden";
	}
}


function menu (td,p,color,colorf,img)
{
if (p==1) {
document.getElementById(td).style.background=color; 
document.getElementById(td).style.color=colorf;
//document.getElementById(td).style.textDecoration="none";
}
if (p==2) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat right'; 
document.getElementById(td).style.color=colorf; 
document.getElementById(td).style.textDecoration="underline"; 
}
if (p==3) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat center'; 
document.getElementById(td).style.color=colorf; 
document.getElementById(td).style.textDecoration="underline"; 
}

}
function menuIns (td,p,color,colorf,img)
{
if (p==1) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat left'; 
//document.getElementById(td).style.color=colorf;
//document.getElementById(td).style.textDecoration="underline"; 
}
if (p==2) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat center top'; 
//document.getElementById(td).style.color=colorf;
document.getElementById(td).style.textDecoration="none"; 
}

}

function menuImg (td,p,color,colorf)
{
if (p==1) {
document.getElementById(td).style.backgroundImage='url(img/'+color+')'; 
document.getElementById(td).style.color=colorf;
}
if (p==2) {
document.getElementById(td).style.backgroundImage='url(img/'+color+')';
document.getElementById(td).style.color=colorf; 
}

}

function add_click (url,target) {
if (url) {
//alert("Debug:"+url);
//alert("Debug:"+target);
if (target=="_parent") {
parent.location.href=url;
}
if (target=="_blank") {
window.open(url);
}
if (target=="_self") {
location.href=url;
}
if (target=="_top") {
top.location.href=url;
}
}//end if !url
}

function createTarget(form)
       {
          _target = form.target; _colon = _target.indexOf(":");

        if(_colon != -1)
          {
          form.target = _target.substring(0, _colon);
          form.args   = _target.substring(_colon+1);
          }
        
        else if(typeof(form.args) == "undefined")
               {
               form.args = "";
               }

        if(form.args.indexOf("{")!=-1)
          {
           _args     = form.args.split("{");
           form.args = _args[0];
           
           for(var i = 1; i < _args.length;i++)
              {
                _args[i] = _args[i].split("}");
                form.args += eval(_args[i][0]) + _args[i][1];
               }
           }
           
           form.args = form.args.replace(/ /g,"");
           _win = window.open('',form.target,form.args);
          
          if(typeof(focus)== "function")
                _win.focus();
                return true;
        } 

function checkEmpty(field, errStr)
{
	if (field)
	{
		if (field.length && field.name == null)
		{
			var execFlag = false;
	
			for(var i = 0; i < field.length; i++)
			{
				execFlag |= checkEmpty(field[i], '');
				if (execFlag) break;
			}
			if (!execFlag) alert(errStr);
	
			return execFlag;
		}
		switch (field.type)
		{
			case "checkbox":
			case "radio":
				if (!field.checked)
				{
					if (errStr.length) alert(errStr);
					field.focus();
					return false;
				}
				break;
			default:
				if (field.value == '')
				{
					if (errStr.length) alert(errStr);
					if (field.type != 'hidden')
						field.focus();
					return false;
				}
				break;
		}
	}
	return true;
}