var REFER = "HOME";
//window.onresize=setTWidth; 
if  (document.referrer != "") { REFER = document.referrer; }
function vetreferrer()
{
var xresult = "";
var ptstr = new String(REFER);

if (ptstr.indexOf("?") == -1) { return; }
if (ptstr.indexOf("&") == -1) { return; }
if (ptstr.indexOf("=") == -1) { return; }
var plist = ptstr.split("?");
xresult = unescape(plist[0]);
xresult += "=";
var alist = plist[1].split("&");
var i;
for (i = 0; i < alist.length; i++) {
	     var elist = alist[i].split("=");
         if (elist[0] == "q" || elist[0] == "title" || elist[0] == "keyword" || elist[0] == "searchfor" || elist[0] == "search") {
                                 xresult += unescape(elist[1]);
                                 break;
         }
}
REFER = xresult;
}
function checkStatus()
{
var olduser = geteCookie('EUSER');
if (!olduser) 
     { vetreferrer(); 
       seteCookie('EUSER', REFER, null, '/');
	   }
var oldstage = geteCookie('Stage'); 
//document.FORMQ.STAGE.value = oldstage;
if (oldstage != "2") { seteCookie('Stage', '0', null, '/');
                       seteCookie('UniqueRef', 'Z', null, '/');
                      }
var pexp = /\s*paragl\s*/;	
var sexp = /\s*skydiv\s*/;
var ustr = new String(REFER);
if (pexp.test(ustr)){
	document.FORMQ.F2PARASKY.value = '1';
}
if (sexp.test(ustr)){
	document.FORMQ.F2PARASKY.value = '2';
}


}






function setpage()
{
var htracker =  geteCookie("htracker");
var country = geteCookie("country");
if (country < 1 || country > 4 || country == 3) {
        country = 1;
		seteCookie( 'country', '1');
		}

if (htracker != "ho") {
			seteCookie( 'htracker', 'ho');
					    }
seteCookie( 'tracker', 'us'); 
var scrwidth = findLPW();	
seteCookie('scrwidth', scrwidth, null, '/')
document.FORMQ.F2H.value = country;
if (country == 1) { setA1(); }
if (country == 2) { setA2(); }
if (country == 4) { setA4(); }
}
function setA1()
{
document.getElementById("F2H").selectedIndex = "0";
}
function setA2()
{
document.getElementById("F2H").selectedIndex = "1";
}
function setA4()
{
document.getElementById("F2H").selectedIndex = "2";
}
function SubmitForm()
{
if (!validates()) { return; }
document.FORMQ.submit();
}

function validates()
{
var xxx = document.FORMQ;
with (xxx) {
 if (buttonpress.value == "N"){ return false; }  
       if (F2A.value == '0') {
        alert("Please set the geographical area you require") 
        return false;
        } 
		var aval = parseInt(F2AD.value, 10);
		var cval = parseInt(F2CH.value, 10);
		var tval = aval + cval;
		if (tval > 10) {
		 alert("10 is maximum number of insureds allowed for insurance on site, please contact us direct for a quote") 
        return false;
		}
		if (aval < 1 && cval > 0){
		 alert("Children alone cannot be insured on site,  please contact us direct for a quote") 
        return false;
        }
		if (F2D.value < "04") {
			  if (!confirm("WARNING: the duration must include the day of departure from your Home country, and cover the whole duration of the trip")) { return false; }
		 }
         if (F2PARASKY.value == "1") {
			  alert("WARNING: this quote does not include cover for paragliding, which can be added at cost of GBP4 per day, after the underlying travel insurance is completed.");
}
         if (F2PARASKY.value == "2") {
			  alert("WARNING: this quote does not include cover for skydiving, which can be added at cost of GBP4 per day, after the underlying travel insurance is completed.");
}		 
 }
return true;
}
function buttonpressed()
{
document.FORMQ.buttonpress.value = "Y";
}	

function setSidebar(s)
{
 if (s == "0") { moveIt('easysteps','sidebar' ) }
 if (s == "1") { moveIt('europe','sidebar' ) }
  if (s == "2"){ moveIt('children','sidebar' ) }
  if (s == "3") { moveIt('partner','sidebar' ) }  
  if (s == "5") { moveIt('stopover','sidebar' ) } 
}



function buttonpressed()
{
document.FORMQ.buttonpress.value = "Y";
}	



function setIns()
{

if (document.FORMQ.FXSP.checked == true){
         document.FORMQ.F2SP.value = "1";
		 var aval = parseInt(document.FORMQ.F2AD.value, 10);
		 if (aval == 1) {document.FORMQ.F2AD.value = "2"; }
         }
         else {
         document.FORMQ.F2SP.value = "0";
         }
}
//function getsearch()
//{
//var aterm = document.FORMQ.F6SEARCH.value;
//seteCookie( 'F6SEARCH', aterm);
//window.location.href="etlookin.asp";
//}
function ShowInformation(x)
{
	var s
	var d = "description" + x
	 if (x == "1") { s = "travel_UK_IsleofMan_Channelislands"; }
	 if (x == "2") { s = "travel_trips_from_Ireland"; }
	 moveIt(s,d);
}

