var boxes;
function HideBoxes(){
//alert('shiding');
	boxes = document.getElementById('red_boxes');
	if(boxes != undefined){
		//alert('one');
		boxes.style.display = 'none';
		document.getElementById('redBox').style.display = 'none';
		
	}else{
		//alert('doesnt exist');
	}//alert('hiding');
		
}

var IE = document.all?true:false;
if (!IE){
	window.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown = showMeNow;
var tempX = 0;
var tempY = 0;
var temper = null;
function showMeNow(e){
	if (IE) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	}else {  // grab the x-y pos.s if browser is in other
		tempX = e.pageX;
		tempY = e.pageY;
	}
	if (tempX < 0){
		tempX = 0;
	}
	if (tempY < 0){
		tempY = 0;
	}
	if(tempX > 560 && tempX < 1033){
		if(tempY > 168 && tempY < 490){
			if((navigator.userAgent).indexOf('MSIE 6.0') == 25){
				HideBoxes();
			}
			setTimeout("HideBoxes()", 400);
			//temper = setInterval("HideBoxes", 500);
		}
	}
	return true;
}


function loadCheck(){
	if(document.body){
		if(document.body.clientWidth < 800){
			document.getElementById('peanut').className = "tester_outer800By600";
		}
	}
	if(window.outerWidth){
		if(window.outerWidth < 830){
			if(document.getElementsByName('peanut') != undefined){
				document.getElementsByName('peanut')[0].style.backgroundImage = null;
			}
		}
	}
}

function getIfOut(){
	//alert(document.getElementById("onValue").value);
	if(document.getElementById("onValue").value == 0){
		return "off";
	}else{
		return "on";
	}
}

function gotoConsult(){
	window.navigate("request.php");
	//pop-up div?
}


function openRentalTerms(){
	window.open("includes/terms.php", "_blank", "status=0, toolbar=0, menubar=0, location=0,width=830, scrollbars=1");
}

function openWhiteInventory(){
	window.open("includes/whiteInventory.php", "_blank", "status=0, toolbar=0, menubar=0, location=0,width=830, scrollbars=1, height=480px");
	//pop-up div?
}

function openAnnouncement(){
	window.open("includes/announcing.php", "_blank", "status=0, toolbar=0, menubar=0, location=0,width=830, scrollbars=1, height=480px");
	//pop-up div?
}

function openInsurance(){
	window.open("includes/insurance.php", "_blank", "status=0, toolbar=0, menubar=0, location=0,width=830, scrollbars=1, height=550px");
	//pop-up div?
}

function CreditApplication(){
	window.open("includes/docs/ImpactClientCreditApplication.pdf");
}

function CreditAuthorization(){
	window.open("includes/docs/CreditCardAuthorization.pdf");
}

function CalTaxForm(){
	window.open("includes/docs/calresale.pdf");
}

function movingLights(){

}

function conventionalFixture(){

}

function LED(){

}

function controlConsoles(){

}

function dimmingSystems(){

}

function powerDistribution(){

}

function foggers(){

}

function truss(){

}


function AmericanDJ(){
	window.open("http://www.americandj.com/");
}

function Apollo(){
	window.open("http://apollodesign.net/");
}

function Avolites(){
	window.open("http://www.avolitesamerica.com/");

}

function CityTheatrical(){
	window.open("http://www.citytheatrical.com/ ");

}

function DougDesign(){
	window.open("http://www.dfd.com/");

}

function Hosa(){
	window.open("http://www.hosatech.com/");
}

function JamesThomas(){
	window.open("http://www.jthomaseng.com/");

}

function Lee(){
	window.open("http://www.leefilters.com/");

}

function LeMaitre(){
	window.open("http://www.lemaitrefx.com/");

}

function Leprecon(){
	window.open("http://www.leprecon.com/");

}

function Leviton(){
	window.open("http://www.leviton.com/");

}

function Lightronics(){
	window.open("http://www.lightronics.com/");
}

function Martin(){
	window.open("http://www.martin.com/frontpage/frontpage.asp?empty=0");

}

function Optikinetics(){
	window.open("http://www.opti-kinetics.com/");
}

function Reel(){
	window.open("http://www.reelefx.com/index.php?c=home.welcome");

}

function Rosco(){
	window.open("http://www.rosco.com/");

}

function Strand(){
	window.open("http://www.strandlighting.com/");

}

function Tomcat(){
	window.open("http://www.tomcatglobal.com/");

}

function Wybron(){
	window.open("http://www.wybron.com/");

}


var hex, textNews, textCount, textIndex, divT;
function textStart(){
	hex = 250; // Initial color value.
	//to be taken from the database later if required
	// target='_blank' will open the link in a new page
	//reference the site above for sequences to certain characters like '`' = &#180; and the accent over the e = &#233;
	textNews = ["<a href='javascript:openAnnouncement();' class='divNewsItems' id='newsCon0'>Announcing our new Website...</a>",
			"<a href='javascript:openWhiteInventory();' class='divNewsItems' id='newsCon1'>See our new \"white\" inventory. It\'s perfect for bright settings.</a>"]
	textCount = textNews.length;
	textIndex = 0;
	divT = document.getElementById("divNews");
	divT.innerHTML = textNews[0];
}

function fadetext(dir){
	var divN = document.getElementById("newsCon" + textIndex);
	if(dir == 'down'){
	  if(hex>80) { //If color is not black yet  //51
		hex-=8; // increase color darkness
		divN.style.color="rgb("+hex+","+hex+","+hex+")";
		setTimeout("fadetext('down');",100);
	  }
	  else{
		if(textIndex == (textCount-1)){
			textIndex = 0;
		}else{
			textIndex = textIndex + 1;
		}
		document.getElementById('divNews').innerHTML = textNews[textIndex];
		setTimeout("fadetext('up');", 500);
	  }
	}else if(dir == 'up'){
	  if(hex<=255) { //If color is not black yet  //212
		hex+=8; // increase color darkness
		divN.style.color="rgb("+hex+","+hex+","+hex+")";
		setTimeout("fadetext('up');", 100);
	  }else{
		setTimeout("fadetext('down');", 3000);
	  }
	}else{
		alert('broken');
		hex=212; //212
	}

}


function closeNews(){
	document.getElementById('divNewsWrapper').style.display = "none";
	document.getElementById('footer_top').style.display = "none";

}

var ua, IE, FF, Safari, hex1, hex2, speedMaster, delayMaster;
function imageStart(){
	ua = navigator.userAgent.toLowerCase();
	if(ua.indexOf( "msie" ) != -1){
		IE = 1;
		FF = 0;
		Safari = 0;
	}else if(ua.indexOf( "firefox" ) != -1){
		IE = 0;
		FF = 1;
		Safari = 0;
	}else{
		Safari = 1;
		IE = 0;
		FF = 0;
	}
	hex1 = 100;
	hex2 = 100-hex1;
	speedMaster = 40;
	delayMaster = 4000;
}
function fadeimage(oneId, twoId){
	var arr = new Array();
	arr[0] = document.getElementById("img" + oneId);
	arr[1] = document.getElementById("img" + twoId);
	if(hex1>0) { //If color is not black yet  //51
		hex1-=1; // increase color darkness
		hex2 = 100-hex1;
		if(IE){
			arr[0].filters.alpha.opacity =hex1;
			arr[1].filters.alpha.opacity =hex2;
		}else if(FF){
			arr[0].style.MozOpacity =(hex1/100);
			arr[1].style.MozOpacity =(hex2/100);
		}else{
			arr[0].style.KhtmlOpacity =(hex1/100);
			arr[1].style.KhtmlOpacity =(hex2/100);
			arr[0].style.opacity =(hex1/100);
			arr[1].style.opacity =(hex2/100);
		}
		setTimeout("fadeimage(" + oneId + ", " + twoId + ");",speedMaster);
	}else{
		oneId++;
		twoId++;
		if(oneId == 5){
			oneId = 1;
		}else if(twoId == 5){
			twoId = 1;
		}
		hex1 = 100;
		setTimeout("fadeimage(" + oneId + ", " + twoId + ");", delayMaster);
	}
}