var objHelpTip = null;
var objIFHelpTip = null;
var t= null; //timeout
var TIP_PAD = -1;
function hide(){
	//alert(objIFHelpTip);
	objHelpTip.style.display='none';
	if(objIFHelpTip != null)
		objIFHelpTip.style.display='none';
}




/*
function fixIE(element, element_iefix) {    Position.clone(element, element_iefix, {setTop:(!element.style.height)});    element_iefix.style.zIndex = 1;    element.style.zIndex = 2;    Element.show(element_iefix);}//req: element must be position absolute.function fixIEOverlapping(element) {    if($(element.id + '_iefix')) {        WCScript.fixIE(element, $(element.id + '_iefix'));    }    if((navigator.appVersion.indexOf('MSIE')>0)         && (navigator.userAgent.indexOf('Opera')<0)         && (Element.getStyle(element, 'position') == 'absolute')        && !$(element.id + '_iefix')) {        new Insertion.After(element.id,         '<iframe id="' + element.id + '_iefix" ' +        'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +        'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');        setTimeout(function() {            WCScript.fixIE(element, $(element.id + '_iefix'));        }, 50);    }}
*/

function showHelpOld(objAnchor, theEvent, strText) {
	try{
		window.clearTimeout(t);
	}
	catch(e){
	}

	if (objAnchor.helpTip) {
		objAnchor.helpTip.style.visibility = "hidden";
		objAnchor.onblur = null;
		objAnchor.helpTip = null;
		return;
	}
	if (objHelpTip!=null)  objHelpTip.style.display='none';
     
	objHelpTip = document.createElement("div");
	objHelpTip.className = "help-tooltip";
	document.body.appendChild(objHelpTip);
	objHelpTip.innerHTML = strText;

	objHelpTip.style.top = (theEvent.clientY + 10) + (document.body.scrollTop) + "px";
	
	
	if ((theEvent.clientX + 275) > document.body.clientWidth) {
		objHelpTip.style.left = (document.body.clientWidth - 275) + "px";
	} else {
		objHelpTip.style.left = (theEvent.clientX - 8) + "px";	
	}
	
	objAnchor.helpTip = objHelpTip;
	
	objAnchor.onblur = function () {
		//document.body.removeChild(objHelpTip);
		var obj = objHelpTip;
		t = window.setTimeout('hide()',1000);
		objAnchor.onblur = null;
		objAnchor.helpTip = null;
	};	
	
}

function showHelpddd(objAnchor, theEvent, strText) {
	try{
		window.clearTimeout(t);
	}
	catch(e){
	}

	if (objAnchor.helpTip) {
		objAnchor.helpTip.style.visibility = "hidden";
		objAnchor.onblur = null;
		objAnchor.helpTip = null;
		return;
	}
	if (objHelpTip!=null)  objHelpTip.style.display='none';
    var objHolder = document.getElementById("Popup"); 
	objHelpTip = document.createElement("div");
	var objChild =  objHolder.firstChild;
	if(objChild){
	   objHolder.removeChild(objChild);
	}
	objHolder.appendChild(objHelpTip);
	
	objHelpTip.className = "help-tooltip";
	//document.body.appendChild(objHelpTip);
	objHelpTip.innerHTML = strText;
	var pad = 20;
    if(objAnchor.tagName.toUpperCase() == 'SELECT')  pad = 120;
	

	var pos = findPos(objAnchor);
	objHolder.style.top =  pos[1] + "px";
	objHolder.style.left =  pos[0] + pad + "px";	
	

    objAnchor.helpTip = objHelpTip;
	
	objAnchor.onblur = function () {
		//document.body.removeChild(objHelpTip);
		var obj = objHelpTip;
		t = window.setTimeout('hide()',1000);
		objAnchor.onblur = null;
		objAnchor.helpTip = null;
	};	
	
}




function fixIE(element, element_iefix) {

	element_iefix.style.top = element.style.top;
	element_iefix.style.left =  element.style.left;
	element_iefix.style.width = element.offsetWidth ;
	element_iefix.style.height =  element.offsetHeight;
	element_iefix.style.zIndex = 1;
	element.style.zIndex = 2;
}

//req: element must be position absolute.
function fixIEOverlapping(element) {

   if(!element.id) element.id = 'kisha123';//dummy id
	
   if( (navigator.appVersion.indexOf('MSIE')>0) 
		&& (navigator.userAgent.indexOf('Opera')<0) 
			&& (Element.getStyle(element, 'position') == 'absolute')){
				
			new Insertion.After(element.id, 
					'<iframe id="' + element.id + '_iefix" ' +
						'style="position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);border:none;background:none;width:auto;height:auto;" ' +
					'src="javascript:false;" frameborder="5" scrolling="no"></iframe>');

			objIFHelpTip = document.getElementById(element.id + '_iefix');

			setTimeout(function() {
				fixIE(element, $(element.id + '_iefix'));
				}, 50);
	}
}


function showHelp(objAnchor, theEvent, strText) {
	try{
		window.clearTimeout(t);
	}
	catch(e){
	}

	if (objAnchor.helpTip) {
		objAnchor.helpTip.style.visibility = "hidden";
		objAnchor.onblur = null;
		objAnchor.helpTip = null;
		//return;
	}
	if (objHelpTip!=null)  objHelpTip.style.display='none';
	if (objIFHelpTip!=null)  objIFHelpTip.style.display='none';
	objHelpTip = document.createElement("div");

	objHelpTip.className = "help-tooltip";
	document.body.appendChild(objHelpTip);
	objHelpTip.innerHTML = strText;
	var pad = 20;
    if(objAnchor.tagName.toUpperCase() == 'SELECT')  pad = 120;
	
	if(TIP_PAD != -1){
		pad = TIP_PAD;
	}
	
	
	var pos = findPos(objAnchor);
	objHelpTip.style.top =  pos[1] + "px";
	objHelpTip.style.left =  pos[0] + pad + "px";	
	

    objAnchor.helpTip = objHelpTip;
	
	objAnchor.onblur = function () {
		//document.body.removeChild(objHelpTip);
		var obj = objHelpTip;
		t = window.setTimeout('hide()',1000);
		objAnchor.onblur = null;
		objAnchor.helpTip = null;
	};	
	
	fixIEOverlapping(objHelpTip);	
	
}

function findPos(obj) {
	var curleft = curtop = 0;

	if (obj.offsetParent) {
	do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}


function showHelpPreset(objAnchor, theEvent, message_name) { 
	var text= "&nbsp;";
	text = eval(message_name);
	showHelp(objAnchor, theEvent, text) ;
}
function showHelpPresetClaims(objAnchor, theEvent, message_name,claimyear) { 
	var text= "&nbsp;";
	if(claimyear=="2400");
	else{
	text = eval(message_name);
	showHelp(objAnchor, theEvent, text) ;
	}
}


var REBUILD 	="Please enter the rebuild cost in &pound;Sterling or, if you are unsure of the rebuild amount, please <a href=javascript:void(window.open(\'/holidayhomeinsurance/sts/rebuild-calc.html\',\'\',\'toolbar=no,width=660,height=300\'))>CLICK HERE.<\/a>"; 


var BUILDON 	="Insurers generally reward newer properties with a higher discount. Simply select the year built from the range provided in the dropdown or select 'don&acute;t know' if this is unknown.";

var LISTED	="Some residential properties fall under the title of Listed Buildings. It is still possible to insure these but insurers like to know in advance. Please select from the dropdown.";

var ALARM	="Insurers are happy to reward properties with a higher level of security with increased discounts. Please select from the dropdown. If you are unsure whether there is an alarm please select 'no' as this may invalidate a claim.";

var CONT_WALL = "Please select from the dropdown. Standard construction refers to walls built with bricks, concrete or stone.";

var CONT_WALL = "Please select from the dropdown. Standard construction refers to walls built with bricks, concrete or stone.";

var CONT_ROOF = "Please select from the dropdown. Standard construction refers to a roof built with slate, tiles, concrete, asphalt or rigid metal.";

var FLAT_ROOF = "If your property is an apartment within a block of flats your answer should represent the ultimate roof. Please note: An additional &pound;150 excess will apply to a flat roof covering more than 50%";

var CONT_SUM = "Please select the total value in &pound;Sterling of contents cover required. This optional cover is provided on a  New for Old basis therefore the total amount should represent the cost to reinstate your contents.<br><a href=javascript:void(window.open(\'/holiday-home-insurance/policy-doc/\',\'\',\'\'))>CLICK HERE<\/a> for full details of how insurers settle contents claims";

var RES_TYPE = "Please select from the dropdown whether your property is your permanent residence OR a holiday home at which you will not stay for a consecutive period of more than 4 months in any policy year. ";

var ABT_YOU = "Regrettably it is not possible for insurers to cover some types of employment which carry a higher risk. It is not possible to provide cover if all persons are unemployed, i.e. at least one person must be in employment.";

var AGE = "Please select the age of the applicant whose name will appear first on the policy schedule";

var CONVICTS = "Please select the appropriate answer from the dropdown. Insurers retain the right to exclude cover from members of the public who have committed a criminal offence.";

var NO_CLAIMS = "Please make your selection from the dropdown. If you are uncertain of the amount of your no-claims bonus entitlement please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a>. In the event of a claim insurers will require proof of your entitlement from your previous insurance provider."


var CHG_EXCESS = "The excess is the amount you pay in the event of a claim. It is possible to reduce the overall premium by accepting a voluntary excess of &pound;250 or &pound;500 against claims for buildings and contents. This may be in addition to any standard excess detailed in the policy wording.";


var ACC_DAMAGE = "PLEASE NOTE: This cover is only provided whilst the property is occupied by the Insured or family <a href=javascript:void(window.open(\'/holidayhomeinsurance/policy_wording.pdf#page=14\',\'\',\'\'))>CLICK HERE<\/a> for more information";

var INC_LIAB = "PLEASE NOTE: Certain clauses apply to properties in Spain, France and Portugal. <a href=javascript:void(window.open(\'policy_wording.pdf#page=30\',\'\',\'\'))>CLICK HERE<\/a> for more information. Your policy automatically provides coverage of &pound;2m however with increases in the settlements made to individuals, particularly those renting properties overseas, many clients may find this extension provides added peace of mind.";

var PR_TIP = "At present we can only offer cover for your permanent residence in Spain, France, Portugal and Southern Cyprus. Please follow the link to get a quote for your country of residence.<br><a href=index.html?Country=Spain>Permanent Residence Spain<\/a><br><a href=index.html?Country=France>Permanent Residence France<\/a><br><a href=index.html?Country=Portugal>Permanent Residence Portugal<\/a><br><a href=index.html?Country=Southern Cyprus>Permanent Residence Southern Cyprus</a><br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

var INSURED = "If you wish to insure the property in anything other than your name please enter the title, first initial and surname. The maximum number of persons we accept for joint ownership is 6.";

var LET_STUD = "At present insurers insist that your property may not be let to students or DSS. This will invalidate any related claim <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";


var DECLINED = "If you have been declined insurance either on this property or at any time it is not possible to complete this application online. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a><br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";


var CARAVAN = "At present insurers insist that your property may not be a caravan, mobile home or working farm. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> if you require further assistance.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";


var CARAVAN = "At present insurers insist that your property may not be a caravan, mobile home or working farm. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> if you require further assistance.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

var CLAIMS_QUIZ = "Insurers need to know whether you or your family have personally made any claims in the last 5 years.";

var CLAIMS_HIGH = "For your safety we insist that you perform the remainder of this sale over the phone. It is possible that your claims history may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

var CLAIMS_YEAR_ERR = "For your safety we insist that you perform the remainder of this sale over the phone. It is possible that your claims history may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

var REPAIR_STAT = "If your property is not in a good state of repair for your safety we insist that you perform the remainder of this sale over the phone. It is possible that this area may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

var BUILD_WORK_TIP = "Please ignore redecoration or internal cosmetic changes such as new kitchen / bathroom";

var BUILD_WORK = "If your property may have building works taking place then for your safety we insist that you perform the remainder of this sale over the phone. It is possible that this area may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";


var OWN_BIZZ = "Please note this policy allows clerical work at home but there is no liability in respect of business activities or customers. Equally there is no cover in respect of business contents at the premises";

var POOL = "If there is a communal swimming pool that may or may not fall under your ownership please pay close attention to the swimming pools endorsement.";

var VERF_NUM = "Please enter the last 3 digits on the signature strip on the reverse of your card.";


WALL_TIP1 = "Unfortunately insurers are unable to provide cover for your type of property. If the construction of walls that you have selected only represents a small percentage of the total walls please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

WALL_TIP2 = "For your safety we insist that you perform the remainder of this sale over the phone. It is possible that the construction type of your walls may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

WALL_TIP3 = "For your safety we insist that you perform the remainder of this sale over the phone. It is possible that the construction type of your walls may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

ROOF_TIP1 = "Unfortunately insurers are unable to provide cover for your type of property. If the roof construction that you have selected only represents a small percentage of the total area please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

ROOF_TIP2 = "For your safety we insist that you perform the remainder of this sale over the phone. It is possible that the construction type of your roof may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

RES_TYPE = "Unfortunately we are currently unable to provide cover for permanent residences in your country. If you are unsure whether your property may be regarded as a holiday home please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you. <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

CONVICT1 = "Unfortunately insurers are unable to provide cover on this occasion. Thank you for considering Staysure, hopefully we will be able to assist at some point in the future. <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

CONVICT2 = "For your safety we insist that you perform the remainder of this sale over the phone. It is possible that your previous convictions may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you. <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

FLAT_ROOF1 = "For your safety we insist that you perform the remainder of this sale over the phone. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you. <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

RATE_HIGH = "For your safety we insist that you perform the remainder of this sale over the phone. It is possible that your claims history may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you. <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

FLAT_TIP = "Please select from the dropdown. We are able to provide cover in most circumstances";

MORE_FLATS = "Insurers require additional information before providing a quotation. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> with a suitable time that we may contact you. <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

FLAT_ABOVE = "Insurers require additional information before providing a quotation. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> with a suitable time that we may contact you. <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

FLOOD ="Insurers require additional information before providing a quotation. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> with a suitable time that we may contact you. <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

PROP_STAT = "Insurers require additional information before providing a quotation. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> with a suitable time that we may contact you.  <br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

OWN_BUSINESS = "For your safety we insist that you perform the remainder of this sale over the phone. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";

HEATING = "For your safety we insist that you perform the remainder of this sale over the phone. It is possible that the heating method may invalidate this policy. Please contact us on UK (+0044) 844 692 8446 or email <a href=mailto:info@staysure.co.uk>info@staysure.co.uk<\/a> suggesting a suitable time that we may contact you.<br><label style='cursor:pointer;float:right;' onClick='javascript:hide();'><b><u>Close window</u></b></label>";


function showWallTip(obj,event){
	TIP_PAD = 250;
	//if(obj.selectedIndex == 1) showHelpPreset(obj, event, 'WALL_TIP1');
	if(obj.selectedIndex == 11 ) showHelpPreset(obj, event, 'WALL_TIP3');  
	if(obj.selectedIndex >= 15 && 22 > obj.selectedIndex) showHelpPreset(obj, event, 'WALL_TIP1');
	if(22 <= obj.selectedIndex) showHelpPreset(obj, event, 'WALL_TIP2');
	TIP_PAD = -1;
	
}


function showRoofTip(obj,event){
	TIP_PAD = 250;
	if(obj.selectedIndex >= 10 && 15 > obj.selectedIndex) showHelpPreset(obj, event, 'ROOF_TIP1');
	if(15 <= obj.selectedIndex) showHelpPreset(obj, event, 'ROOF_TIP2');
	TIP_PAD = -1;
	
}

function showResTip(obj,event){
	TIP_PAD = 250;
	if(obj.form.TxtCountry.value != 'Spain' && obj.form.TxtCountry.value != 'France' && obj.form.TxtCountry.value != 'Portugal' && obj.selectedIndex == 2 && obj.form.TxtCountry.value != 'Cyprus')
		showHelpPreset(obj, event, 'RES_TYPE');
	TIP_PAD = -1;
	
}

function showConvictTip(obj,event){
	TIP_PAD = 190;
	if( obj.selectedIndex == 4)
		showHelpPreset(obj, event, 'CONVICT1');
		
	if( obj.selectedIndex == 3)
		showHelpPreset(obj, event, 'CONVICT2');	
	TIP_PAD = -1;
	
}


function showFlatRoofTip(obj, event){
	TIP_PAD = 250;
	if( obj.selectedIndex == 4 && obj.form.TxtCountry.value != 'Spain' && obj.form.TxtCountry.value != 'Portugal' && obj.form.TxtCountry.value != 'Cyprus'){
		
		showHelpPreset(obj, event, 'CONVICT2');	
	}
	TIP_PAD = -1;
	
}
function showHeatingTip(objAnchor, theEvent, message_name,existingWallRoof){
	var text= "&nbsp;";
	if(existingWallRoof=="false"){
	text = eval(message_name);
	showHelp(objAnchor, theEvent, text) ;
	}
	if(objAnchor.selectedIndex == 6){
		text = eval(message_name);
		showHelp(objAnchor, theEvent, text) ;
	}
	
}


