
var curpage;

function showalloy(aid) {
	window.open('showalloy.php?aid='+aid+'&js=true', 'alloywin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=550, height=530');
}

function showalloy2(aid) {
	window.open('showalloy2.php?aid='+aid+'&js=true', 'alloywin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=550, height=530');
}

function showplastic(aid) {
	window.open('showplastic.php?aid='+aid+'&js=true', 'plasticwin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=670, height=470');
}

function showreferb(aid) {
	window.open('showreferb.php?aid='+aid+'&js=true', 'referbwin', 'toolbar=no, directories=no, location=no, status=yes, menubar=no, resizable=yes, scrollbars=yes, width=550, height=560');
}



function buttonhi(butname,action) {
	if(butname == curpage) { return 0; }
	
	butobj = fetchobj(butname);

	if(action) {
		//true
		butobj.src='sys/img/design/'+butname+'_c.png';
	} else {
		//false
		butobj.src='sys/img/design/'+butname+'_a.png';
	}
}


function fetchobj(objname) {
	if(document.getElementById) {
		obj = document.getElementById(objname);
	} else if(document.all) {
		obj = document.all[objname];
	} else {
		obj = null;
	}
	return obj;
}

function checkenqform() {
	fname = fetchobj('name');
	fenquiry = fetchobj('enquiry');

	if(fname.value == '') { alert('Please enter your Name'); fname.focus(); return false; }
	if(fenquiry.value == '') { alert('Please enter an Enquiry'); fenquiry.focus(); return false; }

        fsource = fetchobj('Source');

	if (fsource){
           if (fsource.selectedIndex == 0)
           {
    		alert("Please select from the \"How did you find us\" options.");
    		fsource.focus();
    		return (false);
  	   }
	}
	return true;	
}

function intdoc() {
	//preload imgs
	var loadArr_b = new Array();
	var loadArr_c = new Array();
	var imgArr = new Array("plasticfinishing","alloywheels","classiccarrestoration","generalfinishing","company");
	
	for (var i=0; i<imgArr.length; i++) {
		loadArr_b[i] = new Image();
		loadArr_c[i] = new Image();
		loadArr_b[i].src = "sys/img/design/'+imgArr[i]+'_b.png";
		loadArr_c[i].src = "sys/img/design/'+imgArr[i]+'_c.png";
	}
	
}

function showLayer(layerName, nest){
	var x = getObj(layerName, nest);
	x.visibility = "visible";
	x.position = "relative";
}

function hideLayer(layerName, nest){
	var x = getObj(layerName, nest);
	x.visibility = "hidden";
	x.position = "absolute";
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=150,left = 376,top = 232');");
}
