function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

getParameter = function(key){
		var value = "";
		var url = "" + window.location;
		if(url.split("?").length == 1){
			return "";
		}
		url = url.split("?")[1];
		var array = url.split("&");
		for(var i = 0; i < array.length; i++){
			var temp = array[i];
			if(temp.split("=").length > 1 && temp.split("=")[0] == key){
				value = temp.split("=")[1];
				value = value.replace("/","");
			}
		}
		return value;
	}

clickButton = function(languageCode, target, affiliateId, hotelFileName, domain, brandId, customData){
	var affiliateParam;
    var host;
    var brandParam;
    
    if (document.getElementById('hotelCheckin2') != null)
    {
        if(document.getElementById('hotelCheckin2').value == 0 || document.getElementById('hotelCheckout2').value == 0 )
        {
		    alert(typeof(JavaScriptEnterCheckinCheckout) == 'undefined' ? 'Please enter your checkin and checkout date.' : JavaScriptEnterCheckinCheckout)
            return false
        }
        else
        {
			document.getElementById("checkinValue2").value = document.getElementById("hotelCheckin2").value;
			document.getElementById("checkoutValue2").value = document.getElementById("hotelCheckout2").value;
        }
    }
    
    if (typeof(brandId) == 'undefined' || brandId == "0" || brandId == "")
    {
		brandParam = '';
    }
    else
    {
		brandParam = '&brandId=' + brandId
}

    if (customData != "") {
        customData = "&label=" + customData;
    }
    
    if (affiliateId == null || affiliateId == '')
    {
        affiliateParam = '';
        host = '';
    }
    else
    {
        affiliateParam = '&a_aid=' + affiliateId;   
		// backwards compatability for existing affiliate scripts
    }
    
    if (typeof (domain) == 'undefined' || domain == '') {
        host = 'http://www.hotelscombined.com'
    }
    else {
        host = 'http://' + domain;
    }
    
    var guest = document.getElementById('guests2') == null? "":"&Adults=" + document.getElementById("guests2").value;
    var room  = document.getElementById('rooms2') == null? "" :"&Rooms=" + document.getElementById('rooms2').value;
	var redirection = host + "/SearchResults.aspx?tabId=Rates&fileName=" + document.getElementById("selectedFileName3").value 
				   + "&checkin=" + document.getElementById("checkinValue2").value + "&checkout=" 
				   + document.getElementById("checkoutValue2").value + "&languageCode=" 
				   + languageCode + affiliateParam + brandParam + guest + room + customData;
    switch (target)
    {
        case "_blank":
            window.open(redirection).focus();
            break;
        case "_parent":
            window.parent.location = redirection;
            break;
        case "_top":
            window.top.location = redirection;
            break;
        default:
            window.location = redirection; // _self
    }
    
    return false;
}

