function Swap(Cell){
switch (Cell.style.color){
case "":
{
Cell.style.color="blue"
Cell.style.background="yellow"
}
break
case "blue":
{
Cell.style.color=""
Cell.style.background="none"
}
break
default:
Cell.style.display = "none"
}
}

//   ##############  SIMPLE  BROWSER SNIFFER
if (document.layers) {navigator.family = "nn6"}
if (document.all) {navigator.family = "ie6"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {navigator.family = "gecko"}


//  #########  popup text 
descarray = new Array(
"Shapeworks&reg; QuickStart Program <br><img src=/images/large-quickstart2.jpg>",
"Shapeworks&reg; Advanced Program <br><img src=/images/large-advanceprogram2.jpg>",
"Shapeworks&reg; Ultimate Program <br><img src=/images/large-ultimateprogram2.jpg>",
"Formula 1 Protein Drink Mix (550g)<br><img src=/images/large-formula1.jpg>",
"Formula 2 Multivitamin Complex<br><img src=/images/large-formula2.jpg>",
"Cell Activator&reg; <br><img src=/images/large-formula3.jpg>",
"Total Control&trade;  <br><img src=/images/large-total-control.jpg>",
"Shapeworks&reg; Herbal Concentrate  <br><img src=/images/large-herbalconcentrate.jpg>",
"Cell-U-Loss&reg;  <br><img src=/images/large-cell-u-loss.jpg>",
"Herbal Aloe Concentrate  <br><img src=/images/large-HerbalAloeConcentrate.jpg>",
"Herbalifeline&reg; <br><img src=/images/large-herbalifeline.jpg>",
"Schizandra Plus <br><img src=/images/large-SchizandraPlus.jpg>",
"Skin Activator&reg; Daily Replenishing Cream  <br><img src=/images/large-SkinActivator.jpg>",
"Radiant C&trade; Daily Face Quencher<br><img src=/images/large-facequencher.jpg>",
"Radiant C&trade; Daily Skin Booster <br><img src=/images/large-skinbooster.jpg>",
"Body Buffing Scrub  <br><img src=/images/large-BodyBuffingScrub.jpg>",
"Body Contouring Creme <br><img src=/images/large-BodyContouringCeme.jpg>",
"Herbal Aloe Hand & Body Lotion <br><img src=/images/large-HerbalAloeHandandBodyLotion.jpg>",
"Herbal Aloe Gel <br><img src=/images/large-HerbalAloeGel.jpg>",
"Herbal Aloe Moisturizing Shampoo<br><img src=/images/large-shampoo.jpg>",
"Herbal Aloe Body Wash <br><img src=/images/large-HerbalAloeBodyWash.jpg>",
"Niteworks&trade; <br><img src=/images/large-niteworks.jpg>",
"Formula 3 Personalised Protein Powder (240g)<br><img src=/images/large-supplement.jpg>",
"Joint Support - Glucosamine with Herbs <br><img src=/images/large-joint-support.jpg>",
"Measuring Spoon <br><img src=/images/large-measuring-spoon.gif>",
"Powder Container - 2oz <br><img src=/images/large-formula-container.jpg>",
"Tablet Crusher <br><img src=/images/large-tablet-crusher.gif>",
"Shaker Cup <br><img src=/images/large-shaker-cup.gif>",
"Sports Water Bottle <br><img src=/images/large-water-bottle.gif>",
"Power Mixer <br><img src=/images/large-power-mixer.gif>",
"Tri-Shield&trade; <br><img src=/images/large-tri-shield.jpg>",
"Herbalife Accessories <br><img src=/images/herbalife-accessories.jpg>",
"Herbalife International Business Pack (IBP) <br><img src=/images/herbalife-ibp.jpg>",
"Tablet Box - Small <br><img src=/images/large-Small-Tablet-Box.jpg>",
"Mini Mixer - Battery Operated <br><img src=/images/large-mini-mixer.jpg>",
"Tape Measure<br><img src=/images/large-tape-measure.jpg>",
"Radiant C&trade; Daily Facial Scrub Cleanser<br><img src=/images/large-facialscrub.jpg>",
"Herbal Aloe Moisturizing Conditioner<br><img src=/images/large-conditioner.jpg>",
"MultiVitamin Normal to Dry Lotion Cleanser<br><img src=/images/2510NA_MVNrmlDryCleanser_400.jpg>",
"MultiVitamin Normal to Oily Foaming Gel Cleanser<br><img src=/images/2511NA_MVNrmlOilyCleanser_400.jpg>",
"MultiVitamin Normal to Dry Toner<br><img src=/images/2512NA_MVTonerNrmlDry_400.jpg>",
"MultiVitamin Normal to Oily Toner<br><img src=/images/2513NA_MVNrmlOilyToner_400.jpg>",
"MultiVitamin Normal to Dry Moisturizer SPF 15<br><img src=/images/2514NA_MVMoistNrmlDry_400.jpg>",
"MultiVitamin Normal to Oily Moisturizer SPF 15<br><img src=/images/2515NA_MVMoistNrmlOily_400.jpg>",
"NouriFusion&reg; MultiVitamin Night Cream<br><img src=/images/2516NA_MVNightCreme_400.jpg>",
"NouriFusion&reg; MultiVitamin Eye Cream<br><img src=/images/2517NA_MVEyeCreme_400.jpg>",
"NouriFusion&reg; MultiVitamin Eye Gel<br><img src=/images/2518NA_MVEyeGel_400.jpg>",
"NouriFusion&reg; MultiVitamin Clarifying Mask<br><img src=/images/2519NA_MVClarifyingMask_400.jpg>",
"NouriFusion&reg; MultiVitamin Moisture Mask<br><img src=/images/2520NA_MVMoistureMAsk_400.jpg>",
"NouriFusion&reg; MultiVitamin Exfoliating Scrub<br><img src=/images/2521NA_MVExfolScrub_400.jpg>",
"NouriFusion Skin Essential Products<br><img src=/images/nourifusion.jpg>",
"NouriFusion Skin Essential Products<br><img src=/images/nourifusion.jpg>",
"NouriFusion Skin Essential Products<br><img src=/images/nourifusion.jpg>",
"NouriFusion Skin Essential Products<br><img src=/images/nourifusion.jpg>",
"Core Complex <br><img src=/images/large-core-complex.jpg>",
"MyoTape Body Tape Measure (60cm Length)<br><img src=/images/large-myotape.jpg>",
"Other 3rd-Party Supplements<br><img src=/images/large-supplements.jpg>",
"Skin Activator&reg; Day Lotion SPF 15<br><img src=/images/Skin-Activator-Day-Lotion.jpg>",
"Skin Activator&reg; Eye Cream<br><img src=/images/Skin-Activator-Eye-Cream.jpg>",
"Skin Activator&reg; Décolletage Cream<br><img src=/images/Skin-Activator-Neck-and-Declotage-Cream.jpg>",
"Skin Activator&reg; Nighttime Replenishing Cream<br><img src=/images/Skin-Activator-NIGHT-TIME-REPLENISHING-CREAM.jpg>",
"Skin Activator&reg; Lip Refiner SPF 15<br><img src=/images/Skin-Activator-Lip-Refiner.jpg>",
"Optimum Cellular Nutrition&trade; Program<br><img src=/images/large-optimal-cellular-nutrition.jpg>",
"2-in-1 Pedometer with Fat Analyzer<br><img src=/images/pedometer-fat-analyzer.jpg>",
"Body Fat Measure & Data Analyzer Tester<br><img src=/images/body-fat-measure-tester.jpg>",
"Start Now Pack (w/ Tea Mix 50g)<br><img src=/images/my-start-now-pack.jpg>",
"Start Now Pack (w/ Tea Mix 100g)<br><img src=/images/my-start-now-pack.jpg>",
"Formula 1 - Nutritious Mixed Soy Powder (550g)<br><img src=/images/my-mixed-soy-powder.jpg>",
"Formula 3 - Blended Soy & Whey Protein Powder<br><img src=/images/my-blended-soy-whey-protein-powder.jpg>",
"Tea Mix - Lemon & Hibiscus (50g)<br><img src=/images/my-tea-mix.jpg>",
"Tea Mix - Lemon & Hibiscus (100g)<br><img src=/images/my-tea-mix.jpg>",
"Roasted Soy Nuts<br><img src=/images/my-roasted-soy-nuts.jpg>",
"Chocolate Peanut Protein Bar<br><img src=/images/my-soy-whey-protein-bar.gif>",
"Herbal Aloe Soft Hold Hair Spray<br><img src=/images/large-Hair-Spray.jpg>",
"Herbal Aloe Hand Cream<br><img src=/images/large-Hand-Cream.jpg>",
"Aussie Bodies HPLC Bar - 100g<br><img src=/images/large-protein-bar.jpg>",
"Body Shaper Kit<br><img src=/images/large-body-shaper-kit.jpg>",
"Body Buffing Lotion and Body Contouring Cream<br><img src=/images/large-buffing-contouring.jpg>"
);
// Last item number 77

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0
var x = 0
var y = 0
var select = document.getElementsByName("ADDITIONALINFO");
overdiv="0";


function popLayer(a){

	handlerMM();	  
	getScrollXY();
	if(!descarray[a]){descarray[a]="This popup (#"+a+") isn't setup correctly - needs description</font>";}
	pad="0"; bord="1 bordercolor=black";

	desc = 	  "<table cellspacing=0 cellpadding="+pad+" border="+bord+"  bgcolor=000000><tr><td>"
		+"<table cellspacing=0 cellpadding=3 border=0><tr><td bgcolor=ffffdd><center><font size=-1>"
		+descarray[a]
		+"</font></center></td></tr></table>\n"
		+"</td></tr></table>";
	
	for(var i = 0; i < select.length; i++)
		select[i].style.visibility="hidden";
	document.getElementById("object1").innerHTML=desc;
//	document.getElementById("object1").style.left=(x+15)+'px';
//	document.getElementById("object1").style.top=(y-255)+'px';
	document.getElementById("object1").style.left=(x+15)+'px';
	document.getElementById("object1").style.top=(tempY+53)+'px';
}

function hideLayer(){
	if (overdiv == "0") {
		document.getElementById("object1").style.top="-500px";
	}
	for(var i = 0; i < select.length; i++)
		select[i].style.visibility="visible";
}

function handlerMM(e){
//	x = (e) ? e.pageX : event.clientX + document.body.scrollLeft;
//	y = (e) ? e.pageY : event.clientY + document.body.scrollTop;
	
  if (IE) { 
  // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {  
  // grab the x-y pos.s if browser is NS
//    tempX = e.pageX;
//    tempY = e.pageY;
	tempX = 450;
	tempY = 450;
//  alert(3);	    
  }  

  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0;}
  if (tempY < 0){tempY = 0;}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  x = tempX;
  y = tempY;
//  document.search.query.value = x+","+y


  return true
  
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  tempX = scrOfX;
  tempY = scrOfY;

  return [ scrOfX, scrOfY ];
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}

	var scrollx = 0, scrolly = 0;
	function saveScrollCoordinates() {
	  scrollx = f_scrollLeft();
	  scrolly = f_scrollTop();
//		alert("scrollx:"+scrollx+"\nscrolly:"+scrolly);
	}
	function scrollback() {
//		alert("scrollx:"+scrollx+"\nscrolly:"+scrolly);
		scroll(scrollx,scrolly);
	}

	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 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 showlightbox(msg) {
	try {
		scroll(0,0);
		if (msg) document.getElementById("lightboxtext").innerHTML = msg;

		document.getElementById('overlay').style.display='block';
		document.getElementById('lightbox').style.display='block';
		
		bar2.showBar();
//		setTimeout("UpdateImg('loading','/images/loading1.gif');",100);
	}
	catch (err) {
		// do nothing
	}
}

function UpdateImg(ctrl,imgsrc) {
	var img = document.getElementById(ctrl);
	img.src = imgsrc;
	setTimeout("UpdateImg2('loading','/images/loading2.gif');",100);
}

function UpdateImg2(ctrl,imgsrc) {
	var img = document.getElementById(ctrl);
	img.src = imgsrc;
	setTimeout("UpdateImg('loading','/images/loading1.gif');",100);
}


function callnow(theform) {
	if (theform.callme.value=="") {
		alert("Please enter a phone number if you like us to call you NOW...");
		return false;
	}
	theform.callbutton.value="Wait...";
	theform.callbutton.disabled = true;
	setInterval ( 'theform.callbutton.disabled=false;', 1000 );
	setInterval ( 'theform.callbutton.value="Call Now";', 1000 );
	return true;
}

function togglehelp() {
	if (document.getElementById("x").innerHTML=="X") {
		document.getElementById("x").innerHTML="+";
		document.getElementById('space').src="/sess.php?helpstatus=hide";
	} else {
		document.getElementById("x").innerHTML="X";
		document.getElementById('space').src="/sess.php?helpstatus=0";
	}
	ToggleDisplay('helpme');
}

function fadein(flag){
	var fade=flag,logo=document.getElementById("fixmetoo").style,ms=(logo.opacity==0)?0:1,pace=setInterval(Fade,40);
	function Fade(){
		if(fade<90){
			fade+=2;
			if(ms)
				logo.filter="alpha(opacity="+fade+")";
			else
				logo.opacity=(fade/100)
		}
		else
			clearInterval(pace)
	}
};


// http://jennifermadden.com/javascript/stringEnterKeyDetector.html

function checkEnter(e){ //e is event object passed from function invocation
	var characterCode // literal character code will be stored in this variable

	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else{
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		
		//document.forms[0].submit() //submit the form
		//document.loginform.submit();
		//document.loginform.submit.click();
		return false 
	}
	else{
		return true 
	}
}

function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
		tstring += splitstring[i];
		
	splitstring = tstring.split("-");
	tstring = "";
	for(i = 0; i < splitstring.length; i++)
		tstring += splitstring[i];
		
	splitstring = tstring.split("+");
	tstring = "";
	for(i = 0; i < splitstring.length; i++)
		tstring += splitstring[i];

	return tstring;
}

function ToggleDisplay(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == 'none')
			document.getElementById(id).style.display = 'block';
		else
			document.getElementById(id).style.display = 'none';
	}else{
		if(document.layers){
			if (document.id.display == 'none')
				document.id.display = 'block';
			else
				document.id.display = 'none';
		}
	}
}

function ShowDisplay(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == 'none')
			document.getElementById(id).style.display = 'block';
	}else{
		if(document.layers){
			document.id.display = 'block';
		}
	}
}
function HideDisplay(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}else{
		if(document.layers){
				document.id.display = 'none';
		}
	}
}

//document.onmousemove = handlerMM;


// Date Script
TDay = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
TMonth = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
TDate = new Date();
CurYear  = TDate.getYear();
CurMonth = TDate.getMonth();
CurDayOw = TDate.getDay();
CurDay= TDate.getDate();
if (CurDay == 1 || CurDay == 21 || CurDay == 31) stth = "st"; else if (CurDay == 2 || CurDay == 22) stth = "nd"; else if (CurDay == 3 || CurDay == 23) stth = "rd"; else stth = "th";
TheDate  = CurDay + stth +' ';
TheDate += TMonth[CurMonth] + ' ';
if (CurYear < 2000) CurYear = CurYear + 1900;
TheDate += CurYear + ', ';
TheDate += TDay[CurDayOw];

function unloadpage() {
	document.getElementById('bottomcart').src="/sess.php?unload=true";
}
// window.onunload = unloadpage();

