/*
	Copyright David Trewern Design         :: www.dtdesign.com ::
	Unauthorised modification / use is a criminal offence, and
	will be prosecuted to the fullest extent permitted by law.
	All Rights Reserved
*/

NAVarr = new Array("memberlogin", "jointheenewsletter", "addtocart", "update", "remove", "continueshopping", "checkout", "continue", "back", "submitorder", "post", "login", "logout", "joinnow", "processmembership", "applytoday", "yes", "no", "submit");
if (document.images) {
	for (var NAVitem in NAVarr) { 
		 for (var NAVicount=0; NAVicount < 2; NAVicount++) { 
				eval("b" + NAVarr[NAVitem] + NAVicount + " = new Image()");
				eval("b" + NAVarr[NAVitem] + NAVicount + ".src = 'assets/swap_" + NAVarr[NAVitem] + "_" + NAVicount + ".gif'");
		 } 
	} 
}

function BturnOn(imageName) {
	if (document.images) {
		var imageNumber = "";
		if (arguments.length > 1) imageNumber = arguments[1];
		document [imageName + imageNumber].src = eval("b" + imageName + "1.src");
	}
}

function BturnOff(imageName) {
	if (document.images) {
		var imageNumber = "";
		if (arguments.length > 1) imageNumber = arguments[1];
		document [imageName + imageNumber].src = eval("b" + imageName + "0.src");
	}
}

function BturnOnInput(obj,imageName) {
	if (obj.src) {
		obj.src = eval("b" + imageName + "1.src");
	}
}

function BturnOffInput(obj,imageName) {
	if (obj.src) {
		obj.src = eval("b" + imageName + "0.src");
	}
}


function imgPopup(path) {
	if (path) {
		window.open("utils_imagepopup.aspx?path=" + path, "popup", "width=400, height=300, toolbar=no, status=no, scrollbars=yes, resizable=yes");
	}
}

function ddRedirect(dd) {
	var preText = "";
	if (arguments.length > 1) preText = arguments[1];
	if (dd.options[dd.selectedIndex].value != "") self.location = preText + dd.options[dd.selectedIndex].value;
}

function showMe (it, box) {
  var vis = (box.checked) ? "none" : "block";
  document.getElementById(it).style.display = vis;
}


function sortProducts(category, whichPage) {

	var path = "shop_" + whichPage + ".aspx?category=" + category + "&";
	var qry = "pagesize=" + escape(document.getElementById("productsperpage").value);
    qry += "&orderby=" + escape(document.getElementById("sort").value);
	
	if (whichPage == "search") {
		qry += "&keyword=" + escape(document.getElementById("keyword").value);	
	}
	
    location = path + qry;

}

function sortHighlights(category, whichPage) {

	var path = "museum-of-cricket_museum-online-collection_" + whichPage + ".aspx?";
	var qry = "pagesize=" + escape(document.getElementById("productsperpage").value);
	
	if (category != "") {
		qry += "&category=" + category;
	}
	
	if (whichPage == "search") {
		qry += "&keyword=" + escape(document.getElementById("keyword").value);	
	}
	
    location = path + qry;

}