﻿function GetHotelProduct()
                {
                 $.ajax({
                        type: "get",
                        dataType: "json",
                        url: "/jquery/ashx/default.ashx",
                        data: "RequestType=1&pageIndex=1&PageCount=8&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 GetGolfProduct()
//                {
//                 $.ajax({
//                        type: "get",
//                        dataType: "json",
//                        url: "/jquery/ashx/default.ashx",
//                        data: "RequestType=2&pageIndex=1&PageCount=5&OrderByStr=UpdateDate desc",
//                        success: function(data){
//                             var datastr = data.Table;
//                              $.each(datastr, function(i, n){
//                                    var row = $("#temptr1").clone();
//                                    row.find("#list1").html("·<a href=/Resource/golf/Details.aspx?Id="+n.Id +" title="+n.ProName+" target=_blank>"+CutString(n.ProName,22)+"</a> <font color=999999 style=font-family: Arial; font-size: 8pt>"+formatdate(n.UpdateDate)+"</font>");   
//                                    row.attr("id","ready1");
//                                    row.appendTo("#datas1"); 
//                                });     
//                              $("#tbody2").insertBefore(datas1.innerHTML,temptr1); //主要使更多的 在所有行的最后，否则会显示在第一行
//                              $("[@id=temptr1]").hide();
//                              $("[@id=ready1]").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();//酒店
               // GetGolfProduct();//高尔夫
            });