var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=15 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
var newMouseX; //= pageXpos 
var newMouseY; //= mouseY ;
var timerID = 0; //initiate timer object
var thisAd = 0;

if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

if (ie||ns6)
var imageObj=document.all? document.all["dhtmlImageFlyOut"] : document.getElementById? document.getElementById("dhtmlImageFlyOut") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

/*////////////////////////////////Browser Sniffer////////////////////////////////*/
/*mactest=(navigator.userAgent.indexOf("Mac")!=-1) //My browser sniffers

Netscape=(navigator.appName.indexOf("Netscape") != -1)

msafari=(navigator.userAgent.indexOf("Safari")!= -1)

wsafari=0; if(!mactest&&msafari){wsafari=1;msafari=0}

is_opera = 0; if(window.opera){is_opera=1}

is_ie_mac = 0; is_ie=0;if(document.all){is_ie=1}

if(is_ie&&mactest){is_ie_mac=1}

alert("mactest:"+mactest+", Netscape:"+Netscape+", wsafari:"+wsafari+", msafari:"+msafari+", is_ie:"+is_ie+", is_ie_mac:"+is_ie_mac+", is_opera:"+is_opera)*/
/*////////////////////////////////End Browser Sniffer////////////////////////////////*/


/*////////////////////////////////Setup Flyout Text////////////////////////////////*/	

var atvLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='50cc-90cc_atvs.html'><font color=blue>50cc to 90cc ATVs</font></a><br><a href='110cc-150cc_atvs.html'><font color=blue>110cc to 150cc ATVs</font></a><br><a href='200cc-250cc_atvs.html'><font color=blue>200cc to 250cc ATVs</font></a><br><a href='250cc+_page.html'><font color=blue>250cc Plus Page</font></a><br></div>";	

var bikeLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='bikes.html'><font color=blue>50cc to 110cc Dirt Bikes</font></a><br><a href='bikes.html'><font color=blue>125cc to 250cc Dirt Bikes</font></a><br><a href='bikes.html'><font color=blue>Scooters and E-Bikes</font></a><br></div>";

var accessoryLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='helmet_page.html'><font color=blue>Helmets</font></a><br><a href='ATV-Parts.html'><font color=blue>Parts</font><br></a></div>";

var safetyLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='safety.html'><font color=blue>Safety Information</font></a><br><a href='http://www.mto.gov.on.ca/english/dandv/vehicle/emerging/'><font color=blue>Alternative Vehicle Laws</font></a><br><a href='http://www.mto.gov.on.ca/english/dandv/orv.htm'><font color=blue>Off-Road Vehicle Regulations</font></a><br><a href='http://www.safety-council.org/info/sport/atv.html'><font color=blue>Canada Safety Council</font></a><br></div>";	

var termsLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='terms_conditions_sale.html'><font color=blue>Terms and Conditions of Sales</font></a><br></div>";	

var conversionLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='http://www.onlineconversion.com/'><font color=blue>Metric Conversion Calculator</font></a><br></div>";

var contactLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='contact.html'><font color=blue>Contact Information</font></a><br><a href='mission_statement.html'><font color=blue>Info / Mission Statement</font></a><br></div>";

var fieldLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='paintball_field.html'><font color=blue>Paintball Field</font></a><br></div>";

var videoLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='videos.html'><font color=blue>Paintball Field Videos</font></a><br></div>";

var eventsLeftNav = "<div onclick='hideddrivetip()' id='flyOutItem' align='center' style='font-family: Arial, Helvetica, sans-serif; font-size: 10px; z-index: 20;'><a href='events-calendar/events-calendar.html'><font color=blue>Bad Bob's Event Calendar</font></a><br></div>";

/*////////////////////////////End Setup Flyout Text////////////////////////////*/

var thewidth;//this allows this value to be used in other functions 
var theheight;//this allows this value to be used in other functions
var halfTipObjWidth;//this allows this value to be used in other functions 
var halfTipObjHeight;//this allows this value to be used in other functions 

function ChangeView(newView,newViewArray)
{
	varCt = newViewArray.length;
	newView = newViewArray[thisAd];
	thisAd++;
	if (thisAd == varCt) 
	{
		thisAd = 0;
	}		
	imageFlyOut(newView,'#eeeeee', 550,350); 
	allowImageFlyOut();
	setTimeout("ChangeView", 50);
}

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
		if (typeof thetext!="undefined" && thetext!="") tipobj.innerHTML=thetext
		//tipobj.innerHTML=thetext;
		//tipobj.width=thewidth; 
		enabletip=true;
		return false  
	}
}												  

var thetop=0;
var theleft=0;
var enablePositiontip2 = false;

function positiontip(e, thetop, theleft)
{			
	newMouseX = theleft;
	newMouseY = thetop;

	tipobj.style.left = newMouseX;
	tipobj.style.top = newMouseY;	
		
	tipobj.style.visibility="visible";
}

function positiontip2(e, thetop, theleft)
{	
if (enablePositiontip2 == false)
	{
		var curX=(ns6)?e.pageXOffset : event.x+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageYOffset : event.y+ietruebody().scrollTop;
		if(ns6)
			{
				mousePosLeft=window.event.pageX;//mouse x position
				mousePosTop=window.event.pageY;//mouse y position
				
				documentScreenHeight = window.innerHeight;
				documentScreenWidth = window.innerWidth;
				pageXpos = window.pageXOffset;//page position relative to scrolled window
				pageYpos = window.pageYOffset;//page position relative to scrolled window	
				mouseX = window.event.pageX;//mouse x position - does not necessarily allow for page scrolling - relates to screen not to document
				mouseY = window.event.pageY;//mouse y position - does not necessarily allow for page scrolling - relates to screen not to document	
			}
		else
			{
				mousePosLeft=window.event.clientX;//mouse x position
				mousePosTop=window.event.clientY;//mouse y position	
					
				documentScreenHeight = document.body.clientHeight;
				documentScreenWidth = document.body.clientWidth;
				pageXpos = document.body.scrollLeft;//page position relative to scrolled window
				pageYpos = document.body.scrollTop;//page position relative to scrolled window
				mouseX = window.event.clientX;//mouse x position - does not necessarily allow for page scrolling - relates to screen not to document
				mouseY = window.event.clientY;//mouse y position - does not necessarily allow for page scrolling - relates to screen not to document
			}	
	}	
	newMouseX = theleft;
	newMouseY = pageYpos+20;

	tipobj.style.left = newMouseX;
	tipobj.style.top = newMouseY;	
		
	tipobj.style.visibility="visible";
	enablePositiontip2 = true;
}

function hideddrivetip()
{
	if(enablePositiontip2 == false)
	{
		tipobj.style.visibility="hidden";
		tipobj.style.left="-1000px";
		tipobj.style.backgroundColor='';
		tipobj.style.width='';
		enablePositiontip2 = false;
		enabletip=false;
	}
}

function hideddrivetip2()
{
	tipobj.style.visibility="hidden";
	tipobj.style.left="-1000px";
	tipobj.style.backgroundColor='';
	tipobj.style.width='';
	enablePositiontip2 = false;
	enabletip=false;
}

var halfImageObjWidth;
var halfImageObjHeight;
var mousePosLeft
var mousePosTop

function imageFlyOut(thetext, thecolor, thewidth, theheight)
{	
	if (ns6||ie)
	{
		if (typeof thewidth!="undefined") imageObj.style.width=thewidth+"px"	
		if (typeof thecolor!="undefined" && thecolor!="") imageObj.style.backgroundColor=thecolor
	
		imageObj.innerHTML=thetext
	
		halfImageObjWidth=thewidth/2;
		halfImageObjHeight=theheight/2;
		enabletip=true;
		
		return false  
	}
}	

function positionImageFlyOut(e)
{
	if (enabletip)
	{
		var curX=(ns6)?e.pageXOffset : event.x+ietruebody().scrollLeft;
			var curY=(ns6)?e.pageYOffset : event.y+ietruebody().scrollTop;
		if(ns6)
			{
				mousePosLeft=window.pageX;//mouse x position
				mousePosTop=window.pageY;//mouse y position
				
				documentScreenHeight = window.innerHeight;
				documentScreenWidth = window.innerWidth;
				pageXpos = window.pageXOffset;//page position relative to scrolled window
				pageYpos = window.pageYOffset;//page position relative to scrolled window	
				mouseX = window.pageX;//mouse x position - does not necessarily allow for page scrolling - relates to screen not to document
				mouseY = window.pageY;//mouse y position - does not necessarily allow for page scrolling - relates to screen not to document	
			}
		else
			{
				mousePosLeft=window.event.clientX;//mouse x position
				mousePosTop=window.event.clientY;//mouse y position	
					
				documentScreenHeight = document.body.clientHeight;
				documentScreenWidth = document.body.clientWidth;
				pageXpos = document.body.scrollLeft;//page position relative to scrolled window
				pageYpos = document.body.scrollTop;//page position relative to scrolled window
				mouseX = window.event.clientX;//mouse x position - does not necessarily allow for page scrolling - relates to screen not to document
				mouseY = window.event.clientY;//mouse y position - does not necessarily allow for page scrolling - relates to screen not to document
			}	
		
		imageObj.style.left =mousePosLeft-halfImageObjWidth;		
		imageObj.style.top =mousePosTop+pageYpos-halfImageObjHeight-25;
		imageObj.style.visibility="visible";
	}
}

function hideImageFlyOut()
{
	imageObj.style.visibility="hidden";
	imageObj.style.left="-1000px";
	imageObj.style.backgroundColor='';
	imageObj.style.width='';
	document.onmousemove=null;
	enabletip=false;
}

function allowImageFlyOut()
{
	document.onmousemove=positionImageFlyOut;
}

function keyDownEvent(view1,view2)
{
	if (ns6){
		if(window.keyCode == 67)
		ChangeView(view1,view2)
	}
	else
	{
		if(window.event.keyCode == 67)
		ChangeView(view1,view2)
	}
}

//function getScreenHeight()
//{
	//leftNavObj.style.height = document.body.clientHeight;
	//alert(leftNavObj);
//}

/*////////////////////////////////Printing Fuctions////////////////////////////////*/

// -- ALLOWS A PRINT LINK WHICH SHOULD WORK IN NETSCAPE OR EXPLORER
function printIt(){
	if(window.print){
		window.print();
	}else{
		var WebBrowser='<object id="WebBrowser1" width=0 height=0 CLASSID="CLSID:8856F961-340A-11D0-00C04FD705A2"></object>';
		document.body.insertAjacentHTML('beforeEnd',WebBrowser);
		WebBrowser1.ExecWB(6,2);
	}
}

var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial(printItem)
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n</HEAD>\n<BODY>\n';

var printReadyElem = document.getElementById(printItem);

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the page to print");
return;
}

html += '\n</BODY>\n</HTML>';

var printWin = window.open("","printSpecial","width=300,height=400,left=50,top=50,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars,resizable,copyhistory=0,");

printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
}
}
/*////////////////////////////////End Printing Fuctions////////////////////////////////*/