var dom = (document.getElementById) ? true : false;
var ns5 = (!document.all && dom || window.opera) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ie4 && !ie5 && !dom) ? true : false;

if (nodyn) { event = "nope" }

var tipFollowMouse = true;	
var offX = 20;
var offY = 12; 

/////////////////////////
// IMAGES AND TOOLTIPS //
/////////////////////////
var messages = new Array();
messages[0] = new Array('images/galleries/RP_DS1.jpg','Starting the removal process of our prep.');
messages[1] = new Array('images/galleries/RP_DS2.jpg','Using our mill to remove the existing asphalt - ensuring proper grade control without disturbing the base.');
messages[2] = new Array('images/galleries/RP_DS3.jpg','Checking all elevations and painting out parking lot to set up for binder coat.');
messages[3] = new Array('images/galleries/RP_DS4.jpg','Here we are installing the binder (also known as first lift).');
messages[4] = new Array('images/galleries/RP_DS5.jpg','Here we are installing the surface lift over the binder lift.');
messages[5] = new Array('images/galleries/RP_DS6.jpg','This surface lift is being rolled while creating a swale to direct water away from the building.');
messages[6] = new Array('images/galleries/RP_DS7.jpg','After the pavement is installed, it is then striped.');
messages[7] = new Array('images/galleries/RP_DS8.jpg','Pavement markings were added for  traffic direction and flow.');
messages[8] = new Array('images/galleries/RP_DS9.jpg','The square foot of the lot was increased during construction which allowed us to engineer more available parking stalls.');
messages[9] = new Array('images/galleries/RP_DS10.jpg','This lot was prepped, paved, and striped all within 4 working days late in November -  to meet our clients expectations. See Testimonial for customer satisfaction.');
messages[10] = new Array('images/galleries/RP_Ind1.jpg','Our crews have the skills and leadership to allow businesses to stay open while paving is in process with minimal disruptions.');
messages[11] = new Array('images/galleries/RP_Ind2.jpg','From Paving to Striping, Rabine Paving exceeds all expectations on all size parking lots from commercial to professional.');
messages[12] = new Array('images/galleries/RP_Ind3.jpg','With our various paver sizes we are capable of all types of road paving.');
messages[13] = new Array('images/galleries/RP_Ind4.jpg','Special equipment or specific needs is utilized with road paving - We are able to incorporate one of our Pnuematic rollers - (Shown Here).');
messages[14] = new Array('images/galleries/RP_Ind5.jpg','From start to finish we are able to complete all aspects of road paving including shouldering.');

////////////////////
// PRELOAD IMAGES //
////////////////////
if (document.images) 
{
	var theImgs = new Array();
	for (var i=0; i<messages.length; i++) 
	{
  		theImgs[i] = new Image();
		theImgs[i].src = messages[i][0];
  	}
}

///////////////////
// INIT TOOL TIP //
///////////////////
var tooltip, tipstyle;
function init() 
{	
	if (nodyn) return;
	
	tooltip = (ie4)? document.all['tipDiv']: (ie5||ns5)? document.getElementById('tipDiv'): null;
	tipstyle = tooltip.style;
	
	if (ie4||ie5||ns5) {	// ns4 would lose all this on rewrites
		tipstyle.width = "";
		tipstyle.fontFamily = "Arial,sans-serif";
		tipstyle.fontSize = "12px";
		tipstyle.color = "#000000";
		tipstyle.backgroundColor = "#F0ECE7";
		tipstyle.borderColor = "#000000";
		tipstyle.borderWidth = "1x";
		tipstyle.padding = "10px";
		tipstyle.borderStyle = "solid";
	}
	
	if (tooltip&&tipFollowMouse) {
		document.onmousemove = trackMouse;
	}
}

window.onload = init;

//////////////////////
// TOOLTIP FUNCTION //
//////////////////////
var tipOn = false;	// TOOLTIP NOT TURNED ON
function doTooltip(evt,num) 
{
	if (!tooltip) return; // IF THERE IS NO TOOLTIP, RETURN
	tipOn = true; // TOOLTIP TURNED ON
	
	if (ie4||ie5||ns5) 
	{
		tooltip.innerHTML = "<table width='400' border='0' cellpadding='0' cellspacing='0'><tr><td align='center'><img src='" + messages[num][0] + "' border='0'></td></tr><tr><td valign='top' style='TEXT-ALIGN:justify;'>" + '<div style="FONT:12px Arial,sans-serif; COLOR:#000000;">' + messages[num][1] + '</div>' + "</td></tr></table>";
	}
	
	setTimeout("tipstyle.visibility='visible'",100);
}

///////////////////////
// POSITION OF MOUSE //
///////////////////////
var mouseX, mouseY;
function trackMouse(evt) 
{
	standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	mouseX = (ns5)? evt.pageX: window.event.clientX + standardbody.scrollLeft;
	mouseY = (ns5)? evt.pageY: window.event.clientY + standardbody.scrollTop;
	if (tipOn) positionTip(evt);
}

//////////////////////////////
// POSITION OF THE TOOL TIP //
//////////////////////////////
function positionTip(evt) 
{
	// TOOLTIP WIDTH AND HEIGHT
	var tipwidth = (ie4||ie5)? tooltip.clientWidth: tooltip.offsetWidth;
	var tipheight = (ie4||ie5)? tooltip.clientHeight: tooltip.offsetHeight;
	
	// DOCUMENT AREA IN VIEW (subtract scrollbar width for ns)
	var windowwidth = (ns5)? window.innerWidth-20+window.pageXOffset: standardbody.clientWidth+standardbody.scrollLeft;
	var windowheight = (ns5)? window.innerHeight-20+window.pageYOffset: standardbody.clientHeight+standardbody.scrollTop;
	
	//POSITION TOOLTIP
	if ((mouseX+offX+tipwidth) > windowwidth) 
		tipstyle.left = mouseX-(tipwidth+offX)+"px";
	else tipstyle.left = mouseX+offX+"px";
	if ((mouseY+offY+tipheight)>windowheight) 
		tipstyle.top = windowheight-(tipheight+offY)+"px";
	else tipstyle.top = mouseY+offY+"px";
}

///////////////////////
// HIDE THE TOOL TIP //
///////////////////////
function hideTip() 
{
	if (!tooltip) return;  // IF THERE IS NO TOOLTIP, RETURN
	
	setTimeout("tipstyle.visibility='hidden'",100);
	
	tipOn = false; // TOOLTIP NOT ON
}

document.write('<div id="tipDiv" style="position:absolute; visibility:hidden; z-index:100"></div>')