var nav = new Array("home", "about", "products", "sales", "whatsnew", "contact", "members", "video");

var products = new Array(["extrimX", "prod_extrimX.html"], 

						 ["extrim_starchblocker", "prod_extrim_starchblocker.html"], 

						 ["extrim_bodysculptor", "prod_extrim_bodysculptor.html"],

						 ["slimwater", "prod_slimwater.html"],

						 ["intenz", "prod_intenz.html"],

						 ["intenz_miracle_mask", "prod_intenzmask.html"],

						 ["tummi_trim", "prod_tummi1.html"],

						 ["procyan", "prod_procyan.html"]  

						  ["joint", "prod_joint.html"]  

						

);



var whatsnew = [];

whatsnew.push("LifePharm Launches TummiTrim the solution for that unsightly tummy");

whatsnew.push("Relief Effort for Tsunami Victims");

whatsnew.push("LifePharm launches PROCYAN Advanced Hair Solution");

whatsnew.push("LifePharm launches extrimX");

whatsnew.push("Join Supplement");

whatsnew.push("LifePharm Establishes Consumer-to-Consumer Marketing Business");






anchor = "";

url = document.location.toString().split("?");

if (url.length > 1) {

	params = url[1].split("&");

	for (temp=0; temp<params.length; temp++) {

		namevalue = params[temp].split("=");

		eval(namevalue[0] + "='" + namevalue[1] + "'");

	}

}



document.writeln("<link rel='stylesheet' type='text/css' href='style_lifepharm.css'>");

document.writeln("<style type='text/css'>");

if (bkgdcode != "") {

	document.writeln("BODY { background-image:url(images/" + bkgdcode + "_bkgd.jpg) }");

}

document.writeln("</style>");



function generate_header() {

	if (scrollcode != "") {

		document.writeln("<body onLoad='initScroll();'>");

	} else {

		document.writeln("<body>");

	}

	document.writeln("<table height='100' border='0' cellpadding='0' cellspacing='0'><tr><td valign='bottom'>");

	document.writeln("<a href='index.html'><img src='images/logo_lifepharm.gif' width='120' height='36' hspace='25' vspace='20' border='0' /></a>");

	document.writeln("</td></tr></table>");

}



function generate_footer() {

	document.writeln("<table width='100%' border='0' cellpadding='10' cellspacing='0'><tr>");

	document.writeln("<td class='tinygreybold'><a href='javascript:popup(\"fineprint.html\", 700, 550)' class='tinygreybold'>Terms and Conditions</a><!-- | License Information | Privacy Policy--></td>");

	document.writeln("<td class='tinygreybold' align='right'>Copyright 2012. LifePharm Pte Ltd. All Rights Reserved.</td>");

	document.writeln("</tr></table>");

	document.writeln("</body>");

	document.writeln("</html>");

}



function generate_whatsnewsubnav() {

	url = document.location.toString().split("_");

	currentwhatsnewcode = parseInt(url[1].substring(0,url[1].indexOf(".")));

	// document.writeln("<span class='smallgrey'><b>Store news >></b><br /><br /></span>");

	document.writeln("<table border='0' cellpadding='0' cellspacing='0' class='smallgrey'>");

	for (temp=whatsnew.length; temp>0; temp--) {

		linkstatus = "";

		boldstatus = "x";

		if (temp == currentwhatsnewcode) {

			linkstatus = "x";

			boldstatus = "";

		}

		document.writeln("<tr><td valign='top'><img src='images/bullet.gif' width='5' height='4' hspace='5' vspace='4' /></td><td><" + linkstatus + "a href='whatsnew_" + temp + ".html' class='smallgrey'><" + boldstatus + "b>" + whatsnew[temp-1] + "</b></a><br /><br /></td></tr>");

	}

	document.writeln("</table>");

}



function generate_swflayer(swf, file) {

	switch (swf) {

		case "nav":

			swf_width = 800;

			swf_height = 250;

			break;

		case "pic":

			swf_width = 300;

			swf_height = 375;

			break;

	}

	file = file.split(":");

	if (file.length == 1) {

		file.push("");

	}

	document.writeln("<div id='" + swf + "'>");

	if (file[0] != "") {

		document.writeln("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0' WIDTH='" + swf_width + "' HEIGHT='" + swf_height + "' id='swf_" + swf + "' ALIGN=''>");

		document.writeln("<PARAM NAME='movie' VALUE='images/" + file[0] + ".swf' />");

		document.writeln("<PARAM NAME='quality' VALUE='high' />");

		document.writeln("<PARAM NAME='FlashVars' VALUE='section=" + section + "&subsection=" + subsection + "&anchor=" + anchor + "&staticpic=" + file[1] + "'>");

				document.writeln("<param name='wmode' value='transparent' />");

		document.writeln("<EMBED src='images/" + file[0] + ".swf' quality='high' WIDTH='" + swf_width + "' HEIGHT='" + swf_height + "' NAME='swf_" + swf + "' ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer' FlashVars='section=" + section + "&subsection=" + subsection + "&anchor=" + anchor + "&staticpic=" + file[1] + "' wmode='transparent' type='application/x-shockwave-flash'></EMBED>");

		document.writeln("</OBJECT>");

	}

	document.writeln("</div>");

}



function generate_scroll() {

	document.writeln("<a href='javascript:;' onMouseDown='startScroll(-1);' onMouseUp='stopScroll();' onMouseOut='stopScroll();'><img src='images/arrow_up.gif' width='12' height='12' vspace='2' border='0' /></a><br /><a href='javascript:;' onMouseDown='startScroll(+1);' onMouseUp='stopScroll();' onMouseOut='stopScroll();'><img src='images/arrow_down.gif' width='12' height='12' vspace='2' border='0' /></a><br /><br />");

}



function generate_prodsubnav() {

	document.writeln("<span class='smallgrey'>View our other products:<br /><br /></span>");

	for (temp=0; temp<products.length; temp++) {

		if (subsection != products[temp][0]) {

			document.writeln("<a href='" + products[temp][1] + "'><img src='images/prod_icon_" + products[temp][0] + ".jpg' width='30' height='30' border='0' /></a>");

		} else {

			document.writeln("<img src='images/prod_icon_" + products[temp][0] + "_dim.jpg' width='30' height='30' border='0' />");

		}

	}

}



function popup(item, width, height) {

	path = "";

	item = item.split(".");

	if (item[1] != "html") {

		path = "images/";

		width += 40;

		height += 30;

	}

	window.open(path + item[0] + "." + item[1], item[0], "width=" + width + ", height=" + height + ", scrollbars=yes, toolbars=no");

}



function link(page) {

	popwidth = 640;

	popheight = 480;

	leftpos = (screen.width-popwidth)/2,

	toppos = (screen.height-popheight)/2;

	if (document.all || document.layers) {

		leftpos -= 10;

	}



	page = page.split(":");

	if (page[1] == null) { page[1] = "index" }

	window.open("http://www." + page[0] + ".com/" + page[1] + ".html", page[0] + "_" + page[1], "width=" + popwidth + ",height=" + popheight + ",top=" + toppos + ",left=" + leftpos + ",menubar=yes,location=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes"); // TO BE MODIFIED

}



// ==== dhtml scrolling scripts ====



/* Extension written by David G. Miles (http://www.z3roadster.net/dreamweaver/) 

based in part on code written by Thomas Brattli (http://www.bratta.com)*/

// Courtesy of SimplytheBest.net (http://simplythebest.net/info/dhtml_scripts.html)

// Modified by KT Ng



function verifyCompatibleBrowser(){ 

    this.ver=navigator.appVersion 

    this.dom=document.getElementById?1:0 

    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 

    this.ie4=(document.all && !this.dom)?1:0; 

    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 

    this.ns4=(document.layers && !this.dom)?1:0; 

    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 

    return this 

} 



bw=new verifyCompatibleBrowser() 



var scrollspeed=25, scrollamount=7;

var loop, timer, initialised

 

function ConstructObject(obj,nest){ 

    nest=(!nest) ? '':'document.'+nest+'.' 

    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 

    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 

    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 

    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 

    this.up=MoveAreaUp;this.down=MoveAreaDown; 

    this.MoveArea=MoveArea; this.x; this.y; 

    this.obj = obj + "Object" 

    eval(this.obj + "=this") 

    return this 

} 

function MoveArea(x,y){ 

    this.x=x;this.y=y 

    this.css.left=this.x 

    this.css.top=this.y 

} 

function MoveAreaDown(scrolldirection){ 

	if (this.y > -this.scrollHeight+objContainer.clipHeight) { 

		this.MoveArea(0,this.y-scrollamount) 

		if (loop) setTimeout(this.obj+".down("+scrolldirection+")",scrollspeed) 

	} 

} 

function MoveAreaUp(scrolldirection){ 

	if (this.y < 0) { 

		this.MoveArea(0,this.y+scrollamount) 

		if (loop) setTimeout(this.obj+".up("+scrolldirection+")",scrollspeed) 

	} 

} 

function startScroll(scrolldirection){ 

	if (initialised){ 

		loop = true; 

		if (scrolldirection>0) objScroller.down(scrolldirection) 

		else objScroller.up(scrolldirection) 

	} 

} 

function stopScroll(){ 

	loop = false 

	if (timer) clearTimeout(timer) 

} 

function initScroll(){ 

	objContainer = new ConstructObject('divContainer_' + scrollcode)

	objScroller = new ConstructObject('divContent','divContainer_' + scrollcode);

	objScroller.MoveArea(0,0);

	objContainer.css.visibility='visible'

	initialised = true; 

} 

function checkscrollposition() {

	alert(objScroller.css.top);

}

function reloadPage(init) {  //reloads the window if Nav4 resized

	if (init==true) with (navigator) { 

		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

			document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; 

		}

	} else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();

}

reloadPage(true);
