var correctwidth=1024 
var stylesheet
var BuyBoxState
var tabtop = "155px";
var tableft = "283px";
var currentlayer
var lastlayer
var thisproductname
var lastplant //the last detail panel
var lastcard ="none" //he last highlighted card = cell table in the product tab
var cardlist = new Array()
var lastbuybox = 0



function right(e) {
var msg = "All images on this site are copyright\nand may not be used without prior permission";
if (navigator.appName == 'Netscape' && e.which == 3) {
alert(msg);
return false;
}
if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
alert(msg);
return false;
}
else return true;
}

function trap() 
  {
  if(document.images)
    {
    for(i=0;i<document.images.length;i++)
      {
      document.images[i].onmousedown = right;
      document.images[i].onmouseup = right;
      }
    }
  }









if (screen.width<correctwidth) {
stylesheet = "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"/css/hh2_lores.css\">";
document.write(stylesheet);
} 

ie5  = (document.all && document.getElementById); 
ns6 = (!document.all && document.getElementById);

//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }

var xmlHttp;
var rootpath;
rootpath = "http://www.healingherbs.co.uk/";   // be sure to change this to your URL
function GetXmlHttpObject(handler)
{
    var objXmlHttp=null
 
    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        alert("Opera not supported...")
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    {
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP"
        }
        try
        {
            objXmlHttp=new ActiveXObject(strName)
            objXmlHttp.onreadystatechange=handler
            return objXmlHttp
        }
        catch(e)
        {
            alert("Error. Scripting for ActiveX might be disabled")
            return
        }
    }
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler
        return objXmlHttp
    }
} 



function valuevalidation(entered, min, max, alertbox, datatype)
{
// Value-Validation (c) Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove the this line and the two lines above.
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
  {smalldatatype=datatype.toLowerCase();
   if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
  }
if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
{
	if (alertbox!="") {alert(alertbox);}
	document.getElementById(id).value=1;
	document.getElementById(id).focus();
	return false;
	}
else {return true;}
}
}

function submitform(thisform)
{alert(thisform);
//document.forms[thisform].submit();
document.thisform.submit();
}

function mouseexitstab(){//unhilite a card if mouse extis the tab area
//alert(lastcard);
			if(lastcard!='none'){
			var lastcardpic=lastcard.replace('card','pic');
			var lastcardid=lastcard.replace('card','');
		document.getElementById(lastcard).className = "";
		var thissrc = '/images/bach flower remedy products/' + lastcardid + '.gif';
		
		//if (thisid > 79) {document.getElementById(lastcardpic).src = thissrc};
}}







function ConvToInt(thisnumber){
	var pricecalc
pricecalc = (thisnumber*10000).toString(); //remove ./convert to string
pricecalc = pricecalc.substring(0,pricecalc.length-4)+'.'+ pricecalc.substring(pricecalc.length-4,pricecalc.length);
pricecalc = parseFloat(pricecalc); // convert to number
return(pricecalc);
}



Number.prototype.toDecimals=function(n){
    n=(isNaN(n))?
        2:
        n;
    var
        nT=Math.pow(10,n);
    function pad(s){
            s=s||'.';
            return (s.length>n)?
                s:
                pad(s+'0');
    }
    return (isNaN(this))?
        this:
        (new String(
            Math.round(this*nT)/nT
        )).replace(/(\.\d*)?$/,pad);
}




function UpdateBasketBox(id,temp1, price,temp2, product){

var frm
frm=document.getElementById("basketaddition");
frm.basketaddition_price.value  = price;
frm.basketaddition_id.value  = id;
frm.basketaddition_quantity.value = "";
document.getElementById("basketaddition_product").innerHTML  = '<p class=\"header4\">' + product + "</p>";
document.getElementById("basketaddition_capacity").innerHTML  = '<p class=\"bodytext\">' + temp1 + "</p>";
document.getElementById("basketaddition_quantity").value=1;
UpdatePriceCalc(1);
}



function UpdatePriceCalc(){


var qty = document.getElementById("basketaddition_quantity").value; 	
var price = document.getElementById("basketaddition_price").value;
price = parseFloat(price);
calcprice=price*qty;
calcprice = calcprice.toDecimals(2);
calcprice = "£" + calcprice;
document.getElementById("basketaddition_pricecalc").innerHTML = calcprice;
if(!IsNumeric(price)){document.getElementById("basketaddition_pricecalc").innerHTML ="Invalid number"};
//if(document.getElementById('BuyBox').style.visibility='visible')
//{document.getElementById('basketaddition_quantity').focus();
//document.getElementById('basketaddition_quantity').select();
//}
}


function UpdateId (){
if (document.getElementById("capacitylist").selectedIndex == 0){document.getElementById("basketaddition_id").value = document.getElementById("id10").value}

if (document.getElementById("capacitylist").selectedIndex == 1){document.getElementById("basketaddition_id").value = document.getElementById("id30").value}
}

function validatebasketaddition(FormName){

var frm = document.forms[FormName];

if (IsEmpty(frm.basketaddition_quantity)){alert('Please fill the quantity'); frm.basketaddition_quantity.focus();return false;};

if (frm.basketaddition_quantity.value==0){alert('Quantity must be more then zero'); frm.basketaddition_quantity.focus();return false;};

if (!IsNumeric(frm.basketaddition_quantity.value)) {alert('Quantity must be numeric'); frm.basketaddition_quantity.focus();frm.basketaddition_quantity.value="";return false;};

document.getElementById('BasketSummary').innerHTML="<p class='style6' style='margin-top:40px'>adding item...</p><img src='/Images/osx.gif' style='margin-left:15px' />";

getThisOrder('&basketaddition_id=' + frm.basketaddition_id.value + '&basketaddition_quantity=' + frm.basketaddition_quantity.value);

//alert(frm.basketaddition_quantity.value+'|'+frm.name+'|'+frm.id);
document.getElementById('basketaddition').reset();
MM_showHideLayers('BuyBox','','hide');
dimtabs(100);

}

function cardsnotgrey (thistab){
	//changes all cards to neutral background unless its already been selected as the active Detail and is therefore the Lastcard
var i
var thiscard
var thsbuydiv
var thispic
var thiscardlist = new Array()
var notessencepage = 0


switch(thistab)
{
case 12:
  thiscardlist = cardlist12;
  break;
case 7:
  thiscardlist = cardlist7;
  break;
case 19:
  thiscardlist = cardlist19;
    break;
default:
  thiscardlist = cardlist;
  notessencepage = 1
  break;
} 

for (i=0;i<thiscardlist.length;i++)
{
//alert(thiscardlist);	
thiscard = 'card' + thiscardlist[i];

thsbuydiv = 'buydiv' + thiscardlist[i];
thispic = 'pic' + thiscardlist[i];
if (ie5){document.getElementById(thiscard).parentElement.className=''}

if (ns6){document.getElementById(thiscard).parentNode.className=''}
if (notessencepage ==1 && thiscard!=lastcard){document.getElementById(thispic).src='/images/bach flower remedy products/'+thiscardlist[i]+'.gif'}

}

}


function buyclick(thisid){
dimtabs(60);
//changedetailpanel(thisid);
ShowBuyBox(thisid);
lastbuybox = thisid
}




function changebackground(thiselement,ThisRemedyGroup,type){

if (type==1){
thiselement.className='tabpic'+ ThisRemedyGroup + '_hover'
}
if (type==0){
thiselement.className=''
}
}



function changeparentbackground(thiselement,ThisRemedyGroup,type){
var e = 3;
if (type==1){
if (ie5){thiselement.parentElement.className='tabpic'+ ThisRemedyGroup + '_hover'}
if (ns6){thiselement.parentNode.className='tabpic'+ ThisRemedyGroup + '_hover'}
}
if (type==0){
if (ie5){thiselement.parentElement.className=''}
if (ns6){thiselement.parentNode.className=''}
}
}


function findPos(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,curtop];
}


function basketboxToCentre()//only for remedies2.asp
{
//if (lyr != 'prescriber'){lyr = 'Detail' + lyr};
var ScrollTop = document.body.scrollTop;

var basketboxoffset =240
var DetailPanelMinTop = 165

if (ScrollTop == 0)
{ 
    if (window.pageYOffset)
        ScrollTop = window.pageYOffset;
    else
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
}
var ScrollTop2 = ScrollTop;


var BasketSummaryContainerScrollTop=ScrollTop2-basketboxoffset;
if (ScrollTop2<basketboxoffset) {BasketSummaryContainerScrollTop=0;}
BasketSummaryContainerScrollTop = BasketSummaryContainerScrollTop + 'px';

if(ScrollTop<DetailPanelMinTop){ScrollTop=DetailPanelMinTop}
ScrollTop = ScrollTop + 'px';
document.getElementById('DetailPanel').style.top=ScrollTop;
document.getElementById('BasketSummaryContainer').style.paddingTop=BasketSummaryContainerScrollTop;
}


function HideDetailPanel(){ 
//alert(1);
	//document.getElementById(lastplant).style.visibility="hidden";
	document.getElementById("DetailPanel").style.visibility="hidden";

InfoOpaque();}

function InfoOpaque(){document.getElementById('OpacityMask').style.visibility="hidden";}


function sidebarToCentre(lyr,tab,page)
{
if (lyr != 'prescriber'){lyr = 'Detail' + lyr};
var ScrollTop = document.body.scrollTop;

var basketboxoffset =150
if (page=='remedies'){basketboxoffset=240};
if (page=='picturegallery'){basketboxoffset=164};


if (ScrollTop == 0)
{ 
    if (window.pageYOffset)
        ScrollTop = window.pageYOffset;
    else
        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
}
var ScrollTop2 = ScrollTop;

//var margin = 340

//var htoflyr = document.getElementById(lyr).clientHeight;

var thislyr = document.getElementById(lyr);
//var temp1 = document.getElementById('DetailPanel').height = document.getElementById('DetailPanel').contentWindow.document.body.scrollHeight + "px";
//alert(htoflyr);
var htoflyr = thislyr.clientHeight;
var htoflyr = document.getElementById('DetailPanel').lastElementChild.clientHeight;
alert(htoflyr);
var htoftab = document.getElementById('tab'+tab).clientHeight;

var a = ScrollTop + htoflyr; 
var b = htoftab  
if(a >= b)
{ScrollTop = htoftab-  htoflyr}
else
{ScrollTop = (ScrollTop )}

if(ScrollTop<0){ScrollTop=2}
//if(ScrollTop<160){ScrollTop=160}

var BasketSummaryContainerScrollTop=ScrollTop2-basketboxoffset;
if (ScrollTop2<basketboxoffset) {BasketSummaryContainerScrollTop=0;}
BasketSummaryContainerScrollTop = BasketSummaryContainerScrollTop + 'px';


ScrollTop = ScrollTop + 'px';
 //;
//document.getElementById(lyr).style.top=ScrollTop;
document.getElementById('DetailPanel').style.top=ScrollTop;
document.getElementById('BasketSummaryContainer').style.paddingTop=BasketSummaryContainerScrollTop;
}

function setLyr(obj,lyr)
{
	var coors = findPos(obj);
	if ((lyr == 'BuyBox') && ns6){

	//coors1: + is down
	//coors0: + is right
	 coors[1] -= 13;
	 coors[0] -= 20;}
	 	if ((lyr == 'BuyBox') && ie5){
	//coors1: + is down
	//coors0: + is right
	 coors[1] -= 13;
	 coors[0] -= 137;}
	var x = document.getElementById(lyr);
	//sidebars only move vertically
	
	
	x.style.top = coors[1] + 'px';
	x.style.left = coors[0] + 'px';

	
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789 ";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
      return true;
   }
   else { return false; }
}




function fadeIn() {
    if(opac < 100){
       opac+=fadespeed;
        if(ie5) document.getElementById(itemtofadein).filters.alpha.opacity = opac;
        if(ns6) document.getElementById(itemtofadein).style.opacity = opac/100;
        setTimeout('fadeIn()', 0);
    }
}
function fadeIn2() {
    if(opac3 < 100){
       opac3+=fadespeed2;
        if(ie5) document.getElementById(itemtofadein).filters.alpha.opacity = opac3;
        if(ns6) document.getElementById(itemtofadein).style.opacity = opac3/100;
        setTimeout('fadeIn2()', 0);
    }
}
function fadeOut() {
	if(opac2 > leavelevel){
		opac2-=fadespeed;
		
		if(ie5) document.getElementById(itemtofadeout).filters.alpha.opacity = opac2;
		if(ns6) document.getElementById(itemtofadeout).style.opacity = opac2/100;
		setTimeout('fadeOut()', 0);
	}
}

function adjustheight(thislayer)
{
	trap();
if (!thislayer) {return}
//if thislayer is nominated set the ht to that of thislayer	
var a = document.getElementById(thislayer).clientHeight;
var b = findPosY(document.getElementById(thislayer));
var tallestDivBottom = a+b;

var yellowbase = tallestDivBottom;
if (yellowbase < 597) {yellowbase = 598};
var shadowpic2 = yellowbase - 597;
if (document.location.pathname == '/index.asp'||document.location.pathname == '/') {

	yellowbase=yellowbase-30;
	shadowpic2 = yellowbase - 580;
	}
	
var opacitymaskht = yellowbase - 100;
//var maskexists = document.getElementById("OpacityMask");
var sidebarexists = document.getElementById("Sidebars");

shadowpic2 = shadowpic2.toString() + "px";
yellowbase = yellowbase.toString() + "px";
document.getElementById('shadowpic2').style.height=shadowpic2;
document.getElementById('FloatingLayer').style.height=yellowbase;

//if(maskexists){document.getElementById('OpacityMask').style.height=opacitymaskht-70};
//if(sidebarexists){document.getElementById('Sidebars').style.height=opacitymaskht-70};

var ztab2 = document.getElementById('tab2');
var ztab3 = document.getElementById('tab3');

if(thislayer=='tab2'){
if (ztab3 != null){document.getElementById('tab3').style.height=a.toString() + "px"};
document.getElementById('tab1').style.height=a.toString() + "px";
}

if(thislayer=='tab1'){
if (ztab2 != null){document.getElementById('tab2').style.height=a.toString() + "px"};
if (ztab3 != null){document.getElementById('tab3').style.height=a.toString() + "px"};
}
}
//why not tab3 same? cos only one tab3 and its on remedies and is the longest anyway






function setuptabdivs(tab1,tab2,tab3)
{
document.getElementById(tab1).style.visibility="visible";
if(tab2){document.getElementById(tab2).style.visibility="hidden"};
if(tab3){document.getElementById(tab3).style.visibility="hidden"};
document.getElementById(tab1).style.top=tabtop;
document.getElementById(tab1).style.left=tableft;
if(tab2){document.getElementById(tab2).style.top=tabtop};
if(tab2){document.getElementById(tab2).style.left=tableft};
if(tab3){document.getElementById(tab3).style.top=tabtop};
if(tab3){document.getElementById(tab3).style.left=tableft};
var e = document.getElementById(tab1).clientHeight;
if(tab2){document.getElementById(tab2).style.height=e.toString() + "px"};
if(tab3){document.getElementById(tab3).style.height=e.toString() + "px"};

//if(ie5) document.getElementById('OpacityMask').filters.alpha.opacity = 50;
//if(ns6) document.getElementById('OpacityMask').style.opacity = 50/100;
adjustheight(tab1);
}


function dimtabs(thislevel){
var ztab2 = document.getElementById('tab2');
var ztab3 = document.getElementById('tab3');	
	
if(ie5) 
{document.getElementById('tab1').filters.alpha.opacity = thislevel;

if (ztab2){document.getElementById('tab2').filters.alpha.opacity = thislevel};
if (ztab3){document.getElementById('tab3').filters.alpha.opacity = thislevel};


}

if(ns6) 
{
document.getElementById('tab1').style.opacity = thislevel/100;
if (ztab2){document.getElementById('tab2').style.opacity = thislevel/100};
if (ztab3){document.getElementById('tab3').style.opacity = thislevel/100};

}
}


function mouseover_nonprod(thisid,thisobj)
{
var thisbuydiv = 	'buydiv' + thisid;
var thispic = 'pic' + thisid;
var thissrc =  '/images/bach flower remedy products/' + thisid + 'over.gif';
document.getElementById(thisbuydiv).style.visibility='visible';
changeparentbackground(thisobj,7,1);
document.getElementById(thispic).src=thissrc
}

function gotoplant(thisproductname){

if(thisproductname=='5flower')
{MM_goToURL('parent','/fiveflower.asp');
return document.MM_returnValue}
else
//if we are not on the remedies page go there
if(document.location.href.search('remedies')==-1)
{var thislink = '/remedies.asp?gotoplant=' + thisproductname
{MM_goToURL('parent',thislink);
return document.MM_returnValue
}
}

{scrollToPlant(thisproductname)}
}

function scrollToPlant(thisproductname){

thiscard = 'card' + thisproductname+'';
var thiscardposy = findPosY(document.getElementById(thiscard));

window.scroll(0,thiscardposy);

changedetailpanel(thisproductname);
getThisPlantDetail(thisproductname);

}

function HideCurrentDetail(){ 
document.getElementById("DetailPanel").style.visibility='hidden';
document.getElementById("DetailPanel").style.display='none';

if(lastplant){
	document.getElementById(lastplant).style.visibility="hidden";
	document.getElementById("DetailPanel").style.display='none'
	document.getElementById("DetailPanel").style.visibility="hidden"};
InfoOpaque();
}


function changedetailpanelinnerstuff(thisid)
{
var thiscard = 'card' + thisid+'';
var thispic = 'pic' + thisid+'';
//ensure any card already hilited is cleared
		if(lastcard!='none'){
			var lastcardpic=lastcard.replace('card','pic');
			var lastcardid=lastcard.replace('card','');
		document.getElementById(lastcard).className = "";
		var thissrc = '/images/bach flower remedy products/' + lastcardid + '.gif';
		var thissrcover = '/images/bach flower remedy products/' + lastcardid + 'over.gif';

		if (thisid > 79) {document.getElementById(lastcardpic).src = thissrc};
		}

lastcard = thiscard;
lastpic=thispic;
//document.getElementById('OpacityMask').style.visibility="visible";
document.getElementById(thiscard).className = "tabpicOnview";
//if (thisid > 79) {document.getElementById(thispic).src = thissrcover};
}




function mouseout_nonprod(thisid,thisobj)
{
var thisbuydiv = 'buydiv'+thisid;
var thispic = 'pic'+thisid;
var thissrc =  '/images/bach flower remedy products/' + thisid + '.gif';
	//if(!lastcard){
document.getElementById(thisbuydiv).style.visibility='hidden';
changeparentbackground(thisobj,7,0);
	
	if(lastcard!=thisobj.id){
	document.getElementById(thispic).src=thissrc
	}
} 





function ChangeTabDiv(thistab) {

if (thistab!=currentlayer){
document.getElementById('tab1').style.visibility="hidden";
document.getElementById('tab2').style.visibility="hidden";

var ztab3 = document.getElementById('tab3')
if (ztab3) {
document.getElementById('tab3').style.visibility="hidden";
document.getElementById('tab3').style.height=""};
document.getElementById('tab1').style.height="";
document.getElementById('tab2').style.height="";
adjustheight(thistab);

currentlayer=thistab;

MM_showHideLayers('BuyBox','','hide');
dimtabs(100);

document.getElementById(thistab).style.visibility="visible";
}
//incase you move tabs and the basketsummary gets stranded below scroll visibility
document.getElementById('BasketSummaryContainer').style.paddingTop="0px";
}



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 ShowBuyBox(thisid){
thisid='pic'+thisid;
positionElement('BuyBox');
//setLyr(document.getElementById(thisid),'BuyBox');
document.getElementById('BuyBox').style.visibility='visible';
//if we dont set buybuttonstate the card div will kill the buybox
BuyBoxState = 1; 

document.getElementById('basketaddition_quantity').focus();
document.getElementById('basketaddition_quantity').select();
}

function HideBuyBox(){
if (BuyBoxState == 1){MM_showHideLayers('BuyBox','','hide')	;
BuyBoxState = 0 ;}
}


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
 
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}
function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
/* First thing is to declare global variables
   to contain the X and Y coordinates of the
   mouse cursor. */
var currentX = 0;
var currentY = 0;
var showtip = 1;
	
/* Use "object sniffing" technique to determine
   if the browser has the captureEvent method.
   This tells us if the client is a Mozilla-type browser.
   If so, we tell the document object to 
   capture the MOUSEMOVE event. */
if (document.captureEvent){
  document.captureEvent(Event.MOUSEMOVE);
}

/* The getMousePosition() function will be the
   event-handling function that sets
   currentX and currentY. */
function getMousePosition(evt){

/* Internet Explorer and Mozilla have differences
   both in the way they implement events and the
   way they determine x/y coordinates. */
  if (ie5){
   //window.event 
    /* This is the Internet Explorer way.
       Adds the x and y coordinates relative to the screen
       to the number of pixels the user has scrolled 
       horizontally and vertically. */
   // currentX = window.event.clientX + document.body.scrollLeft;
	currentX = window.event.clientX + document.documentElement.scrollLeft;
    //currentY = window.event.clientY + document.body.scrollTop;
	currentY = window.event.clientY + document.documentElement.scrollTop;		
  }
  else if (evt){
    
    /* In Mozilla/Netscape browsers, you just need to access
       the pageX and pageY properties to determine coordinates. */
    currentX = evt.pageX;
    currentY = evt.pageY;
  }


}






// register getMousePosition() as an event handler for the onmousemove event.
document.onmousemove = getMousePosition;



//following were used in establishing why document.body.scrollTop did not work in ie
//window.onscroll = fff;



/* The positionElement function will place an object
   at the coordinates (currentX+10, currentY+10).
   Parameter: any valid ID attribute of an element. */
function positionElement(id){
  // set elem to the element with specified id.
  elem = document.getElementById(id);
  if (elem){
    /* If the element exists, set the CSS style "left"
       to currentX + 10, and the CSS style "top" to
       currentY + 10. */

//need to account for floating layer
    var currentwidth = document.body.offsetWidth;
	var flpos = (currentwidth/2)-400;
elem.style.left = (currentX-(flpos+55)) + "px";
elem.style.top = (currentY-215) + "px"; 
  }
}


whatsnewfadedone=0

function dowhatsnew()
{
if(whatsnewfadedone==1){return false;};
MM_showHideLayers('WhatsNewLayer','','show');
opac = 0;
opac2=100;
leavelevel=60;
itemtofadein = 'WhatsNewLayer';
itemtofadeout='bigpic'
fadespeed=1;
fadeIn();
setTimeout('fadeOut()',1500);
whatsnewfadedone=1
}


function getThisOrder(str)
{
    var url=rootpath + "thisorder.asp?rnd=" + Math.random() + str;
     xmlHttp=GetXmlHttpObject(stateChangedBasket); 
    xmlHttp.open("GET", url , true);
    xmlHttp.send(null);   
}
function stateChangedBasket()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("BasketSummary").innerHTML=xmlHttp.responseText
    }
}
 

 
function getThisPlantDetail(str)
{ 
    var url=rootpath + "remedy_detail.asp?id=" + str;
     xmlHttp=GetXmlHttpObject(stateChangedDetail); 
    xmlHttp.open("GET", url , true);
    xmlHttp.send(null);   

}
function stateChanged()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("prescriptionlist").innerHTML=xmlHttp.responseText
    }
}


function stateChangedDetail()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("DetailPanel").innerHTML=xmlHttp.responseText
    document.getElementById("DetailPanel").style.visibility="visible"
	document.getElementById("DetailPanel").style.display="block"
	}
}
//function getPrescription(str)
//{
//    var url=rootpath + "prescription.asp?id=" + str
	//if you dont put something different in it may not refresh the underlying page
//    var url=rootpath + "prescription.asp"  + str + "&rnd=" + Math.random()
//    xmlHttp=GetXmlHttpObject(stateChanged)
//    xmlHttp.open("GET", url , true)
//    xmlHttp.send(null)
//}

