﻿// JScript File

function promptText(thetxt) {
    prompttxt.innerHTML = thetxt + "<br>"
    setvalidationsvis();
}

function removePrompt() {
prompttxt.innerHTML = '';
}


function clearfield(thedefault,thefield) {
    if (thefield.value == thedefault) {
    thefield.value = ''
    }
}


function custVal_jointage(source,args) {

    fsValid = true
  var myRegxp = /^[-+]?\d*$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false || args.Value <1 || args.Value >99) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }

        args.IsValid = fsValid 

}

function custVal_numchildren(source,args) {

    fsValid = true
  var myRegxp = /^[-+]?\d*$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false || args.Value <1 || args.Value >5) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }

        args.IsValid = fsValid 

}

function custVal_employees(source,args) {

    fsValid = true
  var myRegxp = /^[-+]?\d*$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false ) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }

        args.IsValid = fsValid 

}


function custVal_companyname(source,args) {

    fsValid = true
    var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{1,35}$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == ''  || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }

        args.IsValid = fsValid 
};



function custVal_CurrentInsurer(source,args) {

    fsValid = true
    var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{1,35}$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == ''  || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }

        args.IsValid = fsValid 
};


function custVal_firstname(source,args) {

    fsValid = true
    var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{1,35}$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || args.Value == 'first name' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }

        args.IsValid = fsValid 
};



function custVal_surname(source,args) {
 fsValid = true
    var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{2,35}$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || args.Value == 'surname' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_age(source,args) {

    fsValid = true
  var myRegxp = /^[-+]?\d*$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false || args.Value <1 || args.Value >99) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }

        args.IsValid = fsValid 

}

function custVal_postcode(source,args) {
 fsValid = true

    if (args.Value == '' || args.Value == 'postcode') {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_nationality(source,args) {
 fsValid = true

    if (args.Value == '' || args.Value == 'nationality') {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_workingin(source,args) {
 fsValid = true


    if (args.Value == '' || args.Value == '1') {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_street(source,args) {
 fsValid = true

    if (args.Value == '' || args.Value == 'house no & street') {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_city(source,args) {
 fsValid = true

    if (args.Value == '' || args.Value == 'city') {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_daytime_phone(source,args) {
 fsValid = true
    var myRegxp = /^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?\d{5}\)?\s?\d{5})|(\(?\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$/;

   if (myRegxp.test(args.Value) == false) {
        fsValid = false
  }

    if (args.Value == '' || args.Value == 'daytime' || fsValid == false) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_evening_phone(source,args) {
 fsValid = true
    var myRegxp = /^((\(?0\d{4}\)?\s?\d{3}\s?\d{3})|(\(?0\d{3}\)?\s?\d{3}\s?\d{4})|(\(?\d{5}\)?\s?\d{5})|(\(?\d{3}\)?\s?\d{3}\s?\d{4})|(\(?0\d{2}\)?\s?\d{4}\s?\d{4}))(\s?\#(\d{4}|\d{3}))?$/;

   if (myRegxp.test(args.Value) == false) {
        fsValid = false
  }

    if (args.Value == '' || args.Value == 'evening' || fsValid == false) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_daytime_phoneb(source,args) {
 fsValid = true
    var myRegxp = /^[0-9\s\(\)\+\-]+$/;

   if (myRegxp.test(args.Value) == false) {
        fsValid = false
  }

    if (args.Value == '' || args.Value == 'daytime' || fsValid == false) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_evening_phoneb(source,args) {
 fsValid = true
    var myRegxp = /^[0-9\s\(\)\+\-]+$/;

   if (myRegxp.test(args.Value) == false) {
        fsValid = false
  }

    if (args.Value == '' || args.Value == 'evening' || fsValid == false) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_email(source,args) {
 fsValid = true
    var myRegxp = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;

   if (myRegxp.test(args.Value) == false) {
        fsValid = false
  }

    if (args.Value == '' || args.Value == 'you@here.co.uk' || fsValid == false) {
            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}


function custVal_manaddress1(source,args) {
 fsValid = true
    var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{2,35}$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || args.Value == 'street' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_manaddress2(source,args) {
 fsValid = true
    var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{2,35}$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || args.Value == 'town' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_manaddress3(source,args) {
 fsValid = true
    var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{2,35}$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || args.Value == 'city' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_manaddress4(source,args) {
 fsValid = true
    var myRegxp = /^[A-Za-zÀ-ÖØ-öø-ÿ '\-\.]{2,35}$/;

    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || args.Value == 'postcode' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}


function custVal_ChildAge1(source,args) {
 fsValid = true
    var myRegxp = /^[-+]?\d*$/;


    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false ) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_ChildAge2(source,args) {
 fsValid = true
     var myRegxp = /^[-+]?\d*$/;


    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_ChildAge3(source,args) {
 fsValid = true
    var myRegxp = /^[-+]?\d*$/;


    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}

function custVal_ChildAge4(source,args) {
 fsValid = true
   var myRegxp = /^[-+]?\d*$/;


    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}


function custVal_ChildAge5(source,args) {
 fsValid = true
    var myRegxp = /^[-+]?\d*$/;


    if (myRegxp.test(args.Value) == false) {
        fsValid = false
    }

    if (args.Value == '' || fsValid == false) {

            fsValid = false
           } else {
            fsValid = true
        }
        
        if (fsValid == true) {
          document.getElementById(source.controltovalidate).style.border =  '1px solid #7F9DB9';
           document.getElementById(source.controltovalidate).style.padding =  '1px';
        }
        else {
   document.getElementById(source.controltovalidate).style.border = '2px red solid'
        }
        
        args.IsValid = fsValid 
  
}




function setvalidationsvis() {
    changeObjectVisibility('validations', 'visible')
}


function changeObjectVisibility(objectId, newVisibility) {
    // first get the object's stylesheet
    var styleObject = getStyleObject(objectId);

    // then if we find a stylesheet, set its visibility
    // as requested
    //
    if (styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	return false;
    }
}

  function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function initFields() {
    if (!document.getElementsByTagName){ return; }
    var allfields = document.getElementsByTagName("input");

    // loop through all input tags and add events
    for (var i=0; i<allfields.length; i++){
    thisfunction = ''
        var field = allfields[i];

        if ((field.getAttribute("type") == "text") || (field.getAttribute("type") == "password") ) {
           // var oldonload  =  field.onfocus;
           var oDiv = document.getElementById(field.id);
           // alert(oDiv)
           //addEvent(oDiv,'Focus',function() {setvalidationsvis();this.onFocus='';})

          field.onblur = function () {setvalidationsvis();}
       // field.onfocus = function () {setvalidationsvis()}
        }  
    }
}

var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}}} function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}
function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}
function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}


function popUp(evt,oi) {
if (DH) {var wp = pw(); 
ds = fd(oi,1); dm = fd(oi,0); 
st = ds.visibility; 
if (dm.offsetWidth) ew = dm.offsetWidth; 
else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { 
ds.visibility = "hidden"; 
} else {
tv = mouseY(evt) -40; 
lv = mouseX(evt) - (ew/2); if (lv < 2) lv = 2; 
else if (lv + ew > wp) lv -= ew/2; if (!an) {
lv += 'px';tv += 'px';
} 
ds.left = lv; 
ds.top = tv; 
ds.visibility = "visible";}
}
}


/// Google Tracking
var google_conversion_id = 1065027826;

var google_conversion_language = "en_GB";

var google_conversion_format = "1";

var google_conversion_color = "FFFFFF";

var google_conversion_label = "sfJ2CO7fPRDykez7Aw";