


function changeImg_store(imgName,toImg){
	var i = document.getElementById(imgName);
	i.src = toImg;
}

// -------------------------------------------------------------

function sort_list(mode,url){
	location.href = url + "?sort=" + mode;
}

// -------------------------------------------------------------

function showHide(divID, mode) {
	document.getElementById(divID).style.display = mode;
}
// -------------------------------------------------------------

function setElementOn(thisItem){
	thisItem.style.background = "#CFC";	
}
function setElementOff(thisItem){
	thisItem.style.background = "#FFF";	
}
// -------------------------------------------------------------

function checkFormRequest(){
	var frm = document.form_enquiry_basket;
  	var myTelNo = frm.phone.value;
	var errmsg = "";
	if(frm.name.value == "") errmsg = errmsg + " - Your name\n";
  	if (!checkUKTelephone (myTelNo))  errmsg = errmsg + " - Telephone number (" + telNumberErrors[telNumberErrorNo] + ")\n";
	if(frm.email.value == "") errmsg = errmsg + " - Email address\n";
	
	if(frm.virtual_sample.checked == true){
		if(frm._userfile1.value == "" && frm._userfile1.value == "" && frm._userfile1.value == "") errmsg = errmsg + " - Image : you have requested a Virtual Sample but not attached an image\n";
	}
	
	
	if(frm._security_code.value == "") errmsg = errmsg + " - Security code\n";
	if(errmsg == "") {
		frm._mode.value = "submit";
		frm.submit();
	}else{
		errmsg = "Sorry but the form is incomplete. \n\nPlease check the following fields...\n" + errmsg;
		alert(errmsg);
	}
}
// -------------------------------------------------------------

function securityinfo(){
	alert("What's this?\n\nThis is a 5-digit security code that helps us to ensure we get real enquiries from real people.\n\nIf you cannot read the code easily, use the speaker icon to download an audio file that will read the code to you.\nAlternatively, you can click the 'Refresh Image' icon which will load a new code for you. This can be done as many times as you wish.\n\nWe apologise for any inconvenience this may cause but due to other, inconsiderate marketers, we have to protect ourselves again spam and other malicious emails.\n\n")
}
// -------------------------------------------------------------
function checkSearchBox(){
	var val = trim(document.form_quick_search.form_quick_search_text.value)
	if(val == "" || val =="Enter your search here..."){
		alert("Please enter a search word or phrase")
		return false
	}else{
		return true
	}
}

// -------------------------------------------------------------
function info_popup(page, height){
	winRef = window.open(rootFolder +page,'infowindow','width=450,height='+height+',left=50,top=50,screenX=50,screenY=50')
}
function doTracking(){
	info_popup('mailer.php', 1);
}

// -------------------------------------------------------------

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
// -------------------------------------------------------------
function checkForm(){
	var frm = document.enquiry_form;
  	var myTelNo = frm.phone.value;
	var errmsg = "";
	if(frm.name.value == "") errmsg = errmsg + " - Your name\n";
  	if (!checkUKTelephone (myTelNo))  errmsg = errmsg + " - Telephone number (" + telNumberErrors[telNumberErrorNo] + ")\n";
	if(frm.email.value == "") errmsg = errmsg + " - Email address\n";
	

	if(frm._security_code.value == "") errmsg = errmsg + " - Security code\n";
	if(errmsg == "") {
		frm.submit();
	}else{
		errmsg = "Sorry but the form is incomplete. \n\nPlease check the following fields...\n" + errmsg;
		alert(errmsg);
	}
	
}
// -------------------------------------------------------------
function confirmBasketAdd(t_or_f){
	if(t_or_f){
		return confirm("This product is already in your enquiry basket.\n\nAre you sure you want to add it again?");
	}else{
		return true
	}

}

function confirmQuote(t_or_f){
	if(t_or_f){
		return confirm("This product is already in your Enquiry Basket.\n\nAre you sure you want to get a separate quote for this product?");
	}else{
		return true
	}
}

// -------------------------------------------------------------

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
// -------------------------------------------------------------


