function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_swapImgRestore() {
	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) {
	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); return x;
}

function MM_swapImage() {
	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_preloadImages() {
  	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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function OpenTerms(d, ddi)
{
  open(d + 'terms.asp?ddi=' + ddi,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizeable=yes,copyhistory=no,width=700,height=600');
}

function OpenPrivacy(d)
{
  open(d + 'privacy.htm','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizeable=yes,copyhistory=no,width=700,height=600');
}

/* start of include referdetect, the following code is copied from referdetect.js */
  var scriptLoc = location.protocol + '//www.myaffiliateprogram.com/u/leisure/rep.asp';
  var scriptLoca = location.protocol + '//ld.rece2.com/cgi-bin/clickme.cgi';

  var kbId = 0;
  var queryString = window.location.search.substring(1);
  var imgdata = '';
  var subdata = '';
  var overwrite = 1;

  if (queryString.length > 0)
  {
    var pairs = queryString.split('&');
                
    for(var i = 0; i < pairs.length; i++)
    {
      var pairs2 = pairs[i].split('=');
      
      switch(pairs2[0].toLowerCase())
      {
        case 'kbid':
          kbId = pairs2[1];
          break;
        case 'p36':
          kbId = 'B' + pairs2[1];
          break;
        case 'affid':
          kbId = 'W' + pairs2[1];
          break;
        case 'clearcookie':
          if (pairs2[1] == 1)
          {
            DeleteCookie("kbid");
          }
          break;
        case 'img':
          imgdata = pairs2[1];
          break;
        case 'sub':
          subdata = pairs2[1];
          break;
      }
    } //end for
  }//end if

  if (GetCookie("kbid") == null || overwrite == 1)
  {
    if (kbId != 0)
    {
      var img = new Image();
      var imga = new Image();
      var url = scriptLoc + '?id=' + kbId;
      var urla = scriptLoca + '?exec=' + kbId;
      if (imgdata != '')
      {
        url += '&img=' + imgdata
        urla += '&img=' + imgdata
      }

      if (subdata != '')
      {
        url += '&sub=' + subdata
        urla += '&sub=' + subdata
      }

      img.src = url;
      if(location.protocol == "http:") imga.src = urla;

      SetCookie("kbid", kbId, 45, "/", document.domain);
    }
  }//end if
  
  function getCookieVal (offset) 
  {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
      endstr = document.cookie.length;

    return unescape(document.cookie.substring(offset, endstr));
  }

  function GetCookie (name) 
  {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    
    while (i < clen) 
    {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
        return getCookieVal (j);
      
      i = document.cookie.indexOf(" ", i) + 1;

      if (i == 0) break; 
    }
    
    return null;
  }

  function WriteCookie (name, value, expires) 
  {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    
    var cookie = name + "=" + escape(value) +
      ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
      ((path == null) ? "" : ("; path=" + path)) +
      ((domain == null) ? "" : ("; domain=" + domain)) +
      ((secure == true) ? "; secure" : "");

    document.cookie = cookie;
  }

  function DeleteCookie (name) 
  {
    var exp = new Date();
    exp.setTime (exp.getTime() - 1000000000);  // This cookie is history (changed -1 to make it previous time)
    var cval = GetCookie (name);
    document.cookie =name + "=" + cval + "; expires=" + exp.toGMTString();
  }

  function SetCookie(name, value, expiredays)
  {
    var expdate = new Date(); 
    expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 1000 * expiredays)); 
    WriteCookie(name, value, expdate);  
  }
/* end of include referdetect */

function WritePhoneNumber(where, n, isI2F)
{
  var kbid = isI2F == 'True' ? GetCookie("kbid") : null;
  var PhoneNum = "";

    PhoneNum += (kbid == null) ? n : "0871 423 5519";
    switch(where)
    {
      default:
      case 0:
        PhoneNum += " ";
        break;
      case 1:
        PhoneNum += "<BR>";
        break;
      case 2:
        PhoneNum += "</DIV><DIV style='margin-right:3px;'>";
        break;
      case 3:
        PhoneNum = "<BR>" + PhoneNum;
        PhoneNum += (kbid == null) ? "" : " Quoting AF" + kbid;
        document.write(PhoneNum);
        return;
    }
    PhoneNum = "<DIV style='margin-right:3px;'>" + PhoneNum
    PhoneNum += (kbid == null) ? "" : "Quoting AF" + kbid;
    PhoneNum += "</DIV>"
    document.write(PhoneNum);
}
