﻿function validInt()
{
	e=window.event;
	var keyCode=e.keyCode;			
	if((!(keyCode>=48 && keyCode<=57)) && (!(keyCode==13)))
	{	
		e.keyCode=0
	}
}
function setCheckInDate(d)
{
    document.getElementById("txt_StartDate").value=d;
    showCalendar('dimg2',false,'txt_EndDate','txt_StartDate');

}	
function setCheckInDateRes(d)
{
    document.getElementById("txt_StartDate_Res").value=d;
    showCalendar('dimg2_res',false,'txt_EndDate_Res','txt_StartDate_Res');
}
function setCheckInDatePoint(d)
{
    document.getElementById("txt_StartDate_Point").value=d;
    showCalendar('dimg2_point',false,'txt_EndDate_Point','txt_StartDate_Point');
}    
function setCheckInDate1(d)
{
    document.getElementById("txt_StartDate1").value=d;
	showCalendar('dimg4',false,'txt_EndDate1','txt_StartDate1');
}
function setCheckInDate3(d,start,end,img)
{
    img=img.replace('_start','_end');
    document.getElementById(start).value=d;
    showCalendar_M(img,false,end,start);					        
}
function setCheckInDate4(d)
{
    document.getElementById("txt_StartDate3").value=d;
	showCalendar('Img2',false,'txt_EndDate3','txt_StartDate3');

}			
function setCheckInDate5(d)
{
    document.getElementById("txt_StartDate").value=d;					    
}
function setCheckInDate6(d)
{
    document.getElementById("txt3_StartDate").value=d;
	showCalendar('dimg8',false,'txt3_EndDate','txt3_StartDate');					    
}
function setCheckInDate7(d)
{
    document.getElementById("txt_StartDate2").value=d;
	showCalendar('dimg6',false,'txt_EndDate2','txt_StartDate2');					    
}
function setCheckInDate8(d)
{
    document.getElementById("rs_StartDate").value=d;					    
}
function Show(note)
{			   
     document.body.className="";     
     var Notes=note;
     document.getElementById('iPage').src='restaurantpromotionSentMsg.aspx?note='+Notes;
}
function Return()
{			    
	document.body.className="Normal";
}			  
function Photo_Click(id)
{
    var index=parseInt(document.getElementById('txt_PhotoIndex').value);
    var num=parseInt(document.getElementById('txt_PhotoNum').value);
    if(id==1)   //下一张

    {
       if(index==num)
       {
            index=1;
       }
       else
       {
            index=index+1;
       }
    }
    else    //上一张

    {
       if(index==1)
       {
            index=num;
       }
       else
       {
            index=index-1;
       }
    }
    for(var i=1;i<=num;i++)
    {
        document.getElementById('res_photo_'+i).style.display='none';
    }
    document.getElementById('res_photo_'+index).style.display='';
    document.getElementById('txt_PhotoIndex').value=index;
}				
function amend_or_cancel()
{
    if(document.getElementById('booking').style.display=='none')
    {
        document.getElementById('booking').style.display='';
        document.getElementById('booking2').style.display='';
        document.getElementById('booking3').style.display='';
    }
    else
    {
        document.getElementById('booking').style.display='none';
        document.getElementById('booking2').style.display='none';
        document.getElementById('booking3').style.display='none';
    }
}
function funSubmit()
{
    document.forms[0].action='member.aspx';
    document.forms[0].submit();
}




/*-- script for initialization ------------------------------------------------------------------*/

(function($){
		  
	$("#nav").load("components/nav.aspx",function(){  //loading menu
		$("#nav > ul > li").hover(
		function(){$(this).find("ul").stop(true,true).fadeIn(300);},
		function(){$(this).find("ul").stop(true,true).hide();});								   
	});
	
	$("#footer").load("components/footer.aspx");  //loading footer
	
	$("#language").load("components/language.aspx"); //loading language
	
	$("#sidebar1").load("components/booking_online.aspx",function(){
		var sps_n = 0,
			$spa_box = $(".special_box"),
			sps_num = $spa_box.size(),
			$sps_current_num = $(".sps_current_num");
			$spa_total_num = $(".sps_total_num");

		$spa_box.eq(sps_n).fadeIn();
		$spa_total_num.html(sps_num);
		$sps_current_num.html(sps_n+1);
		
		$("#sps_next").click(function(){
			sps_n = sps_n >= sps_num-1 ? sps_num-1 : sps_n+1;				  
			$spa_box.eq(sps_n).fadeIn().siblings().hide();
			$sps_current_num.html(sps_n+1);
		});
		
		$("#sps_pre").click(function(){
			sps_n = sps_n <= 0 ? 0 : sps_n-1;						 
			$spa_box.eq(sps_n).fadeIn().siblings().hide();
			$sps_current_num.html(sps_n+1);
		});														  
	});
	
	$.ajax({
		url:"components/memberLogin.aspx",
		dataType:"html",
		cache:false,
		success:function(data){
			$("#hpic2").html(data);	
		}
	});
	
	
	if ($.browser.msie) {
        if ($.browser.version == "6.0"){
			$.getScript("js/DD_belatedPNG_0.0.8a.js",function(){
			DD_belatedPNG.fix('#hpic1,#hpic_1,.copyright_1 dl');});	
		}}

		

})(jQuery);
		


	



