﻿function autoLoadImg() //显示图片
{
    $(".default").each(function(){
        $(this).attr("src",$(this).attr("lang"));
    });
}
function GetHotelProduct()
                {
                 $.ajax({
                        type: "get",
                        dataType: "json",
                        url: "/jquery/ashx/default.ashx",
                        data: "RequestType=1&pageIndex=1&PageCount=10&OrderByStr=UpdateDate desc",
                        success: function(data){
                             var datastr = data.Table;
                              $.each(datastr, function(i, n){
                                    var row = $("#temptr0").clone();
                                    row.find("#list0").html("·<a href=/HolidayPackage/Details.aspx?Id="+n.Id +"  title="+n.Title+" target=_blank>"+CutString(n.Title,22)+"</a>");   
                                    // row.find("#list0").html("·<a href=/HolidayPackage/Details.aspx?Id="+n.Id +"  title="+n.Title+" target=_blank>"+CutString(n.Title,22)+"</a> <font color=999999 style=font-family: Arial; font-size: 8pt>"+formatdate(n.UpdateDate)+"</font>");  
                                    row.attr("id","ready0");
                                    row.appendTo("#datas0"); 
                                });     
                              $("#tbody1").insertBefore(datas0.innerHTML,temptr0); //主要使更多的 在所有行的最后，否则会显示在第一行
                              $("[@id=temptr0]").hide();
                              $("[@id=ready0]").show();
                            }
                     }); 
                }
	function formatdate(inStr)
	{
	var d = eval('new Date(' + inStr.replace(/\d+(?=-[^-]+$)/, function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) + ')'); 
     return d.format('MM/dd');
	}
	Date.prototype.format = function(format)
    {
    var o = {
    "M+" : this.getMonth()+1, //month

    "d+" : this.getDate(), //day

    "h+" : this.getHours(), //hour

    "m+" : this.getMinutes(), //minute

    "s+" : this.getSeconds(), //second

    "q+" : Math.floor((this.getMonth()+3)/3), //quarter

    "S" : this.getMilliseconds() //millisecond

    }
    if(/(y+)/.test(format))
    format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
    for(var k in o)
    if(new RegExp("("+ k +")").test(format))
    format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k] :("00"+ o[k]).substr((""+ o[k]).length));
    return format;
    }
function CutString(inStr,inbit){
     if(inStr.length > inbit){return inStr.substring(0,inbit)+".."}else{return inStr}  
}
function submitForm() {  //回车提交
    if(window.event.keyCode==13) { 
     $("#form1").attr("action","/hotel/hotellist.aspx")
    }
} 
 function SearchHotel()
{ 
 $("#form1").attr("action","/hotel/hotellist.aspx")
 $("#form1").submit()

}
function SearchHostel()
{
     $("#form1").attr("action","/hotel/HouseList.aspx")
     $("#form1").submit()
}
$(document).ready(function(){
    GetHotelProduct();//酒店
    setTimeout(autoLoadImg,500);  
    var hasShow = false; 
    $(window).bind("scroll",function(){
        if(hasShow==true){
            $(window).unbind("scroll");
            return;
        }
        var t = $(document).scrollTop();
            if(t>200){
                $(".img100").each(function(){
                $(this).attr("src",$(this).attr("lang"));
            });
        }
    });
});
