﻿$(function(){            
    $('#search').bind('submit',function(){
        if($('#q_header').val()=='' || $('#q_header').val()=='地址,酒店名称,地标,商圈,景点'){
            alert('请输入关键字！');
            return false ;
        }                    
        var url='http://www.souout.com/hotel/search/';
        url=url+$('#q_header').val() + "?key=" + $('#q_header').val() ;
        location.href=url;
        return false ;
    });  
    
    $('#q_header').bind('focus',function(){
        $(this).css({ color:"#494949", fontWeight:"bolder" });     
        if($(this).val()=='地址,酒店名称,地标,商圈,景点') 
            $(this).val('');       
    });
});

function pagerHtml(){
    if(actionName==null) return ;
        
    var html='共计['+ recordCount +']家酒店 ';
    if(pageCount>1){
        if(pageIndex>1){
            html=html+'<a href="/Hotel/'+actionName +'/'+ id  +'">首 页</a> '; 
            html=html+' <a href="/Hotel/'+actionName +'/'+ id  +'?pi='+ (pageIndex-1)  +'">上一页</a> ';           
        }
        for(var i=start;i<=end;i++){
            if(i!=pageIndex){
               html=html+' <a href="/Hotel/'+actionName +'/'+ id  +'?pi='+ i +'">'+i+'</a>  '; 
            }else{
                html=html+ i;
            }
        }
        if(pageIndex<pageCount){
            html=html+' <a href="/Hotel/'+actionName +'/'+ id  +'?pi='+ (pageIndex+1)  +'">下一页</a> ';
            html=html+'<a href="/Hotel/'+actionName +'/'+ id  +'?pi='+ pageCount +'">末 页</a> ';
        }
    }
    
    $(".pager").html(html);
}