var domain = ' ';
var phoneNum = ' ';


function openChildWindow(url) {
		w = screen.availWidth-10;
		h = screen.availHeight-50;
		features = "width="+w+",height="+h;
		features += ",left=0,top=0,scrollbars=1,resizable=1,status=0";
		window.open(url, "", features);
}



function displayHideSelect(){
	if( !jGet("amt_region_list") )
		return;
	//new: if AMT, show amt_region_list, hide country_list[1..N] && buttonDiv
	if( parseInt(document.getElementById('days').value) ==  365){
		if( !isNaN( parseFloat('1.1') ) && parseFloat('1.1') >= 1.1  )
			document.getElementById( "amt_region_list" ).style.width = "300px";
		else 
			document.getElementById( "amt_region_list" ).style.width = "200px";
		document.getElementById( "amt_region_list" ).style.display = "block";
		document.getElementById( "buttonDiv" ).style.display = "none";
		document.getElementById( "containerDiv" ).style.display = "none";
	} else {
		document.getElementById( "amt_region_list" ).style.display = 'none';
		document.getElementById( "buttonDiv" ).style.display = "block";
		document.getElementById( "containerDiv" ).style.display = "block";
	}	
}



function setCountryDropDown(countries,us){
	
	if (document.getElementById('containerDiv') != null ) return;// already created

	alreadySelectedCountries  = us.selectedCountries;
	numberOfAlreadySelectedCountries = 0;
	if (alreadySelectedCountries != null){
		alreadySelectedCountries = alreadySelectedCountries.split(',');
	}else {
		alreadySelectedCountries = Array(0);
	}
	
	
	numberOfAlreadySelectedCountries = alreadySelectedCountries.length;
	
	alreadySelected = false;
	firstSelectedCountry = null;
	if (numberOfAlreadySelectedCountries > 0 ) {
		alreadySelected = true;
		firstSelectedCountry = alreadySelectedCountries[0];
	}
	
	amt = false;
	//AMT? Change select values to regions
 	if( document.getElementById('days') != null ){
		if (document.getElementById('days').value == 365) amt = true;
	}

 	   countriesAndRegionsArray = eval(countries.countryList);//2D array [country name,region],[country name,region],[country name,region],[country name,region]
	   
	   temp = null;
	   
	   containerDiv = document.createElement('div');
	   containerDiv.id = 'containerDiv';
	   containerDiv.setAttribute('style','width:220px');

	   selectBoxTemp = document.getElementById("return_location");	   	   
	   
	   selectBox = selectBoxTemp.cloneNode(false);
	   selectBox.name = "country_list1";
	   selectBox.id = "country_list1";
	   selectBox.style.display = "inline";
	   selectBox.style.visibility = "visible";
	   selectBox.onchange = function(){setDestination();};
	   
	   
	
	   option = document.createElement("option");
	   option.innerHTML = "Please Select";
	   option.value = '';
	   selectBox.appendChild(option.cloneNode(true));

	   for (i=0;i<countriesAndRegionsArray.length;i++){
		   temp = countriesAndRegionsArray[i];
		   option = document.createElement("option");
		   option.innerHTML = temp[0];//country name
		   option.value = temp[0];
		   option.id = temp[1];//region set as id
	   	   if (alreadySelected) {
	   		   if (firstSelectedCountry!=null) if (firstSelectedCountry == temp[0]) option.selected = "true";
	   	   }
   	  
	   	   selectBox.appendChild(option);
	   }
	   containerDiv.appendChild(selectBox);
	   if (numberOfAlreadySelectedCountries > 1){
		 
		   selectedCounty = null;
		   for (count = 1;count<numberOfAlreadySelectedCountries;count++){
			   selectedCounty = alreadySelectedCountries[count];	   
			   	   index = count +1;
			   	   temp = null;
			   	   selectBox = selectBoxTemp.cloneNode(false);
			   	   selectBox.name = "country_list"+index;
			   	   selectBox.id = "country_list"+index;
			   	   selectBox.style.display = "inline";
			   	   selectBox.style.visibility = "visible";
			   	   selectBox.onchange = function(){setDestination();};
			   	   
			   	   option = document.createElement("option");
			   	   option.innerHTML = "Please Select";
			   	   option.value = '';
			   	   selectBox.appendChild(option.cloneNode(true));
		   	   
			   	   for (i=0;i<countriesAndRegionsArray.length;i++){
			   		   temp = countriesAndRegionsArray[i];
			   		   option = document.createElement("option");
			   		   option.innerHTML = temp[0];
			   		   option.value = temp[0];
			   		   option.id = temp[1];   
			   		   if (selectedCounty!=null) if (selectedCounty == temp[0]) option.selected = "true";
			   		   selectBox.appendChild(option);
			   	   
			   	   }
			   	   containerDiv.appendChild(selectBox);
		   }
	   }
	   if (amt){
		   containerDiv.style.display = "none";
		   document.getElementById('buttonDiv').style.display = "none";
	   }
	   
   	   selectBoxTemp.parentNode.appendChild(containerDiv);
   	   //selectBoxTemp.parentNode.appendChild(buttonDiv);
   	   
	   selectBox = selectBoxTemp.cloneNode(false);
	   selectBox.name = "amt_region_list";
	   selectBox.id = "amt_region_list";
	   selectBox.style.display = "inline";
	   selectBox.style.visibility = "visible";
	   selectBox.onchange = function(){setDestination();};
	   
  
	   amtSelectedRegion = 'none';
	   if (us.selectedAmtRegion != null) amtSelectedRegion = us.selectedAmtRegion;  
	
	   var option = document.createElement("option");
	   option.innerHTML = "Please Select";
	   option.value = '';
	   selectBox.appendChild(option);
   	   
	   // #1
	   /*if('INSME' == 'STS01') {
		   option = document.createElement("option");
		   option.innerHTML = "Europe (Exc.Spain,Cyprus,Turkey,Malta)";
		   option.value = "europe1";
		   selectBox.appendChild(option);
		   if (amtSelectedRegion == option.value) option.selected = true;
	   }*/
	   
	   //#2
	   option = document.createElement("option");
	   option.innerHTML = "Europe";
	   option.value = "europe2";
	   if ('INSME' == 'TIMUK'){
		   option.innerHTML = "Europe";
		   //option.value = "AXA_AREA3";
		   option.value = "EUROPE_HR";
	   }
	   selectBox.appendChild(option);
	   if (amtSelectedRegion == option.value) option.selected = true;
	   
	   //#3
	   /*if('INSME' == 'STS01') {
		   option = document.createElement("option");
		   option.innerHTML = "Worldwide (Exc.USA,Canada,Caribbean,Bermuda)";
		   option.value = "world";
		   selectBox.appendChild(option);
		   if (amtSelectedRegion == option.value) option.selected = true;
	   }*/
	   
	   //#4
	   option = document.createElement("option");
	   option.innerHTML = "Worldwide";
	   option.value = "usa";
	   if ('INSME' == 'TIMUK'){
		   option.innerHTML = "Worldwide";
		   //option.value = "AXA_AREA5";
		   option.value = "WORLD_HR";
	   }
	   selectBox.appendChild(option);
	   if (amtSelectedRegion == option.value) option.selected = true;
   	   
	   if (!amt) selectBox.style.cssText = "display:none";
	   
	   selectBoxTemp.parentNode.appendChild(selectBox);
	   
   	   selectBoxTemp.style.cssText = "display:none";
	
}

URL = {
	servicePath: "/sapi-travelinsuranceinsme",
	medicalConditionsPageUrl: "/travelinsurance/conditions"
}; 

function BindEnv( thisReference, func ){
	return function(){
		func.apply(thisReference, arguments);
	}
}

function jGet( id ){
	return jQuery( '#' + id ).get(0);
}

function setSelect(id, value) {
	var index = -1;
	try{
		var select = document.getElementById(id);
		for( var i=0; i<select.options.length; i++ ){
			select.options[i].selected = false;
			if( select.options[i].value == value && index == -1 )
				index = i;
		}
		if( index > -1)
			select.options[index].selected = true;
	}catch(e){ if( index > -1) select.selectedIndex = i; }
}

function mapBackDepartLocation( loc ){
	if( 'INSME' == 'EXPAT' ){
		//var map = {'Austria':'AUSTRIA','Belgium':'BELGIUM','Bulgaria':'BULGARIA','Cyprus':'CYPRUS','Czech Republic':'CZECH REPUBLIC','Denmark':'DENMARK','Estonia':'ESTONIA','Finland':'FINLAND','France':'FRANCE','Germany':'GERMANY',	'Greece':'GREECE', 'Hungary':'HUNGARY', 'Ireland':'IRELAND', 'Italy':'ITALY', 'Latvia':'LATVIA', 'Lithuania':'LITHUANIA', 'Luxembourg':'LUXEMBOURG', 'Malta':'MALTA', 'Netherlands':'NETHERLANDS', 'Poland':'POLAND', 'Portugal':'PORTUGAL', 'Romania':'ROMANIA', 'Slovakia':'SLOVAKIA', 'Slovenia':'SLOVENIA', 'Spain':'SPAIN (& ISLANDS)', 'Sweden':'SWEDEN', 'United Kingdom':'UNITED KINGDOM'};
		return loc;
	} else {
		if( loc == 'United Kingdom')
			return 'uk1';
		if( loc == 'Channel Islands' )
			return 'uk2';
		if( loc == 'Isle of Man' )
			return 'uk3';
		return 'uk1';
	}
}

function mapBackReturnLocation( loc ){
	if( loc == 'United Kingdom')
		return 'uk';
	if( loc == 'Europe')
		return 'europe';
	if( loc == 'Worldwide (Excl.US/Canada/Caribbean)')
		return 'world';
	if( loc == 'Worldwide')
		return 'usa';
	if( loc == 'Australia &amp; NZ' || loc == 'Australia & NZ' || loc == 'Australia/NZ' )
		return 'ausnz';
} 

function formatCurrency( number ){
	var val = 0;
	try{
		val = Number(number).toFixed(2);
	} catch( e ) {}
	return val;
}

var curtainCancelTimerId = 0;

function lockInputs(){
	if( jGet('AjaxLoader') && jGet('AjaxLoader').firstChild &&  jGet('AjaxLoader').firstChild.nextSibling  ){
		jGet('AjaxLoader').firstChild.nextSibling.innerHTML = "Please wait";
		window.clearTimeout( curtainCancelTimerId );
		curtainCancelTimerId = window.setTimeout( 'addCancelLink()', 5000 ); 
	}
	jQuery('#Curtain').css( { opacity : "0.3"} );
	jQuery('#Curtain').fadeIn('def');
	jQuery('#AjaxLoader').fadeIn('def');
}

function unlockInputs(){
	jQuery('#Curtain').fadeOut('def');
	jQuery('#AjaxLoader').fadeOut('def'); 
	window.clearTimeout( curtainCancelTimerId );
}

function addCancelLink(){
	if( jGet('AjaxLoader') && jGet('AjaxLoader').firstChild &&  jGet('AjaxLoader').firstChild.nextSibling  ){
		jGet('AjaxLoader').firstChild.nextSibling.innerHTML =  "Please wait<br/><a id='AjaxLoaderCancel' style='padding:-15px;cursor: pointer;' onclick='unlockInputs();' href='#' >Cancel</a>" ;
	}
}


/* ***HISTORICAL FUNCTIONS:*** */
/*
function showCal(type){
	if (type=='depart_'){
		document.getElementById('calTitle').innerHTML = 'Departure Date';
		dateCalendar.openDateChooser(type);
	}
	if (type == 'return_'){
		document.getElementById('calTitle').innerHTML = 'Return Date';
		dateCalendar.openDateChooser(type);
	}
	if (type == 'motorRenewal_'){
		document.getElementById('calTitle').innerHTML = 'Motor Insurance Renewal Date';
		dateCalendar.openDateChooser(type);
	}
	if (type == 'homeRenewal_'){
		document.getElementById('calTitle').innerHTML = 'Home Insurance Renewal Date';
		dateCalendar.openDateChooser(type);
	}
	document.getElementById('calDiv').style.display = '';
	document.getElementById('calParentDiv').style.display = '';
}
*/
function returnDateChange() {
	 
	var objForm = document.frmStep1;
	var landingType = objForm.landingType.value;
	if (landingType == 'backpacker'){
		backpackerReturnDateChange();
		return;
	}
	 
	var objDays = objForm.days;
	var objReturnDate = objForm.return_date;
	var objDepartDate = objForm.depart_date;
	var strReturnDate = objReturnDate.value;
	var strDepartDate = objDepartDate.value;
		
	if (strDepartDate == '') return false;
	if (strReturnDate == '') return false;
	
	var intOneDay = (1000 * 60 * 60 * 24);
	var objRegExpDate = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
	
	if (objRegExpDate.test(strDepartDate) == false) {
		return false;
	}
	
	if (objRegExpDate.test(strReturnDate) == false) {
		return false;
	}	
	
	arrDepartDate = strDepartDate.split('/');
	arrReturnDate = strReturnDate.split('/');
	
	objDepartDate = new Date(arrDepartDate[2], arrDepartDate[1] - 1, arrDepartDate[0], 0,0,0);
	objReturnDate = new Date(arrReturnDate[2], arrReturnDate[1] - 1, arrReturnDate[0],0,0,0);

	var intDaysDifference = Math.round( (objReturnDate - objDepartDate) / intOneDay );
	intDaysDifference = intDaysDifference + 1;
	
	var singleTripMaxDays = 100;
	if( 'INSME' == 'TIMUK' ) 
		singleTripMaxDays = 90;
	if( ( jGet('tripTypeSingle').checked || jGet('tripTypeWinter').checked ) && intDaysDifference > singleTripMaxDays ) {
		var hundredDaysFromDepart = new Date(arrDepartDate[2], arrDepartDate[1] - 1, parseInt(arrDepartDate[0]) + 99, 0,0,0);
		var day = "0" + hundredDaysFromDepart.getDate(); 
		day = day.substr(day.length - 2);  
		var month = "0" + (hundredDaysFromDepart.getMonth() + 1);
		month = month.substr( month.length - 2);
		jGet("return_date").value = 
			day + "/" + 
			month + "/" + 
			hundredDaysFromDepart.getFullYear(); 
		intDaysDifference = singleTripMaxDays;
	}
	
	var landing = objForm.landingType.value;
	//if ((landing!='longstay')&&(landing!='backpacker')) if (intDaysDifference > 0 && intDaysDifference <= 100) {
	if( jQuery('#tripTypeSingle').is(':checked') && intDaysDifference > 0 && intDaysDifference <= 100 ) {
		objDays.value = intDaysDifference;
	} else if ( jQuery('#tripTypeAnnual').is(':checked') ) {	
		var duration = 365;
		var startDateFrags = objForm.depart_date.value.split('/');
		var endDateFrags = objForm.return_date.value.split('/');
		var startDate = new Date( 
				parseInt(startDateFrags[2],10), 
				parseInt(startDateFrags[1],10) - 1,
				parseInt(startDateFrags[0],10));
		var endDate = new Date(
				parseInt(endDateFrags[2],10),
				parseInt(endDateFrags[1],10) - 1,
				parseInt(endDateFrags[0],10));
		//if start date or end date is not selected yet:
		if( startDate == "Invalid Date")
			startDate = new Date( endDate.getTime() - 365 * 24 * 60 * 60 * 1000);
		if( endDate == "Invalid Date")
			endDate = new Date( startDate.getTime() + 365 * 24 * 60 * 60 * 1000 );
		
		//if start year is leap year and start date < leap day and end date > leap day, 
		//OR end year is leap year and start date < leap day and end date > leap day
		if( ( new Date(startDate.getFullYear(),1,29).getDate() == 29 
				&& startDate.getTime() < new Date(startDate.getFullYear(),1,29).getTime() 
				&& endDate.getTime() > new Date(startDate.getFullYear(),1,29).getTime() )
				|| ( new Date(endDate.getFullYear(),1,29).getDate() == 29 
				&& startDate.getTime() < new Date(endDate.getFullYear(),1,29).getTime()
				&& endDate.getTime() > new Date(endDate.getFullYear(),1,29).getTime() )) {
			duration = 366;
		}
		
		startDate = new Date(endDate.getTime() - (duration - 1) * 24 * 60 * 60 * 1000 );
		objForm.depart_date.value = padWithZero(startDate.getDate()) + "/" + padWithZero(startDate.getMonth() + 1) + "/" + startDate.getFullYear();
		
	}
	uktoukCheck();
	wrongReturnDateCheck();
	longStaySetDate();
}

function getCookie(c_name){
	if (document.cookie.length>0)
	  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
	    {
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	    }
	  }
	return "";
}

function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function capitalize( str ){
	var ns = str.split(' ');
	var val = '';
	for( var i = 0; i < ns.length; i++ )
	    ns[i] = ns[i].substr(0,1).toUpperCase() + ns[i].substr(1).toLowerCase()
	for( var i = 0; i < ns.length; i++ )
	    val += ns[i] + ' ';
	return val.substr(0, val.length-1);
}

function showHelp(objAnchor, theEvent, strText) {

	if (objAnchor.helpTip) {
		objAnchor.helpTip.style.visibility = "hidden";
		objAnchor.onblur = null;
		objAnchor.helpTip = null;
		return;
	}
	
	var objHelpTip = document.createElement("div");
	objHelpTip.className = "help-tooltip";
	document.body.appendChild(objHelpTip);
	objHelpTip.innerHTML = strText;

	//objHelpTip.style.top = (theEvent.clientY + 20) + (document.body.scrollTop) + "px";
	//using JQuery
	var offsets = jQuery( objAnchor ).offset();
	objHelpTip.style.top = (offsets.top + 20) + 'px';
	
	if( offsets.left + 275 > document.body.clientWidth ){
		objHelpTip.style.left = (document.body.clientWidth - 275) + "px";
	} else {
		objHelpTip.style.left = (offsets.left - 8) + "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;
	
	var clojure = function(objHelpTip, objAnchor){ 
		return function() {
			document.body.removeChild(objHelpTip);
			objAnchor.onblur = null;
			objAnchor.helpTip = null;
		};
	}(objHelpTip, objAnchor);
	objAnchor.onblur = function(){ 
		return function(){
			window.setTimeout( clojure, 300 );
		}; 
	}( clojure );	
	
}



function showHelpPreset(objAnchor, theEvent, message_name) {
	
var AMT_MES 	="Covers any number of trips up to 183 days abroad per annum. Maximum 50 days per trip up to age 65 (extendable to 100 days) or 35 days per trip up to age 80. <a href=javascript:void(window.open(\'amt.html\',\'\',\'toolbar=no,width=660,height=700\'))>See Other AMT Benefits<\/a>"; //index,instantquote,long,longqote
//var GOLF_MES 	="Cover includes: Golf Equipment &pound;1,000, Course Closure &pound;150, Hole-in-One &pound;150, Equipment Hire &pound;100, plus trace & delivery assistance for lost sets of clubs. Excludes hired or loaned equipment and items over 3 years old, <a href=javascript:void(window.open(\'Staysure_Policy_Wording.pdf\',\'\',\'\'))>click here for more information<\/a>";//instant qouete,long qote
var GOLF_MES 	="Cover includes: Golf Equipment &pound;1,000, Equipment Hire &pound;300, Course Closure &pound;150, Hole in One &pound;150. Excludes hired or loaned equipment and items over 3 years old, <a href=\"javascript:void(window.open(\'/sapi-travelinsuranceinsme/Policywording.pdf#page=19\',\'\',\'\'))\">click here for more information<\/a>";
var WEDING_MES	="NOTE: Requires Personal Baggage upgrade also. Cover includes: Wedding Attire &pound;1,500, Wedding Gifts &pound;1,000, Wedding Photographs & Videos &pound;750, Wedding Rings &pound;250 (per ring). <a href=javascript:void(window.open(\'/sapi-travelinsuranceinsme/Policywording.pdf#page=20\',\'\',\'\'))>Click here for more information<\/a> and exclusions that apply.')";//instantqoote,long qoute
var SING_MES	="NOTE: Requires Personal Baggage upgrade also. This option provides cover beyond the maximum &pound;300 ceiling allowed in the Personal Baggage section for one item of personal belongings. <a href=javascript:void(window.open(\'/sapi-travelinsuranceinsme/Policywording.pdf#page=19\',\'\',\'\'))>Click here for more information<\/a> and exclusions that apply.";//instantquote,long quote
var SING_MES2	="You have requested to insure an item (or set) valued above &pound;300. If you have not already done so we suggest you read the  <a href=javascript:void(window.open(\'/sapi-travelinsuranceinsme/Policywording.pdf#page=19\',\'\',\'\'))>Increased Single Item Limit summary<\/a> before proceeding, then enter a description here that accurately identifies your item or set";//instquote,longqoute
var FREESPIRIT	="Please select the relevant condition you need to declare from the drop-down list below. There is no additional premium payable for conditions accepted by us and the latter shall be noted on your validation certificate under <b>Medical Reference</b>.<br>If your condition is not listed or if any person travelling has more than one condition to declare please <a href=javascript:void(window.open(\'freespirit.html\',\'\',\',,\'))>CLICK HERE<\/a>";//pd
var PREPOL		="If you do not have your current policy number to hand please enter 1234567 to continue. We will still honour the loyalty discount. Just contact us once within 7 days quoting both your new policy number and the previous one.";//
var MEDICAL		="Please select the relevant condition you need to declare from the drop-down list below. There is no additional premium payable for conditions accepted by us and the latter shall be noted on your validation certificate under <b>Medical Reference</b>.<br>If your condition is not listed or if any person travelling has more than one condition to declare please <a href=javascript:void(window.open(\'freespirit.html\',\'\',\',,\'))>CLICK HERE<\/a>"
var VERIF       ="The verification number is located on the signature strip on the back of your card. It is the last three digits.";
var BK          ="In recognition of increased safety we offer a reduction for joint travel.";
var BKGOLF_MES 	="Cover includes: Golf Equipment &pound;1,000, Course Closure &pound;150, Hole-in-One &pound;150, Equipment Hire &pound;100, plus trace & delivery assistance for lost sets of clubs. Excludes hired or loaned equipment and items over 3 years old, <a href=javascript:void(window.open(\'Backpacker_Policy_Wording.pdf\',\'\',\'\'))>click here for more information<\/a>";//instant qouete,long qote
var BKWEDING_MES="NOTE: Requires Personal Baggage upgrade also. Cover includes: Wedding Attire &pound;1,500, Wedding Gifts &pound;1,000, Wedding Photographs & Videos &pound;750, Wedding Rings &pound;250 (per ring). <a href=javascript:void(window.open(\'Backpacker_Policy_Wording.pdf\',\'\',\'\'))>Click here for more information<\/a> and exclusions that apply.')";//instantqoote,long qoute
var TRANS_FEE = "Credit cards will incur a 2% fee to cover the costs we get charged. Debit cards have NO fee and are free to use with Staysure.";// Transaction fee on payment page

	var text= "&nbsp;";
	
	if (message_name == 'wedding') 			text = WEDING_MES;
	else if (message_name == 'amt') 		text = AMT_MES;
	else if (message_name == 'golf') 		text = GOLF_MES;  
	else if (message_name == 'sin1') 		text = SING_MES;
	else if (message_name == 'sin2') 		text = SING_MES2;
	else if (message_name == 'freespirit') 	text = FREESPIRIT;
	else if (message_name == 'prePol') 		text = PREPOL;
	else if (message_name == 'medi') 		text = MEDICAL;
	else if (message_name == 'veri') 		text = VERIF;
	else if (message_name == 'bk') 			text = BK;
	else if (message_name == 'bkgolf')		text = BKGOLF_MES;
	else if (message_name == 'bkwed') 		text = BKWEDING_MES;
	else if (message_name == 'trans') 		text = TRANS_FEE;
	
	showHelp(objAnchor, theEvent, text) ;

}


function getMaxWeightCountry(){
	var list = ["uk","europe1", "europe2", "europe", "worldwide1", "worldwide2", "world", "worldwide", "ausnz", "usa"];
	if( "INSME" == "TIMUK" )
		list = [ "AXA_AREA2", "AXA_AREA3", "AXA_AREA4", "AXA_AREA5" ];
		//list = [ "EUROPE_LR", "EUROPE_HR", "WORLD_LR", "WORLD_HR" ];
	var maxindex = -1;
	for( var i = 1, sel = document.getElementById("country_list1"); sel ; sel = document.getElementById("country_list"+(++i)) ) {
		var index = list.indexOf(sel.options[sel.selectedIndex].id);
		if( index > -1 )
			maxindex = index;
	}
	if( maxindex > -1 )
		return list[maxindex];
	return null;
}

