function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}


function ValidateForm(form)
{
document.chout.mail_message.value = "Welcome to London Academy.\r\rWe are pleased to confirm your place on the following course:"+form.mail_subject.value+"\r\r\rAlways check www.media-courses.com for the start time of your specific course.\r\rYour class will be held at 1 Lancing St, Euston, London, NW1 1NA.\r\rThe doors remain closed until the specified start time of your course. Your tutor will meet you at the main door and direct you to your class.\r\rDeposits\r________________\rIf you have only paid a deposit please pay the remainder of the fees 21 days before your course begins, as we cannot turn away full fee paying students who wish to take a place on the same course as yourself. Any late payments will be enrolled onto the next course, no refunds are given.\r________________\r\r\rStudent Support Help Desk.\r_______________\r\rUK: 0871 566 1631 option 2 or 3\r\rInternational: +44 208 328 9490 option 2 or 3\r\r________________\r\rLondon Academy wishes you every success and is here to help you achieve your future aspirations. Thanks again for choosing the London Academy of Media, Film & TV.\r\r\rHave a great Day.\r\rStudent Support Team.\r\rCheck www.media-courses.com for the latest from London Academy.\r";

var thedate = new Date();
document.chout.trans_id.value = 'LARFT' + thedate.toGMTString();	

if (form.ship_email.value == "") 
   { 
      alert('You have not entered an Email address. We need it to send your invoice details') 
      form.ship_email.focus(); 
      return false; 
   } 
   
   
if (form.ship_name.value == "") 
   { 
      alert('You have not entered a name. Please write it and try again, thank you') 
      form.ship_name.focus(); 
      return false; 
   } 
if (form.ship_tel.value == "") 
   { 
      alert('You have not entered a Telephone number. We need this to be able to contact you') 
      form.ship_tel.focus(); 
      return false; 
   } 
 
 if (form.ship_addr_1.value == "") 
   { 
      alert('You have not entered an address. Please try again, thank you') 
      form.ship_addr_1.focus(); 
      return false; 
   } 
 
return true;
 
} 

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
function radio_price()
{	
	document.cart_form.price.value= getCheckedValue(document.forms['cart_form'].elements['price_list']);
		
}

function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}

function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
      return true;
   }
   else { return false; }
}	

function validate_form ()
{
	valid = true;
  
        if ( document.cart_form.qty.value == "" )
        {
                alert ( "Please fill in the quantity box." );
                valid = false;
        }
        
        if (!IsNumeric(document.cart_form.qty.value)) 
        { 
                alert('Please enter only numbers in the quantity field') 
                valid = false; 
        } 
        
        if ( ( document.cart_form.price_list[0].checked == false ) && ( document.cart_form.price_list[1].checked == false )&& ( document.cart_form.price_list[2].checked == false ) )
        {
                alert ( "Please choose your payment options" );
                valid = false;
        }

        if ( document.cart_form.course_date.selectedIndex == 0 )
        {
                alert ( "Please select your date." );
                valid = false;
        }
        
       return valid;
}