function topbanEffects(idwhat, whichway)
{
if (whichway == "IN")
	{
		startfilter(idwhat)
		document.all.item(idwhat).style.color = "rgb(253,253,5)"
	}
	else
	{
		stopfilter(idwhat)
		document.all.item(idwhat).style.color = "rgb(255,255,255)"
	}
}
function topbanEffectsImg(idwhat, whichway, prefix)
{
	var imgsuffix;
	var imgSource;
	
	if (whichway == "IN")
	{
		imgsuffix = "b.jpg";
	}
	else
	{
		imgsuffix = "a.jpg";
	}
	switch(idwhat)
	{
		case 'imgNewSale':
		case 'imgUsedSale':
			imgSource = prefix + "images/topban3" + imgsuffix;
			break		
		case 'imgNewRent':
		case 'imgUsedRent':
			imgSource = prefix + "images/topban5" + imgsuffix;
			break		
		case 'imgAttach':
			imgSource = prefix + "images/topban11" + imgsuffix;
			break		
		case 'imgParts':
			imgSource = prefix + "images/topban13" + imgsuffix;
			break		
	}
	document.all.item(idwhat).src = imgSource;
}
//--- Blinking effect-----------//
var i_strength=0
var max_strength=1
var shadowcolor="#FDFD05"
var timer
var speed=100
var thisobj



function stopfilter(thisdiv){
    if (document.all) {
        clearTimeout(timer)
	    thisobj=thisdiv
	    //thisobj.style.filter=" "
	    document.all.item(thisdiv).style.filter=" "
    }
}


function startfilter(thisdiv){
    if (document.all) {
        clearTimeout(timer)
	    thisobj=thisdiv
        morefilter()
    }
}

function morefilter(){
    if (i_strength <=max_strength) {
	    //thisobj.style.filter="glow(color="+shadowcolor+", strength="+i_strength+")"
	     document.all.item(thisobj).style.filter="glow(color="+shadowcolor+", strength="+i_strength+")"
        i_strength++
        timer = setTimeout("morefilter()",speed)
    } 
    else {
        clearTimeout(timer)
       lessfilter()
    } 
}

function lessfilter(){
    if (i_strength >=0) {
	    //thisobj.style.filter="glow(color="+shadowcolor+", strength="+i_strength+")"
	     document.all.item(thisobj).style.filter="glow(color="+shadowcolor+", strength="+i_strength+")"
       // i_strength--              //********* Uncomment this line to have a blinking effect
        timer = setTimeout("lessfilter()",speed)
    }    
    else {
        clearTimeout(timer)
        morefilter()
    } 
}
//--- Blinking effect------end-----//
// ------------- For the News Ticker Typing style instead of using a Marquee -----//
	var theCharacterTimeout = 50;
	var theStoryTimeout     = 5000;
	var theWidgetOne        = "_";
	var theWidgetTwo        = "-";
	var theWidgetNone       = "";
	var theLeadString       = "";//"Worldwide Rental Services:&nbsp;";

	var theSummaries = new Array();
	var theSiteLinks = new Array();

	//var theItemCount = 4;
	
	var theAnchorObject;

	
	//	theSummaries[0] = "We will earn your confidence with our reliable, thorough service and support.";
	//	theSiteLinks[0] = "../UnderConstruction.htm";
	
	//	theSummaries[1] = "Put our expertise to work for you - We know heavy equipment inside out.";
	//	theSiteLinks[1] = "../UnderConstruction.htm";
	
	//	theSummaries[2] = "Let us analyze your project and recommend the right equipment for the job.";
	//	theSiteLinks[2] = "../UnderConstruction.htm";
	
	//	theSummaries[3] = "We can customize our machines to handle all types of construction projects.";
	//	theSiteLinks[3] = "../UnderConstruction.htm";
	
// Ticker startup
function startTicker()
{
	// Define run time values
	theCurrentStory     = -1;
	theCurrentLength    = 0;
	// Locate base objects
	if (document.getElementById) {	
		    theAnchorObject = document.all['tickerAnchor'];
			runTheTicker();   	
		 }
	else {
            document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
	}
}
// Ticker main run loop
function runTheTicker()
{
	var myTimeout;  
	// Go for the next story data block
	if(theCurrentLength == 0)
	{
		theCurrentStory++;
		theCurrentStory      = theCurrentStory % theItemCount;
		theStorySummary      = theSummaries[theCurrentStory].replace(/&quot;/g,'"');		
		theTargetLink        = theSiteLinks[theCurrentStory];
		theAnchorObject.href = theTargetLink;
		thePrefix 	     = "<span class=\"tickls\">" + theLeadString + "</span>";
	}
	// Stuff the current ticker text into the anchor
	theAnchorObject.innerHTML = thePrefix + 
	theStorySummary.substring(0,theCurrentLength) + whatWidget();
	// Modify the length for the substring and define the timer
	if(theCurrentLength != theStorySummary.length)
	{
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
	}
	else
	{
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("runTheTicker()", myTimeout);
}
// Widget generator
function whatWidget()
{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}

	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}
}

// for product comparison.
function WindowPopup(link)
	{
		//var link = "../images/Superior/SuperiorPipelayer/" + imgname +".jpg" ;//"NoteLogData.aspx?Function=New&Mode=Modal&ID=" + sIndividualID + "&Type=Contact";
		//alert("link " + link);
		window.showModalDialog(link, null,'dialogHeight:800 px; dialogWidth: 800px; edge: Raised; center: Yes; help: No; scroll:Yes; resizable: Yes; status: No;');
	}
	
//For Rotating Banner Ads on Division Home pages
var interval = 5	// delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}
function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}
function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}
function getNextImage() {
//if (random_display) {
image_index = generate(0, number_of_image-1);
//}
//else {
//image_index = (image_index+1) % number_of_image;
//}
var new_image = get_ImageItemLocation(image_list[image_index]);
var new_link = link_list[image_index].image_item.src
if (new_link.substring((new_link.length - 1), new_link.length) != '#')
{
	document.all.item('hlBannerAd').href = link_list[image_index].image_item.src;
	document.all.item('hlBannerAd').style.cursor = 'pointer'
}
else
{
	document.all.item('hlBannerAd').href = '#';
	document.all.item('hlBannerAd').style.cursor = 'default'
}
return(new_image);
}

// Rotation does not occur when the banner ad is moused over.
function rotateImage(strBannerAd)
{
	var bannerAd = document.getElementById(strBannerAd);
	
	if(!bannerAd)
		return;

	if(bannerAd.MousedOver == undefined)
		setupBannerAd(bannerAd);

	if(!bannerAd.MousedOver)
	{
		var new_image = getNextImage();
		bannerAd.src = new_image;
	}

	var recur_call = "rotateImage('"+ strBannerAd +"')";
	setTimeout(recur_call, interval);
}

function setupBannerAd(bannerAd)
{
	bannerAd.MousedOver = false;
	bannerAd.onmouseover = function() { bannerAd.MousedOver = true }
	bannerAd.onmouseout = function() { bannerAd.MousedOver = false }
}

//Equipment Search for Division pages
function MainEquipSearch()
{
	var qstr
	if ((document.all.item('txtSearch').value != ''))
		qstr = '?model_number=' + document.all.item('txtSearch').value
	else
		qstr = ''
	location.href='../EquipmentSearch.aspx' + qstr
}
