$(function(){
	var s_today = new   Date();
	var today = s_today.getFullYear()+'-'+((s_today.getMonth()+1)>9?(s_today.getMonth()+1):('0'+(s_today.getMonth()+1)))+'-'+(s_today.getDate()>9?s_today.getDate():('0'+s_today.getDate()));
	s_today.setUTCDate((s_today.getUTCDate()+1));
	var tomorrow = s_today.getFullYear()+'-'+((s_today.getMonth()+1)>9?(s_today.getMonth()+1):('0'+(s_today.getMonth()+1)))+'-'+(s_today.getDate()>9?s_today.getDate():('0'+s_today.getDate())); 
	s_today.setUTCDate((s_today.getUTCDate()+6));
	var seven = s_today.getFullYear()+'-'+((s_today.getMonth()+1)>9?(s_today.getMonth()+1):('0'+(s_today.getMonth()+1)))+'-'+(s_today.getDate()>9?s_today.getDate():('0'+s_today.getDate()));
	if($('#sdate').val()=='')
		$('#sdate').val(today);
	if($('#edate').val()=='')	
		$('#edate').val(seven);
	$('#sdate').doubleDatePicker({minDate:today});  
	$('#edate').doubleDatePicker({minDate:tomorrow,firstCal:'sdate'});
	//事件绑定
	$('#id_sdate').bind('click',function(){$('#sdate').focus();});
	$('#id_edate').bind('click',function(){$('#edate').focus();});
	$('#sub').bind('click',function(){document.f1.submit();});
	//执行初始化操作
	getAllRoom();
});

function piaoShow(e,stat,breakfast,offline,deposit,full){
	$('#piao').css({'display':'block'});
	$('#piao_roomstat').html($.trim(stat));
	$('#piao_roombreakfast').html($.trim(breakfast));
	if(offline=='1')
		$('#piao_payqt').addClass('gray2 f_scx');
	else
		$('#piao_payqt').removeClass('gray2 f_scx');
	if(deposit=='1')	
		$('#piao_paydj').addClass('gray2 f_scx');
	else	
		$('#piao_paydj').removeClass('gray2 f_scx');
	if(full=='1')	
		$('#piao_payqe').addClass('gray2 f_scx');
	else
		$('#piao_payqe').removeClass('gray2 f_scx');
	var a=e.srcElement || e.target;
	var off=$(a).offset();
	var h=a.offsetHeight;
	$('#piao').css({top:off.top+27+'px',left:off.left-46+'px',position:'absolute'});
}
function piaoHide(){
	$('#piao').css({'display':'none'});
}
function getAllRoom(){
	$("#allroom").load("/www2009/ajax/shop_hotel_list_ajax.jsp", {cust_id: $('#cust_id').val(),sdate:$('#sdate').val(),edate:$('#edate').val(),online:online});
}
//添加到收藏
function addFavorite(info_id,title,url,price,info_type,cust_id){
	if(info_id=='')
		info_id=new Date().getTime();
	 $.ajax({
			   type: 'POST',
			   url: 'http://www.51766.com/www2009/userbox/box_ajax.jsp',
			   data: 'action=addFavorite&cust_id='+cust_id+'&info_id='+info_id +'&title='+escape(title)+'&price='+price+'&info_type='+info_type+'&url='+url,
			   beforeSend:function(){
			   		document.body.disabled=true;
			   },
			   success: function(msg){
			   		document.body.disabled=false;
			     	alert(msg);
			     	getFavorite();
			   },
			   error:function(msg){
			   		document.body.disabled=false;
			   		alert('添加“关注”失败！请稍后重试。');
			   }
		});
}