var isIE = document.all?true:false;
var isNS = document.layers?true:false;
function searchByKeyword() 
{
    var checkboxReview = document.getElementById('chkSearchInReview').checked;
    if(checkboxReview)
    {
        document.location.href="Hotels-"+document.getElementById('freesearch').value+ "_inreview" + "_k.aspx";
    }
    else
    {
        document.location.href="Hotels-"+document.getElementById('freesearch').value+"_k.aspx"; 
    }
         
	return false;
}

function entsub(e) 
{
    var _ret2 = true;
    var redirect = false;
    if (window.event) {
        //alert( window.event.keyCode );
        if (window.event.keyCode != 13) {
            //window.event.keyCode = 0;
            _ret2 = true;
        }
        else {
            redirect = true;
            _ret2 = true;
        }
    }
    if (e.which!=null) {
        if (e.which != 13) {
            //e.which = 0;
            _ret2 = true;
        }
        else {
            redirect = true;
            _ret2 = true;
        }
    }

    //alert("ret: " + _ret2);
    //alert("redirect: " + redirect);

    if( _ret2 && redirect ) 
    {
		var checkboxReview = document.getElementById('chkSearchInReview').checked;
		if(checkboxReview)
		{
			document.location.href="Hotels-"+document.getElementById('freesearch').value+ "_inreview" + "_k.aspx";
		}
		else
		{
			document.location.href="Hotels-"+document.getElementById('freesearch').value+"_k.aspx"; 
		}
        _ret2 = false;
    }

    
    return (_ret2); 
}

function onlyDigits(e) {
    //alert("sdfsdf");
    var _ret = true;
    if (isIE) {
        if (window.event.keyCode < 46 || window.event.keyCode > 57) {
            window.event.keyCode = 0;
            //alert(1);
            _ret = false;
        }
    }
    if (isNS) {
        if (e.which < 46 || e.which > 57) {
            e.which = 0;
            //alert(2);
            _ret = false;
        }
    }
    return (_ret); 
}

function showHelp() 
{
    window.open('help.htm', 'help', 'width=200,height=60,toolbar=0,resizable=1,scrollbars=1,screenX=200,screenY=200,left=200,top=200');
    return false;
}

function showPrivacy() 
{
    window.open('privacy.htm', 'privacy', 'width=432,height=270,toolbar=0,resizable=1,scrollbars=1,screenX=200,screenY=200,left=200,top=200');
    return false;
}

function hideText( obj )
{
    if( obj.value=='From...' || obj.value=='To...' )
    {
        obj.value = '';
    }
}



function slideSwitch() {
    var $active = $('#loadArea IMG.active');
    if($active ==  null) return;
    
    if ( $active.length == 0 ) $active = $('#loadArea IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#loadArea IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

try{
$(function() {
    setInterval( "slideSwitch()", 5000 );
});
}
catch(ex)
{}



function slideSwitch2() {
    var $active = $('#slideshow IMG.active');
    if($active ==  null) return;
    
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

try
{
$(function() {
    setInterval( "slideSwitch2()", 5000 );
});
}
catch(ex)
{}