// JavaScript Document

var browserName=navigator.appName; 
var ns4=false; 


if (browserName=="Netscape")
{ 
	ns4=true; 
}
else 
{ 
	if (browserName=="Microsoft Internet Explorer")
	{
		ns4=false; 
	}
	else
	{
		ns4=false; 
	}
}

var maindiv="";

function showdiv(divid,action,imagename,bigdivid,event,type)
{
	maindiv=bigdivid;

	var imagex=0;
	imagex=getElementLeft(imagename,event);

	var imagey=0;
	imagey=getElementTop(imagename,event);
	
	if(type=='vert')
	{
		
		document.getElementById(divid).style.left=imagex+210+'px';
		if(ns4)
		document.getElementById(divid).style.top=imagey+'px';
		else 
		document.getElementById(divid).style.top=imagey+'px';
	
	}
	if(type=='horz')
	{
		
		document.getElementById(divid).style.left=imagex+'px';
		if(ns4)
		document.getElementById(divid).style.top=imagey+38+'px';
		else 
		document.getElementById(divid).style.top=imagey+38+'px';
	
	}
	
	if(action=="show")
		document.getElementById(divid).style.visibility='visible';
	else if(action=="hide")
		document.getElementById(divid).style.visibility='hidden';
}

function showsubdiv(divid,action,imagename,bigdivid,event,type,subdiv,level)
{
	showdiv(subdiv,action,imagename,bigdivid,event,type)
	
	maindiv=bigdivid;

	var imagex=0;
	imagex=getElementLeft(subdiv,event);

	var imagey=0;
	imagey=getElementTop(subdiv,event);
	
	
	if(level>1)
	{
		for(i=0;i<level-1;i++)
		{
			plusy=imagey+21;
		}
	
	}
	else
	{
		plusy=imagey;
	}
	
	
	
	if(type=='vert')
	{
		
		document.getElementById(divid).style.left=imagex+139+'px';
		if(ns4)
		document.getElementById(divid).style.top=plusy+'px';
		else 
		document.getElementById(divid).style.top=plusy+'px';
	
	}
	if(type=='horz')
	{
		
		document.getElementById(divid).style.left=imagex+'px';
		if(ns4)
		document.getElementById(divid).style.top=imagey+38+'px';
		else 
		document.getElementById(divid).style.top=imagey+38+'px';
	
	}
	
	
	if(action=="show")
		document.getElementById(divid).style.visibility='visible';
	else if(action=="hide")
		document.getElementById(divid).style.visibility='hidden';
}


function getElementLeft(Elem,event) {
	if (ns4) {
		var elem = getObjNN4x(event,Elem);
	return elem;
	} else {
		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
  		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;
	}
}


function getElementTop(Elem,event) {
	if (ns4) {
		var elem = getObjNN4y(event,Elem);
		return elem;
	} else {
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
	}
}

function getObjNN4x(event,imagename)
{
 //   pos_x = document.getElementById(imagename).offsetLeft;
	//return pos_x;




		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(imagename);
		} else if (document.all){
			var elem = document.all[imagename];
		}
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
  		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;

}



function getObjNN4y(event,imagename)
{
    //pos_y =document.getElementById(imagename).offsetTop;
	//return pos_y;




		if(document.getElementById) {	
			var elem = document.getElementById(imagename);
		} else if (document.all) {
			var elem = document.all[imagename];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;



}






/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip



<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// Set up the image files to be used.
var theBackImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theBackImages[0] = 'div_banner_img1';
theBackImages[1] = 'div_banner_img2';
theBackImages[2] = 'div_banner_img3';
theBackImages[3] = 'div_banner_img4';
theBackImages[4] = 'div_banner_img5';

var thePermanetImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

thePermanetImages[0] = 'image_permanet1';
thePermanetImages[1] = 'image_permanet2';
thePermanetImages[2] = 'image_permanet3';
thePermanetImages[3] = 'image_permanet4';
thePermanetImages[4] = 'image_permanet5';

var theZeroflyImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theZeroflyImages[0] = 'image_zerofly1';
theZeroflyImages[1] = 'image_zerofly2';
theZeroflyImages[2] = 'image_zerofly3';
theZeroflyImages[3] = 'image_zerofly4';
theZeroflyImages[4] = 'image_zerofly5';

var theLifestrawImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theLifestrawImages[0] = 'image_lifestraw1';
theLifestrawImages[1] = 'image_lifestraw2';
theLifestrawImages[2] = 'image_lifestraw3';
theLifestrawImages[3] = 'image_lifestraw4';
theLifestrawImages[4] = 'image_lifestraw5';

var theLeftImages = new Array() // do not change this

theLeftImages[0] = 'left_pic1.jpg';
theLeftImages[1] = 'left_pic2.jpg';
theLeftImages[2] = 'left_pic3.jpg';
theLeftImages[3] = 'left_pic4.jpg';
theLeftImages[4] = 'left_pic5.jpg';



var theLifestrawLeftImages = new Array() // do not change this

theLifestrawLeftImages [0] = 'lifestraw_left_pic1.jpg';
theLifestrawLeftImages [1] = 'lifestraw_left_pic2.jpg';
theLifestrawLeftImages  [2] = 'lifestraw_left_pic3.jpg';
theLifestrawLeftImages [3] = 'lifestraw_left_pic4.jpg';
theLifestrawLeftImages [4] = 'lifestraw_left_pic5.jpg';


// do not edit anything below this line

var j = 0
var p = theBackImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theBackImages[i]
}


//var whichImage = Math.round(Math.random()*(p-1));
var whichImage = Math.floor(Math.random() * theBackImages.length);

var prevs_whichImage = 0;
var prevs_whichImagePermanet = 0;
var prevs_whichImageLifestraw = 0;
var prevs_whichImagezerofly = 0;



function getWhichImage()
{
	whimg=Math.floor(Math.random() * theBackImages.length);	
	return whimg;
}


function showImage()
{
	whichImage = Math.floor(Math.random() * theBackImages.length);
	//alert(document.getElementById('top_banner_img').className );
	//alert(theBackImages[whichImage]);
	document.getElementById('top_banner_img').className  =theBackImages[whichImage];
	document.getElementById('top_permanet_div').className=thePermanetImages[whichImage];
	document.getElementById('top_zerofly_div').className=theZeroflyImages[whichImage];
	document.getElementById('top_lifestraw_div').className=theLifestrawImages[whichImage];
	//alert(document.getElementById('top_banner_img').className );
	//document.write('<img src="'+theImages[whichImage]+'">');
}

function change_banner()
{
	
	whichImage = Math.floor(Math.random() * theBackImages.length);
	document.getElementById('banner_image').className=theBackImages[whichImage];
	intval=setTimeout("showImage_option2()",3300);
}

function showImage_option2()
{
	whichImage = Math.floor(Math.random() * theBackImages.length);
	//alert(document.getElementById('top_banner_img').className );
	//alert(theBackImages[whichImage]);
	//document.getElementById('top_banner_img').className  =theBackImages[whichImage];
	//document.getElementById('top_permanet_img').className=thePermanetImages[whichImage];
	//document.getElementById('top_zerofly_img').className=theZeroflyImages[whichImage];
	//document.getElementById('top_Lifestraw_img').className=theLifestrawImages[whichImage];
	//alert(document.getElementById('top_banner_img').className );
	//document.write('<img src="'+theImages[whichImage]+'">');
	//alert(thePermanetImages[whichImage]+","+theZeroflyImages[whichImage]+","+theLifestrawImages[whichImage]);
	document.getElementById('permanet_image_div').className=thePermanetImages[whichImage];
	document.getElementById('zerofly_image_div').className=theZeroflyImages[whichImage];
	document.getElementById('lifestraw_image_div').className=theLifestrawImages[whichImage];
	intval=setTimeout("showImage_option2()",3300);
}


function showTrans_option()
{
	whichImage = Math.floor(Math.random() * theLeftImages.length);
	//alert(document.getElementById('top_banner_img').className );
	//alert(theBackImages[whichImage]);
	//document.getElementById('top_banner_img').className  =theBackImages[whichImage];
	//document.getElementById('top_permanet_img').className=thePermanetImages[whichImage];
	//document.getElementById('top_zerofly_img').className=theZeroflyImages[whichImage];
	//document.getElementById('top_Lifestraw_img').className=theLifestrawImages[whichImage];
	//alert(document.getElementById('top_banner_img').className );
	//document.write('<img src="'+theImages[whichImage]+'">');
	//alert("hello");
	//alert(theLeftImages[whichImage]);
	//alert(document.getElementById('leftimage').src);
	document.getElementById('leftimage').src='images/'+theLeftImages[whichImage];
	//alert(document.getElementById('leftimage').src);
	intval=setTimeout("showTrans_option()",5500);
}



function changeleftimage()
{
	whichImage = Math.floor(Math.random() * theLeftImages.length);
	document.getElementById('lifestrawleftimage').src='images/'+theLifestrawLeftImages[whichImage];
	intval=setTimeout("changeleftimage()",5500);
}




function showImage_option3()
{
	whichImage = getWhichImage();
	
	if(prevs_whichImage==whichImage)
	{
		showImage_option3();	
	}
	else
	{
		document.getElementById('top_banner_img').className  =theBackImages[whichImage];
		document.getElementById('top_permanet_div').className=thePermanetImages[whichImage];
		document.getElementById('top_lifestraw_div').className=theLifestrawImages[whichImage];
		document.getElementById('top_zerofly_div').className=theZeroflyImages[whichImage];
		prevs_whichImage=whichImage;
		prevs_whichImagePermanet=whichImage;
		prevs_whichImageLifestraw=whichImage;
		prevs_whichImageZerofly=whichImage;
		intval=setTimeout("showImage_option3permanet()",6600);
	}
	
}


function showImage_option3permanet()
{
	//alert("permanet");
//	whichImage = Math.floor(Math.random() * theBackImages.length);
	whichImage = getWhichImage();
	
	if(prevs_whichImagePermanet==whichImage)
	{
		showImage_option3permanet();	
	}
	else
	{
		document.getElementById('top_permanet_div').className=thePermanetImages[whichImage];
		prevs_whichImagePermanet=whichImage;
		intval=setTimeout("showImage_option3lifestraw()",3300);
	}
}


function showImage_option3lifestraw()
{
	//alert("lifestraw");
	whichImage = getWhichImage();
	
	if(prevs_whichImageLifestraw==whichImage)
	{
		showImage_option3lifestraw();
	}
	else
	{
		document.getElementById('top_lifestraw_div').className=theLifestrawImages[whichImage];
		//intval=setTimeout("showImage_option3lifestraw()",3300);
		prevs_whichImageLifestraw=whichImage;
		intval=setTimeout("showImage_option3zerofly()",3300);
	}
}


function showImage_option3zerofly()
{
	//alert("zerofly");
	whichImage = getWhichImage();
	
	if(prevs_whichImageZerofly==whichImage)
	{
		showImage_option3zerofly();
	}
	else
	{
		document.getElementById('top_zerofly_div').className=theZeroflyImages[whichImage];
		//intval=setTimeout("showImage_option3zerofly()",11000);
		prevs_whichImageZerofly=whichImage;
		intval=window.clearTimeout(intval);
		intval=setTimeout("showImage_option3permanet()",6600);
	}
}


//  End -->
