/*
if (top.frames.length != 0)
top.location = self.document.location;
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);

var theImages = new Array() 

theImages[0] = 'indexpic1.jpg'
theImages[1] = 'indexpic5.jpg'
theImages[0] = 'indexpic2.jpg'
theImages[0] = 'girl.jpg'
theImages[1] = 'girl.jpg'
theImages[2] = 'girlwithflowers.jpg'
theImages[3] = '400.jpg'
theImages[4] = '500.jpg'

var j = 0
var p = theImages.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}

var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="pix/'+theImages[whichImage]+'" border="0" alt="" galleryimg="off">');
}
*/
function signup_email() {
var iMyWidth;
var iMyHeight;
iMyWidth = (window.screen.width/2) - (140) //half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (65) //half the screen height minus half the new window height (plus title and status bars).
var reg_email = document.signup.reg_email;
if ((document.signup.reg_email.value == "") || (document.signup.reg_email.value.indexOf ('@', 0) == -1) || (document.signup.reg_email.value.length < 6) || (document.signup.reg_email.value.indexOf ('.', 0) == -1)) {
	alert('This is not a valid email address.\n\r          Please try again.');
	reg_email.value = "";
	reg_email.focus();
	return true;
	}
	var reg_win = window.open("about:blank","reg_win","height=230,width=480,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + "" + iMyHeight + ",scrollbars=no,status=no,toolbar=no,menubar=no");
	document.signup.submit();
	document.signup.reset();
}

function validate_reg_email() {
var iMyWidth;
var iMyHeight;
iMyWidth = (window.screen.width/2) - (140) //half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (65) //half the screen height minus half the new window height (plus title and status bars).
var reg_email = document.register.reg_email;
if ((document.register.reg_email.value == "") || (document.register.reg_email.value.indexOf ('@', 0) == -1) || (document.register.reg_email.value.length < 6) || (document.register.reg_email.value.indexOf ('.', 0) == -1)) {
	alert('This is not a valid email address.\n\r          Please try again.');
	reg_email.value = "";
	reg_email.focus();
	return true;
	}
	var reg_win = window.open("about:blank","reg_win","height=230,width=480,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + "" + iMyHeight + ",scrollbars=no,status=no,toolbar=no,menubar=no")
	document.register.submit();
	document.register.reset();
}

function validate_pr_email() {

var iMyWidth;
var iMyHeight;

iMyWidth = (window.screen.width/2) - (140) //half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (65) //half the screen height minus half the new window height (plus title and status bars).
	
var pr_email = document.pressrelease.pr_email;

if (pr_email.value == "" || pr_email.value.indexOf ('@', 0) == -1 || pr_email.value.indexOf ('.', 0) == -1 || pr_email.value.length < 8) {

	alert('This is not a valid email address.\n\r          Please try again.');
	pr_email.value = "";
	pr_email.focus();
	return true;
	}
	var pr_win = window.open("about:blank","pr_win","height=130,width=280,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + "" + iMyHeight + ",scrollbars=no,status=no,toolbar=no,menubar=no")
	document.pressrelease.submit();
	document.pressrelease.reset();
}



function popup_reg(url){
var iMyWidth;
var iMyHeight;

iMyWidth = (window.screen.width/2) - (100) //half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (100) //half the screen height minus half the new window height (plus title and status bars).
	
	var reg_win = window.open(url,"reg_win","height=200,width=200,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + "" + iMyHeight + ",scrollbars=no,status=no,toolbar=no,menubar=no")
}

function what_brand_en() {

	sel = document.form1.brandname;
	if (sel.selectedIndex != "-1") {
		window.location.href = "index.cfm?nme=" + sel.options[sel.selectedIndex].value;
	}else {
		window.location.href = "index.cfm?nme=all"
	}
}

function ShowSection(ID){
	if (document.all[ID + "Sec"].className=="menu_off")
	{
		document.all["arr" + ID].src = "pix/arrowleft2.jpg";
		document.all[ID + "Sec"].className="menu_on";
	}
	else
	{
		document.all["arr" + ID].src = "pix/arrowright2.jpg";
		document.all[ID + "Sec"].className="menu_off";
	}
}
function DispSection(section){
	if (document.all[section + "Sec"].className== section + "_menu_off")
	{
		document.all["arr" + section].src = "pix/arrowleft2.jpg";
		document.all[section + "Sec"].className=section +"_menu_on";
	}
	else
	{
		document.all["arr" + section].src = "pix/arrowright2.jpg";
		document.all[section + "Sec"].className=section +"_menu_off";
	}
}

function DispSection2(section){
	try {
		document.all["arr" + section].src = "pix/arrowleft2.jpg";
		document.all[section + "Sec"].className=section +"_menu_on";
	} catch (error) {
		return false;
	}
}

// OLD MENU
function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("cont").getElementsByTagName("DIV");
		if(el.style.display == "none"){
			for (var i=0; i<ar.length; i++){
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}
function ChangeClass(menu, newClass) { 
	 if (document.getElementById) { 
	 	document.getElementById(menu).className = newClass;
	 } 
} 
document.onselectstart = new Function("return true");


function sortingItems() {
	url_dest = document.getElementById("sortbyselect").value;
	window.location.href = url_dest;
}


function checkOut_en () {
	
	window.location.href = "checkout_getInfo.cfm";
}

promQTY = 1;
var intFocus = -1

function inBasket_en(){

	alert ("This product has been added to your shopping basket.\n\nUse the menu on the left to continue shopping.");
}

function get_details_en(){
	// This is to check the payment type. Comment lines if not needed.
	/*
	payment_type = document.getinfo.payment_type;
	if (payment_type.selectedIndex == 0) {
	 	alert ("Please select the payment type.");
	    payment_type.focus();
	    return true;
	}
	*/
	/*
	selpayer = document.getinfo.payer_title;
	if (selpayer.selectedIndex == 0) {
	alert ("Please select a Title");
	selpayer.focus();
	return true;
	}
	*/
	if (document.getinfo.payer_firstname.value == "" && document.getinfo.firstname.value == "") {
		alert ("You need to enter a Firstname.");
		document.getinfo.payer_firstname.focus();
		return true;
    }
	if (document.getinfo.payer_surname.value == "" && document.getinfo.surname.value == "") {
		alert ("You need to enter a Surname.");
		document.getinfo.payer_surname.focus();
		return true;
    }
	if (document.getinfo.payer_email.value == "" || document.getinfo.payer_email.value.indexOf ('@', 0) == -1 || document.getinfo.payer_email.value.indexOf ('.', 0) == -1 || document.getinfo.payer_email.value.length < 8) 
	{
		alert('You need to enter a valid email address');
		document.getinfo.payer_email.focus();
		return true;
	}
	if (document.getinfo.payer_phone.value == "" || document.getinfo.payer_phone.value.length < 9) 
	{
		alert('You need to enter a valid telephone number or a mobile number.');
		document.getinfo.payer_phone.focus();
		return true;
	}
	if (document.getinfo.address1.value == "" && document.getinfo.address2.value == "") {
		alert ("You need to enter the delivery address.");
		document.getinfo.address1.focus();
		return true;
    }
	if (document.getinfo.town.value == "") {
		alert ("You need to enter the Town.");
		document.getinfo.town.focus();
		return true;
    }
	if (document.getinfo.region.value == "") {
		alert ("You need to enter the Region.");
		document.getinfo.region.focus();
		return true;
    }
	if (document.getinfo.postcode.value == "") {
		alert ("You need to enter the Post Code.");
		document.getinfo.postcode.focus();
		return true;
    }
	sel = document.getinfo.country;
	if (sel.selectedIndex == 0) {
	alert ("Please select a country.");
	sel.focus();
	return true;
	}
	//NOT USED
	//var other_country = document.getinfo.country;
	//if (other_country.options[other_country.selectedIndex].value == 21 && document.getinfo.other_country.value == "") {
	//alert ("You need to select a country from the list or\n\ntype in a country if the country is not in the list");
	//document.getinfo.other_country.focus();
	//return true;
	//}
	//This is to check for the survey
	/*
	survey_sel = document.getinfo.survey;
	if (survey_sel.selectedIndex == 0) {
	alert ("Please select how did you hear about us.");
	survey_sel.focus();
	return true;
	}	
	var survey1 = document.getinfo.survey;
	if (survey1.options[survey1.selectedIndex].value == 3 && document.getinfo.other_survey.value == "") {
	alert ("Please specify the Magazine name.");
	document.getinfo.other_survey.focus();
	return true;
	}
	var survey2 = document.getinfo.survey;
	if (survey2.options[survey2.selectedIndex].value == 5 && document.getinfo.other_survey.value == "") {
	alert ("Please type in how did you hear from us.");
	document.getinfo.other_survey.focus();
	return true;
	}
	*/
	// This is to check the payment type and country. Comment lines if not needed.
	// var country_payment_type = document.getinfo.country;
	// if (document.getinfo.payment_type.value == 'podelivery' && country_payment_type.options[country_payment_type.selectedIndex].value != 'Spain'){ 
	// alert ("Please change the payment type.\n\n\For countries other than Spain, payment must be with credit card.");
	// document.getinfo.payment_type.focus();
	// if (confirm("For deliveries outside of Spain you must first contact us.\rWould you like to contact us to continue with your order for outside of Spain?")){
	// window.location.href = "contactus.cfm";
	// return false;
	// }
	// return true;
	// }	
	document.getinfo.submit();
}

function clearField(){

	var empty = document.getinfo.other_country;
	empty.value = "";
}

function other_country_en(){
	
	var other_country = document.getinfo.country;
	clearField();
	if (other_country.options[other_country.selectedIndex].value == 21) {
	alert ("Please type in your country if it is not on the list.");
	document.getinfo.other_country.focus();
	return true;
	}	
}

function survey_result(){
										
	var survey = document.getinfo.survey;
	if (survey.options[survey.selectedIndex].value == 3) {
		alert ("Please specify the Magazine name.");
		document.getinfo.other_survey.focus();
		return true;
	}else if (survey.options[survey.selectedIndex].value == 5) {
		alert ("Please type in how did you hear from us");
		document.getinfo.other_survey.focus();
		return true;
	}
}

function place_order_en() {

	document.placeorder.submit();
}

function check_makeup_colour() { 
prod_makeup_colours = document.form.prod_makeup_colours;
	if (prod_makeup_colours.selectedIndex == 0) {
	alert ("Please select a colour");
	prod_makeup_colours.focus();
	return true;
	}
	document.form.submit();
}


function return2shop_en () {
	
	window.location.href = "index.cfm?lang=en";
}

function popup_terms (url){

var iMyWidth;
var iMyHeight;

iMyWidth = (window.screen.width/2) - (325 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (225 + 50)//half the screen height minus half the new window height (plus title and status bars).
var popup_terms = window.open(url,"Window","status=no,height=450,width=650,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes")

if (!popup_terms.opener)
popup_terms.opener = self;
}

function popup_feedback (url){
var iMyWidth;
var iMyHeight;

iMyWidth = (window.screen.width/2) - (225 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (175 + 50)//half the screen height minus half the new window height (plus title and status bars).
var popup_feedback = window.open(url,"Window","status=no,height=450,width=550,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no")

if (!popup_feedback.opener)
popup_feedback.opener = self;
}

function popup_callme (url){
var iMyWidth;
var iMyHeight;

iMyWidth = (window.screen.width/2) - (225 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (175 + 50)//half the screen height minus half the new window height (plus title and status bars).
var popup_callme = window.open(url,"Window","status=no,height=350,width=450,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=no")

if (!popup_terms.opener)
popup_callme.opener = self;
}


function popup_pressreleases (url){

var iMyWidth;
var iMyHeight;

iMyWidth = (window.screen.width/2) - (325 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - (225 + 50)//half the screen height minus half the new window height (plus title and status bars).
var popup_pressreleases = window.open(url,"Window","status,height=450,width=650,resizable=no,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes")

if (!popup_pressreleases.opener)
popup_pressreleases.opener = self;
}

function validate_contactus_en() {

if (document.emailform.fullname.value == "") 
	{
		alert ('Please enter your Firstname.');
		document.emailform.fullname.focus();
		return true;
    }
if (document.emailform.email.value == "" || document.emailform.email.value.indexOf ('@', 0) == -1 || document.emailform.email.value.indexOf ('.', 0) == -1 || document.emailform.email.value.length < 8) 
	{
		alert('This is not a valid e-mail address.\n\r          Please try again.');
		document.emailform.email.focus();
		return true;
	}
if (document.emailform.email2.value == "") 
	{
		alert('Please confirm your e-mail address');
		document.emailform.email2.focus();
		return true;
	}
if (document.emailform.email.value !=  document.emailform.email2.value) 
	{
		alert('You entered email addresses that do not match.\n\r          Please try again');
		document.emailform.email.focus();
		return true;
	}
if (document.emailform.message.value == "" || document.emailform.message.value.length < 5) 
	{
		alert ('This is not a valid message.\n\r          Please try again.');
		document.emailform.message.focus();
		return true;
    }
	document.emailform.submit();
}

function validate_promotion () {

if (document.promotionform.fullname.value == "") 
	{
		alert ('Please enter your Firstname.');
		document.promotionform.fullname.focus();
		return true;
    }
if (document.promotionform.email.value == "" || document.promotionform.email.value.indexOf ('@', 0) == -1 || document.promotionform.email.value.indexOf ('.', 0) == -1 || document.promotionform.email.value.length < 8) 
	{
		alert('This is not a valid e-mail address.\n\r          Please try again.');
		document.promotionform.email.focus();
		return true;
	}
if (document.promotionform.email2.value == "") 
	{
		alert('Please confirm your e-mail address');
		document.promotionform.email2.focus();
		return true;
	}
if (document.promotionform.email.value !=  document.promotionform.email2.value) 
	{
		alert('You entered email addresses that do not match.\n\r          Please try again');
		document.promotionform.email.focus();
		return true;
	}
if (document.promotionform.promotion.value == "" || document.promotionform.promotion.value.length < 4) 
	{
		alert ('This is not a valid code.\n\r          Please try again.');
		document.promotionform.promotion.focus();
		return true;
    }
	document.promotionform.submit();
}


function validate_callme() {
	nr1=document.callmeform.telephone.value;
  	flg=0;
  	str="";
  	spc=""
  	arw="";
	
if (document.callmeform.fullname.value == "") 
	{
		alert ('Please enter your name.');
		document.callmeform.fullname.focus();
		return true;
    }
if ((document.callmeform.telephone.value == "") || (document.callmeform.telephone.value.length < 8 ) || (document.callmeform.telephone.value.length > 14 ))
	{
		alert ('Please enter a valid telephone number.');
		document.callmeform.telephone.focus();
		return true;
    }
for (var i=0;i<nr1.length;i++)
	{
   		cmp="0123456789"
   		tst=nr1.substring(i,i+1)
   	if (cmp.indexOf(tst)<0){
    	flg++;
    	str+=" "+tst;
    	spc+=tst;
    	arw+="^";
   	}
   	else{arw+="_";}
  	}
  	if (flg!=0){
   		if (spc.indexOf(" ")>-1) {
    	str+=" and a space";
    }
   	alert(nr1+"\r"+arw+"\rI'm sorry. This entry must " +"be a number. I found "+flg+" unacceptable: "+str+".");
	document.callmeform.telephone.focus();
   	return false;
	}
	callday = document.callmeform.callday;
	if (callday.selectedIndex == 0) {
		alert ("Please select when you would like us to call you.");
		callday.focus();
		return true;
	}
	calltime = document.callmeform.calltime;
		if (calltime.selectedIndex == 0) {
		alert ("Please select at what time you would like us to call you.");
		calltime.focus();
		return true;
	}
//if ((document.callmeform.callday.value == "") || (document.callmeform.callday.value == "dd/mm/yyyy") || (document.callmeform.callday.value == "ddmmyyyy") || (document.callmeform.callday.value.indexOf ("/") > 0))
	//{
	//	alert ('Please enter when you like to get called.');
	//	document.callmeform.callday.focus();
	//	return true;
    //}
	document.callmeform.submit();
	
}


function validate_email2friend_en() {

if (document.email2friend.sender_email.value == "" || document.email2friend.sender_email.value.indexOf ('@', 0) == -1 || document.email2friend.sender_email.value.indexOf ('.', 0) == -1 || document.email2friend.sender_email.value.length < 8) 
	{
		alert('This is not a valid email address.\n\r          Please try again.');
		document.email2friend.sender_email.focus();
		return true;
	}
	
if (document.email2friend.recipient_email.value == "" || document.email2friend.recipient_email.value.indexOf ('@', 0) == -1 || document.email2friend.recipient_email.value.indexOf ('.', 0) == -1 || document.email2friend.recipient_email.value.length < 8) 
	{
		alert('This is not a valid email address.\n\r          Please try again.');
		document.email2friend.recipient_email.focus();
		return true;
	}
	
if (document.email2friend.message.value == "") 
	{
		alert ('This is not a valid message.\n\r          Please try again.');
		document.email2friend.message.focus();
		return true;
    }
	document.email2friend.submit();

}

function RemoveBad(strTemp) { 
    //strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-|\[|\]|\{|\}|\#|\!|\~|\=|\¦|\*/g,"");
	strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\[|\]|\{|\}|\#|\!|\~|\=|\¦|\*/g,"");
    return strTemp;
} 

function ignoreSpaces(string) {
		var temp = "";
		string = '' + string;
		splitstring = string.split(" ");
		for(i = 0; i < splitstring.length; i++)
		temp += splitstring [i];
		return temp;
}
function showhide(id){
	if (document.getElementById){
	obj = document.getElementById(id);
		if (obj.style.display == "none"){
			obj.style.display = "";
		} else {
			obj.style.display = "none";
		}
	}
}

function pandpExtra() { 
	countries = document.getinfo.country;
	countries_delivery = document.getinfo.country_delivery;
	if (((countries.options[countries.selectedIndex].value) == "United Kingdom") && ((countries_delivery.options[countries_delivery.selectedIndex].value) == "United Kingdom")){
		showhide("pandpExtra");
	} else {
		obj = document.getElementById("pandpExtra");
		obj.style.display = "none";
		document.getinfo.NextDayDelivery.checked=false;
	}
}


/* Cookie */
function Set_Cookie( name, value, expires, path, domain, secure ){
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires ){
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( check_name ) {
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}
function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}



function getAllCookies() {
   var cookieOutput = "";
   var prodOutput = "";
   var cookies  = document.cookie.split(";");
   for (var i = 0; i < cookies.length; i++){
     cookiePair = cookies[i].split("=");
	 if (cookiePair[0].indexOf("wishlist") != -1) {
		prods = cookiePair[1].split("*");
		prodOutput += "<form action='products.cfm?type=Treatments&id="+ prods[0] +"&buy=y' method='post' name='wishlistform'>";
		prodOutput += "<input type='hidden' name='addID' value='" + prods[0] +"'>";
		prodOutput += "<input type='hidden' name='addName' value='" + prods[1] +"'>";
		prodOutput += "<input type='hidden' name='addPrice' value='" + prods[2] +"'>";
		prodOutput += "<a href='products.cfm?id="+prods[0]+"'>" + prods[1].replace(/%20/g,' ') + "</a>  &pound;" + prods[2] + "&nbsp;&nbsp;<input type='submit' name='submit' value='Add to Basket' class='form'><br>";
		prodOutput += "</form>";
	 }
   }
   document.getElementById("my_cookie").innerHTML = prodOutput;
}

function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}

var W3CDOM = document.createElement && document.getElementsByTagName;

function setMaxLength() {
	if (!W3CDOM) return;
	var textareas = document.getElementsByTagName('textarea');
	var counter = document.createElement('div');
	counter.className = 'counter';
	for (var i=0;i<textareas.length;i++) {
		if (textareas[i].getAttribute('maxlength')) {
			var counterClone = counter.cloneNode(true);
			counterClone.innerHTML = '<span>0</span> / Max '+textareas[i].getAttribute('maxlength')+' characters';
			textareas[i].parentNode.insertBefore(counterClone,textareas[i].nextSibling);
			textareas[i].relatedElement = counterClone.getElementsByTagName('span')[0];
			textareas[i].onkeyup = textareas[i].onchange = checkMaxLength;
			textareas[i].onkeyup();
		}
	}
}

function checkMaxLength() {
	var maxLength = this.getAttribute('maxlength');
	var currentLength = this.value.length;
	if (currentLength > maxLength)
		this.relatedElement.className = 'toomuch';
	else
		this.relatedElement.className = '';	
	this.relatedElement.firstChild.nodeValue = currentLength;
}

function validateColour() {
	try {
		var selboxMakeUpColour = document.getElementById("prod_makeup_colour").value;
		if (selboxMakeUpColour == "0") {
			alert("Please select a colour");
			document.getElementById("prod_makeup_colour").focus();
			return false;
		}
	} catch (error) {
		return true;
	}

}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//NOT USED
function buyMakeup () {
	sel_makeup = document.form_prod_makeup_colours.prod_makeup_colour;
	strmakeup = sel_makeup.options[sel_makeup.selectedIndex].value;
	strmakeup = strmakeup.split("-")
	document.form_prod_makeup_colours.action = "products_other.cfm?type=encodeURI("+ strmakeup[0] +")&id="+ strmakeup[1] + "&buy=y";
	document.form_prod_makeup_colours.addName.value = strmakeup[2] + " " +strmakeup[3];
	document.form_prod_makeup_colours.addID.value = strmakeup[1];
	document.form_prod_makeup_colours.addPrice.value = strmakeup[4];
	document.form_prod_makeup_colours.addQty.value = 1;
    document.form_prod_makeup_colours.submit();     // Submit the page
    return true;	
}
