
			function showalert(txt){
				$.prompt(txt,{ 
					buttons:{Close:true}
				});
			}
			
			function showbrochurealert(txt){
				$.prompt(txt,{ 
					buttons:{Close:false}
				});
				$("#jqi").css('background-color','#009FA3');
				$(".jqibuttons").css('visibility','hidden');

				$(".jqiclose").css('color','#009FA3');

			}
			
			function setCookie(c_name,value,exdays)
			{
				
			document.cookie=c_name + "=	"+getCookie(c_name)+";expires=0;  path=/;domain="+document.domain;
			var exdate=new Date();
			exdate.setDate(exdate.getDate() + exdays);
			var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
			document.cookie=c_name + "=" + c_value + "; path=/;domain="+document.domain;
			
			/*setCookie(c_name, c_value, 86400*30, '/', 'www3.planetcruise.co.uk');*/
			}
			
			
			function getCookie(c_name)
			{
			var i,x,y,ARRcookies=document.cookie.split(";");
			for (i=0;i<ARRcookies.length;i++)
			{
			  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
			  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
			  x=x.replace(/^\s+|\s+$/g,"");
			  if (x==c_name)
				{
				return unescape(y);
				}
			  }
			}
			
			function checkCookie(msg)
			{
				
			var isalert=getCookie("isalert");
			  if (isalert!=null && isalert!="" && msg==isalert)
			  {
			 
			  }
			else 
			  {
				showalert(msg);
				setCookie("isalert",msg,365);
				
			  }
			}
			
			
			function checkbrochureCookie(msg)
			{
				
			var isbrochure=getCookie("isbrochure");
			  if(isbrochure!=null && isbrochure!="" && isbrochure=='yes')
			  {
			 
			  }
			else 
			  {
				  showbrochurealert(msg);
					setCookie("isbrochure",'yes',365);				
			  }
			}
			
			function autotimecall()
			{
				
				 setTimeout("checktime()",1000);			
			}
			
			
			  function validatePage() {
	  
		 var msg="";
		
		 if (document.forms.requestpopupbrochure.First_name.value == "") {
			 msg += "* Please provide your first name\n";
		 }
		  if (document.forms.requestpopupbrochure.Surname.value == "") {
			 msg += "* Please provide your last name\n";
		 }
		 var stripped = document.forms.requestpopupbrochure.Number.value.replace(/[\(\)\.\-\ ]/g, '');   
		if (document.forms.requestpopupbrochure.Number.value == "") {
			 msg += "* Please provide a number\n"; 
		 } else if (isNaN(parseInt(stripped))) {
         msg += "* The phone number is invalid.\n";
       	 }
		 if (document.forms.requestpopupbrochure.Email.value == "") {
			 msg += "* Please provide a email\n";
		 }
		 if (document.forms.requestpopupbrochure.Email.value.match(/[^@]+@[^\.]+\.*/)) {
			 // valid email
		 } else {
			 	msg += "* The email address supplied does not appear to be valid (e.g. name@company.com)\n";
		 }
		 
		 
		 if(document.forms.requestpopupbrochure.semail.checked == '1')
		 {
			 document.forms.requestpopupbrochure.Address1.value == "post";
			 
			  if (document.forms.requestpopupbrochure.Address1.value == "") {
			 msg += "* Please provide your Address Line1\n";
			 }
			 
			  if (document.forms.requestpopupbrochure.Town.value == "") {
			 msg += "* Please provide your Town\n";
			 }
			 
			  if (document.forms.requestpopupbrochure.County.value == "") {
			 msg += "* Please provide your County\n";
			 }
			 
			  if (document.forms.requestpopupbrochure.Postcode.value == "") {
			 msg += "* Please provide your Postcode\n";
			 }
			 
		 }
		 
		 if (document.forms.requestpopupbrochure.bot.value == "1") {
			 document.forms.requestpopupbrochure.bot.value ="0";
		 }

		 
		 if (msg == "") {
			 setCookie("isitime",90,1365);
			return true;			 
		 } else {
			 alert("This form cannot be submitted. Please correct the following issue(s):\n\n"+ msg);
		     return false;
		 }
		   
		   
	   }
	 
	 
	 
			function checktime()
			{
					var isitime = getCookie("isitime");
			 
			  if(isitime!=null && isitime!="" && isitime!="undefined" )
			  {
				  
			 	var newtime = parseInt(isitime) + 1;
				
			  	if(newtime == 90 )
				{
					
					
							 var brown_theme_text = '<h1 style="color:#ffffff; padding-left: 0;">Request a FREE brochure</h1><div style="background-repeat: no-repeat;'+
' float: right; background-position: right; width:40px; padding-right: 25px; cursor:pointer; height: 40px; background: url(/images/closechat.jpg);" class="jqiclose"></div><h2 style="color:#ffffff">packed full of exclusive cruise and stay holidays</h2><br/>'+
		 '<h3 style="color:#ffffff">We can only post brochures to UK residents, however all non-UK residents can view the brochure online after submitting the below details<br/>Simply fill out the form below.</h3><br/>'+
		 '<form style="background:#ffffff" name="requestpopupbrochure" action="http://www.planetcruise.co.uk/planet-cruise-brochure/contact.php" method="POST" onsubmit="return validatePage()">'+
'<input type="hidden" name="previous" value="" />'+
'<input type="hidden" name="return" value="thank-you.php" />'+
'<input type="hidden" name="bot" value="1" />'+
'<input type="hidden" name="send_type" id="send_type" value="email" />'+
'<table >'+
	'<tr><td valign="top"><table width="400" border="0" cellspacing="1" cellpadding="1" style="float:left;">'+
  '<tr>'+
    '<td width="110" height="50">TITLE:</td>'+
    '<td><select name="Title"><option value="Miss">Miss</option><option value="Mr">Mr</option><option value="Mrs">Mrs</option><option value="Ms">Ms</option></select></td>'+
  '</tr>'+
    '<tr>'+
    '<td height="50">FIRST NAME:</td>'+
    '<td><input name="First_name" type="text" value="" size="25" /></td>'+
 '</tr>'+
    '<tr>'+
    '<td height="50">LAST NAME:</td>'+
    '<td><input name="Surname" type="text" value="" size="25" /></td>'+
  '</tr>'+
  '<tr>'+
    '<td height="50">EMAIL:</td>'+
    '<td><input name="Email" type="text" value="" size="25" /></td>'+
  '</tr>'+
    '<tr>'+
    '<td height="50">PHONE NUMBER:</td>'+
    '<td><input name="Number" type="text" value="" size="25" /></td>'+	
  '</tr>'+
  '<tr><td colspan="2"><span style="font-size:9px;">(optional)</span></td></tr>'+
 '<tr>'+
    '<td height="50">GET BROCHURE BY:</td>'+
    '<td>'+
      		'<table><tr><td><input name="sonline" type="checkbox" value="1" size="25" />Online (Email)</td>'+
            '<td><input name="semail" type="checkbox" value="1" size="25" />Mail </a></td></tr></table>'+
  '</td>'+
  '</tr>'+
  '</table>'+

  '</td><td valign="top">'+
  '<table width="420" border="0" cellspacing="1" cellpadding="1" style="float:left;">'+
       '<tr>'+
     '<td width="110"  height="50">ADDRESS LINE 1:</td>'+
     '<td><input name="Address1" type="text" value="" size="25" /></td>'+
   '</tr>'+
         '<tr>'+
     '<td height="50">ADDRESS LINE 2:</td>'+
     '<td><input name="Address2" type="text" value="" size="25" /></td>'+
   '</tr>'+
         '<tr>'+
     '<td height="50">ADDRESS LINE 3:</td>'+
     '<td><input name="Address3" type="text" value="" size="25" /></td>'+
   '</tr>'+
          
           '<tr>'+
     '<td height="50">TOWN:</td>'+
     '<td><input name="Town" type="text" value="" size="25" /></td>'+
   '</tr>'+
             '<tr>'+
     '<td height="50">COUNTY:</td>'+
     '<td><input name="County" type="text" value="" size="25" /></td>'+
   '</tr>'+
   '<tr>'+
     '<td height="50">COUNTRY:</td>'+
	 '<td>'+
		'<select name="Country"><option value="England">England</option><option value="Wales">Wales</option><option value="Scotland">Scotland</option><option value="Northern Ireland">Northern Ireland</option></select>'+
	'</td>'+
   '</tr>'+
     '<tr>'+
     '<td height="50">POSTCODE:</td>'+
     '<td><input name="Postcode" type="text" value="" size="25" /></td>'+
   '</tr>'+
'</table></td></tr>'+

'<tr><td style="padding:10px" align="right" >'+
'<input type="image" src="http://www.planetcruise.co.uk/planet-cruise-brochure/request-brochure-button.gif" name="button" width="151" height="30" value="REQUEST A BROCHURE" />'+
'</td><td align="right"></td></tr>'+  
'</table> '+
  ' '+

  
'</form>';

				if(window.location.href != document.domain+'/planet-cruise-brochure/')
				{
					showbrochurealert(brown_theme_text);
					 setCookie("isitime",parseInt(newtime),365);
				}
				else
				{
						 setCookie("isitime",parseInt(parseInt(newtime)-1),365);
				}
				
				/*setCookie("isbrochure",'yes',365);*/				
				}
				else if(newtime < 90)
				{
				setCookie("isitime",parseInt(newtime),365);
				autotimecall();
				}
			  }
			else 
			  {
				 var newtime = 1;
				 setCookie("isitime",parseInt(newtime),365);
				 			var isitime = getCookie("isitime");
			  
						autotimecall();
			  }	
			}
			

