// JavaScript Document

//MACROMEDIA SCRIPTS BELOW

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_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_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_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];}
}

//MY SCRIPTS BELOW

//erase the cookie that tracks the slide number on the home page
function eraseCookie(name) {
	createCookie(name,"",-1);
}

//applied only to the "home" button in the "header.html" file
function goHome() {
	eraseCookie("slideCookie");
	homeURL = "/index.shtml";
	window.location.href = homeURL;
};

// set cookie to determine which slide the user was last on
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

//checks the cookie then goes to that slide
function checkCookie() {
	var x = readCookie('slideCookie')
	if (x == "slideone") {
			//go to slide one
			document.getElementById('walkthrough').innerHTML = slides[0];
		} else {
		if (x == "slidetwo") {
			//go to slide two
			document.getElementById('walkthrough').innerHTML = slides[1];
			} else {
			if  (x == "slidethree") {
				//go to slide three
				document.getElementById('walkthrough').innerHTML = slides[2];
				} else {
					//do nothing
					};
				};
			};
		};

//custom popup code - parameters passed onClick
var theImageURL2 = 0;
var imageHeight2 = 0;
var imageWidth2 = 0;
var popUpHeader2 = 0;

function myPopUp(theImageURL, imageHeight, imageWidth, popUpHeader)
{
	theImageURL2 = theImageURL;
	imageHeight2 = imageHeight;
	imageWidth2 = imageWidth;
	popUpHeader2 = popUpHeader;
			
			//initially resizes the window- don't remove the height and width features as explorer/mac and windows needs them
			theWindow = window.open("/generic-popup.shtml", "theWindow", "menubar=1,height=100,width=100,scrollbars=yes,resizable=yes");
			theWindow.moveTo(0, 0);
			theWindow.focus();
			
}

//preload the rollover images
if (document.images) 
{
   img1 = new Image();
   img2 = new Image();
   img3 = new Image();
   img4 = new Image();
   img5 = new Image();
   img6 = new Image();
   img7 = new Image();
   img8 = new Image();
   img9 = new Image();
   img1.src = "/images/bt-alkalizer_f2.gif";
   img2.src = "/images/bt-water_f2.gif";
   img3.src = "/images/bt-testimonials_f2.gif";
   img4.src = "/images/bt-support_f2.gif";
   img5.src = "/images/bt-news_f2.gif";
   img6.src = "/images/bt-purchase_f2.gif";
   img7.src = "/images/bt-downloads_f2.gif";
   img8.src = "/images/bt-corporate_f2.gif";
   img9.src = "/images/bt-contact_f2.gif";
}

//array of section links along top of all pages below tabs
var description = new Array();
description[0] = 	"<p class='linkdividers'>\
	<a href='/alkalizer/benefits.shtml' class='headerlinks'>Health Benefits</a> | \
	<a href='/alkalizer/howitworks.shtml' class='headerlinks'>How It Works</a> | \
	<a href='/alkalizer/wateruses.shtml' class='headerlinks'>Water Uses</a> | \
	<a href='/news/studies.shtml' class='headerlinks'>Clinical Studies</a> | \
	<a href='/alkalizer/warranty.shtml' class='headerlinks'>Warranty</a> | \
	<a href='/alkalizer/specification.shtml' class='headerlinks'>Specifications</a> \
	</p>";
description[1] = 	"<p class='linkdividers'>\
	<a href='/water/yourwater.shtml' class='headerlinks'>Is Your Water Healthy?</a> | \
	<a href='/water/tapwater.shtml' class='headerlinks'>Tap Water</a> | \
	<a href='/water/bottled.shtml' class='headerlinks'>Bottled Water</a> | \
	<a href='/water/rowater.shtml' class='headerlinks'>RO Water</a> |\
	<a href='/water/filtered.shtml' class='headerlinks'>Filtered Water</a> \
	</p>";
description[2] =  	"<p class='linkdividers'>\
	<a href='/testimonials/disease.shtml' class='headerlinks'>Disease/Afflictions</a> | \
	<a href='/testimonials/general.shtml' class='headerlinks'>General Health</a> | \
	<a href='/testimonials/weight.shtml' class='headerlinks'>Weight</a> | \
	<a href='/testimonials/cosmetic.shtml' class='headerlinks'>Beauty/Cosmetic</a> \
	</p>";
description[3] =  	"<p class='linkdividers'>\
	<a href='/support/faqs.shtml' class='headerlinks'>FAQs</a> | \
	<a href='/support/consumption.shtml' class='headerlinks'>How To Use - Consumption</a> | \
	<a href='/support/installation.shtml' class='headerlinks'>Installation Guide</a> \
	</p>";
description[4] =  	"<p class='linkdividers'>\
	<a href='/news/articles.shtml' class='headerlinks'>Articles</a> | \
	<a href='/news/studies.shtml' class='headerlinks'>Clinical Studies</a> | \
	<a href='/news/links.shtml' class='headerlinks'>Health Links</a> \
	</p>";
description[5] =  	"<p class='linkdividers'>\
	<strong>For Immediate Pricing/Ordering Call: (407) 226-3701</strong> \
	</p>";
description[6] =  	"<p class='linkdividers'>\
	<a href='/downloads/video.shtml' class='headerlinks'>Video</a> | \
	<a href='/downloads/manuals.shtml' class='headerlinks'>Manuals/Guides</a> \
	</p>";
description[7] =  	"<p class='linkdividers'>\
	<a href='/corporate/about.shtml' class='headerlinks'>About Alkalizer.com</a> | \
	<a href='/corporate/press.shtml' class='headerlinks'>News/Press Releases</a> | \
	<a href='/corporate/partnership.shtml' class='headerlinks'>Partnership Opportunities</a> \
	</p>";
description[8] =  	"<p class='linkdividers'>\
	<a href='/contact/general.shtml' class='headerlinks'>Information Request Form</a> | \
	<a href='/corporate/partnership.shtml' class='headerlinks'>Partnership Opportunities</a> \
	</p>";
	
var header = new Array();
header[0] = "<div class='pageheader'><span class='plus-page-header'>+</span>The Alkalizer</div>";
header[1] = "<div class='pageheader'><span class='plus-page-header'>+</span>Water Compared</div>";
header[2] = "<div class='pageheader'><span class='plus-page-header'>+</span>Testimonials</div>";
header[3] = "<div class='pageheader'><span class='plus-page-header'>+</span>Support</div>";
header[4] = "<div class='pageheader'><span class='plus-page-header'>+</span>Health News</div>";
header[5] = "<div class='pageheader'><span class='plus-page-header'>+</span>Purchase</div>";
header[6] = "<div class='pageheader'><span class='plus-page-header'>+</span>Downloads</div>";
header[7] = "<div class='pageheader'><span class='plus-page-header'>+</span>Corporate</div>";
header[8] = "<div class='pageheader'><span class='plus-page-header'>+</span>Contact</div>";

//determines which button to highlight and links to display
function checkHeaderButtons() {
if (highlightTab == "home") {
document.getElementById('sectionlinks').innerHTML = description[0];
}

if (highlightTab == "alkalizer") {
window.document.btalkalizer.src="/images/bt-alkalizer_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[0];
document.getElementById('sectionheader').innerHTML = header[0];
}

if (highlightTab == "water") {
window.document.btwater.src="/images/bt-water_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[1];
document.getElementById('sectionheader').innerHTML = header[1];
}

if (highlightTab == "testimonials") {
window.document.bttestimonials.src="/images/bt-testimonials_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[2];
document.getElementById('sectionheader').innerHTML = header[2];
}

if (highlightTab == "support") {
window.document.btsupport.src="/images/bt-support_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[3];
document.getElementById('sectionheader').innerHTML = header[3];
}

if (highlightTab == "news") {
window.document.btnews.src="/images/bt-news_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[4];
document.getElementById('sectionheader').innerHTML = header[4];
}

if (highlightTab == "purchase") {
window.document.btpurchase.src="/images/bt-purchase_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[5];
document.getElementById('sectionheader').innerHTML = header[5];
}

if (highlightTab == "downloads") {
window.document.btdownloads.src="/images/bt-downloads_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[6];
document.getElementById('sectionheader').innerHTML = header[6];
}

if (highlightTab == "corporate") {
window.document.btcorporate.src="/images/bt-corporate_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[7];
document.getElementById('sectionheader').innerHTML = header[7];
}

if (highlightTab == "contact") {
window.document.btcontact.src="/images/bt-contact_f2.gif";
document.getElementById('sectionlinks').innerHTML = description[8];
document.getElementById('sectionheader').innerHTML = header[8];
}
}