function showterms()
	{
		 $.blockUI({ message: $('#terms') });
	}
	function hideoverlay()
	{
		setTimeout($.unblockUI, 0);
	}
	
	function showFlight(itemcode)
	{		
		$("#myflightdiv").html("Loading...");
		$("#myflightdiv").load("ajax/flights.asp", "itemcode=" + itemcode + "&r=" + Math.random());
		$.blockUI({ 
            message: $('#myflightdiv'), 
            css: {color: '#ffffff', backgroundColor: '#333333'},
			overlayCSS: {backgroundColor: '#ffffff' } 
        }); 

		//$("#myflightdiv").css('display', 'block');
	}	
	
		
	function step2()
	{		
		$("#step1").fadeOut("fast", function() {$("#step2").fadeIn("fast");});
	}
	
	function step3(mobno,password)
	{		
		$("#step3").fadeIn(1000);
		$("#step3").html("<div style='height:15px; line-height:15px; font-size:15px;'></div><div>Validating...</div>");
		$("#step3").load("ajax/checkemail.asp", "mobno=" + mobno + "&password=" + password + "&r=" + Math.random());
	}
	
	function step4(mobno,itemcode,flightpoints,email)
	{		
		//$("#step4").css("display","block");
		$("#step2").fadeOut(1000, function() {$("#step4").css("display","block").load("ajax/redemption.asp", "mobno=" + mobno + "&itemcode=" + itemcode + "&flightpoints=" + flightpoints + "&email=" + email + "&r=" + Math.random()).fadeIn(1000);});
	}
	
	function changeemail(mobno,email)
	{
		$("#step3").html("<div style='height:15px; line-height:15px; font-size:15px;'></div><div>Updating...</div>");
		$("#step3").load("ajax/changeemail.asp", "mobno=" + mobno + "&email=" + email + "&r=" + Math.random()).fadeIn(1000);
	}
	
	function validateemail(email)
	{		
		if (echeck(email))
		{
			$("#errormsg").load("ajax/validateemail.asp", "email=" + email + "&r=" + Math.random()).fadeIn("fast");
		}
		else
		{
			$("#errormsg").html("<img src='images/changeDisabled.png' alt='CHANGE' style='vertical-align:middle' />&nbsp;&nbsp;You have not entered a valid email address").fadeIn("fast");
		}
		
	}
	
	function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}
	
	function validateterms(mobno,itemcode,flightpoints)
	{		
		if (document.getElementById("chkterms").checked == true)
		{			
			$("#errormsg2").css("dislpay","block").fadeIn(1000);
		}
		else
		{
			$("#errormsg2").css("dislpay","none").fadeOut(1000);
		}
	}