


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 msg_virtualsample(){
	tx = "We can create a virtual sample of almost any product on our website.\n";
	tx = tx + "Simply put, a 'virtual sample' is a grahical mock up of what your chosen product will look like when printed with your required artwork\n\n"
	tx = tx + "All you have to do is ask for a quote, from either the 'Get A Fast Quote' or 'Enquiry Basket' options, and upload your logo or artwork.\n";
	tx = tx + "Make sure you tick the 'Free Virtual Sample' option on the form and we'll email you a picture of what your chosen products will look like.\n\n";
	tx = tx + "Please note that the Virtual Sample is not always perfect and that the finished product may vary slightly from the mock-up image.";
	alert(tx);
}

// -------------------------------------------------------------
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,"");
}
// -------------------------------------------------------------

function custom_people_popup(){
	winRef = window.open(rootFolder +'promotional-usb/custom-design-people.php','custompeople','width=900,height=750,left=50,top=50,screenX=50,screenY=50')
}

function writeAddToBasketLink(rootFolder,itemID,inBasket,imgortext){
	document.write('<a href="' + rootFolder 
				   	+ 'enquiry_basket.php?mode=add&amp;item=' + itemID 
					+ '" onclick="return confirmBasketAdd(' + inBasket + ')" rel="nofollow">');
	if(imgortext == "img"){
		document.write('<img src="' + rootFolder +'images/button_basket_add.gif" border="0">');
	}else{
		document.write('Add to your<br>Quote Enquiry Basket');
	}
	document.write('</a>');	
}
