<!--
// Browser sniffer
var ns4 = (document.layers); 
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);
// START DEBUGGER
	function PageQuery(q) {
		if(q.length > 1) this.q = q.substring(1, q.length);
		else this.q = null;
		this.keyValuePairs = new Array();
		if(q.length > 1) {
			for(var i=0; i < this.q.split("&").length; i++) {
				this.keyValuePairs[i] = this.q.split("&")[i];
			}
		}
		this.getKeyValuePairs = function() { return this.keyValuePairs; }
		this.getValue = function(s) {
			for(var j=0; j < this.keyValuePairs.length; j++) {
				if(this.keyValuePairs[j].split("=")[0] == s)
					return this.keyValuePairs[j].split("=")[1];
			}
			return false;
		}
		this.getParameters = function() {
			var a = new Array(this.getLength());
			for(var j=0; j < this.keyValuePairs.length; j++) {
				a[j] = this.keyValuePairs[j].split("=")[0];
			}
			return a;
		}
		this.getLength = function() { return this.keyValuePairs.length; }	
	}
	function queryString(key){
		var page = new PageQuery(window.location.search); 
		return unescape(page.getValue(key)); 
	}
	var bDebug = false;
	if(queryString('debug')=='true') {
		bDebug = true;
	}
// END DEBUGGER
function OpenWindow(url,name,opts) {
	newwindow = window.open(url,name,opts); 
	if (window.focus){
		newwindow.focus()
	}
}
var iDarkenScreen_ExtraHeight;
function grayOut(vis, options) {
	// Pass true to gray out screen, false to ungray
	// options are optional.  This is a JSON object with the following (optional) properties
	// opacity:0-100         // Lower number = less grayout higher = more of a blackout 
	// zindex: #             // HTML elements with a higher zindex appear on top of the gray out
	// bgcolor: (#xxxxxx)    // Standard RGB Hex color code
	// grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
	// Because options is JSON opacity/zindex/bgcolor are all optional and can appear
	// in any order.  Pass only the properties you need to set.
	var options = options || {}; 
	var zindex = options.zindex || 100;
	var opacity = options.opacity || 70;
	var opaque = (opacity / 100);
	var bgcolor = options.bgcolor || '#000000';
	var dark=document.getElementById('darkenScreenObject');
	if (!dark) {
		// The dark layer doesn't exist, it's never been created.  So we'll
		// create it here and apply some basic styles.
		// If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
		var tbody = document.getElementsByTagName("body")[0];
		var tnode = document.createElement('div');           // Create the layer.
		tnode.style.position='absolute';                 // Position absolutely
		tnode.style.top='0px';                           // In the top
		tnode.style.left='0px';                          // Left corner of the page
		tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
		tnode.style.display='none';                      // Start out Hidden
		tnode.id='darkenScreenObject';                   // Name it so we can find it later
		tbody.appendChild(tnode);                            // Add it to the web page
		tbody.onclick="alert('')"
		dark=document.getElementById('darkenScreenObject');  // Get the object.
	}
	if (vis) {
		var iExtraHeight = 0;
		//example in traveljunky bespoke.js
		if(iDarkenScreen_ExtraHeight) {
			iExtraHeight = iDarkenScreen_ExtraHeight;
		}
		
		sSelectHide = 'none';
		// Calculate the page width and height 
		if( document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
			var pageWidth = document.body.scrollWidth+'px';
			var pageHeight = document.body.scrollHeight+iExtraHeight+'px';
		} else if( document.body.offsetWidth ) {
			var pageWidth = document.body.offsetWidth+'px';
			var pageHeight = document.body.offsetHeight+iExtraHeight+'px';
		} else {
			var pageWidth='100%';
			var pageHeight='100%';
		}   
		//set the shader to cover the entire page and make it visible.
		dark.style.opacity=opaque;                      
		dark.style.MozOpacity=opaque;                   
		dark.style.filter='alpha(opacity='+opacity+')'; 
		dark.style.zIndex=zindex;        
		dark.style.backgroundColor=bgcolor;  
		dark.style.width= pageWidth;
		dark.style.height= pageHeight;
		dark.style.display='block';				 
	} else {
		dark.style.display='none';
		sSelectHide = '';
	}
	oSelects = document.getElementsByTagName('select');
	for(x=0;x<oSelects.length;x++) {
		//oSelects[x].style.display = sSelectHide;
	}
}

function showHideFAQ(sQuestionID) {
	var sDiv = document.getElementById('FAQ'+sQuestionID)
	if(sDiv) {
		if(sDiv.style.display=='') {
			sDiv.style.display='none';
		}else{
			sDiv.style.display='';
		}
	}
}

function changeCurrency(fId) {
	if(confirm('Are you sure you want to change the currency?')) {
		location.href='/includes/changecurrency.asp?code='+fId+'&url='+window.location;
	}
}

function object_attach(id){
	var obj;
	if(ns4) obj = document.layers[id];
	else if(ie4) obj = document.all[id];
	else if(ie5 || ns6) obj = document.getElementById(id);
	return obj;
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
		}else{
			window.onload = function() {
				if (oldonload) {
				oldonload();
			}
		func();
		}
	}
}

function getQuerystring() {
	var URL = document.URL
	if(URL.indexOf('?')) {
		var arURL = URL.split('?')
		return arURL[1];	
	}
}

function IsNumeric(sText) {
   var ValidChars = "0123456789. ";
   var IsNumber=true;
   var Char;

   for (i = 0; i < sText.length && IsNumber == true; i++) { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) {
         IsNumber = false;
      }
   }
   return IsNumber;
   
}

function validateNewsletter(fId) {
	var m = '';
	if(!fId.name.value || fId.name.value=='Enter your name') {m+='- Please enter your name\n'}
	if(!/.+@[^.]+(\.[^.]+)+/.test(fId.email.value) || isValidField(fId.email.value,2) == false || fId.email.value=='Enter your email'){m+='- Please enter a valid email address\n'}
	if(m){
		alert(m);
		return false;		
	}else{
		return true;		
	}
}

function validateEnquiry(fId) {
	var m = '';
	if(fId.title.value=='-'){m+='- Please select your title\n'}
	if(!fId.firstname.value || fId.firstname.value == '- First name -'){m+='- Please enter your first name\n'}
	if(!fId.surname.value || fId.surname.value == '- Surname -'){m+='- Please enter your surname\n'}
	if(fId.telephone.getAttribute('validateFId')=='true' || fId.telephone.getAttribute('validateFId')=='True') {
		if(!fId.telephone.value || isValidField(fId.telephone.value,6)==false){m+='- Please enter a valid telephone number\n'}
	}
	if(fId.telephone.value){
		if(!IsNumeric(fId.telephone.value)){
			m+='- Please enter a valid telephone number\n';
		}
	}
	if(!/.+@[^.]+(\.[^.]+)+/.test(fId.email.value) || isValidField(fId.email.value,2) == false){m+='- Please enter a valid email address\n'}
	if(!fId.enquiry.value){m+='- Please enter your enquiry\n'}
	if(m){
		alert(m);
		return false;		
	}else{
		return true;		
	}
}

function LoadGoogleMap(sDiv, iLat, iLng, bOverrideSize, iCustomZoomLevel, bHidePoint) {
	var iZoomLevel = 13;
	if(iCustomZoomLevel){
		iZoomLevel = iCustomZoomLevel;
	}
	if(document.getElementById(sDiv)) {
		sDiv = document.getElementById(sDiv)
		if(!bOverrideSize) {
			sDiv.style.width = '500px';
			sDiv.style.height = '220px';
		}
		if (GBrowserIsCompatible()) {
			var mygmap = new GMap2(sDiv);
			//map.addControl(new YSliderControl());
			mygmap.addControl(new GSmallMapControl());
    		mygmap.addControl(new GMapTypeControl());
			mygmap.setCenter(new GLatLng(iLat, iLng), iZoomLevel);
			if(!bHidePoint) {
				var point = new GLatLng(iLat,iLng);
				mygmap.addOverlay(new GMarker(point));
			}
		}
	}
}

function SwitchPhoto(PlaceHolderName,ThumbImg){
	var ImagePath = ThumbImg;
	if (document.all){
		document.getElementById(PlaceHolderName).style.filter="blendTrans(duration=1)";
		document.getElementById(PlaceHolderName).filters.blendTrans.Apply();
	}
	if(document.getElementById) {
		document.getElementById(PlaceHolderName).src = ImagePath;
	}else{
		document.HotelImage.src = ImagePath;
	}
	if(document.all){
		document.getElementById(PlaceHolderName).filters.blendTrans.Play();
	}
}

// Checks if field contains valid characters
// 1 - Numeric Integer, 2 - Email, 3 - Numeric Decimals
function isValidField(sText, iType){
	if(iType==1)
	{ ValidChars = "0123456789"; }
	else if(iType==2)
	{ ValidChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._-@"; }
	else if(iType==3)
	{ ValidChars = "0123456789."; }
	else if(iType==4)
	{ ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "; }
	else if(iType==5)
	{ ValidChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-/ "; }
	else if(iType==6)
	{ ValidChars = "+0123456789-()[] "; }
	var isValid=true;
	var Char;
	for (iii = 0; iii < sText.length && isValid == true; iii++) 
	{ 
		Char = sText.charAt(iii); 
		if (ValidChars.indexOf(Char) == -1) 
		{ isValid = false; }
	}
	return isValid;
}
function echeck(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){
		return (true)
	}
	return (false)
}
function writeInDiv(sText, sID) {
	if(document.getElementById(sID)) {
		document.getElementById(sID).innerHTML = sText;
	}
}

function checkPackageForm(sForm) {
	sCurForm = sForm;
	sCurSearchType = 'Package';
	sSubmitForm = document.getElementsByName('frm'+sForm);
	sLocationID = document.getElementById('packageLocationTo'+sForm);
	var e = sSubmitForm.elements, m = '';
	if(countPassengers()>9) {
		alert('You can only search for a maximum of 9 passengers when your search includes a flight');
		return false;
	}
	if(sLocationID.value==''){m += '- Please select a destination.\n';}
	if(validateDate('startdate_d'+sForm,'startdate_m'+sForm,'startdate_y'+sForm)<=2) {m += '- Departure date is not valid.\n';}
	bBoard = false;
	for(x=0;x<document.forms['frm'+sForm].board.length;x++) {
		if(document.forms['frm'+sForm].board[x].checked==true) {
			bBoard = true;	
		}
	}
	if(!bBoard){m += '- Please select at least one board option.\n';}
	
	if(document.getElementById('rooms'+sForm)) {
		if(document.getElementById('rooms'+sForm).value=='0') {
			m+='- Please select no. of rooms\n';
		}
	}
	if(m) {
		OpenSearch();
		alert('The following errors occurred:\n\n' + m);
		return false;
	}else{
		sSubmitForm[0].submit();
	}	
}

//topsearch
function showhidechangeoptions(type) {
	if(type == "show") {
		div_switch("slimSearchTop", true, true);
		div_switch("slimSearchBottom", true, true);
		div_switch("DivShow", false, true);
		div_switch("DivHide", true, true);
	}
	if(type == "hide") {
		div_switch("slimSearchTop", false, true);
		div_switch("slimSearchBottom", false, true);
		div_switch("DivShow", true, true);
		div_switch("DivHide", false, true);
	}
}
var SelectedSearchTab = 'search_tab1';
function SwitchTabs(sid, ison) {
	if(SelectedSearchTab!=sid && SelectedHeaderTab!=sid) {
		sExtra = '';
		if(ison==1){
			if(document.getElementById(sid).className.indexOf('Over')<0){
				document.getElementById(sid).className = document.getElementById(sid).className + 'Over'
			}else{
				SelectedSearchTab = sid
			}
		}else{
			if(document.getElementById(sid).className.indexOf('Over') > -1) {
				document.getElementById(sid).className = Left(document.getElementById(sid).className,document.getElementById(sid).className.length-4);
			}
		}
	}
}
function SwitchSearch(id) {
	/* HIDE PREDICTIVE TEXT OPTIONS IF SHOWING */
	if(document.getElementById('as_idFreetextHotel')) {
		document.getElementById('as_idFreetextHotel').style.display = 'none';
	}
	if(document.getElementById('as_idFreetextFlight')) {
		document.getElementById('as_idFreetextFlight').style.display = 'none';
	}
	if(document.getElementById('as_idFreetextFlightHotel')) {
		document.getElementById('as_idFreetextFlightHotel').style.display = 'none';
	}
	for(x=1;x<8;x++) {
		idSearchTab = document.getElementById('search_tab'+x);
		if(idSearchTab) {
			idSearchTab.className = 'searchtab';
		}
		if(document.getElementById('search'+x)) {
			document.getElementById('search'+x).style.display = 'none';
		}
	}
	SelectedSearchTab = id;
	sSelectedSearchTab = document.getElementById(id)
	if(sSelectedSearchTab) {
		sRadarBars = sSelectedSearchTab.getElementsByTagName('input');
		if(sRadarBars.length>0) {
			for(xx=0;xx<sRadarBars.length;xx++) {
				if(sRadarBars[xx].type.toLowerCase()=='radio') {
					sRadarBars[xx].checked = true;
				}
			}
		}
		sSelectedSearchTab.className = 'searchtabOver';
	}
	if(document.getElementById('search'+Right(id,1))) {
		document.getElementById('search'+Right(id,1)).style.display = '';
	}
}


function SwitchLanding(id) {
	for(x=1;x<8;x++) {
		if(document.getElementById('landing_tab'+x)) {
			document.getElementById('landing_tab'+x).className = 'searchtab';
		}
		if(document.getElementById('divLanding'+x)) {
			document.getElementById('divLanding'+x).style.display = 'none';
		}
	}
	SelectedSearchTab = id;
	if(document.getElementById(id)) {
		document.getElementById(id).className = 'searchtabOver';
	}
	if(document.getElementById('divLanding'+Right(id,1))) {
		document.getElementById('divLanding'+Right(id,1)).style.display = '';
	}
	if(Right(id,1)=='4'){
		if(document.getElementById('divLandingSearch')) {
			document.getElementById('divLandingSearch').style.display = '';
		}	
	}else{
		if(document.getElementById('divLandingSearch')) {
			document.getElementById('divLandingSearch').style.display = 'none';
		}
	}
	if(Right(id,1)=='3'){
		if(document.getElementById('divLandingOffers')) {
			document.getElementById('divLandingOffers').style.display = '';
		}	
	}else{
		if(document.getElementById('divLandingOffers')) {
			document.getElementById('divLandingOffers').style.display = 'none';
		}
	}
}

function Left(strtemp, ntemp){
	if (ntemp <= 0)
	    return "";
	else if (ntemp > String(strtemp).length)
	    return strtemp;
	else
	    return String(strtemp).substring(0,ntemp);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

// Clears a text field only if the value matches what is passed in
function clearField(fId, sMatch, sChange){
	if(sChange == null) sChange = '';
	if(fId.value == sMatch)
	{ fId.value = sChange; }
}
// Shows/hides div objects
function div_switch(id, bShow, bBlock) {
	if(document.getElementById(id)){
		if(bShow==true) {
			document.getElementById(id).style.display = '';
		}else{
			document.getElementById(id).style.display = 'none';
		}
	}
}

function checkFormFieldSelectedIndex(sFieldName, sErrTxt) {
	oTitleElements = document.getElementsByTagName("select")
	for (i = 0; i < oTitleElements.length; i++)
	{
		if(oTitleElements.item(i).id.indexOf(sFieldName) == 0)
		{
			if(oTitleElements.item(i).selectedIndex == 0)
			{ alert(sErrTxt); oTitleElements.item(i).focus(); return false; break; }
		}
	}
	return true;
}

function checkFormFieldValue(sFieldName, sDefaultVal, sErrTxt, iMinLen){
	if(iMinLen==undefined || iMinLen==null) { iMinLen = 1; }
	oFormElements = document.getElementsByTagName("input")
	for (i = 0; i < oFormElements.length; i++){
		if(oFormElements.item(i).id.indexOf(sFieldName) == 0){
			if(oFormElements.item(i).value == '' || oFormElements.item(i).value == sDefaultVal || oFormElements.item(i).value.length < iMinLen || (sFieldName == 'surname' && oFormElements.item(i).value.indexOf(' ') > -1) || ((sFieldName == 'surname' || sFieldName == 'firstname') && (isValidField(oFormElements.item(i).value,5)==false || Left(oFormElements.item(i).value,1)=='-' || Left(oFormElements.item(i).value,1)=='/' || oFormElements.item(i).value.length < 2 || oFormElements.item(i).value==sDefaultVal))){
				alert(sErrTxt);
				oFormElements.item(i).focus();
				return false;
				break;
			}
		}
	}
	oFormElements = document.getElementsByTagName("textarea")
	for (i = 0; i < oFormElements.length; i++){
		if(oFormElements.item(i).id.indexOf(sFieldName) == 0){
			if(oFormElements.item(i).value == '' || oFormElements.item(i).value == sDefaultVal){
				alert(sErrTxt);
				oFormElements.item(i).focus()
				return false;
				break;
			}
		}
	}
	return true;
}

function formatCurrency(num, bHidePound){
	if(typeof num != "undefined") {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		if(bHidePound==true) {
			return (((sign)?'':'-') + num + '.' + cents);
		}else{
			return (((sign)?'':'-') + '&pound;' + num + '.' + cents);
		}
	}
}

// START ALT POP JS
	// onmouseover="ShowInfoPop('This is a test','And it works!!')" onmouseout="HideInfoPop()"
	Xoffset=20;
	Yoffset=20;
	var yyy=-1000;
	var newDiv, newFrame;
	function ShowInfoPop(title,msg,newYoffset,newXoffset){
		if(newYoffset) {
			Yoffset = newYoffset;
		}
		if(newXoffset) {
			Xoffset = newXoffset;
		}
		if(window.Event && document.captureEvents)
		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove=get_mouse;
		sHTML='';
		sHTML+='<div class="infotitle">'+title+'</div>'
		sHTML+='<div class="infotext">'+msg+'</div>'
		yyy=Yoffset;
		document.getElementById('CTInfoBox').innerHTML = sHTML;
		document.getElementById('CTInfoBox').style.display='block';
		if(document.getElementById('CTInfoBoxFrame')) {
			document.getElementById('CTInfoBoxFrame').style.display='block';
			document.getElementById('CTInfoBoxFrame').style.width=document.getElementById('CTInfoBox').offsetWidth+'px';
			document.getElementById('CTInfoBoxFrame').style.height=document.getElementById('CTInfoBox').offsetHeight+'px';
		}
		
	}
	function HideInfoPop(){
		yyy=-1000;
		if(document.getElementById('CTInfoBoxFrame')) {
			document.getElementById('CTInfoBoxFrame').style.display='none';
		}
		document.getElementById('CTInfoBox').style.display='none';
	}
	function get_mouse(e){
		if (!e) {
			var e = window.event||window.Event;
		}
		if('undefined'!=typeof e.pageX){
			mouseX = e.pageX;
			mouseY = e.pageY;
		}else{
			mouseX = e.clientX + document.documentElement.scrollLeft;
			mouseY = e.clientY + document.documentElement.scrollTop;
		}
		
		iMouseX = mouseX+Xoffset;
		//alert(document.documentElement.scrollTop);
		if(document.getElementById('CTInfoBoxFrame')) {
			document.getElementById('CTInfoBoxFrame').style.left=mouseX+Xoffset+'px';
			document.getElementById('CTInfoBoxFrame').style.top=mouseY+yyy+'px';
		}
		if(document.getElementById('CTInfoBox')) {
			document.getElementById('CTInfoBox').style.left=mouseX+Xoffset+'px';
			document.getElementById('CTInfoBox').style.top=mouseY+yyy+'px';
		}
	}
// END ALT POP JS

// START AJAX DIV UPDATER
	function updateDivAJAX(sDiv, sURL, sLoadingContent){
		if(document.getElementById(sDiv) && sLoadingContent) {
			document.getElementById(sDiv).innerHTML = sLoadingContent;				   
		}
		var divLoader = new ajaxObject(sDiv, sURL);
		divLoader.update(sDiv);
	}
	function ajaxObject(layer, url) {                                   
		var that=this;                                                  
		var updating = false;       
		this.callback = function() {}
		this.update = function(passData) {
			if (updating==true) { return false; }   
			updating=true;
			var AJAX = null;    
			if (window.XMLHttpRequest) {       
				AJAX=new XMLHttpRequest();     
			} else {       
				AJAX=new ActiveXObject("Microsoft.XMLHTTP");   
			}   
			if (AJAX==null) {        
				alert("Your browser doesn't support AJAX.");                                                   
				return false 
			} else {        
				AJAX.onreadystatechange = function() { 
				if(LayerID){
					if (AJAX.readyState==4 || AJAX.readyState=="complete") {
						var sText = AJAX.responseText
						if(sText.indexOf("|") > -1){
							sText = sText.split("|")[1]
						}
						LayerID.innerHTML=sText;            
						delete AJAX;
						updating=false;
						that.callback();        
					} 
				}
			}     
			var timestamp = new Date();      
			var uri=urlCall+'?'+passData+'&timestamp='+(timestamp*1);  
			
			AJAX.open("GET", uri, true);        
			AJAX.send(null);   
			return true;   
			}                   
		}
		var LayerID = document.getElementById(layer);  
		var urlCall = url;
	}
// END AJAX DIV UPDATED

/* START DATE VALIDATION */
	var dtCh= "/";
	var minYear=1900;
	var maxYear=2100;
	function isInteger(s){
		var i;
		for (i = 0; i < s.length; i++){   
			// Check that current character is number.
			var c = s.charAt(i);
			if (((c < "0") || (c > "9"))) return false;
		}
		// All characters are numbers.
		return true;
	}
	
	function stripCharsInBag(s, bag){
		var i;
		var returnString = "";
		// Search through string's characters one by one.
		// If character is not in bag, append to returnString.
		for (i = 0; i < s.length; i++){   
			var c = s.charAt(i);
			if (bag.indexOf(c) == -1) returnString += c;
		}
		return returnString;
	}
	function daysInFebruary (year){
		// February has 29 days in any year evenly divisible by four,
		// EXCEPT for centurial years which are not also divisible by 400.
		return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	}
	function DaysArray(n) {
		for (var i = 1; i <= n; i++) {
			this[i] = 31
			if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
			if (i==2) {this[i] = 29}
	   } 
	   return this
	}
	
	function CTisDate(dtStr){
		var daysInMonth = DaysArray(12)
		var pos1=dtStr.indexOf(dtCh)
		var pos2=dtStr.indexOf(dtCh,pos1+1)
		var strDay=dtStr.substring(0,pos1)
		var strMonth=dtStr.substring(pos1+1,pos2)
		var strYear=dtStr.substring(pos2+1)
		strYr=strYear
		if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
		if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
		for (var i = 1; i <= 3; i++) {
			if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
		}
		month=parseInt(strMonth)
		day=parseInt(strDay)
		year=parseInt(strYr)
		if (pos1==-1 || pos2==-1){
			//alert("The date format should be : mm/dd/yyyy")
			return false
		}
		if (strMonth.length<1 || month<1 || month>12){
			//alert("Please enter a valid month")
			return false
		}
		if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
			//alert("Please enter a valid day")
			return false
		}
		if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
			//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
			return false
		}
		if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
			//alert("Please enter a valid date")
			return false
		}
		return true
	}
/* END DATE VALIDATION */



var MouseYPosition = 0;
var MouseXPosition = 0;
function GetMousePosition() {
	if(window.Event && document.captureEvents)
	document.captureEvents(Event.CLICK);
	document.onclick=GetMousePositionScript;
}
function GetMousePositionScript(e){
	if(!e) {
		var e = window.event||window.Event;
	}
	if('undefined'!=typeof e.pageX){
		MouseXPosition = e.pageX;
		MouseYPosition = e.pageY;
	}else{
		MouseXPosition = e.clientX + document.documentElement.scrollLeft;
		MouseYPosition = e.clientY + document.documentElement.scrollTop ;
		//alert('mouseY: '+e.clientY+'\nscrollTop: '+document.documentElement.scrollTop);
		//alert(document.documentElement.scrollHeight)
	}
}
GetMousePosition();


function updateLocationTo(sValue) {
	document.getElementById('PackageLocation').value = sValue;
}

function setCookie(c_name,value,expiredays){
	if(value != null && value != ''){
		var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" + value +
		((expiredays==null) ? "" : "; expires="+exdate.toGMTString()) +
		((value.indexOf('path=')==-1) ? "; path=/" : "");
	}
}
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).replace(new RegExp("^[&]+", "g"), "").replace(new RegExp("[&]+$", "g"), ""));
		} 
	}
	return "";
}
function PersistCookies(name,affiliatedays){
	setCookie(name + 'Affiliate',getCookie(name + 'Affiliate'),affiliatedays);
	setCookie(name,getCookie(name),1);
}

-->