// Called on a search.
function SetupSearch()
{
     if ($get("isPageLinkSearch").value == 'true')
    {
        $get("isPageLinkSearch").value = 'false';
        $get("pageNumber").value = "1";
    }
}

// Show the what's this depending on the value given
function showWhatsThisPopupPanel(parent, width)
{
    var elem = document.getElementById("ctl00_phContent_Clipboard1_WhatsThisPanel");
    
    var x = parent.offsetLeft;
    var y = parent.offsetTop;
    
    while (parent.offsetParent)
    {
        parent = parent.offsetParent;
        x += parent.offsetLeft;
        y += parent.offsetTop;
    }
    elem.style.top = y + "px";
    elem.style.left = (x - width) + "px";
    
    elem.style.visibility = "visible";
    elem.style.display = "block";
    
    return false;
}

function hideWhatsThisPopupPanel()
{
    var elem = document.getElementById("ctl00_phContent_Clipboard1_WhatsThisPanel");
    
    elem.style.visibility = "hidden";
    elem.style.display = "none";
    
    return false;
}

function ValidateSearchDates(val, args)
{
    if (checkoutTextBox.value && checkoutTextBox.value != 'Check-out Date' && 
        checkinTextBox.value && checkinTextBox.value != 'Check-in Date')
    {
        var checkinDate = getDateFromShortDateString(checkinTextBox.value);
        var checkoutDate = getDateFromShortDateString(checkoutTextBox.value);
        var today = new Date();
        today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
        if (checkoutDate <= checkinDate)
        {
            datesCustomValidator.innerHTML = "*Check-out must be greater than Check-in.<br/>";
            args.IsValid = false;
        }
        else if (checkinDate < today)
        {
            datesCustomValidator.innerHTML = "*Check-in cannot be in the past.<br/>";
            args.IsValid = false;
        }
    }
    else if ((checkoutTextBox.value && checkoutTextBox.value != 'Check-out Date' && (!checkinTextBox.value || checkinTextBox.value == 'Check-in Date')) ||
        (checkinTextBox.value && checkinTextBox.value != 'Check-in Date' && (!checkoutTextBox.value || checkoutTextBox.value == 'Check-out Date')))
    {
        datesCustomValidator.innerHTML = "*Either provide both or no dates.<br/>";
        args.IsValid = false;
    }
}

function getDateFromShortDateString(shortDate)
{
    var dateParts = shortDate.split('/');
    var month = dateParts[0] - 1;
    var day = dateParts[1];
    var year = dateParts[2];
    return new Date(year, month, day);
}
if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.attachEvent("onload", fnLoadPngs1);
}

// Hack for flashing page problem on home page.
function fnLoadPngs1() {
    window.setTimeout(fnLoadPngs, 10);
}

function fnLoadPngs() {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
	for (var i = document.all.length - 1, obj = null; (obj = document.all[i]); i--) {
		if (itsAllGood && obj.currentStyle.backgroundImage.match(/\.png/i) != null) {
		    if(!obj.getAttribute('Command') || 
		        (obj.getAttribute('Command') != 'Bold' &&
		        obj.getAttribute('Command') != 'Italic' &&
		        obj.getAttribute('Command') != 'Underline' &&
		        obj.getAttribute('Command') != 'InsertOrderedList' &&
		        obj.getAttribute('Command') != 'InsertUnorderedList' &&
		        obj.getAttribute('Command') != 'netspell' &&
		        obj.getAttribute('Command') != 'Ucase' &&
		        obj.getAttribute('Command') != 'Lcase' &&
		        obj.getAttribute('Command') != 'Cut' &&
		        obj.getAttribute('Command') != 'Copy' &&
		        obj.getAttribute('Command') != 'Paste' &&
		        obj.getAttribute('Command') != 'PasteText' &&
		        obj.getAttribute('Command') != 'PasteWord' &&
		        obj.getAttribute('Command') != 'Unlink' &&
		        obj.getAttribute('Command') != 'CleanCode')) {
			    this.fnFixPng(obj);
			    obj.attachEvent("onpropertychange", this.fnPropertyChanged);
			}
		}
	}
}
	
function fnPropertyChanged() {
	if (window.event.propertyName == "style.backgroundImage") {
		var el = window.event.srcElement;
		if (!el.currentStyle.backgroundImage.match(/x\.gif/i)) {
			var bg	= el.currentStyle.backgroundImage;
			var src = bg.substring(5,bg.length-2);
			el.filters.item(0).src = src;
			el.style.backgroundImage = "url(/images/blank.gif)";
		}
	}
}
	
function fnFixPng(obj) {
	var bg	= obj.currentStyle.backgroundImage;
	var src = bg.substring(5,bg.length-2);
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='crop')";
	obj.style.backgroundImage = "url(/images/blank.gif)";
}
function SendFindingMethod(thename)
{
   s.prop31 = thename;
}

function SendMapToPP()
{
    s.prop32 = 'map';
}

function SendSort(sortType)
{
    s.prop32 = sortType;
    s.t();
}

function SendPPCount(theName)
{
    s.prop33 = theName;
}
var addthis_url;
var addthis_title;
var addthis_pub;

function setAddThis(){
  addthis_url = location.href; 
  if(document.title.match("::"))
  {  
    addthis_title = document.title.replace(/::/g," ");
  }
  else
  {
    addthis_title = document.title;
  }
  addthis_pub    = 'VacationRentalsZonder';     
}

