/********************************************************
*
* Copyright 1989-2008 DSHI Systems, Inc.
*
* Use of this code is expressly forbidden without prior
* written consent.
*
* Portions of this code were derived from:
*
* Pop-it menu-  Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
*********************************************************/

var defaultMenuWidth="250" //set default menu width.
var loadTimer;

////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
{
if ((window.location.pathname.toLowerCase() == "/fmdtriage.html") || (window.location.pathname.toLowerCase() == "/fmdtriagetest.html"))
{
	if (ie5)
		
		document.write('<div id="fmdEvaluate" style="position: absolute; height: 900px; width: 100%; z-index: 0; top: 115px;"></div>');
	else
	{
//		if ((window.location.pathname.toLowerCase() != "/fmdtriagetest.html"))
//			document.write('<div id="fmdEvaluate" style="position: absolute; height: 90%; width: 100%; z-index: 0; top: 115px;"></div>')
	}
}
else
{
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')
document.write('<div id="popvideo"></div>')
document.write('<div id="popfmd2"></div>')
document.write('<div id="imgPane"></div>')
document.write('<div id="pcpVid"></div>')
}
document.write('<div id="loading"><CENTER><IMG SRC="/loading.gif"><BR><SPAN CLASS="lMsg">Loading...</SPAN></CENTER></div>');
document.write('<div id="popfooter"></div>')
//document.write('<div id="pcpBeta" style="position: absolute; z-index: 100; top: 0px; left: 3px; font-size: 8pt; font-family: arial; width: 98%; text-align: right;">&#223;eta</div>');

}
function showFlash4(pType) {
showLoading();
videoobj=ie5? document.all.menuSection : document.getElementById("menuSection")
var vHTML = '<center><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="442" id="newSplash2" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" /><param name="scale" value="noscale" /><param name="FlashVars" value="al=' + getWn() + '&pType='+pType+'" />'
vHTML += '<param name="movie" value="/newsplash2.swf" /><param name="salign" value="ct" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="bgcolor" value="#ffffff" /><embed src="/newsplash2.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="900" height="442" name="newsplash2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="newSplash2" salign="ct" scale="noscale" FlashVars="al=' + getWn() + '&pType='+pType+'" />'
vHTML += '</object>'
videoobj.innerHTML = vHTML;
setTimeout("document.getElementById('newSplash2').focus()", 10);
}

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}
function sImage(imageName){
imgobj=ie5? document.all.imgDsp : document.getElementById("imgDsp")
var iHTML = '<IMG SRC="/images/' + imageName + '">'
imgobj.innerHTML = iHTML
imgobj.style.visibility ="visible"
}

function doVideo(videoName, videoSize){
videoobj=ie5? document.all.popvideo : document.getElementById("popvideo")
var vHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="400" id="vPopL" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" /><param name="salign" value="lt" />'
vHTML += '<param name="FlashVars" value="vID=' + videoName + '&vLD=' + videoListID + '" />'
vHTML += '<param name="movie" value="/vPopL.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/vPopL.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="400" height="400" name="vPopL" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" salign="lt" FlashVars="vID=' + videoName + '&vLD=' + videoListID + '" />'
vHTML += '</object>'
videoobj.innerHTML = vHTML;
var tPos = f_scrollTop() + ((f_clientHeight() - 400) / 2);
if (tPos < 82) {
    videoobj.style.top = "82px";
}
else  {
    videoobj.style.top = tPos + "px";
}
videoobj.style.visibility ="visible"
}

function hideVideo(){
videoobj=ie5? document.all.popvideo : document.getElementById("popvideo")
videoobj.style.visibility = "hidden"
}
function getH(){
var h;
if(document.innerHeight){ h=document.innerHeight;
} else if(document.documentElement.clientHeight){ h=document.documentElement.clientHeight;
} else if(document.body){ h=document.body.clientHeight; }
return h;
}
function doImageOld(x, w, h, i){
scroll(0,0)
var wI = (parseInt(w) + parseInt('200'))
var hI = (parseInt(h) + parseInt('40'))
var wI2 = 0 - (wI/2)
var hI2 = 0 - (hI/2)
var iHTML = '<TABLE STYLE="width: ' + wI + 'px; background-color: #F0FAFE; border-style: solid; border-width: 2px; border-color: #808080; border-collapse: collapse;">'
iHTML += '<TR><TD COLSPAN=2 ID="iHdr"><A HREF="javascript:closeImage()" ID="clsBtn">Close</A></TD></TR>'
iHTML += '<TR STYLE="height: ' + hI +'px">'
iHTML += '<TD WIDTH=165px>'
iHTML += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="165" height="470" id="iPop" align="middle">'
iHTML += '<param name="allowScriptAccess" value="sameDomain" /><param name="FlashVars" value="xP=' + x + '&dP=' + i +'" />'
iHTML += '<param name="movie" value="/iPop.swf" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/iPop.swf" loop="false" menu="false" quality="high" wmode="transparent" bgcolor="#ffffff" width="165" height="470" name="iPop" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="xP=' + x + '&dP=' + i +'" />'
iHTML += '</object><BR>'
iHTML += '</TD>'
iHTML += '<TD><DIV id="imgDsp" ></DIV></TD>'
iHTML += '</TR><TR><TD COLSPAN=2><DIV ID="iCpy">Copyright 1989-2007 DSHI Systems, Inc.</DIV></TD></TR></TABLE>'

imgobj=ie5? document.all.imgPane : document.getElementById("imgPane")
imgobj.innerHTML = iHTML
imgobj.style.visibility = "visible"
imgobj.style.offsetWidth = wI
imgobj.style.offsetHeight = hI
imgobj.style.marginLeft = wI2 + "px"
imgobj.style.marginTop = hI2 + "px"
if (parseInt(imgobj.offsetTop) < 170) {
	hI2 += (170 - parseInt(imgobj.offsetTop));
	imgobj.style.marginTop = hI2 + "px"
}
}
function doImage(x, w, h, i) {
var dW = w + 180;
var dW2 = dW + 20;
var dH = h + 60;
var dH2 = dH + 20;

videoobj=ie5? document.all.imgPane : document.getElementById("imgPane")
var tPos = f_scrollTop() + ((f_clientHeight() -dH2) / 2);
if (tPos < 82) {
    videoobj.style.top = "82px";
}
else  {
    videoobj.style.top = tPos + "px";
}
videoobj.style.height = dH2 + "px";
videoobj.style.width = dW2 + "px";
videoobj.style.marginLeft = (0-(dW2/2)) + "px";
var vHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + dW2 + '" height="' + dH2 + '" id="vPopL" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" />';
vHTML += '<param name="FlashVars" value="xP=' + x + '&dP=' + i + '&dW=' + dW + '&dH=' + dH +'" />'
vHTML += '<param name="movie" value="/iPopNew.swf" /><param name="salign" value="lt" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/iPopNew.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="' + dW2 + '" height="' + dH2 + '" name="vPopL" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FlashVars="xP=' + x + '&dP=' + i + '&dW=' + dW + '&dH=' + dH +'" scale="noscale" salign="lt" />'
vHTML += '</object>'
videoobj.innerHTML = vHTML;
videoobj.style.visibility ="visible"
}

function hideImage() {
 closeImage();
}
function closeImage() {
imgobj=ie5? document.all.imgPane : document.getElementById("imgPane")
imgobj.style.visibility = "hidden"
}
function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=((typeof optWidth!="undefined")? optWidth : defaultMenuWidth) + "px"
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-10+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY-5+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

function doThmOvr(tID, tTip) {
if (!document.all&&!document.getElementById)
return
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.style.backgroundColor = '#99CACF';
}

function doThmOut() {
if (!document.all&&!document.getElementById)
return
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.style.backgroundColor = '#FFFFFF';
}

function doBMH(){
return
if (!document.all&&!document.getElementById)
{
return
}
hdrobj=ie5? document.all.pcpHdr : document.getElementById("pcpHdr")
imgobj=ie5? document.all.bmovl : document.getElementById("bmovl")
t = (parseInt(hdrobj.offsetTop) + 104)
imgobj.style.top =  t + "px"
t = (parseInt(hdrobj.offsetLeft) + 28)
imgobj.style.left = t + "px"
imgobj.style.visibility = "visible"
}


function doBM() {
	if(typeof onBookmarkButtonPressed == 'function') { 
		onBookmarkButtonPressed(fmdPageType); 
	} 
	else
{
	if (window.sidebar) {
		if (navigator.appVersion.indexOf("Mac")!=-1)
			alert("To bookmark this page:\n\nPress OK.\nThen press Command-D");
		else
			alert("To bookmark this page:\n\nPress OK.\nThen press CTRL-D");
	}
	else if (window.external)
		window.external.AddFavorite(document.URL, document.title);
	
	else if( window.opera && window.print )
    	{
    		var mbm = document.createElement('a');
    		mbm.setAttribute('rel','sidebar');
    		mbm.setAttribute('href',document.URL);
    		mbm.setAttribute('title',document.title);
    		mbm.click();
	}
	else if (navigator.appVersion.indexOf("Mac")!=-1)
	{
			alert("To bookmark this page:\n\nPress OK.\nThen press Command-D");
	}
}
}

function doEM() {
	if(typeof onEmailButtonPressed == 'function') { 
		onEmailButtonPressed(fmdPageType); 
	} 
	else
	{
		if ((window.fmdPageType != undefined) && (fmdPageType == 'PCP'))
		{
			window.location = 'mailto:?Subject='+ document.title.substr(7) + '&Body=%0D%0A' + escape('Dear Doctor,') + '%0D%0A%0D%0A' + escape('I have completed a symptom evaluation at http://www.freeMD.com.') + '%0D%0A%0D%0A' + escape('Please click on the link below to view a detailed record of my results:') + '%0D%0A%0D%0A' + escape(document.URL);
		}
		else
		{
			window.location = 'mailto:?Subject='+ document.title.substr(7) + '&Body=%0D%0A' + escape('I found this medical information at http://www.freeMD.com and I think you will find it helpful: ' + document.URL) + '.%0D%0A%0D%0A%0D%0A' + escape('Visit http://www.freeMD.com to see the only electronic doctor on the Internet that conducts an interview, analyzes symptoms, and provides expert advice -- for free.')
		}
	}
}

function doPR() {
	if(typeof onPrintButtonPressed == 'function') { 
		onEPrintButtonPressed(fmdPageType); 
	} 
	else
	{
		window.print();
	}
}


function doSE() {
	if(typeof onSearchButtonPressed == 'function') { 
		onSearchButtonPressed(fmdPageType); 
	} 
	else
	{
		setWn("");
		window.location = "/search.html";	
	}
}

function doHM() {
	if(typeof onHomePressed == 'function') { 
		onHomePressed(fmdPageType); 
	} 
	else
	{
		setWn("");
		window.location = "/";	
	}
}

function doHDR() {
	if(typeof onBannerPressed == 'function') { 
		onBannerPressed(fmdPageType); 
	} 
	else
	{
		setWn("");
		window.location = "/";	
	}
}

if (ie5||ns6)
document.onclick=hidemenu

function doD(eID, eSubID) {
 doT(eID, eSubID);
}

function doT(eID, eSubID){
//alert("client height: " + f_clientHeight());
//scroll(0,0)
showLoading();
fmd2obj=ie5? document.all.popfmd2 : document.getElementById("popfmd2")
var vHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="600" id="vPopL" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" />'
vHTML += '<param name="FlashVars" value="eID=' + eID + '&sID=' + eSubID + '" />'
vHTML += '<param name="movie" value="/fmdpop1.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/fmdpop1.swf" quality="high" wmode="transparent" bgcolor="#ffffff" name="fmdpop1" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="800" height="600" FlashVars="eID=' + eID + '&sID=' + eSubID + '" />'
vHTML += '</object>'
fmd2obj.innerHTML = vHTML;
var tPos = f_scrollTop() + ((f_clientHeight() - 500) / 2);
if (tPos < 82) {
    fmd2obj.style.top = "82px";
}
else  {
    fmd2obj.style.top = tPos + "px";
}
fmd2obj.style.visibility ="visible"
}
function hidefmd2(){
fmd2oobj=ie5? document.all.popfmd2 : document.getElementById("popfmd2")
fmd2oobj.style.visibility = "hidden"
fmd2oobj.innerHTML = ""
}

function closeFmd2(){
fmd2oobj=ie5? document.all.popfmd2 : document.getElementById("popfmd2")
fmd2oobj.style.visibility = "hidden"
fmd2oobj.innerHTML = ""
}
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function doG(eID){
//alert("client height: " + f_clientHeight());
//scroll(0,0)
showLoading();
fmd2obj=ie5? document.all.popfmd2 : document.getElementById("popfmd2")
var vHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="600" id="vPopL" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" />'
vHTML += '<param name="FlashVars" value="eID=' + eID + '&gE=1" />'
vHTML += '<param name="movie" value="/fmdpop1.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/fmdpop1.swf" quality="high" wmode="transparent" bgcolor="#ffffff" name="fmdpop1" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="800" height="600" FlashVars="eID=' + eID + '&gE=1" />'
vHTML += '</object>'
fmd2obj.innerHTML = vHTML;
var tPos = f_scrollTop() + ((f_clientHeight() - 500) / 2);
if (tPos < 82) {
    fmd2obj.style.top = "82px";
}
else  {
    fmd2obj.style.top = tPos + "px";
}
fmd2obj.style.visibility ="visible"
}
function doFooter(footerName){
showLoading();
videoobj=ie5? document.all.popfooter : document.getElementById("popfooter")
var vHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="520" height="450" id="vPopL" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" /><param name="salign" value="lt" />'
vHTML += '<param name="FlashVars" value="pN=' + footerName + '&eN=' + document.URL +  '" />'
vHTML += '<param name="movie" value="/footpop.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/footpop.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="520" height="450" name="vPopL" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" salign="lt" FlashVars="pN=' + footerName + '&eN=' + document.URL + '" />'
vHTML += '</object>'
videoobj.innerHTML = vHTML;
var tPos = f_scrollTop();
var cHeight = f_clientHeight();
if (cHeight > 400)
	tPos += ((f_clientHeight() - 400) / 2);
else
	tPos += 10;

if (tPos < 82) {
    videoobj.style.top = "82px";
}
else  {
    videoobj.style.top = tPos + "px";
}
videoobj.style.left = "50%";
videoobj.style.marginLeft = "-260px";
videoobj.style.visibility ="visible";
//videoobj.style.zIndex = 500;
//alert(videoobj.style);
}

function doAbout() {
	doFooter("About");
}

function doFAQ() {
	doFooter("FAQ");
}
function doTOU() {
	doFooter("TOU");
}
function doNewV() {
	doFooter("NewV");
}
function hideFootpop(){
videoobj=ie5? document.all.popfooter : document.getElementById("popfooter")
videoobj.style.visibility = "hidden"
if (document.getElementById('newSplash2'))
  setTimeout("document.getElementById('newSplash2').focus()", 10);
}
function showFlash(pType) {
showLoading();
videoobj=ie5? document.all.menuSection : document.getElementById("menuSection")
var vHTML = '<center><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="632" id="newSplash2" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" /><param name="scale" value="noscale" /><param name="FlashVars" value="al=' + getWn() + '&pType='+pType+'" />'
vHTML += '<param name="movie" value="/newsplash2.swf" /><param name="salign" value="ct" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="bgcolor" value="#ffffff" /><embed src="/newsplash2.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="900" height="632" name="newsplash2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="newSplash2" salign="ct" scale="noscale" FlashVars="al=' + getWn() + '&pType='+pType+'" />'
vHTML += '</object>'
videoobj.innerHTML = vHTML;
setTimeout("document.getElementById('newSplash2').focus()", 10);
}
function doTriageLoad() {
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) {  // if we've detected an acceptable version
	showLoading();
	tStr = window.location.href;
	if (tStr.indexOf('?') > 0)
	{
		urlParams = tStr.substr(tStr.indexOf('?')+1);
		if (ie5)
			urlParams += "&ie=1";
	}
	else
	{
		if (ie5)
			urlParams = "ie=1";
		else
			urlParams = "";
	}
    if (screen.height <= 768)
	{
	  oH = 460;
	  oW = 599;	
	}
	else
	{
	if (screen.height <= 900)
	{
	  oH = 560;
	  oW = 729;	
	}
	else
	{
	  oH = 590
	  oW = 768;
	}
	}
    var iHTML = '<center><object id="fmdTriage" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    + 'width="' + oW + '" height="' + oH + '"'
    + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    + '<param name="movie" value="FMDTriage.swf" /><param name="salign" value="ct" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />'
    + '<param name="FlashVars" value="' + urlParams + '" />'
    + '<embed src="FMDTriage.swf" loop="false" quality="high" bgcolor="#ffffff" '
    + ' width="100%" height="600" name="FMDTriage" align="top"'
    + ' play="true"'
    + ' loop="false"'
    + ' quality="high"'
    + ' wmode="transparent"'
    + ' allowScriptAccess="sameDomain"'
    + ' type="application/x-shockwave-flash"'
    + ' pluginspage="http://www.macromedia.com/go/getflashplayer" id="fmdTriage2">'
    + '<\/embed>'
    + '<\/object>'
  } else {  // flash is too old or we can't detect the plugin
    var iHTML = ''
  	+ 'FreeMD requires the Macromedia Flash Player.'
   	+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash</a>';
  }
imgobj=ie5? document.all.fmdEvaluate : document.getElementById("fmdEvaluate")
imgobj.innerHTML = iHTML
ftrobj=ie5? document.all.fmdNewFooter : document.getElementById("fmdNewFooter")
fOH = oH + 20;
alert("oh: " + fOH);
ftrobj.style.top = fOH + "px";
ftrobj.style.visibility = "visible";
setTimeout("document.getElementById('fmdTriage').focus()", 50);
}

function doPCPVideo(){
videoobj=ie5? document.all.pcpVid : document.getElementById("pcpVid")
var vHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="340" height="260" hspace="0" vspace="0" id="vemb" align="top">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" /><param name="FlashVars" value="vName=PCPWelcome"><param name="salign" value="lt" /><param name="wmode" value="transparent" />'
vHTML += '<param name="movie" value="/vemb2.swf" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="bgcolor" value="#ffffff" /><embed src="/vemb2.swf" loop="false" menu="false" quality="high" scale="noscale" bgcolor="#ffffff" width="340" height="260" name="vemb" align="top" wmode="transparent" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" salign="lt" FlashVars="vName=PCPWelcome" />'
vHTML += '</object>'
videoobj.innerHTML = vHTML;
videoobj.style.visibility = "visible";
}

function doEncyclopedia(iPath, wName)
{
	setWn(wName);
	window.location = '/' + iPath;
}
function doEvaluate(iPath, wName)
{
//var uR = confirm("You consent and agree that use of this site does not constitute a physician patient relationship.\n\nfreeMD® is no substitute for your physician’s personal examination and evaluation of your symptoms.\n\nfreeMD is provided for information purposes only.\n\nPlease review our terms of use.");
//	if (uR) {
		setWn(wName);
		showLoading();
		window.location.href = '/fmdTriage.html?e='+iPath;
//	}
//	window.name = wName;
//	alert('iPath: ' + iPath + '\n' + iPath.replaceAll(' ','-').replaceAll('--', '-'));
//	window.location.href = '/' + iPath.replaceAll(' ','-').replaceAll('--', '-');

}
function doTriageClose(newLoc) {
	if(typeof onEvaluationComplete == 'function') { 
	// this needs to be changed to include newLoc, Interval, Location, Gender, Age,  ChiefComplaint, AddINfo
		onEvaluationComplete(); 
	} 
	else
		window.location.replace('/records/' + newLoc + '.htm');
}
function doATL()
{
	alert(doATL);
	NewWindow=window.open('/fmdTriage.html?'+window.location.search.substring(1),'fmdTriage','width=810,height=740,left=0,top=0,toolbar=No,location=No,scrollbars=Yes,status=No,resizable=Yes,fullscreen=No');
	checkOpenWindow(NewWindow);
}
function launchSym(e)
{
	doEvaluate(e);
//	window.name = wName;
//	window.location.href = '/' + e.replace(' ','-');
//		showLoading();
//		window.location.href = '/fmdTriage.html?e='+e;
}
function checkOpenWindow (openWin)
{
    var exists = false;
    if (openWin && !openWin.closed)
    {
        exists = true;
        try {
            openWin.focus();
        }
        catch (e) {
            exists = false;
        }
     }
    if (!exists)
    {
        alert("The window you attempted to open was blocked");
        // do something here
    }
}
function setIt()
{
function setIt2()
{
}
}
function replacePage()
{
window.location.replace("/fmdtriage.html");
alert("done");
}

function showLoading()
{
	loadTimer = setTimeout('doLoadingMsg()', 250);
//doLoadingMsg();
}
function doLoadingMsg()
{
lobj=ie5? document.all.loading : document.getElementById("loading")
lobj.style.visibility = "visible";
}
function clearLoading()
{
	clearTimeout(loadTimer);
lobj=ie5? document.all.loading : document.getElementById("loading")
lobj.style.visibility = "hidden";
	if(typeof onPageFullyLoaded == 'function') { 
		onPageFullyLoaded(fmdPageType); 
	} 
}
function doFB()
{
	doFooter("Feedback");

}
function showTriage() {
showLoading();
imgobj=ie5? document.all.hTitleText : document.getElementById("hTitleText")
imgobj.innerHTML = decodeURIComponent(window.location.search.substr(3));
document.title = imgobj.innerHTML + ": Evaluation - freeMD";

    if (screen.height <= 768)
	{
	  oH = 460;
	  oW = 599;	
	}
	else
	{
		if (screen.height <= 900)
		{
			  oH = 560;
			  oW = 729;	
		}
		else
		{
			  oH = 590
			  oW = 768;
		}
	}
	tStr = window.location.href;
	if (tStr.indexOf('?') > 0)
	{
		urlParams = tStr.substr(tStr.indexOf('?')+1);
	}
	else
	{
		urlParams = "";
	}

videoobj=ie5? document.all.menuSection : document.getElementById("menuSection")
var vHTML = '<center><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="632" id="fmdtriage" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" /><param name="scale" value="noscale" /><param name="FlashVars" value="' + urlParams + '" />'
vHTML += '<param name="movie" value="/fmdtriage.swf" /><param name="salign" value="ct" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="bgcolor" value="#ffffff" /><embed src="/fmdtriage.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="900" height="632" name="fmdtriage" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="fmdtriage" salign="ct" scale="noscale" flashVars="' + urlParams + '" />'
vHTML += '</object>'
videoobj.innerHTML = vHTML;
setTimeout("document.getElementById('fmdtriage').focus()", 10);
}
function  doReferences() {
imgobj=ie5? document.all.cites : document.getElementById("cites")
if (imgobj.style.visibility == 'visible') {
	imgobj.style.visibility ="hidden"
}
else
{
	imgobj.style.visibility ="visible"
	window.scrollTo(findScrollLeft(), findPosY(imgobj));
//	alert("pos: " + findPosY(imgobj));
}
}
function findScrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.y) {
        curtop+=obj.y;
    }
    return curtop;
}

function doDoc(docName) {
	window.open('http://www.dshisystems.com/leadership.aspx', 'authors');
}
function doPM(docID) {
	window.open('http://www.ncbi.nlm.nih.gov/pubmed/'+docID, 'authors');

}
function doPT() {
	alert("POS TEST");
}
function hidefmddemo() {
videoobj=ie5? document.all.popfooter : document.getElementById("popfooter")
videoobj.style.visibility = "hidden"
}

function doPOSRef(pos, age){
showLoading();
videoobj=ie5? document.all.popfooter : document.getElementById("popfooter")
var vHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"' 
vHTML += 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="520" height="450" id="vPopL" align="middle">'
vHTML += '<param name="allowScriptAccess" value="sameDomain" /><param name="salign" value="lt" />'
vHTML += '<param name="FlashVars" value="pos=' + pos + '&age=' + age +  '" />'
vHTML += '<param name="movie" value="/fmddemo.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/fmddemo.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="520" height="450" name="vPopL" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" salign="lt" FlashVars="pos=' + pos + '&age=' + age + '" />'
vHTML += '</object>'
videoobj.innerHTML = vHTML;
var tPos = f_scrollTop();
var cHeight = f_clientHeight();
if (cHeight > 400)
	tPos += ((f_clientHeight() - 400) / 2);
else
	tPos += 10;

if (tPos < 82) {
    videoobj.style.top = "82px";
}
else  {
    videoobj.style.top = tPos + "px";
}
videoobj.style.left = "50%";
videoobj.style.marginLeft = "-260px";
videoobj.style.visibility ="visible";
//videoobj.style.zIndex = 500;
//alert(videoobj.style);
}

function doPOS(Pos, Zip, Age) {
	refURL = "http://maps.google.com";
	if (Pos == 0) {
		refURL = 'http://maps.google.com/maps?q='+Zip+', hospital%20emergency%20room';
	}
	else
	if (Pos == 1) {
		refURL = 'http://maps.google.com/maps?q='+Zip+', urgent%20care%20center';
	}
	else
	if (Pos == 3) {
		refURL = 'http://maps.google.com/maps?q='+Zip+', dentist';
	}
	else
	if (Pos == 4) {
		refURL = 'http://maps.google.com/maps?q='+Zip+', urgent%20care%20center%20OR%20family%20practice';
	}
	else if (Pos == 2) {
		if (Age < 18)
			refURL = 'http://maps.google.com/maps?q='+Zip+', pediatrician';
		else
			refURL = 'http://maps.google.com/maps?q='+Zip+', family%20practice';
	}
	w = window.open(refURL, "fmdReferral");
	w.focus();
}
String.prototype.replaceAll = function( 
strTarget, // The substring you want to replace
strSubString // The string you want to replace in.
){
var strText = this;
var intIndexOfMatch = strText.indexOf( strTarget );
 

// Keep looping while an instance of the target string
// still exists in the string.
while (intIndexOfMatch != -1){
// Relace out the current instance.
strText = strText.replace( strTarget, strSubString )
 

// Get the index of any next matching substring.
intIndexOfMatch = strText.indexOf( strTarget );
}
 

// Return the updated string with ALL the target strings
// replaced out with the new substring.
return( strText );
}
function showAds() {
	return (getWf(1) == '');
}
function getWn() {
	return getWf(0);
}
function getWf(wE) {
	if (window.name) {
		s = window.name.split(":");
		if (s.length >= wE) {
			return s[wE];
		}
	}
	return "";
}
function setWn(wN) {
	setWf(wN, 0);
}
function setWf(wV, wE) {
	s = window.name.split(":");
	s[wE] = wV;
	window.name = s.join(":");
}
function setAds() {
	if (document.referrer.toLowerCase().indexOf('nih.gov') >= 0) {
		setWf(1, 1);
	} else {
		setWf("", 1);
	}
}
function pLoad() {

if (window.name.indexOf(":") < 0) {
	setAds();
}

if (showAds() && (getWn() != 'TheNewWin')) {
	adobj2=ie5? document.all.gas : document.getElementById("gas");
	if (adobj2)
		adobj2.style.visibility = "visible";
	adobj=ie5? document.all.gads : document.getElementById("gads");
	if (adobj)
		adobj.style.visibility = "visible";
}
}