/**********************************************************************************************************************************************************************/
/*                                                                                                                                                                    */
/*                                                          GENERAL FUNCTION LIBRARY FOR TCR WEBSITE                                                                  */
/*                                                                                                                                                                    */
/**********************************************************************************************************************************************************************/

/**********************************************************************************************************************************************************************/
/* PRELOAD IMAGES FOR ROLLOVER BUTTONS                                                                                                                                */
/**********************************************************************************************************************************************************************/

	btnConsoleRepairs = new Image();
	btnConsoleRepairs.src = "http://www.totalconsolerepair.co.uk/images/tabs/consoleRepairOver.png";
	
	btnIpodRepair = new Image();
	btnIpodRepair.src = "http://www.totalconsolerepair.co.uk/images/tabs/ipodRepairOver.png";
	
	btnShopCorp = new Image();
	btnShopCorp.src = "http://www.totalconsolerepair.co.uk/images/tabs/shopCorporateOver.png";
	
	btnContactUs = new Image();
	btnContactUs.src = "http://www.totalconsolerepair.co.uk/images/tabs/contactOver.png";
	
	btnSubmit = new Image();
	btnSubmit.src = "http://www.totalconsolerepair.co.uk/images/button/buttonSubmitOver.png";
	
	btnConfirm = new Image();
	btnConfirm = "http://www.totalconsolerepair.co.uk/images/button/buttonConfirmOver.png";
	
	btnGo = new Image();
	btnGo = "http://www.totalconsolerepair.co.uk/images/button/btnGoOver.png";
	
	btnPost = new Image();
	btnPost = "http://www.totalconsolerepair.co.uk/images/button/btnPostOver.png";
	
	btnTouch = new Image();
	btnTouch = "http://www.totalconsolerepair.co.uk/images/button/btntouchOver.png";
	

/**********************************************************************************************************************************************************************/
/* RESTORE IMAGE BUTTON ON MOUSE OUT EVENT                                                                                                                            */
/**********************************************************************************************************************************************************************/
function MM_swapImgRestore() 
{
	var i, x, a = document.MM_sr;
	for(i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++) 
		x.src=x.oSrc;
}

/**********************************************************************************************************************************************************************/
/* LOOK FOR AN OBJECT IN THE DOCUMENT AND SAY IF IT EXISTS                                                                                                            */
/**********************************************************************************************************************************************************************/
function MM_findObj(n, d) 
{ //v4.01
  	var p,i,x;  
  	if(!d) 
  		d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
    	d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
  	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=MM_findObj(n,d.layers[i].document);
  	if(!x && d.getElementById) x=d.getElementById(n); 
	return x;
}

/**********************************************************************************************************************************************************************/
/* SWAP IMAGE BUTTON ON MOUSE OVER EVENT                                                                                                                              */
/**********************************************************************************************************************************************************************/
function MM_swapImage() 
{ //v3.0
  	var i,j=0,x,a=MM_swapImage.arguments; 
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
   		if ((x=MM_findObj(a[i]))!=null)
		{
			document.MM_sr[j++]=x; 
			if(!x.oSrc) 
				x.oSrc=x.src; 
			x.src=a[i+2];
		}
}

/**********************************************************************************************************************************************************************/
/* ANTI SPAM EMAIL SYSTEM                                                                                                                                             */
/**********************************************************************************************************************************************************************/
function openMail(mail)
{
	domainName = "@totalconsolerepair"; //domain name
	/*BUILD THE EMAIL ADDRESS
	/******************************************************/
	document.write('<a href="mailto:' + mail + domainName + '.co.uk" class="email">' + mail + domainName + '.co.uk</a>');
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkPersInfo()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	fName = document.getElementById("firstName").value;
	lName = document.getElementById("lastName").value;
	address = document.getElementById("address").value;
	town = document.getElementById("town").value;
	postcode = document.getElementById("postcode").value;
	email = document.getElementById("mail").value;
	phHome = document.getElementById("phHome").value;
	
	if( fName == "" || lName == "" || address == "" || town == "" || postcode == "" || email == "" || phHome == "")//one of the required field is empty
		alert("Please fill in all the required fields !");
	else
		if (checkMail(email))
			document.personalInfoForm.submit();
		else
			alert("Your email is not valid !\n\n-> Check if you key it lowercase\n-> Accent and special characters are forbidden\n");
}

/**********************************************************************************************************************************************************************/
/* WRITE THE CODE OF AN EMOTICON IN A BLOCK                                                                                                                           */
/**********************************************************************************************************************************************************************/
function emoticon(type)
{
	//type -> emoticon symbol ;) for example
	
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	content = document.getElementById("reply").value;
	/*CHANGE CONTENT
	/******************************************************/
	document.getElementById("reply").value = content + "[" + type + "]";	
}

/**********************************************************************************************************************************************************************/
/* WRITE '[QUOTE]' IN A BLOCK                                                                                                                                         */
/**********************************************************************************************************************************************************************/
function quote()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	replyBoxValue = document.getElementById("reply").value;
	/*CHANGE CONTENT
	/******************************************************/
	document.getElementById("reply").value = replyBoxValue + "[quote]";	
}

/**********************************************************************************************************************************************************************/
/* WRITE A TEXT IN THE 'LOGINBOX' BLOCK                                                                                                                               */
/**********************************************************************************************************************************************************************/
function writediv(text, state)
{
	//text -> content which is going to be written in the loginBox block
	//state -> state of the login: available or unavailable
	
	document.getElementById('loginBox').innerHTML = text; //write content
	document.getElementById('isLogOk').value = state; //write status of the login in a hidden input text
}
/**********************************************************************************************************************************************************************/
/* TEST IF THE PRESSED KEY IS 'ENTER'                                                                                                                                 */
/**********************************************************************************************************************************************************************/
function isEnter(evt)
{
	//evt -> javascript event: in this case: code of the key pressed by the user
	
	var key = window.event ? evt.keyCode : evt.which;
	if(key	== 13)
		return(true);
	else
		return(false);
}

/**********************************************************************************************************************************************************************/
/* REDIRECTION ON THE 'CONSOLE DETAILS' PAGE                                                                                                                          */
/**********************************************************************************************************************************************************************/
function displayConsoleDetails(console)
{
	//console -> name of the selected console
	
	if(console != "none")
		document.location.href = "consoleDetails.asp?id="+console;
}

/**********************************************************************************************************************************************************************/
/* REDIRECTION ON THE 'IPOD DETAILS' PAGE                                                                                                                             */
/**********************************************************************************************************************************************************************/
function displayIpodDetails(ipod)
{
	//ipod -> name of the selected ipod
	
	if(ipod != "none")
		document.location.href = "ipodDetails.asp?id="+ipod;
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkNewAccountForm(type)
{
	//type -> account type: private (member) or company
	
	address = document.getElementById("address").value;
	town = document.getElementById("town").value;
	postcode = document.getElementById("postcode").value;
	email = document.getElementById("mail").value;
	
	login = document.getElementById("login").value;
	password = document.getElementById("password").value;
	passwordconf = document.getElementById("passwordconf").value;
	question = document.getElementById("question").options[document.getElementById("question").selectedIndex].value;
	answer = document.getElementById("answer").value;
	
	if(type == "member")
	{
		/*GET THE DIFFERENT ELEMENTS
		/******************************************************/
		fName = document.getElementById("firstName").value;
		lName = document.getElementById("lastName").value;

		phHome = document.getElementById("phHome").value;

		if( fName == "" || lName == "" || address == "" || town == "" || postcode == "" || email == "" || phHome == "" ||
			login == "" || password == "" || passwordconf == "" || question == "" || answer == "" ) //one of the required field is empty
			alert("Please fill in all the required fields !");
		else
			if (document.getElementById("isLogOk").value == "false")//Unavailable login
				alert(login+" is not a valid login !");
			else
				if (password != passwordconf) //password ant its confirmation are different
					alert("Your password and its confirmation are different !");
				else
					if (checkMail(document.getElementById("mail").value))// check if the email is valid
						document.privateAccountForm.submit();
					else
						alert("Your email is not valid !\n\n-> Check if you key it lowercase\n-> Accent and special characters are forbidden\n");
	}
	else
	{
		/*GET THE DIFFERENT ELEMENTS
		/******************************************************/
		comp = document.getElementById("compName").value;
		natBusiness = document.getElementById("natBusiness").value;

		tel = document.getElementById("tel").value;
		
		if( comp == "" || natBusiness == "" || address == "" || town == "" || postcode == "" || email == "" || tel == "" ||
			login == "" || password == "" || passwordconf == "" || question == "" || answer == "" ) //one of the required field is empty
			alert("Please fill in all the required fields !");
		else
			if(document.getElementById("quantityAccount").checked == true && document.getElementById("quantity").value == "")
				alert("Please fill the 'Expected Quantity' Field !");
			else
				if(document.getElementById("referralAccount").checked == true && document.getElementById("website").value == "")
					alert("Please fill the 'Website Address' Field !");
				else
					if (document.getElementById("isLogOk").value == "false")//Unavailable login
						alert(login+" is not a valid login !");
					else
						if (password != passwordconf) //password ant its confirmation are different
							alert("Your password and its confirmation are different !");
						else
							if (checkMail(document.getElementById("mail").value))// check if the email is valid
								document.companyAccountForm.submit();
							else
								alert("Your email is not valid !\n\n-> Check if you key it lowercase\n-> Accent and special characters are forbidden\n");
	}
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkUpdateInfoCompany()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	address = document.getElementById("address").value;
	town = document.getElementById("town").value;
	postcode = document.getElementById("postcode").value;
	email = document.getElementById("mail").value;
	
	oldPass = document.getElementById("oldPass").value;
	newPass = document.getElementById("newPass").value;
	newPassConf = document.getElementById("newPassConf").value;
	
	comp = document.getElementById("compName").value;
	natBusiness = document.getElementById("natBusiness").value;

	tel = document.getElementById("tel").value;
	
	if( comp == "" || natBusiness == "" || address == "" || town == "" || postcode == "" || email == "" || tel == "") //one of the required field is empty
	{
		alert("Please fill in all the required fields !");	
	}
	else
	{
		if(oldPass != "")
		{
			if(newPass == "" || newPassConf == "")
				alert("If you want to change your password then fill in the new password and\nthe new password confirmation fields");
			else
				if(newPass != newPassConf)
					alert("Your new password and its confirmation are different !");
				else
					if (checkMail(document.getElementById("mail").value))// check if the email is valid
						document.updatePersoInfoCompForm.submit();
					else
						alert("Your email is not valid !\n\n-> Check if you key it lowercase\n-> Accent and special characters are forbidden\n");
		}
		else
		{
			if (checkMail(document.getElementById("mail").value))// check if the email is valid
				document.updatePersoInfoCompForm.submit();
			else
				alert("Your email is not valid !\n\n-> Check if you key it lowercase\n-> Accent and special characters are forbidden\n");
		}
	}
}

/**********************************************************************************************************************************************************************/
/* CHECK IF AN EMAIL IS CORRECT OR WRONG                                                                                                                              */
/**********************************************************************************************************************************************************************/
function checkMail(email)
{
	//email -> email which is going to be tested
	
	/*REGULAR EXPRESSION
	/******************************************************/
	var reg = new RegExp("^[a-z0-9._-]+@[a-z0-9._-]{2,}\\.[a-z]{2,4}$", "gi");
	//^[a-z0-9._-] -> begin with numbers, letters, _ , - or . (name, surname, ...) 
	//+@ -> then @ 
	//[a-z0-9._-]{2,} -> minimum 2 characters  which are numbers, letters, _ , - or . 
	//\. -> then . (. is a special character which has a meaning in regular expression, so the \ protect it
	//[a-z]{2,4}$ -> finish with 2, 3 or 4 letters

	if(reg.test(email))// test the email
		return(true);// email OK
	return(false);//WRONG email
}

/**********************************************************************************************************************************************************************/
/* DISPLAY THE RATING STARS SYSTEM                                                                                                                                    */
/**********************************************************************************************************************************************************************/
function setMark(m)
{
	//m -> mark given by a user: 1 or 2 or 3 or 4 or 5 stars
	
	/*GET THE MARK
	/******************************************************/
	document.getElementById("mark").value = m;

	for (i=1;i<=m;i++)
		document.getElementById("s"+i).src = "../images/icon/yellowStar.png";
	for (i=m+1;i<=5;i++)
		document.getElementById("s"+i).src = "../images/icon/greyStar.png";
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkComment()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	m = document.getElementById("mark").value;
	fn = document.getElementById("fname").value;
	ln = document.getElementById("lname").value;
	content = document.getElementById("content").value;
	
	if (fn == "" || ln == "" || content == "")
		alert("Please fill in all the fields !");
	else
		if (m == "0")
			alert("Please give us a mark !");
		else
			if(content.length > 1020)
				alert("Sorry ! Your message cannot be longer than 510 characters !");
			else
				document.leaveCommentForm.submit();
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkRepairForm()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	surname = document.getElementById("surname").value;
	policy = document.getElementById("policy").value;
	
	if (surname == "" || policy == "")
		alert("Please fill in all the fields !");
	else
		document.repairStatusForm.submit();
}

/**********************************************************************************************************************************************************************/
/* CHECK IF A USER AGREE WITH TCR TERMS AND CONDITIONS                                                                                                                */
/**********************************************************************************************************************************************************************/
function checkConfirmConsole()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	if (document.getElementById("agree").checked == false)
		alert("You must agree with TCR terms and Conditions before sending us your console !");
	else
	{
		msg = "Your Paperwork will now be generated.\nPlease print it and include it in your package";
		alert(msg);
		
		//document.location.href = "http://www.totalconsolerepair.co.uk/includes/requestStored.asp";
		
		document.location.href = "http://www.totalconsolerepair.co.uk/consoleRepairs/repairForms/printout.asp";
	}
}

/**********************************************************************************************************************************************************************/
/* CHECK IF A USER AGREE WITH TCR TERMS AND CONDITIONS                                                                                                                */
/**********************************************************************************************************************************************************************/
function checkConfirmIpod()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	if (document.getElementById("agree").checked == false)
		alert("You must agree with TCR terms and Conditions before sending us your console !");
	else
	{
		msg = "Your Paperwork will now be generated.\nPlease print it and include it in your package";
		alert(msg);
		
		//document.location.href = "http://www.totalconsolerepair.co.uk/includes/requestStored.asp";
		document.location.href = "http://www.totalconsolerepair.co.uk/iPodRepairs/repairForms/printout.asp";
	}
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkChangePersInfo()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	fName = document.getElementById("firstName").value;
	lName = document.getElementById("lastName").value;
	address = document.getElementById("address").value;
	town = document.getElementById("town").value;
	postcode = document.getElementById("postcode").value;
	email = document.getElementById("mail").value;
	phHome = document.getElementById("phHome").value;
	
	oldPass = document.getElementById("oldPass").value;
	newPass = document.getElementById("newPass").value;
	newPassConf = document.getElementById("newPassConf").value;
	
	if( oldPass != "" ) //want to change the password
	{
		if( newPass == "" || newPassConf == "" ) //Fields new password or new password confirmation empty
			alert("If you want to change your password then fill in all the password fields !");
		else
			if( newPass != newPassConf ) //Password and its confirmation different
				alert("Your new password and its confirmation are different");
			else
				if( fName == "" || lName == "" || address == "" || town == "" || postcode == "" || email == "" || phHome == "") //required field empty
					alert("Please fill in all the required fields !");
				else
					document.privateAccountForm.submit();
	}
	else
	{	
		if( fName == "" || lName == "" || address == "" || town == "" || postcode == "" || email == "" || phHome == "")// required field empty
			alert("Please fill in all the required fields !");
		else
			document.privateAccountForm.submit();
	}
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkBookCollection()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	fName = document.getElementById("firstName").value;
	lName = document.getElementById("lastName").value;
	address = document.getElementById("address").value;
	town = document.getElementById("town").value;
	postcode = document.getElementById("postcode").value;
	email = document.getElementById("mail").value;
	phHome = document.getElementById("phHome").value;
	
	policy = document.getElementById("policy").value;
	date = document.getElementById("date").value;
	
	if( fName == "" || lName == "" || address == "" || town == "" || postcode == "" || email == "" || phHome == "" ||
	    policy == "" || date == "Use Link ->") //required field empty
		alert("Please fill in all the required fields !");	
	else
		document.collectionForm.submit();
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkBookCollectionCompany()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	compName = document.getElementById("compName").value;
	address = document.getElementById("address").value;
	town = document.getElementById("town").value;
	postcode = document.getElementById("postcode").value;
	email = document.getElementById("mail").value;
	tel = document.getElementById("tel").value;
	
	policy = document.getElementById("policy").value;
	date = document.getElementById("date").value;
	numberOfBox = document.getElementById("numberOfBox").value;
	
	if( compName == "" || address == "" || town == "" || postcode == "" || email == "" || tel == "" ||
	    policy == "" || date == "Use Link ->" || numberOfBox == "" || numberOfBox == "0") //required field empty
		alert("Please fill in all the required fields !");
	else
		document.collectionForm.submit();
}

/**********************************************************************************************************************************************************************/
/* CHECK IF ALL THE REQUIRED FIELDS ARE FILLED IN                                                                                                                     */
/**********************************************************************************************************************************************************************/
function checkContactUsForm()
{
	/*GET THE DIFFERENT ELEMENTS
	/******************************************************/
	fName = document.getElementById("fname").value;
	lName = document.getElementById("lname").value;
	email = document.getElementById("email").value;
	ph = document.getElementById("phone").value;
	sbj = document.getElementById("subject").value;
	query = document.getElementById("query").value;
	
	if( fName == "" || lName == "" || email == "" || ph == "" || sbj == "" || query == "") //required field empty
		alert("Please fill in all the required fields !");
	else
		if(checkMail(email))
			document.contactUsForm.submit();
		else
			alert("Your email is not valid !\n\n-> Check if you key it lowercase\n-> Accent and special characters are forbidden");
}

/**********************************************************************************************************************************************************************/
/* HIDE OR SHOW AN INPUT BOX IN THE 'CREATE A COMPANY' ACCOUNT PAGE                                                                                                   */
/**********************************************************************************************************************************************************************/
function changeInputState(v)
{
	//v -> value selected in the type of company account (referral or quantity) box
	
	if(v == "referral")
	{
		document.getElementById("website").style.visibility = "visible";
		document.getElementById("text1").style.visibility = "visible";
		document.getElementById("text2").style.visibility = "visible";
		document.getElementById("quantity").style.visibility = "hidden";
		document.getElementById("text3").style.visibility = "hidden";
		document.getElementById("text4").style.visibility = "hidden";
	}
	else
	{
		document.getElementById("website").style.visibility = "hidden";
		document.getElementById("text1").style.visibility = "hidden";
		document.getElementById("text2").style.visibility = "hidden";
		document.getElementById("quantity").style.visibility = "visible";
		document.getElementById("text3").style.visibility = "visible";
		document.getElementById("text4").style.visibility = "visible";
	}
}

/**********************************************************************************************************************************************************************/
/* CHANGE THE CSS CLASS OF AN OBJECT                                                                                                                                  */
/**********************************************************************************************************************************************************************/
function rollClass(id, cl)
{
	//id -> identifier of the object
	//cl -> css class we want to attached to the object
	
	document.getElementById(id).className = cl;
}

/**********************************************************************************************************************************************************************/
/* CHECK IF THE PRESSED KEY IS A NUMBER                                                                                                                               */
/**********************************************************************************************************************************************************************/
function isNumeric(evt)
{
	//evt -> javascript event: in this case: code of the key pressed by the user
	
	var key = window.event ? evt.keyCode : evt.which;
	
	//see any ASCII table on the internet to have the keycode
	if((key >= 96 && key <= 105)||(key >= 48 && key <= 57)||(key == 9)||(key == 8)||(key == 46)||(key == 44))
		return true;
	return false;
}

/**********************************************************************************************************************************************************************/
/* CHECK IF THE PRESSED KEY IS A NUMBER                                                                                                                               */
/**********************************************************************************************************************************************************************/
function isReferralCode(evt)
{
	//evt -> javascript event: in this case: code of the key pressed by the user
	
	var key = window.event ? evt.keyCode : evt.which;
	
	discountReferralCode = document.getElementById("discountReferralCode").value;
	
	//see any ASCII table on the internet to have the keycode
	if(((key >= 96 && key <= 105)||(key >= 48 && key <= 57)||(key == 46)||(key == 9)||(key == 44)) && discountReferralCode.length < 5 || (key == 8))
		return true;
	return false;
}

/**********************************************************************************************************************************************************************/
/* UPDATE THE CUSTOMER REPAIR VOUCHER ORDER                                                                                                                           */
/**********************************************************************************************************************************************************************/
function updateOrder(id)
{
	unitPrice = document.getElementById("unitPrice"+id);
	oldquantity = document.getElementById("oldquantity"+id);
	quantity = document.getElementById("quantity"+id);
	price = document.getElementById("price"+id);
	total = document.getElementById("totalAmount");
	
	if(quantity.value == "")
		quantity.value = "0";
	
	newPrice = quantity.value * unitPrice.value;
	price.value = newPrice.toFixed(2);
	
	if(quantity.value > oldquantity.value)
	{		
		i = parseInt(quantity.value) - parseInt(oldquantity.value);
		newtotal = parseFloat(total.value) + (i * parseFloat(unitPrice.value));
		total.value =  newtotal.toFixed(2);
	}
	else
	{
		//update price
		i = parseInt(oldquantity.value) - parseInt(quantity.value);
		newtotal = parseFloat(total.value) - (i * parseFloat(unitPrice.value));
		if(newtotal > 0)
			total.value = newtotal.toFixed(2);
		else
			total.value = "0.00";
	}
	
	oldquantity.value = quantity.value;
}

/**********************************************************************************************************************************************************************/
/* REDIRECT THE USER TO THE 'VOUCHER DETAILS' PAGE                                                                                                                    */
/**********************************************************************************************************************************************************************/
function redirectVoucher(id)
{
	if(id != "none")
		window.location.href = "http://www.totalconsolerepair.co.uk/consoleRepairs/repairVouchers/voucherDetails.asp?id="+id;	
}

/**********************************************************************************************************************************************************************/
/* CHECK IF A TEXT IN AN INPUT BOX IS NOT TOO LONG                                                                                                                    */
/**********************************************************************************************************************************************************************/
function checkSize(str,evt,size)
{
	var key = window.event ? evt.keyCode : evt.which;
	if(str.length > size)
		if(key == 8) //backspace allowed
			return true;
		else
			return false;
	return true;
}