var url = "";

function SetLanguage(selection){
	url = "?mod=setlanguage&language=" + selection + "&red=" + strQueryStrings;
	document.location = url;
}

function PopImage(type,id){
	window.open("image.asp?type=" + type + "&id=" + id,"image","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1,height=1,left = 200,top = 200");
}

function SearchMan(selection){
	url = "?mod=search&type=advanced&man_id=" + selection;
	document.location = url;
}

function goToModel(selection){
	url = "?mod=model&make_id=" + selection;
	document.location = url;
}

function addToCart(product_id, field_id){
	var quant = document.getElementById("products_to_alter_" + field_id).value;
	if(quant!=0){
		document.location = "?mod=cart&action=add&id=" + product_id + "&quant=" + quant;
	}
}

function deleteFromCart(cookie_id, field_id){
	var quant = document.getElementById("products_to_alter_" + field_id).value;
	if(quant!=0){
		document.location = "?mod=cart&action=delete&id=" + cookie_id + "&quant=" + quant;
	}
}

function showError(number, source, description){
	div_name = "errordiv";
	document.getElementById(div_name).style.visibility = "";
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		index_02_over = newImage("images/index_02-over.gif");
		index_04_over = newImage("images/index_04-over.jpg");
		index_06_over = newImage("images/index_06-over.jpg");
		index_07_over = newImage("images/index_07-over.jpg");
		preloadFlag = true;
	}
}
