// Copyright Acro Media Inc. 1998-2002, www.acromediainc.com
preloaded = 0;
var imageNames;
var imageOver;

graphicsDir = "/graphics/toolbar/";

if (document.images) {
  imageNames = new initArray("home", "corp", "tech", "contact", "news", "lease", "account", "viewcart");
  imageOver = new initArray("b_home_02.gif", "b_corp_02.gif", "b_tech_02.gif", "b_contact_02.gif", "b_news_02.gif", "b_lease_02.gif", "b_account_02.gif", "b_viewcart_02.gif");
}

function preloadImages(){
	var i, temp;

	if(document.images){
		for(i=0; i<imageNames.length; i++){
			document.images[imageNames[i]].offsrc = document.images[imageNames[i]].src;
		}


		for(i=0; i<imageNames.length; i++){
			temp = new Image();
			temp.src = graphicsDir + imageOver[i];
			document.images[imageNames[i]].oversrc = temp.src;
		}
		preloaded = 1;
	}
}

function initArray(){
	if (document.images){
		this.length = initArray.arguments.length;
		for (var i=0;i<= this.length; i++){
			this[i] = initArray.arguments[i];
		}
	}
}

function mouseOver(imageID) {
	if(document.images && preloaded){ 
		document.images[imageNames[imageID]].src = document.images[imageNames[imageID]].oversrc;
	}
}

function mouseOut(imageID) {
	if(document.images && preloaded){
		document.images[imageNames[imageID]].src = document.images[imageNames[imageID]].offsrc;
	}
}

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = 0 + dc.indexOf(prefix);
	if (begin == -1){
		return 0;
	}
	begin += prefix.length;
	var end = 0 + document.cookie.indexOf(";", begin);
	if (end == -1){
		end = dc.length;
	}
	return unescape(dc.substring(begin, end));
}	

entryPoint = document.referrer;
entryPoint.toLowerCase();
if(entryPoint.indexOf("lasergrafix") == -1){
	var expires = new Date();
	expires.setTime(expires.getTime() + 3E11);   // about 10 years = "forever"
	setCookie("entryPoint", document.referrer, 0, "/", ".lasergrafix.com");
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

function openUp(windowURL, windowWidth, windowHeight) {
	var topPos = "";
	var leftPos = "";
	if(!windowWidth) windowWidth = 0;
	if(!windowHeight) windowHeight = 0;
	if(windowWidth == 0){
		if(screen){
			windowWidth = screen.availWidth -10;
		}
		else{
			windowWidth = 790;
		}
		leftPos = ",left=0";
	}
	if(windowHeight == 0){
		if(screen){
			windowHeight = screen.availHeight -30;
		}
		else{
			windowHeight = 790;
		}
		topPos = ",top=0";
	}


	newWin = window.open(windowURL,"acromedia","toolbar=no,menubar=0,width="+windowWidth+",height="+windowHeight+topPos+leftPos+",scrollbars=yes,resizable=no");

	if(javascript_version > 1.0){
		setTimeout('newWin.focus();',100);
	}
}

function checkValue(name){

	if(eval("document.detailsForm."+name+".value") == ""){
		eval("document.detailsForm."+name+".value = '1'");
	}
	else{
		eval("document.detailsForm."+name+".value = ''");
	}

}

function checkBox(name, otherName){
	if(eval("document.detailsForm."+otherName+".value") == ""){
		eval("document.detailsForm."+name+".checked = false");
	}
	else{
		eval("document.detailsForm."+name+".checked = true");
	}
}