function changeto(highlightcolor){
	source=event.srcElement;
	if (source.tagName=="TABLE") {
		return;
	}
	while(source.tagName!="TR") {
		source=source.parentElement;
	}
	if ((source.style.backgroundColor!=highlightcolor) && (source.id!="ignore")) {
		source.style.backgroundColor = highlightcolor;
	}
}

function changeback(originalcolor){
	if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore") {
		return;
	}
	if (event.toElement!=source) {
			source.style.backgroundColor=originalcolor;
	}
}

function show_carpet_colors() {
	window.open("carpetdisplay.asp","","top=" + (screen.height/2 - (400/2)) + ",left=" + (screen.width/2 - (490/2)) + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=490,height=425");
}

function preview_shipping(prod_id) {
	window.open("preview_shipping.asp?id=" + prod_id,"","top=" + (screen.height/2 - (100/2)) + ",left=" + (screen.width/2 - (250/2)) + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=250,height=100");
}

function show_single_photo(pth) {
	window.open("/show_install_pic.asp?p=" + pth,"","top=" + (screen.height/2 - (440/2)) + ",left=" + (screen.width/2 - (570/2)) + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=570,height=440");
}

function open_example(pth) {
	window.open("show_example.asp?" + pth,"","top=" + (screen.height/2 - (250/2)) + ",left=" + (screen.width/2 - (425/2)) + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=425,height=250");
}

function Start(page) {
	window.open(page, "", "top=" + (screen.height/2 - (500/2)) + ",left=" + (screen.width/2 - (700/2)) + ",toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no, width=700, height=500");
}

function max_win() {
	window.moveTo(1,1);
	if (document.all) {
		window.resizeTo(screen.availWidth - 1,screen.availHeight - 1);
	} else if (document.layers || document.getElementById) {
		if (window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth){
			window.outerHeight = screen.availHeight - 1;
			window.outerWidth = screen.availWidth - 1;
		}
	}
}

function open_window (url, width, height) {
	var left, top;
	left = (screen.availWidth / 2) - (width / 2);
	top = (screen.availHeight / 2) - (height / 2);
	window.open (url, "carpet", "resize=no,scroolbars=no,history=no,toolbar=no,statusbar=no,left=" + left + ",top=" + top + ",width=" + width + ",height=" + height);
}

var wn;

function OWin(url, w, h) {
	var left = (screen.availWidth - w) / 2;
	var top = (screen.availHeight - h) / 4;
	wn = window.open(url, 'popup', 'width=' + w + ',height=' + h + ',left=' + left + ',top=' + top + ',history=no,toolbar=no,status=no,scrollbars=yes,resizable=yes');
	wn.focus();
	return;
}
	