﻿window.onload = rolloverInit;

function rolloverInit() {
	for (var i=0; i<document.images.length; i++) {
		setupRollover(document.images[i]);
	}
}

function setupRollover(thisImage) {

    if (thisImage.src.lastIndexOf('_Off.') > -1) {
    
        /* Set the mouseout image. */
		thisImage.outImage = new Image();
		thisImage.outImage.src = thisImage.src;
		thisImage.onmouseout = rollOut;
		
		/* Set the mouseover image. */
		thisImage.overImage = new Image();
		thisImage.overImage.src = thisImage.src.slice(0, thisImage.src.lastIndexOf('_')+1) + "Over" + thisImage.src.slice(thisImage.src.lastIndexOf("."));
		thisImage.onmouseover = rollOver;
		
		/* Set the mousedown image.*/
		thisImage.clickImage = new Image();
		thisImage.clickImage.src = thisImage.src.slice(0, thisImage.src.lastIndexOf('_')+1) + "Down" + thisImage.src.slice(thisImage.src.lastIndexOf("."));
		thisImage.onmousedown = rollClick;
	}
}

function rollOut() {
	this.src = this.outImage.src;
}

function rollOver() {
	this.src = this.overImage.src;
}

function rollClick() {
	this.src = this.clickImage.src;
}

function rolloverInitOld() {
	for (var i=0; i<document.images.length; i++) {
		if (document.images[i].parentNode.tagName == "A"){
			setupRollover(document.images[i]);
		}
	}
}

function gethomelocation() {
	if (document.location.host=="www.rocketrooterla.com") {
		javascript:document.location.href="http://www.rocketrooterla.com/index.html"}
	if (document.location.host=="www.losangelessewercleaning.com") {
		javascript:document.location.href="http://www.losangelessewercleaning.com/index.html"}
}


