var now=new Date();
var month=now.getMonth()+1;
var year = now.getYear() ;
function toggle(target,imgname, isOn){
	window.onresize = null;
	obj=document.getElementById(target);
	obj2=document.getElementById(imgname);
	if(isOn){
		obj.style.visibility='hidden';
		obj.style.display='none';
		obj2.style.visibility='visible';
		obj2.style.display='inline';
	}
	else{
		obj.style.visibility='visible';
		obj.style.display='inline';
		obj2.style.visibility='hidden';
		obj2.style.display='none';
	}
}
function openWindow(url,toolbar ,x ,y) {
	subWindow=open(url, "newwin", "status=yes, resizable=yes, top=10,left=100,toolbar="+toolbar+", scrollbars=yes, width="+x+", height="+y+"");
	if(subWindow.opener==null) subWindow.opener=self;
}

function openFullscreen(frmurl, scrollbar, wd, hg) {
	if (wd==0) {
	var wd=screen.width-5;
	}
	if (hg==0) {
	var hg=screen.height-55;
	}
	winame='newwin';
	features='scrollbars='+scrollbar+',width='+ wd +',height='+ hg +',left=10,screenX=0,top=0,screenY=0,status=0';
	window.open(frmurl,winame,features);

}
/*
Highlight Image Script II- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/
function borderit(which,color){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
which.style.borderColor=color
}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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;
}

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];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function emptyfield(check,err_msg){
   if (check.value == ""){
      alert(err_msg);
	  check.focus();
	  return false;
   }
}

function selectlistindex(check)
{   
   var idx=0;
   for(i=0;i<check.options.length;i++){
     if (check.options[i].selected){
        idx=i;	 
		break;
     }
   }	
   return idx;
}

 
function isInteger(val) {
	var digits=" .+-0123456789";
	for (var i=0; i < val.length; i++) {
		if (digits.indexOf(val.charAt(i))==-1) {	return false; }
	}
	return true;
}
function isNumeric(val) {
	var digits="0123456789";
	for (var i=0; i < val.length; i++) {
		if (digits.indexOf(val.charAt(i))==-1) {	return false; }
	}
	return true;
}
function validNum(check, err_msg){
   str=new String(check.value)
   if(isNaN(str) == true ){
      alert(err_msg)
	  check.focus();
	  return false;
   }
   if(check.value<0) {
   	alert(err_msg)
   	check.focus();
   	return false;
   }
}

function valid(vl,errm) // varying number of arguments
{
	var i;
	validated=true;
	// scan regular expressions
	for (i=2;i<valid.arguments.length;i++) 
	{
		var rx;
		//alert(valid.arguments[i]);
		rx=new RegExp(valid.arguments[i]);
		if ((a=rx.exec(vl))!=null && a[0].length==vl.length) {
			//alert("output:" + a[0]);
			return true;  // ok
		}
	}
	// no matches...
	alert(errm);
	validated=false;  // tell onsubmit if necessary
	return false;
}

function checkOneEmail(check, err_msg)
{
	// [\w-_]+(\.[\w-_]+)*\@+[\w-_]+(\.[\w-_]+)+
	//alert(vl);
	rv=valid(check,err_msg,"[\\w-_]+(\\.[\\w-_]+)*\\@+[\\w-_]+(\\.[\\w-_]+)+");
	return rv;
}
function checkEmail(check){
   email = new String(check.value);
   errmsg="Invalid Email Address";
     if (email.indexOf("@") == -1){
	    alert(errmsg);
		check.focus();
		return false;
	 }
	 else
	 {
	   idx1=email.indexOf("@");
	 }
	 if(email.indexOf(".") == -1){
	    alert(errmsg);
		check.focus();
		return false;
	 }
	 else{
	    idx2=email.indexOf(".");
	 }
	 str1=email.substring(0,idx1);
	 if(str1.length < 2){
	    alert(errmsg);
		check.focus();
		return false;
	 }
	 str2=email.substring(idx1,idx2);
	 if(str2.length < 2){
	    alert(errmsg);
		check.focus();
		return false;
	 }
	 str3=email.substring(idx2,email.length-1);
	 if(str3.length < 2){
		alert(errmsg);
		check.focus();
		return false;
	 }
}

function checkBox(check,err_msg){
   var counter=0;
   for(var i=0;i<check.length;i++)
   {
     if(check[i].checked)
	 {
	   counter=counter+1;
	 }
   }
   if(counter < 1 )
   {
     alert(err_msg);
	 check[0].focus();
	 return false;
   }
}

function checkcreditcard(frm){
	for (var j=0; j<frm.credittype.length; j++){
		if (frm.credittype[j].checked){
	var cmk=frm.credittype[j].value;
	      }
	}

	var cno = frm.creditnumber.value; //Card number
	var cno = cno.replace(/ /g, "");
	var flag=true

	//########## Check Visa ##########
	if(cmk=="VISA"){
	    if ((cno.length == 13 || cno.length == 16) && (cno.substring(0,1) == 4)){
		flag=true
	    }else{
		flag=false;
	    }
	}

	//########## Check Mastercard ##########
	if(cmk=="MASTERCARD"){
	var firstdig=cno.substring(0,1);
	var seconddig=cno.substring(1,2);
	  if ((cno.length == 16 || cno.length == 19) && (firstdig == 5) && ((seconddig >= 1) && (seconddig <= 5))){
	      flag=true
	  }else{
		flag=false;
	  }
	}

	//########## Check Diners ##########
	if(cmk=="DINERS"){
	  firstdig = cno.substring(0,1);
	  seconddig = cno.substring(1,2);
	  if ((cno.length == 14 || cno.length == 17)  && (firstdig == 3) && ((seconddig == 0) || (seconddig == 6) || (seconddig == 8))){
	      flag=true
	  }else{
		flag=false;
	  }
	}

	//########## Check Amex ##########
	if(cmk=="AMEX"){
	 firstdig = cno.substring(0,1);
	  seconddig = cno.substring(1,2);
	  if (((cno.length == 15)  || (cno.length == 18)) && (firstdig == 3) && ((seconddig == 4) || (seconddig == 7))){
		flag=true
	  }else{
		flag=false;
	   }
	}

	//########## Check JCB ##########
	if(cmk=="JCB"){
	  firstdig = cno.substring(0,1);
	  seconddig = cno.substring(1,2);
	  if ((cno.length == 15 || cno.length == 16)){
	     flag=true
	  }else{
		flag=false;
	  }
	}
	return flag
}

function show( id ) {
document.getElementById(id).style.display = 'block';
}
function hide( id ) {
document.getElementById(id).style.display = 'none';
} 

function membershiptype_onclick(selectMe, i) {
    var showmembership = "showmembership"+i;
  	if (selectMe == "nonmember") {
		document.getElementById(showmembership).style.display = "none";
	} else {
		document.getElementById(showmembership).style.display = "block";
	}
}
function accperson_onclick(selectMe, i) {
	var oaccperson = "accperson" + i;
	var accperson = document.form1[oaccperson].value;
    var showaccompanyperson = "showaccompanyperson"+i;
	var selectedItem=document.form1[oaccperson].selectedIndex;
	//alert(selectedItem);
	//alert(selectMe);
	if (selectMe == "yes") {
		document.getElementById(showaccompanyperson).style.display = "block";
	} else {
		document.getElementById(showaccompanyperson).style.display="none";
	}
}
 
function changeregform(frm) {
	frm.action = "register_start.asp?formid=step2&mode=step2"
	frm.submit();
}
function checkregform_step1(frm)
{ 
	if (frm.tickets.value=="0" && frm.stickets.value=="0")
	{
		alert("Please Delegate's or Student's Number of Ticket(s)");
		return false;
	}
	frm.submit();
}
function checkregform(frm, cmd)
{
	var tickets = frm.tickets.value;  
	for(i=0;i<tickets;i++) {
		j = i + 1;
		var ofirstname = "firstname" + i;
		var firstname = document.form1[ofirstname].value;
		var osurname = "surname" + i;
		var surname = document.form1[osurname].value;
		var obadgename = "badgename" + i;
		var badgename = document.form1[obadgename].value;
		var odesignation = "designation" + i;
		var designation = document.form1[odesignation].value;
		var oorganisation = "organisation" + i;
		var organisation = document.form1[oorganisation].value;
		var oaddress = "address" + i;
		var address = document.form1[oaddress].value;
		var ocountry = "country" + i;
		var country = document.form1[ocountry].value;
		var opostal = "postal" + i;
		var postal = document.form1[opostal].value;
		var oemail = "email" + i;
		var email = document.form1[oemail].value;
		var otelno_country = "telno_country" + i;
		var telno_country = document.form1[otelno_country].value;
		var otelno_area = "telno_area" + i;
		var telno_area = document.form1[otelno_area].value;
		var otelno = "telno" + i;
		var telno = document.form1[otelno].value;
		var omobileno_country = "mobileno_country" + i;
		var mobileno_country = document.form1[omobileno_country].value;
		var omobileno_area = "mobileno_area" + i;
		var mobileno_area = document.form1[omobileno_area].value;
		var omobileno = "mobileno" + i;
		var mobileno = document.form1[omobileno].value;
		var ofaxno_country = "faxno_country" + i;
		var faxno_country = document.form1[ofaxno_country].value;
		var ofaxno_area = "faxno_area" + i;
		var faxno_area = document.form1[ofaxno_area].value;
		var ofaxno = "faxno" + i;
		var faxno = document.form1[ofaxno].value;
		var omembershiptype = "membershiptype" + i;
		var membershiptype = document.form1[omembershiptype].value;
		var omembershipno = "membershipno" + i;
		var membershipno = document.form1[omembershipno].value;
 		var opromcode = "promcode" + i;
		var promcode = document.form1[opromcode].value;
 		var oattend_closingparty = "attend_closingparty" + i;
		var attend_closingparty = document.form1[oattend_closingparty].value;
		var oaccperson = "accperson" + i;
		var accperson = document.form1[oaccperson].value;
		var oaccpersonname = "accpersonname" + i;
		var accpersonname = document.form1[oaccpersonname].value;
		var oaccattend_closingparty = "accattend_closingparty" + i;
		var accattend_closingparty = document.form1[oaccattend_closingparty].value;	
		var oaccdietrequirement = "accdietrequirement" + i;
		var accdietrequirement = document.form1[oaccdietrequirement].value;	
		
		if (firstname == "" || firstname == " ") {
			alert("Please enter Delegates " + j + " Information - First Name");
			document.form1[ofirstname].focus();
			return false;
		}
		if (surname == "" || surname == " ") {
			alert("Please enter Delegates " + j + " Information - Surname");
			document.form1[osurname].focus();
			return false;
		}
		if (badgename == "" || badgename == " ") {
			alert("Please enter Delegates " + j + " Information - Name on Badge");
			document.form1[obadgename].focus();
			return false;
		}
		if (designation == "" || designation == " ") {
			alert("Please enter Delegates " + j + " Information - Job Title");
			document.form1[odesignation].focus();
			return false;
		}
		if (organisation == "" || organisation == " ") {
			alert("Please enter Delegates " + j + " Information - Organisation");
			document.form1[oorganisation].focus();
			return false;
		}
		if (address == "" || address == " ") {
			alert("Please enter Delegates " + j + " Information - Address");
			document.form1[oaddress].focus();
			return false;
		}
		if (country == "" || country == " ") {
			alert("Please enter Delegates " + j + " Information - Country");
			document.form1[ocountry].focus();
			return false;
		}
		if (postal == "" || postal == " ") {
			alert("Please enter Delegates " + j + " Information - Zip Code");
			document.form1[opostal].focus();
			return false;
		}
		if (email == "" || email == " ") {
			alert("Please enter Delegates " + j + " Information - Email Address");
			document.form1[oemail].focus();
			return false;
		}
		if (checkOneEmail(email,"Please enter a Valid Delegates " + j + " Information - Email Address")==false){
			document.form1[oemail].focus();
			return false;
		}
		
		/*if(telno_country=="" || telno=="") {
			alert("Please enter Telephone Number")
			document.form1[otelno_country].focus();
			return;
		}*/
		if (telno_country == "" || telno_country == " ") {
			alert("Please enter Delegates " + j + " - Telephone Number (Country)");
			document.form1[otelno_country].focus();
			return false;
		}
		if (!isInteger(telno_country)){
			alert("Delegates " + j + " Information - Telephone Number (Country) must be integer");
			document.form1[otelno_country].focus();
			return false;
		}
		if (telno == "" || telno == " ") {
			alert("Please enter Delegates " + j + " - Telephone Number (Number)");
			document.form1[otelno].focus();
			return false;
		}
		if (telno_area != "" ||  telno != "") {
			if (!isNumeric(telno_area)){
				alert("Delegates " + j + " Information - Telephone Number (Area) must be integer");
				document.form1[otelno_area].focus();
				return false;
			}
			if (!isNumeric(telno)){
				alert("Delegates " + j + " Information - Telephone Number (Number) must be integer");
				document.form1[otelno].focus();
				return false;
			}
		}
		if (mobileno_country != "" || mobileno_area != "" ||  mobileno != "") {
			if (!isInteger(mobileno_country)){
				alert("Delegates " + j + " Information - Mobile Number (Country) must be integer");
				document.form1[omobileno_country].focus();
				return false;
			}
			
			if (!isNumeric(mobileno_area)){
				alert("Delegates " + j + " Information - Mobile Number (Area) must be integer");
				document.form1[omobileno_area].focus();
				return false;
			}
			if (!isNumeric(mobileno)){
				alert("Delegates " + j + " Information - Mobile Number (Number) must be integer");
				document.form1[omobileno].focus();
				return false;
			}
		}
	 
		/*if (validNum(document.form1[omobileno],"Delegates " + j + " Information - Mobile Number must be integer")==false){
			document.form1[omobileno].focus();
			return false;
		}*/
 		if (faxno != "" || faxno_country != "") {
			if (faxno_country == "" || faxno_country == " ") {
				alert("Please enter Delegates " + j + " - Fax Number (Country)");
				document.form1[ofaxno_country].focus();
				return false;
			}

			if (faxno == "" || faxno == " ") {
				alert("Please enter Delegates " + j + " - Fax Number (Number)");
				document.form1[ofaxno].focus();
				return false;
			}
			if (!isInteger(faxno_country)){
				alert("Delegates " + j + " Information - Fax Number (Country) must be integer");
				document.form1[ofaxno_country].focus();
				return false;
			}
			
			if (!isNumeric(faxno_area)){
				alert("Delegates " + j + " Information - Fax Number (Area) must be integer");
				document.form1[ofaxno_area].focus();
				return false;
			}
			if (!isNumeric(faxno)){
				alert("Delegates " + j + " Information - Fax Number (Number) must be integer");
				document.form1[ofaxno].focus();
				return false;
			}
		}  
		
		if (membershiptype == "" || membershiptype == " ") {
			alert("Please select Delegates " + j + " Information - Membership Type");
			document.form1[omembershiptype].focus();
			return false;
		}
		if (membershiptype != "nonmember")
		{
			if (membershipno == "" || membershipno == " ") {
				alert("Please enter Delegates " + j + " Information - Membership Number / Student Number (if any)");
				document.form1[omembershipno].focus();
				return false;
			}
		} else {
			if (membershipno != "") {
				alert("Please empty Delegates " + j + " Information - Membership Number / Student Number (if any)");
				document.form1[omembershipno].focus();
				return false;
			}

		}
		/*if (membershiptype == "fulltime")
		{
			if (promcode !="")
			{
				alert("No Promotiion for Full-Time Student. Please leave blank Delegates " + j + " Information - Promotion Code (if any)");
				document.form1[opromcode].focus();
				return false;
			}
		}*/
		if (attend_closingparty == "" || attend_closingparty == " ") {
			alert("Please select Delegates " + j + " Information - Are you attending Closing Party");
			document.form1[oattend_closingparty].focus();
			return false;
		}
		if (accperson == "" || accperson == " ") {
			alert("Please select Delegates " + j + " Information - Accompany Person");
			document.form1[oaccperson].focus();
			return false;
		}
		if (accperson == "yes")
		{
			if (accpersonname == "" || accpersonname == " ") {
				alert("Please enter Accompany Person " + j + " Information - Accompany Person Name");
				document.form1[oaccpersonname].focus();
				return false;
			}
			if (accattend_closingparty == "" || accattend_closingparty == " ") {
				alert("Please enter Accompany Person " + j + " Information - Are you attending Closing Party");
				document.form1[oaccattend_closingparty].focus();
				return false;
			}
		}
		if (accperson == "no")
		{
			
			if (accpersonname != "") {
				alert("Please leave blank if you are not bring Accompany Person " + j + " Information - Accompany Person Name");
				document.form1[oaccpersonname].focus();
				return false;
			}

			/*if (accattend_closingparty == "yes")
			{
				alert("Please select No if you are not bring Accompany Person " + j + " Information");
				document.form1[oaccattend_closingparty].focus();
				return false;
			}*/
			if (accdietrequirement != "") {
				alert("Please leave blank if you are not bring Accompany Person " + j + " Information - Accompany Person Name");
				document.form1[oaccdietrequirement].focus();
				return false;
			}
		}
	}
	if(emptyfield(frm.contacttitle,"Please enter Contact Person - Title")==false) return; 
	if(emptyfield(frm.contactfirstname,"Please enter Contact Person - First Name")==false) return;
	if(emptyfield(frm.contactsurname,"Please enter Contact Person - Surname")==false) return;
	if(emptyfield(frm.contactdesignation,"Please enter Contact Person - Job Title")==false) return;
	if(emptyfield(frm.contactorganisation,"Please enter Contact Person - Organisation")==false) return;
	if(emptyfield(frm.contactaddress,"Please enter Contact Person - Address")==false) return;
	if(emptyfield(frm.contactcountry,"Please enter Contact Person - Country")==false) return;
	if(emptyfield(frm.contactpostal,"Please enter Contact Person - Zip Code")==false) return;
	if(emptyfield(frm.contactemail,"Please enter Contact Person - Email Address")==false) return;
	if(checkOneEmail(frm.contactemail.value,"Please enter Valid Contact Person - Email Address")==false) {
		frm.contactemail.focus();
	   	return false;
	}
	if(emptyfield(frm.contacttelno_country,"Please enter Contact Person - Telephone Number (Country)")==false) return;
	if(emptyfield(frm.contacttelno,"Please enter Contact Person - Telephone Number (Number)")==false) return;
	if (frm.contacttelno_country.value != "" || frm.contacttelno.value != "") {
		if (!isInteger(frm.contacttelno_country.value)){
			alert("Contact Person - Telephone Number (Country) must be integer.");
			frm.contacttelno_country.focus();
			return false;
		}
		if (!isNumeric(frm.contacttelno_area.value)){
			alert("Contact Person - Telephone Number (Area) must be integer.");
			frm.contacttelno_area.focus();
			return false;
		}
		if (!isNumeric(frm.contacttelno.value)){
			alert("Contact Person - Telephone Number (Number) must be integer.");
			frm.contacttelno.focus();
			return false;
		}

	}
	if (frm.contactmobileno_country.value != "" || frm.contactmobileno.value != "") {
		if (!isInteger(frm.contactmobileno_country.value)){
			alert("Contact Person - Mobile Number (Country) must be integer.");
			frm.contactmobileno_country.focus();
			return false;
		}
		if (!isNumeric(frm.contactmobileno_area.value)){
			alert("Contact Person - Mobile Number (Area) must be integer.");
			frm.contacttelno_area.focus();
			return false;
		}
		if (!isNumeric(frm.contactmobileno.value)){
			alert("Contact Person - Mobile Number (Number) must be integer.");
			frm.contactmobileno.focus();
			return false;
		}

	}
	/*
	if(emptyfield(frm.contactmobileno,"Please enter Contact Person - Mobile Number")==false) return;
	if (frm.contactmobileno.value != "") {
		if (validNum(frm.contactmobileno,"Contact Person - Mobile Number must be integer.")==false){
			frm.contactmobileno.focus();
			return false;
		}
	} */
	if (frm.contactfaxno.value != "") {
		if (!isInteger(frm.contactfaxno_country.value)){
			alert("Contact Person - Fax Number (Country) must be integer.");
			frm.contactfaxno_country.focus();
			return false;
		} 
		if (!isNumeric(frm.contactfaxno_area.value)){
			alert("Contact Person - Fax Number (Area) must be integer.");
			frm.contactfaxno_area.focus();
			return false;
		}
		if (!isNumeric(frm.contactfaxno.value)){
			alert("Contact Person - Fax Number (Number) must be integer.");
			frm.contactfaxno.focus();
			return false;
		}

	}
	 
	//if(emptyfield(frm.totalprice,"Total Price is empty, please back to browser to select again")==false) return;
	if(checkBox(frm.payment,"Please select Payment Method")==false) {
		return;
	}
	for(i=0;i<frm.payment.length;i++) {
		if(frm.payment[i].checked) {
			payment=frm.payment[i].value;
			break;
		}
	}
	if (payment == "creditcard")
	{	if(checkBox(frm.credittype,"Please select Credit Card")==false) {
			return;
		}
 		if(emptyfield(frm.creditexpiry_month,"Please enter Expiry Date - Month")==false)  {
			return;
		}
		if(emptyfield(frm.creditexpiry_year,"Please enter Expiry Date - Year")==false)  {
			return;
		}
		if (frm.creditexpiry_year.value <= year)
		{
			if (frm.creditexpiry_month.value < month ) 
			{
				alert("Please ensure your date of expiry is valid")
				frm.creditexpiry_month.focus();
				return;
			}
		}
		if(emptyfield(frm.issuing_bank,"Please enter Issuing Bank")==false)  {
			return;
		}
		if(emptyfield(frm.creditnumber,"Please enter Card Number")==false)  {
			return;
		}
		if(checkcreditcard(frm)==false) {
			alert("Please complete your credit card details and ensure your Card Number is correct");
			frm.creditnumber.focus();
			return;
		}
		creditcv2numberstring = new String(frm.creditcv2number.value)
		if(creditcv2numberstring.length < 3) {
			alert("Please enter at least 3 digits");
			frm.creditcv2number.focus();
			return;
		}
		if(emptyfield(frm.creditcv2number,"Please enter CV2 Number")==false)  {
			return;
		}
		if(emptyfield(frm.creditname,"Please enter Name on Card")==false)  {
			return;
		}
		 
	}
	frm.action = "register_preview.asp"
	frm.submit();
}

function RetrieveDB(frm)
{
	var Clicked = frm.Retrieve.checked ;
	if (Clicked == true)
	{	frm.contacttitle.value = frm.title0.value;
		frm.contactfirstname.value = frm.firstname0.value;
		frm.contactsurname.value = frm.surname0.value;
		frm.contactdesignation.value = frm.designation0.value;
		frm.contactorganisation.value = frm.organisation0.value;
		frm.contactaddress.value = frm.address0.value;
		frm.contactcity.value = frm.city0.value;
		frm.contactcountry.value = frm.country0.value;
		frm.contactpostal.value = frm.postal0.value;
		frm.contactemail.value = frm.email0.value;
		frm.contacttelno_country.value = frm.telno_country0.value;
		frm.contacttelno_area.value = frm.telno_area0.value;
		frm.contacttelno.value = frm.telno0.value;
		frm.contactmobileno_country.value = frm.mobileno_country0.value;
		frm.contactmobileno_area.value = frm.mobileno_area0.value;
		frm.contactmobileno.value = frm.mobileno0.value;
		frm.contactfaxno_country.value = frm.faxno_country0.value;
		frm.contactfaxno_area.value = frm.faxno_area0.value;
		frm.contactfaxno.value = frm.faxno0.value;
	}
	else
	{
		//form.name.value = "" ;
	}
}
function enablecreditcard() {
	var creditexpiry_month = document.getElementById('creditexpiry_month');
	var creditexpiry_year = document.getElementById('creditexpiry_year');
	var issuing_bank = document.getElementById('issuing_bank');
	var creditnumber = document.getElementById('creditnumber');
	var creditcv2number = document.getElementById('creditcv2number');
	var creditname = document.getElementById('creditname');
	creditexpiry_month.className = 'textbox';
	creditexpiry_year.className = 'textbox';
	issuing_bank.className = 'textbox';
	creditnumber.className = 'textbox';
	creditname.className = 'textbox';
	creditcv2number.className = 'textbox';
	document.form1.credittype[0].checked=true;
	for(i=0;i<document.form1.credittype.length;i++) {
		document.form1.credittype[i].disabled=false;
	}
	document.form1.creditexpiry_month.disabled=false;
	document.form1.creditexpiry_year.disabled=false;
	document.form1.issuing_bank.disabled=false;
	document.form1.creditnumber.disabled=false;
	document.form1.creditcv2number.disabled=false;
	document.form1.creditname.disabled=false;
 }


function disabledcreditcard() {
	var creditexpiry_month = document.getElementById('creditexpiry_month');
	var creditexpiry_year = document.getElementById('creditexpiry_year');
	var issuing_bank = document.getElementById('issuing_bank');
	var creditnumber = document.getElementById('creditnumber');
	var creditcv2number = document.getElementById('creditcv2number');
	var creditname = document.getElementById('creditname');
	creditexpiry_month.className = 'displaybox';
	creditexpiry_year.className = 'displaybox';
	issuing_bank.className = 'displaybox';
	creditnumber.className = 'displaybox';
	creditname.className = 'displaybox';
	creditcv2number.className = 'displaybox';
	document.form1.credittype[0].checked=true;
	for(i=0;i<document.form1.credittype.length;i++) {
		document.form1.credittype[i].disabled=true;
	}
	document.form1.creditexpiry_month.disabled=true;
	document.form1.creditexpiry_year.disabled=true;
	document.form1.issuing_bank.disabled=true;
	document.form1.creditnumber.disabled=true;
	document.form1.creditcv2number.disabled=true;
	document.form1.creditname.disabled=true;
 }

function blockNonNumbers(obj, e, allowDecimal, allowNegative)
{
	var key;
	var isCtrl = false;
	var keychar;
	var reg;
		
	if(window.event) {
		key = e.keyCode;
		isCtrl = window.event.ctrlKey
	}
	else if(e.which) {
		key = e.which;
		isCtrl = e.ctrlKey;
	}
	
	if (isNaN(key)) return true;
	
	keychar = String.fromCharCode(key);
	
	// check for backspace or delete, or if Ctrl was pressed
	if (key == 8 || isCtrl)
	{
		return true;
	}

	reg = /\d/;
	var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;
	var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;
	
	return isFirstN || isFirstD || reg.test(keychar);
}
function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}
function checktellafriend(frm)
{
 	if(emptyfield(frm.yourname,"Please enter Your Name")==false)  {
		return;
	}
	if(emptyfield(frm.youremail,"Please enter Your Email")==false)  {
		return;
	}
	if (frm.youremail.value != "") {
		if(checkOneEmail(frm.youremail.value,"")==false) {
			alert("Your Email is invalid\n");
			return;
		}
	}
	if(emptyfield(frm.friendname1,"Please enter Your Friend Name")==false)  {
		return;
	}
	if(emptyfield(frm.friendemail1,"Please enter Your Friend Email")==false)  {
		return;
	}
	if(checkOneEmail(frm.friendemail1.value,"")==false) {
			alert("Your Friend Email is invalid\n");
			return;
		}
	if(emptyfield(frm.strCAPTCHA,"Please enter the characters in the image above into the field below.")==false)  {
		return;
	}
	frm.submit();
}
function checkcommentform(frm)
{
 	if(emptyfield(frm.author,"Please enter Name")==false)  {
		return;
	}
	if (frm.email.value != "") {
		if(checkOneEmail(frm.email.value,"")==false) {
			alert("Email is invalid\n");
			return;
		}
	}
	/*if (frm.url.value != "")
	{
		sURL = new String(frm.url.value);
		if (sURL.indexOf("http") == -1){
			alert("Invalid URL");
			frm.url.focus();
			return;
		}
	}*/
 	
	if(emptyfield(frm.comment,"Please enter Comment")==false)  {
		return;
	}
	if(emptyfield(frm.strCAPTCHA,"Please enter the characters in the image above into the field below.")==false)  {
		return;
	}
 	
	frm.submit();
}
function getXmlHttpRequest()
{
	var httpRequest = null;
	try
	{
		httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try
		{
			httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			httpRequest = null;
		}
	}
	if (!httpRequest && typeof XMLHttpRequest != "undefined")
	{
		httpRequest = new XMLHttpRequest();
	}
	return httpRequest;
}

var xmlHttp
function showTicket(str, cty)
{ 
	xmlHttp=getXmlHttpRequest()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	//var name = document.getElementById("username").value;
	var url="gettickets.asp"
	url=url+"?cty="+cty+"&stype="+str
	xmlHttp.open("GET",url,true)
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.send(null)
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("getResult").innerHTML=xmlHttp.responseText 
	 } 
}

