// JavaScript Document

<!--
var ie5 = (document.getElementById && document.all);
var ns6 = (document.getElementById && !document.all);

var alpha = "abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ";
var numeric = "1234567890";
var dateMsg = "";
var dtCh= "/";
var minYear=1900;
var maxYear=2100;


function getObj(n, d) { 
  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=getObj(n,d.layers[i].document);
	}
  if(!x && d.getElementById) {
		x=d.getElementById(n); 
	}
	return x;
}



/**
// -----------------------------------------------------------------------------------------------------------
//   TEMPLATE FOR VALIDATION FUNCTIONS
// -----------------------------------------------------------------------------------------------------------

function validateFunctionTemplate(normalColour, errorColour) {
	var msg = 'Please correct the following errors:\n';
	msg += '-------------------------------------------\n\n';
	
	var ok = true;
	
	// do this for every form element you are validating
	setBGColor("!!yourElementNameHere!!",normalColour);
	
	// use the functions listed below to check your form elements
	if (!isThere("!!yourElementNameHere!!")) {
		ok = false;
		msg += "Please enter yourElementNameHere\n";
		setBGColor("!!yourElementNameHere!!",errorColour);
	}


	// if ok submit, it not display the errors
	if (!ok) {
		alert(msg);
	} else {
		document.!!yourFormNameHere!!.submit();
	}		

}
**/

// -----------------------------------------------------------------------------------------------------------
// form validation functions
// -----------------------------------------------------------------------------------------------------------
function getObj(n, d) { 
  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=getObj(n,d.layers[i].document);
	}
  if(!x && d.getElementById) {
		x=d.getElementById(n); 
	}
	return x;
}
// -----------------------------------------------------------------------------------------------------------
// checkes that a value has been entered
// -----------------------------------------------------------------------------------------------------------
function isThere(elementName) {
	var element = getObj(elementName);
	if (element.value == "") {
		return false;
	} else {
		return true;
	}
}

// -----------------------------------------------------------------------------------------------------------
// sets the background colour of an element
// -----------------------------------------------------------------------------------------------------------

function setBGColor(elementName, colour) {
	element = getObj(elementName);
	try {
		element.style.backgroundColor = colour;
	} catch (e) {
		alert(e);
	}
}

// -----------------------------------------------------------------------------------------------------------
// checks that a value has been entered and that it follows an email format.
// -----------------------------------------------------------------------------------------------------------
function emailCheck(elementName) 
{
	var email = getObj(elementName).value;
	invalidChars = " /:,;"

	if (email == "") {
		return false;
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) {
		return false;
	}
	if (email.indexOf("@",atPos+1) > -1) {
		return false;
	}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {
		return false;
	}
	if (periodPos+3 > email.length)	{
		return false;
	}
	return true;
}


function open_win(url,ref_page)
{

window.open(url);
document.location.href=ref_page;
}

// -----------------------------------------------------------------------------------------------------------
// Validate Form function
// -----------------------------------------------------------------------------------------------------------


function validate_login_form()
{
	
	var msg = ''	
	var ok = true;
	var sendmag = true;
	
	var normalColour = 'FFFFFF';	
	var errorColour = 'C7E0EF';
	
	
	// do this for every form element you are validating
	setBGColor("txt_log_email", normalColour);
	setBGColor("txt_log_password", normalColour);
	
	
	// use the functions listed below to check your form elements
	if (!isThere("txt_log_email")) {
		ok = false;
		msg += "Please enter your email address\n";
		setBGColor("txt_log_email",errorColour);
	}
	
	if (!emailCheck("txt_log_email")) {
		ok = false;
		msg += "Please enter a valid email address\n";
		setBGColor("txt_log_email",errorColour);
	}

	if (!isThere("txt_log_password")) {
		ok = false;
		msg += "Please enter your password\n";
		setBGColor("txt_log_password",errorColour);
	}

	if (!ok) {
		alert(msg);
		return false;
	} else {
		document.fm_login.submit();
	}
}


function validate_keyword()
{

	var msg = ''	
	var ok = true;
	var sendmag = true;
	
	var normalColour = 'FFFFFF';	
	var errorColour = 'C7E0EF';
	var element = getObj("txt_Keyword");
	
	// do this for every form element you are validating
	setBGColor("txt_Keyword", normalColour);
	
	if (!isThere("txt_Keyword")) {
		ok = false;
		msg += "Please enter your search term\n";
		setBGColor("txt_Keyword",errorColour);
	}
	
	if (element.value.length < 3){
		ok = false;
		msg += "Your search term should be 3 or more characters.\n";
		setBGColor("txt_Keyword",errorColour);
	
	}

	if (!ok) {
		alert(msg);
		return false;
	} else {
		document.fm_search.submit();
	}
}


function validate_password_form()
{

	var msg = ''	
	var ok = true;
	var sendmag = true;
	
	var normalColour = 'FFFFFF';	
	var errorColour = 'C7E0EF';
	
	
	// do this for every form element you are validating
	setBGColor("txt_for_email", normalColour);
	
	if (!emailCheck("txt_for_email")) {
		ok = false;
		msg += "Please enter a valid email address\n";
		setBGColor("txt_for_email",errorColour);
	}

	if (!ok) {
		alert(msg);
		return false;
	} else {
		document.fm_password.submit();
	}
}
//********************************************
function validate_package_form_no_book()
{
var normalColour = 'FFFFFF';	
var errorColour = 'C7E0EF';

var strMsg = ''
var ok = true;

var radio_package = document.fm_package.radio_package; 
var discountcode =  getObj('txt_discount_code'); 

 // Set all radio buttons to OK colour
       for(i=0; i<radio_package.length; i++) {
                     setBGColour(radio_package[i],normalColour);
              }             

 // check if a radio button has been checked
  var blnPackageSelected = false;
       for(i=0; i<radio_package.length; i++) {
                     if (radio_package[i].checked == true)      {
                           blnPackageSelected = true;
                           break
                     }

              }

  // if radio button not checked, append to error message
   if (blnPackageSelected == false) {
              for(i=0; i<radio_package.length; i++) {
                     setBGColour(radio_package[i],errorColour);
              }
              ok = false;
              strMsg += "Please select a Package or a Daysoutuk book \n";  
       }
   
   if(discountcode.value.length > 0){
		//6 numbers a slash followed by either s or w and 08
		var RegExPattern=/^\d{6}\/[swSW](08|09)$/ 

		if ((discountcode.value.match(RegExPattern))) {
			//alert('its ok');
			document.forms.fm_package.hid_superbreakcode.value = 1;
			
		}else {
			//alert('its not ok');
			document.forms.fm_package.hid_superbreakcode.value = 0;
		}
		
    }

	if (!ok) {
		alert(strMsg);
		return false;
	} else {
		document.fm_package.submit();
	}



}


function validate_package_form()
{
var normalColour = 'FFFFFF';	
var errorColour = 'C7E0EF';

var strMsg = ''
var ok = true;

var radio_package = document.fm_package.radio_package; 
var radio_postage =  document.fm_package.radio_postage;

 // Set all package radio buttons to OK colour
       for(i=0; i<radio_package.length; i++) {
                     setBGColour(radio_package[i],normalColour);
              }             

 // check if a radio button has been checked
  var blnPackageSelected = false;
       for(i=0; i<radio_package.length; i++) {
                     if (radio_package[i].checked == true)      {
                           blnPackageSelected = true;
                           break
                     }

              }

  // if radio button not checked, append to error message
   if (blnPackageSelected == false) {
              for(i=0; i<radio_package.length; i++) {
                     setBGColour(radio_package[i],errorColour);
              }
              ok = false;
              strMsg += "Please select a Package or a Daysoutuk book \n";  
       }  

//**************start of package***************************

// Set all postage radio buttons to OK colour
       for(i=0; i<radio_postage.length; i++) {
                     setBGColour(radio_postage[i],normalColour);
              }             

 // check if a radio postage button has been checked
  var blnPostageSelected = false;
       for(i=0; i<radio_postage.length; i++) {
                     if (radio_postage[i].checked == true)      {
                            blnPostageSelected = true;
                           break
                     }

              }

  // if radio button not checked, append to error message
   if ( blnPostageSelected == false) {
              for(i=0; i<radio_postage.length; i++) {
                     setBGColour(radio_postage[i],errorColour);
              }
              ok = false;
              strMsg += "Please select a P&P or a Daysoutuk book \n";  
       }  


	if (!ok) {
		alert(strMsg);
		return false;
	} else {
		document.fm_package.submit();
	}



}

//**************************************


//********************************************
function validate_cost_form()
{
var normalColour = 'FFFFFF';	
var errorColour = 'C7E0EF';

var strMsg = ''
var ok = true;

var radio_package = document.fm_package.radio_package; 

 // Set all radio buttons to OK colour
       for(i=0; i<radio_package.length; i++) {
                     setBGColour(radio_package[i],normalColour);
              }             

 // check if a radio button has been checked
  var blnPackageSelected = false;
       for(i=0; i<radio_package.length; i++) {
                     if (radio_package[i].checked == true)      {
                           blnPackageSelected = true;
                           break
                     }

              }

  // if radio button not checked, append to error message
   if (blnPackageSelected == false) {
              for(i=0; i<radio_package.length; i++) {
                     setBGColour(radio_package[i],errorColour);
              }
              ok = false;
              strMsg += "Please select a Package or a Daysoutuk book \n";  
       }  

	if (!ok) {
		alert(strMsg);
		return false;
	} else {
		document.fm_package_cost.submit();
	}



}

//**************************************



function validate_registration_form()
{
	
	var msg = ''
	var ok = true;
	var sendmag = true;
	
	var normalColour = 'FFFFFF';	
	var errorColour = 'C7E0EF';
	
	var chk_terms = getObj('chk_terms');
	
	
	// do this for every form element you are validating
	setBGColor("txt_first_name", normalColour);
	setBGColor("txt_last_name", normalColour);
	setBGColor("txt_reg_email", normalColour);
	setBGColor("txt_reg_confirm_email", normalColour);
	setBGColor("txt_tel", normalColour);
	setBGColor("txt_mobile", normalColour);
	setBGColor("txt_address1", normalColour);
	setBGColor("txt_address2", normalColour);
	setBGColor("txt_address3", normalColour);
	//setBGColor("txt_address4", normalColour);
	setBGColor("txt_postcode", normalColour);
	setBGColor("txt_reg_password", normalColour);
	setBGColor("txt_reg_confirm_password", normalColour);
	setBGColor("chk_terms", normalColour);
	

	// use the functions listed below to check your form elements
	if (!isThere("txt_first_name")) {
		ok = false;
		msg += "Please enter your first name\n";
		setBGColor("txt_first_name",errorColour);
	}

	if (!isThere("txt_last_name")) {
		ok = false;
		msg += "Please enter your last name\n";
		setBGColor("txt_last_name",errorColour);
	}

	if (!emailCheck("txt_reg_email")) {
		ok = false;
		msg += "Please enter a valid email address\n";
		setBGColor("txt_reg_email",errorColour);
	}
	
	var strEmail, strConfirmEmail
	strEmail = getObj("txt_reg_email").value;
	strConfirmEmail = getObj("txt_reg_confirm_email").value;
	

	if (!emailCheck("txt_reg_confirm_email") || strEmail != strConfirmEmail) {
		ok = false;
		msg += "Please ensure the two email addresses are identical\n";
		setBGColor("txt_reg_confirm_email",errorColour);
		}
	
	if (!isThere("txt_tel")||!isNumeric("txt_tel") ) {
		ok = false;
		msg += "Please enter your telephone number using numbers only\n";
		setBGColor("txt_tel",errorColour);
	}
	if (!isThere("txt_mobile")||!isNumeric("txt_mobile") ) {
		ok = false;
		msg += "Please enter your mobile number using numbers only\n";
		setBGColor("txt_mobile",errorColour);
	}
	
	
	if (!isThere("txt_address1")) {
		ok = false;
		msg += "Please enter the first line of your address\n";
		setBGColor("txt_address1",errorColour);
	}
	if (!isThere("txt_address2")) {
		ok = false;
		msg += "Please enter the second line of your address\n";
		setBGColor("txt_address2",errorColour);
	}
	if (!isThere("txt_address3")) {
		ok = false;
		msg += "Please enter the third line of your address\n";
		setBGColor("txt_address3",errorColour);
	}
	//if (!isThere("txt_address4")) {
		//ok = false;
		//msg += "Please enter your country\n";
		//setBGColor("txt_address4",errorColour);
	//}
	if (!isThere("txt_postcode")) {
		ok = false;
		msg += "Please enter your postcode\n";
		setBGColor("txt_postcode",errorColour);
	}
	
	if (!isThere("txt_reg_password")) {
		ok = false;
		msg += "Please enter your password\n";
		setBGColor("txt_reg_password",errorColour);
	}
	
	var strPassword, strConfirmPassword
	strPassword = getObj("txt_reg_password").value;
	strConfirmPassword = getObj("txt_reg_confirm_password").value;	

	if (!isThere("txt_reg_confirm_password") || strPassword != strConfirmPassword) {
		ok = false;
		msg += "Please ensure the two passwords are identical\n";
		setBGColor("txt_confirm_password",errorColour);
		}
	
	if(!chk_terms.checked)
	{
		ok = false;
		msg += 'Please tick the box to confirm you have read the Terms & Conditions.\n';
		setBGColor("chk_terms",normalColour);
	}
	

	if (!ok) {
		alert(msg);
		return false;
	} else {
		document.fm_registration.submit();
	}
}



// -----------------------------------------------------------------------------------------------------------
// checkes that a value has been entered
// -----------------------------------------------------------------------------------------------------------
function isThere(elementName) {
	var element = getObj(elementName);
	if (element.value == "") {
		return false;
	} else {
		return true;
	}
}

// -----------------------------------------------------------------------------------------------------------
// sets the background colour of an element
// -----------------------------------------------------------------------------------------------------------

function setBGColor(elementName, colour) {
	element = getObj(elementName);
	try {
		element.style.backgroundColor = colour;
	} catch (e) {
		alert(e);
	}
}

// -----------------------------------------------------------------------------------------------------------
// check a form elements length agains the entered value
// -----------------------------------------------------------------------------------------------------------
function checkLength(elementName, length) {
	var element = getObj(elementName);
	if (element.value.length < length) {
		return false;
	} else {
		return true;
	}
}

// -----------------------------------------------------------------------------------------------------------
// checkes to see if a select drop box matches a particular value
// -----------------------------------------------------------------------------------------------------------
function selectMatches(elementName, value) {
	var element = getObj(elementName);
	var elementValue = element.options[element.selectedIndex].value;
	if (elementValue == value) {
		return true;
	} else {
		return false;
	}
}

// -----------------------------------------------------------------------------------------------------------
// checkes to see if a value has been entered and that it is numeric
// -----------------------------------------------------------------------------------------------------------
function isNumeric(elementName) {
	var element = getObj(elementName);
	var strString = element.value;
	if (strString == "") {
		return false;
	}
  var strValidChars = "0123456789.";
  var strChar;
  var blnResult = true;

  if (strString.length == 0) return false;

  //  test strString consists of valid characters listed above
  for (i = 0; i < strString.length && blnResult == true; i++)
     {
     strChar = strString.charAt(i);
     if (strValidChars.indexOf(strChar) == -1)
        {
        blnResult = false;
        }
     }
  return blnResult;

}

// -----------------------------------------------------------------------------------------------------------
// checkes to see if a value has been entered and that it matches a credit card (can include spaces)
// -----------------------------------------------------------------------------------------------------------
function isCC(elementName) {
	var element = getObj(elementName);
	var strString = element.value;
	if (strString == "") {
		return false;
	}
  var strValidChars = "0123456789 ";
  var strChar;
  var blnResult = true;

  if (strString.length == 0) return false;

  //  test strString consists of valid characters listed above
  for (i = 0; i < strString.length && blnResult == true; i++)
     {
     strChar = strString.charAt(i);
     if (strValidChars.indexOf(strChar) == -1)
        {
        blnResult = false;
        }
     }
  return blnResult;

}

// -----------------------------------------------------------------------------------------------------------
// checkes to see if a value has been entered and that it matches a phone number
// does not do format checking, only checks that the characters entered are
// valid for a phone number
// -----------------------------------------------------------------------------------------------------------
function isPhoneNumber(elementName) {
	var element = getObj(elementName);
	var strString = element.value;
	if (strString == "") {
		return false;
	}
  var strValidChars = "0123456789 ()+";
  var strChar;
  var blnResult = true;

  if (strString.length == 0) return false;

  //  test strString consists of valid characters listed above
  for (i = 0; i < strString.length && blnResult == true; i++)
     {
     strChar = strString.charAt(i);
     if (strValidChars.indexOf(strChar) == -1)
        {
        blnResult = false;
        }
     }
  return blnResult;

}

// -----------------------------------------------------------------------------------------------------------
// checks if two elements values match
// -----------------------------------------------------------------------------------------------------------
function valuesMatch(element1, element2) {
	var e1 = getObj(element1);
	var e2 = getObj(element2);
	if (e1.value == e2.value) {
		return true;
	} else {
		return false;
	}
}

// -----------------------------------------------------------------------------------------------------------
// checks that a value has been entered and that it follows an email format.
// -----------------------------------------------------------------------------------------------------------
function emailCheck(elementName) 
{
	var email = getObj(elementName).value;
	invalidChars = " /:,;"

	if (email == "") {
		return false;
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) {
			return false;
		}
	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) {
		return false;
	}
	if (email.indexOf("@",atPos+1) > -1) {
		return false;
	}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {
		return false;
	}
	//if (periodPos+3 > email.length)	{
		//return false;
	//}
	return true;
}


// -----------------------------------------------------------------------------------------------------------
// checks that a value has been entered and that it is a valid date
// -----------------------------------------------------------------------------------------------------------

function isDate(dtStr){
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strDay=dtStr.substring(0,pos1);
	var strMonth=dtStr.substring(pos1+1,pos2);
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1){
		dateMsg = "The date format should be : mm/dd/yyyy";
		return false;
	}
	if (strMonth.length<1 || month<1 || month>12){
		dateMsg = "Please enter a valid month";
		return false;
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		dateMsg = "Please enter a valid day";
		return false;
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		dateMsg = "Please enter a valid 4 digit year between "+minYear+" and "+maxYear;
		return false;
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		dateMsg = "Please enter a valid date"
		return false;
	}
	return true;
}

// -----------------------------------------------------------------------------------------------------------
// Utility function for isDate()
// -----------------------------------------------------------------------------------------------------------

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

// -----------------------------------------------------------------------------------------------------------
// Utility function for isDate()
// -----------------------------------------------------------------------------------------------------------

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

// -----------------------------------------------------------------------------------------------------------
// Utility function for isDate()
// -----------------------------------------------------------------------------------------------------------

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
		if (i==2) {this[i] = 29;}
   } 
   return this
}

// -----------------------------------------------------------------------------------------------------------
// Other functions
// -----------------------------------------------------------------------------------------------------------


// -----------------------------------------------------------------------------------------------------------
// formats a number to a particular number of decimals
// -----------------------------------------------------------------------------------------------------------
function formatNumber(expr, decplaces) {
	var str = "" + Math.round(eval(expr) * Math.pow(10, decplaces));
	while (str.length <= decplaces)
	{
		str += "0";
	}

	var decpoint = str.length - decplaces;

	return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
}

function showhide(qid) {
	for (var x=1; x <= 50; x++) {
	
		if (getObj('answer-' + x) != null) {
			getObj('answer-' + x).style.display = 'none';
		}
	}
	getObj('answer-' + qid).style.display = 'block';
}





function typeit(){
	getObj('typing').insertAdjacentText("beforeEnd",". ")
	setTimeout("typeit()",100)
}

function golink() {
	var sel = getObj('quicklinks').options[getObj('quicklinks').selectedIndex].value;
	window.document.location = sel;
}

function displaydatetime() {
	dateVar = new Date();
	thisday = dateVar.getDate();
	thismonth = getCalendarMonth(dateVar.getMonth());
	thisyear = dateVar.getFullYear();
	thishrs = dateVar.getHours();
	thismins = String(dateVar.getMinutes());
	
	if (thismins.length < 2) {
		thismins = '0' + thismins;
	}
	
	document.write(thisday + ' ' + thismonth + ' ' + thisyear + ' ' + thishrs + ':' + thismins);
	
	function getCalendarMonth(monthNum) {
			
		var moy = new Array(12)
		moy[0] = "January" 
		moy[1] = "February" 
		moy[2] = "March" 
		moy[3] = "April" 
		moy[4] = "May" 
		moy[5] = "June" 
		moy[6] = "July" 
		moy[7] = "August" 
		moy[8] = "September" 
		moy[9] = "October" 
		moy[10] = "November" 
		moy[11] = "December" 
		return moy[monthNum] 
	}
}


function openWindow(theURL, winName, features) {
	newWin=window.open(theURL, winName, features);
	newWin.originalWindow=window; // keep a reference to this window
}

function setBGColour(element, colour){

	element.style.backgroundColor = colour;

}

function fnisbook() {
//alert("its a book- so we need post and packaging");

document.forms.fm_package.is_book.value = 1;
document.fm_package.submit();
}

function fnnotbook() {
//alert("its a book- so we need post and packaging");

document.forms.fm_package.is_book.value = 0;
document.fm_package.submit();

}


function fnsubmitform(){
document.fm_package.submit();

}

function validate_enquiry_form()
{
	
	var msg = ''	
	var ok = true;
	var sendmag = true;
	
	var normalColour = 'FFFFFF';	
	var errorColour = 'C7E0EF';
	
	var chk_terms = getObj('chk_terms');
	
	// do this for every form element you are validating
	setBGColor("txt_first_name", normalColour);
	setBGColor("txt_last_name", normalColour);
	setBGColor("txt_email", normalColour);
	setBGColor("txt_tel", normalColour);
	setBGColor("txt_address1", normalColour);
	setBGColor("txt_address2", normalColour);
	setBGColor("txt_address3", normalColour);
	setBGColor("txt_address4", normalColour);
	setBGColor("txt_postcode", normalColour);
	setBGColor("chk_terms", normalColour);
	
	// use the functions listed below to check your form elements
	if (!isThere("txt_first_name")) {
		ok = false;
		msg += "Please enter your first name\n";
		setBGColor("txt_first_name",errorColour);
	}

	if (!isThere("txt_last_name")) {
		ok = false;
		msg += "Please enter your last name\n";
		setBGColor("txt_last_name",errorColour);
	}

	if (!emailCheck("txt_email")) {
		ok = false;
		msg += "Please enter a valid email address\n";
		setBGColor("txt_email",errorColour);
	}
	
	if (!isThere("txt_address1")) {
		ok = false;
		msg += "Please enter the first line of your address\n";
		setBGColor("txt_address1",errorColour);
	}
	if (!isThere("txt_address2")) {
		ok = false;
		msg += "Please enter the second line of your address\n";
		setBGColor("txt_address2",errorColour);
	}
	if (!isThere("txt_address3")) {
		ok = false;
		msg += "Please enter the third line of your address\n";
		setBGColor("txt_address3",errorColour);
	}
	if (!isThere("txt_address4")) {
		ok = false;
		msg += "Please enter your country\n";
		setBGColor("txt_address4",errorColour);
	}
	if (!isThere("txt_postcode")) {
		ok = false;
		msg += "Please enter your postcode\n";
		setBGColor("txt_postcode",errorColour);
	}
	
	if(!chk_terms.checked)
	{
		ok = false;
		msg += 'Please tick the box to confirm you have read the Terms & Conditions.\n';
		setBGColor("chk_terms",normalColour);
	}

	
	if (!ok) {
		
		alert(msg);
		return false;
	} else {
		document.fm_enquiry.submit();
	}
}

function fnsubmitRedeemform(){
document.frm_redeem.submit();

}

function confirm_redeem()
  {
  var redeem=confirm("Are you sure you want to redeem this voucher?.")
  if (redeem==true)
    {
	 //window.location='redeem.htm'
	 document.frm_redeem.submit();
    }
  else
    {
    //do nothing
    }
  }

function clearSearchBox()
{
	var objBox=getObj("txt_Keyword");
	objBox.value="";
}

function openNewWindow()
{

window.open("redeem.htm");
}


//-->


