var useBSNns;
if (useBSNns){
	if (typeof(bsn) == "undefined")
		bsn = {}
	var _bsn = bsn;
}
else{
	var _bsn = this;
}

_bsn.Crossfader = function (divs, fadetime, delay ){	
	this.nAct = -1;
	this.aDivs = divs;
	for (var i=0;i<divs.length;i++)	{
		document.getElementById(divs[i]).style.opacity = 0;
		document.getElementById(divs[i]).style.position = "absolute";
		document.getElementById(divs[i]).style.filter = "alpha(opacity=0)";
		document.getElementById(divs[i]).style.display = "none";
        //document.getElementById(divs[i]).style.height = "1px";
	}
	this.nDur = fadetime;
	this.nDelay = delay;
	this._newfade();
}
_bsn.Crossfader.prototype._newfade = function(){
	if (this.nID1)
		clearInterval(this.nID1);
	this.nOldAct = this.nAct;
	this.nAct++;
	if (!this.aDivs[this.nAct])	this.nAct = 0;
	
	if (this.nAct == this.nOldAct)
		return false;
	document.getElementById( this.aDivs[this.nAct] ).style.display = "block";
	this.nInt = 50;
	this.nTime = 0;
	var p=this;
	this.nID2 = setInterval(function() { p._fade() }, this.nInt);
}
_bsn.Crossfader.prototype._fade = function(){
	this.nTime += this.nInt;
	var ieop = Math.round( this._easeInOut(this.nTime, 0, 1, this.nDur) * 100 );
	var op = ieop / 100;
	document.getElementById( this.aDivs[this.nAct] ).style.opacity = op;
	document.getElementById( this.aDivs[this.nAct] ).style.filter = "alpha(opacity="+ieop+")";
	if (this.nOldAct > -1)	{
		document.getElementById( this.aDivs[this.nOldAct] ).style.opacity = 1 - op;
		document.getElementById( this.aDivs[this.nOldAct] ).style.filter = "alpha(opacity="+(100 - ieop)+")";
	}
	if (this.nTime == this.nDur)	{
		clearInterval( this.nID2 );
		if (this.nOldAct > -1)
			document.getElementById( this.aDivs[this.nOldAct] ).style.display = "none";
		
        var p=this;
		this.nID1 = setInterval(function() { p._newfade() }, this.nDelay);
	}
}
_bsn.Crossfader.prototype._easeInOut = function(t,b,c,d){
	return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}

 var centaur = { src: '/_sifr/centaur.swf' };
  var myriadprocondensed = { src: '/_sifr/myriadprocondensed.swf'};
  var myriadcondensedweb = { src: '/_sifr/myriadcondensedweb.swf'};
  var gillsans = { src: '/_sifr/gillsansmt.swf'};
  var avenir = { src: '/_sifr/avenirA.swf'};

  sIFR.debugMode = true;
  sIFR.delayCSS  = true;
  // sIFR.domains = ['novemberborn.net'] // Don't check for domains in this demo
  sIFR.activate(myriadprocondensed, avenir);


  doSifr = function(){
        sIFR.replace(myriadprocondensed, {
    selector: '.sTitleMain'
	,wmode:'transparent'
    ,css: {
   //   '.sIFR-root': { 'color': '#660000', 'letter-spacing': -1.5, 'text-transform': 'capitalize' }
     '.sIFR-root': { 'color': '#5292ce', 'letter-spacing': 0.3, 'font-size':'23px'},
	 'a':{ 'color': '#b8b8b8', 'text-decoration': 'none'}
    }
  });
  }
    doSifrHome = function(){
        sIFR.replace(avenir, {
			selector: '#sifr_welcome'
			,wmode:'transparent'
			,css: {
		   //   '.sIFR-root': { 'color': '#660000', 'letter-spacing': -1.5, 'text-transform': 'capitalize' }
			 '.sIFR-root': { 'color': '#666666', 'letter-spacing': '0.2', 'background-color':'#ffffff'}
			 , 'strong' : {'font-weight':'normal', 'color': '#000000', 'letter-spacing': 0, 'background-color':'#ffffff'}
			 ,'a':{ 'color': '#666666'}
			}
		}); 
		sIFR.replace(myriadcondensedweb, {
			selector: '.sifr_nav'
			,wmode:'transparent'
			,css: {
		   //   '.sIFR-root': { 'color': '#660000', 'letter-spacing': -1.5, 'text-transform': 'capitalize' }
			 '.sIFR-root': { 'color': '#666666', 'letter-spacing': -0.2, 'font-size':'14px', 'background-color':'#ffffff'}
			 , 'strong' : {'font-weight':'normal', 'color': '#000000', 'letter-spacing': 0,'background-color':'#ffffff'}
			}
		}); 
  } 
      doSifrCommercial = function(){
        sIFR.replace(avenir, {
			selector: '#sifr_intro'
			,css: {
		   //   '.sIFR-root': { 'color': '#660000', 'letter-spacing': -1.5, 'text-transform': 'capitalize' }
			 '.sIFR-root': { 'color': '#666666', 'letter-spacing': '0.2', 'background-color':'#ffffff', 'font-size':'12px'}
			 , 'strong' : {'font-weight':'normal', 'color': '#000000', 'letter-spacing': 0, 'background-color':'#ffffff'}
			 ,'a':{ 'color': '#ffffff'}
			 ,'a:hover': {'color':'#666666'}
			},wmode:'transparent'
		}); 
	  }
      
       doSifrSpotlight = function(){
        sIFR.replace(avenir, {
			selector: '#spotlight'
            ,wmode:'transparent'
			,css: {
		   //   '.sIFR-root': { 'color': '#000000', 'letter-spacing': -1.5, 'text-transform': 'capitalize', 'font-size':'15px' }
			 '.sIFR-root': { 'color': '#000000', 'letter-spacing': '-0.5', 'background-color':'#ffffff', 'font-size':'15px'}
			 , 'strong' : {'font-weight':'normal', 'color': '#21558c', 'letter-spacing': '-0.5', 'background-color':'#ffffff', 'font-size':'120%', 'text-decoration':'none'}
			 , 'a' : {'font-weight':'normal', 'color': '#21558c', 'letter-spacing': '-0.5', 'background-color':'#ffffff', 'font-size':'120%', 'text-decoration':'underline'}
			 ,'a:hover': {'color':'#666666'}
			}
		}); 
        }
        
        doSifrBannerAd = function(){
        sIFR.replace(avenir, {
			selector: '#bannerAdTitle',
            css: {
		   //   '.sIFR-root': { 'color': '#660000', 'letter-spacing': -1.5, 'text-transform': 'capitalize' }
			 '.sIFR-root': { 'color': '#000000', 'letter-spacing': '-0.2', 'background-color':'#f2b924', 'font-size':'19px', 'text-align':'center','padding':'10px'}
			 , 'strong' : { 'color': '#000000', 'letter-spacing': '-0.2', 'background-color':'#f2b924', 'font-weight':'normal', 'font-size':'80%'}
			 ,'a':{ 'color': '#000000', 'letter-spacing': '0.2', 'background-color':'#ecb420', 'font-size':'13px'}
			 ,'a:hover': {'color':'#666666'}
			}
		}); 
        sIFR.replace(avenir, {
			selector: '#bannerAdIntro',
            css: {
		   //   '.sIFR-root': { 'color': '#660000', 'letter-spacing': -1.5, 'text-transform': 'capitalize' }
			 '.sIFR-root': { 'color': '#000000', 'letter-spacing': '-0.2', 'background-color':'#f2b924', 'font-size':'14px', 'text-align':'left','padding':'10px'}
			 , 'strong' : { 'color': '#000000', 'letter-spacing': '-0.2', 'background-color':'#f2b924', 'font-weight':'normal', 'font-size':'80%'}
			 ,'a':{ 'color': '#ffffff'}
			 ,'a:hover': {'color':'#666666'}
			}
		}); 
	  }
      
      
      
      
      
      
  doOther = function(color){
	  color = "#"+color;
        sIFR.replace(avenir, {
			selector: '#bmi'
			,wmode:'transparent'
			,css: {
		   //   '.sIFR-root': { 'color': '#660000', 'letter-spacing': -1.5, 'text-transform': 'capitalize' }
			 '.sIFR-root': { 'color': '#000000', 'letter-spacing': '0.2', 'background-color':'#ffffff','font-size':'19px'}
			 , 'strong' : {'font-weight':'normal', 'color': color, 'letter-spacing': 0, 'background-color':'#ffffff'}
			 ,'a':{ 'color': '#666666'}
			}
		}); 
  }
 /*     sIFR.replace(myriadprocondensed, {
    selector: '.bdcrumb'
	,wmode:'transparent'
    ,css: {
   //   '.sIFR-root': { 'color': '#660000', 'letter-spacing': -1.5, 'text-transform': 'capitalize' }
     '.sIFR-root': { 'color': '#990000', 'letter-spacing': 0.0, 'font-size':'13px','font-weight':'bold','text-decoration':'none'}
	 ,'a': { 'text-decoration': 'none','color':'#000000'}
	 ,'a:link' { 'text-decoration': 'none','color':'#666666'}
    }
  });*/

  //]]>
 contactMe = function(e,x,y, who){
	if(e != null || e != ''){
		cfdisplay = document.getElementById('contactform').style.display;
		if(cfdisplay == 'inline'){
			document.getElementById('contactform').style.display = 'none';
		} else if(cfdisplay != 'inline'){
			document.getElementById('contactform').style.left=x+50;
			document.getElementById('contactform').style.top=y;
			document.getElementById('contactform').style.display = 'inline';
			where= "/tmepcontact.php?who="+who+"&em="+e;
			new Ajax.Updater('contactform', where, { asynchronous:true, evalScripts:true });
		}
	}
} 
  shownav = function(what,where,primnavback,color){
	if(where == 'clinicalspecialties'){
		if (navigator.appName == "Microsoft Internet Explorer"){
			posx = findPosX(clinicalspecialties);
			posy = findPosY(clinicalspecialties); 
		} else if (navigator.appName != "Microsoft Internet Explorer"){
			posx = findPosX(clinicalspecialties)-0;
			posy = findPosY(clinicalspecialties)-15;
		}
		//document.getElementById('initiatives_menu').style.display='none';
		document.getElementById('locations_menu').style.display='none';
		document.getElementById('healthprofessionals_menu').style.display='none';
		//document.getElementById('waystogive_menu').style.display='none';
	} else if(where == 'initiatives'){
		if (navigator.appName == "Microsoft Internet Explorer"){
			posx = findPosX(initiatives)-10;
			posy = findPosY(initiatives); 
		} else if (navigator.appName != "Microsoft Internet Explorer"){
			posx = findPosX(initiatives)-0;
			posy = findPosY(initiatives)-15;
		}
		document.getElementById('clinicalspecialties_menu').style.display='none';
		document.getElementById('locations_menu').style.display='none';
		document.getElementById('healthprofessionals_menu').style.display='none';
		//document.getElementById('waystogive_menu').style.display='none';
	} else if(where == 'locations'){
		if (navigator.appName == "Microsoft Internet Explorer"){
			posx = findPosX(locations)-13;
			posy = findPosY(locations); 
		} else if (navigator.appName != "Microsoft Internet Explorer"){
			posx = findPosX(locations)-15;
			posy = findPosY(locations)-15;
		}
		//document.getElementById('initiatives_menu').style.display='none';
		document.getElementById('clinicalspecialties_menu').style.display='none';
		document.getElementById('healthprofessionals_menu').style.display='none';
		//document.getElementById('waystogive_menu').style.display='none';
	} else if(where == 'healthprofessionals'){
		if (navigator.appName == "Microsoft Internet Explorer"){
			posx = findPosX(healthprofessionals)-10;
			posy = findPosY(healthprofessionals); 
		} else if (navigator.appName != "Microsoft Internet Explorer"){
			posx = findPosX(healthprofessionals)-15;
			posy = findPosY(healthprofessionals)-15;
		}
		//document.getElementById('initiatives_menu').style.display='none';
		document.getElementById('locations_menu').style.display='none';
		document.getElementById('clinicalspecialties_menu').style.display='none';
		//document.getElementById('waystogive_menu').style.display='none';
	} else if(where == 'waystogive'){
		if (navigator.appName == "Microsoft Internet Explorer"){
			posx = findPosX(waystogive)-10;
			posy = findPosY(waystogive); 
		} else if (navigator.appName != "Microsoft Internet Explorer"){
			posx = findPosX(waystogive)-11;
			posy = findPosY(waystogive)-15;
		}
		//document.getElementById('initiatives_menu').style.display='none';
		document.getElementById('locations_menu').style.display='none';
		document.getElementById('healthprofessionals_menu').style.display='none';
		document.getElementById('clinicalspecialties_menu').style.display='none';
	}
	document.getElementById(what).style.display='inline';
	document.getElementById(what).style.left=posx+5;
	document.getElementById(what).style.top=posy+0;
	document.getElementById(primnavback).style.backgroundColor='#'+color;
	
	
}
hideMenu = function (what,primnavback,color){
	document.getElementById(what).style.display='none';
	document.getElementById(primnavback).style.backgroundColor='#'+color+'';
}

function findPosX(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
		return curleft;
	}
function findPosY(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
		return curtop;
	}
aLoadalist = function(specialtyall,specialty, name,gp,city){
	//document.getElementById('map').style.display='none';
	if(gp == '' || gp == null){
		groupn = '';
	} else groupn = '&groupname='+gp;
	
	if(city == '' || city == null){
		cityn = '';
	} else cityn = '&city='+city;
	if((specialtyall != '' && specialty != '') || (specialtyall == '' && specialty != '')){
		where = '/_phy_dirlistA_test1.php?type='+specialty+'&name='+name+groupn+cityn;
	} else if(specialtyall != '' && specialty == ''){
		where = '/_phy_dirlistA_test1.php?type='+specialtyall+'&name='+name+groupn+cityn;
	} else where = '/_phy_dirlistA_test1.php?name='+name+groupn+cityn;
	document.getElementById('loading').style.display='inline';//document.getElementById('_nav_physiciansdirectory_c').innerHTML='';
	//document.getElementById('_nav_physiciansdirectory_c').style.display='none';
	new Ajax.Updater('bodytext', where, { asynchronous:true, evalScripts:true });
}
aLoadacrossref = function(type,groupname,city){
	//document.getElementById('map').style.display='none';
	//document.getElementById('list').innerHTML = '';
	document.getElementById('loading').style.display='inline';
	if(type != ''){
			where = '_phy_dirlistA_test1.php?type='+type;
		} else if(groupname != ''){
			where = '_phy_dirlistA_test1.php?groupname='+groupname;
		} else if(city != ''){
			where = '_phy_dirlistA_test1.php?city='+city;
		}
		new Ajax.Updater('bodytext', where, { asynchronous:true, evalScripts:true });
}


    function load(e) {
	var map;var directionsPanel;var directions;
      if (GBrowserIsCompatible()) {
           map = new GMap2(document.getElementById("map"));
      directionsPanel = document.getElementById("route");
	  map.addControl(new GSmallMapControl());
	  map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(36.12802,-86.84298), 15);
      directions = new GDirections(map, directionsPanel);
      directions.load(e+" to 36.12802,-86.84298");
	  
      }
    }
function showmap(e) {
	if(document.getElementById('domap').style.visibility != 'visible'){
		document.getElementById('domap').style.visibility='visible';
		document.getElementById('domap').style.overflow='visible';
		document.getElementById('floors').style.marginTop='30px';
      } else if(document.getElementById('domap').style.visibility == 'visible'){
		document.getElementById('domap').style.visibility='hidden';
		document.getElementById('domap').style.height='1px';
		document.getElementById('domap').style.overflow='hidden';
      }
	  if(e == 'o'){
	  	document.getElementById('domap').style.visibility='visible';
		document.getElementById('domap').style.overflow='visible';
		document.getElementById('floors').style.marginTop='0px';
	  }
    }
getDirections = function(){
	if(document.getElementById('directioninput').style.display != 'inline'){
		document.getElementById('directioninput').style.display='inline';
	} else if(document.getElementById('directioninput').style.display == 'inline'){
		document.getElementById('directioninput').style.display='none';
		document.getElementById('domap').style.visibility='hidden';
		document.getElementById('domap').style.height='1px';
		document.getElementById('domap').style.overflow='hidden';
		//showmap();
	}
	}	
doDirections = function(e){
if(document.getElementById('domap').style.visibility=='visible'){
	document.getElementById('route').innerHTML='';
}
load(e);
showmap('o');
}

loadPr = function(e, page, title){
	if(e == 'bodytext'){
		document.getElementById('bodytext').innerHTML='Loading......';
	}
		new Ajax.Updater(e, page, {asynchronous:true, evalScripts:true });
}

	function calcBMI(weight,h1,h2) {
		document.getElementById('bmistuff').style.display='inline';
		var d = document;
		var f = d.bmi;
		//var weight = f.elements.weight.value;
		//var h1 = f.elements.height1.value;
		//var h2 = f.elements.height2.value;
		//alert(h2);
		if ((weight == "" || h1 == "")) {
			alert("Please fill out the form completely to calculate your BMI");
			return false;
		} else if (isNaN(weight) || isNaN(h1) || isNaN(h2)) {
			alert("Please make sure you enter the correct values to calculate your BMI");
			return false;
		} else {
			var w = weight*.45359237;
			var h = h1*12;
			h = h-(-h2);
			h = h*.0254;
			h = h*h;
			var index = w/h;
			var index = index.toFixed(1); 
			if(index > 29.9){
				color = "e51837";
				size = " and are considered obese.";
			} else if(index > 24.9 && index < 30){
				color = "b7737d";
				size = " and are considered overweight.";
			} else if(index > 18.4 && index < 25){
				color = "000000";
				size = " and are considered normal.";
			} else if(index < 18.5){
				color = "1f6dfa";
				size = " and are considered underweight";
				//A BMI of less than 19 indicates you are underweight. A BMI between 20 and 24 is usually considered normal. A person with a BMI of 25 to 29 is considered overweight, and a person with a BMI of 30 or above is considered obese. Obesity is associated with an increased risk for heart disease, diabetes, and other life-threatening diseases.";
			}
			if (d.getElementById) {
				var e = d.getElementById("bmiPrint");
				e.innerHTML = "";
				e.innerHTML = "<div id='bmi'>Your BMI is <strong>" + index + ""+size+"</strong></div>";
				document.getElementById('bmiinfo').innerHTML = "A BMI of less than 19 indicates you are underweight. A BMI between 20 and 24 is usually considered normal. A person with a BMI of 25 to 29 is considered overweight, and a person with a BMI of 30 or above is considered obese. Obesity is associated with an increased risk for heart disease, diabetes, and other life-threatening diseases.";
				doOther(color);
			} else {
				
			}
		}
	}
	
	clear = function(){
		//alert('test');
		document.getElementById('clinicalspecialties_menu').style.display='none';
		document.getElementById('primarynav_clinicalspecialties').style.backgroundColor='#ffffff';
		document.getElementById('locations_menu').style.display='none';
		document.getElementById('locations_menu').style.backgroundColor='#ffffff';
		document.getElementById('healthprofessionals_menu').style.display='none';
		document.getElementById('healthprofessionals_menu').style.backgroundColor='#ffffff';
		document.getElementById('waystogive_menu').style.display='none';
		document.getElementById('waystogive_menu').style.backgroundColor='#ffffff';
		
	}
	sendData = function() {
        var url = '/healthprofessionals/_284life_submission.php';
        var pars = Form.serialize('carefinders');
        var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars,onComplete: showResponse} );
	}
    showResponse = function(){
    	alert("Thank you. We've received your request. Someone will be contacting you shortly.");window.location='http://www.sths.com';
    }
	