﻿function openURL(sPage) {
    var winWidth = 950;
    var winHeight = 520;
    var winProps = "resizable=yes, toolbar=no, scrollbars=yes, menubar=no, location=no, status=yes, top=0, left=100, width=" + winWidth + ", height=" + winHeight;
    window.open(sPage, "_blank", winProps, true);
}
function clearDefault() {
    var searchField = document.getElementById('sKeywords');
    switch (searchField.value) {
        case "Add your search term here":
            searchField.value = "";
            return;
    }
}
function checkSearch() {
    var searchField = document.getElementById('sKeywords');
    switch (searchField.value) {
        case "":
        case "Add your search term here":
        case "Enter Keywords":
            window.alert("Please enter a search term.");
            searchField.focus();
            return false;
    }
}
function searchFieldSetFocus() {
    var searchField = document.getElementById('sKeywords');
    if (searchField != null) {
        searchField.focus();
    }
}
function progress() {
    intWidth = parseInt(document.getElementById("container").style.width) + 1;
    if (intWidth <= 300) {
        document.getElementById("container").style.width = intWidth;
    } else {
        document.getElementById("container").style.width = 0;
    }
    setTimeout("progress()", 40);
}
function checkDate() {
    if (document.frmSearch.CheckInMonth.options.selectedIndex > document.frmSearch.CheckOutMonth.options.selectedIndex) {
        document.frmSearch.CheckOutMonth.options.selectedIndex = document.frmSearch.CheckInMonth.options.selectedIndex;
    } else if (document.frmSearch.CheckInMonth.options.selectedIndex == document.frmSearch.CheckOutMonth.options.selectedIndex) {
        if (document.frmSearch.CheckInDay.options.selectedIndex > document.frmSearch.CheckOutDay.options.selectedIndex) {
            document.frmSearch.CheckOutDay.options.selectedIndex = document.frmSearch.CheckInDay.options.selectedIndex;
        }
    }
}
function textCounter(field, cntfield, maxlimit) {
    if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);
    else
        cntfield.value = maxlimit - field.value.length;
}
function ChangePhoto(whichpic, w, h) 
{
    if (document.getElementById) 
    {
        document.getElementById('photo').src = "/images/spacer.gif";
        //document.getElementById('photo').width = w;
        //document.getElementById('photo').height = h;
        document.getElementById('photo').lowsrc = "/images/spacer.gif";
        document.getElementById('photo').src = whichpic.href;
        document.getElementById('photo').style.width = w + 'px';
        document.getElementById('photo').style.height = h + 'px';
        if (whichpic.title) {
            document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
        } else {
            document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
        }
        return false;
    } 
    else 
    {
        return true;
    }
}
