﻿//function to highlight item in quick guide

function highlight(item){
    var obj = document.getElementById('guideList').getElementsByTagName('li');
    obj[item].className = "listActive";
}

//function to highlight item in find hotels by area left list

function highlightArea(){
    var str = window.location.href;
    var start = str.lastIndexOf('/')+1;
    var end = str.indexOf('.');
    str = str.substring(start,end);
    str = str.replace('-',' ');
    
    var obj = document.getElementById('areaList').getElementsByTagName('a');
    
    for(i=0;i<obj.length;i++)
    {
        if(obj[i].innerHTML == str)
        {
            obj[i].className = "listActive";
        }
    }

}

function noSpam(user, domain)
{locationstring = "mailto:" + user + "@" + domain;window.location = locationstring;}

//functions for jquery autosuggest

function findValue(li) {
	if( li == null ) return alert("No match!");

	// if coming from an AJAX call, let's use the CityId as the value
	if( !!li.extra ) var sValue = li.extra[0];

	// otherwise, let's just display the value in the text box
	else var sValue = li.selectValue;

	//alert("The value you selected was: " + sValue);
	
    //$("#searchName").attr("onclick", "window.location='/searchName.aspx?s="+sValue+"'");
    $("#searchName" ).click( function () { window.location='/searchName.aspx?s='+sValue }); 
    $("#searchName").attr("disabled", "");
	$("#searchName").focus();
    
    //window.location = sValue;

}

function selectItem(li) {
	findValue(li);
}

function formatItem(row) {
	return row[0] + " (id: " + row[1] + ")";
}