﻿var philo_current=0;

function img_on(obj) 
{
	obj.src=obj.src.replace("_off","_on");
}

function img_off(obj)
{
	obj.src=obj.src.replace("_on","_off");
}

function philo_on(id)
{
	for(var i=1;i<=4;i++)
	{
		
		if(philo_current!=i)
		{
			if(i==id)
			{
				document.getElementById("philo_"+i+"a").src=document.getElementById("philo_"+i+"a").src.replace("_off","_on");
				document.getElementById("philo_"+i+"b").src=document.getElementById("philo_"+i+"b").src.replace("_off","_on");
			}
		}
	}	
}

function philo_off(id)
{
	for(var i=1;i<=4;i++)
	{
		
		if(philo_current!=i)
		{
			if(i==id)
			{
				document.getElementById("philo_"+i+"a").src=document.getElementById("philo_"+i+"a").src.replace("_on","_off");
				document.getElementById("philo_"+i+"b").src=document.getElementById("philo_"+i+"b").src.replace("_on","_off");
			}
		}
	}	
}

function setphilo_current(id)
{
	philo_current=id;
	for(var i=1;i<=4;i++)
	{
		
		if(philo_current!=i)
		{
			document.getElementById("philo_"+i+"a").src=document.getElementById("philo_"+i+"a").src.replace("_on","_off");
			document.getElementById("philo_"+i+"b").src=document.getElementById("philo_"+i+"b").src.replace("_on","_off");
		}
	}	
}

function changeLocTit_on(id)
{
	for(var i=1;i<=6;i++)
	{
		if(i!=id)
			{
				//document.getElementById("loc_place_"+i).style.display="none";
				//document.getElementById("loc_tit_"+i).className='location_title_off'; 	
			}
		else
			{
				//document.getElementById("loc_place_"+i).style.display="inline";
				//document.getElementById("loc_tit_"+i).className='location_title_on'; 	
				window.location.href="?id="+i;
			}
	}
	
}

function loadLocTab(id)
{
	for(var i=1;i<=5;i++)
	{
		if(i!=id)
			{
				document.getElementById("loc_place_"+i).style.display="none";
				document.getElementById("loc_tit_"+i).className='location_title_off'; 	
			}
		else
			{
				document.getElementById("loc_place_"+i).style.display="inline";
				document.getElementById("loc_tit_"+i).className='location_title_on'; 	
			}
	}
}

function loadLocTab_new(id,total)
{
	for(var i=1;i<=total;i++)
	{
		if(i!=id)
			{
				document.getElementById("loc_place_"+i).style.display="none";
				document.getElementById("loc_"+i).className='contact_div_off'; 	
			}
		else
			{
				document.getElementById("loc_place_"+i).style.display="inline";
				document.getElementById("loc_"+i).className='contact_div_on'; 	
			}
	}
}

function changeMileStones(id)
{
	for(var i=1;i<=5;i++)
	{
		if(id!=i)			
		{
			//document.getElementById("milestones_"+i).style.display="none";
			//img_off(document.getElementById("milestone_tit_"+i));
		}
		else
		{
			//document.getElementById("milestones_"+i).style.display="inline";
			//img_on(document.getElementById("milestone_tit_"+i)); 
			window.location.href="?id="+i;
		}
	}
}

function loadMileStoneTab(id)
{
	for(var i=1;i<=5;i++)
	{
		if(id!=i)			
		{
			document.getElementById("milestones_"+i).style.display="none";
			img_off(document.getElementById("milestone_tit_"+i));
		}
		else
		{
			document.getElementById("milestones_"+i).style.display="inline";
			img_on(document.getElementById("milestone_tit_"+i)); 	
		}
	}
}



function submitForm()
{
	var outputString="";
	outputString=checkform(document.getElementById("reservation_form"));
	if (outputString!="")
		alert(outputString);
	else
		document.getElementById("reservation_form").submit();
}



function  isPhoneNo(phoneNo){   
    var allowstrlist="1234567890()-";   
    for(i=0;i<phoneNo.length;i++){if(allowstrlist.indexOf(phoneNo.substr(i,1))==-1){return false;}}
    return true;   
} 

function  isTime(inTime){   
    var allowstrlist="1234567890-.:";   
    for(i=0;i<inTime.length;i++){if(allowstrlist.indexOf(inTime.substr(i,1))==-1){return false;}}
    return true;   
} 

function  isGuest(inTime){   
    var allowstrlist="1234567890";   
    for(i=0;i<inTime.length;i++){if(allowstrlist.indexOf(inTime.substr(i,1))==-1){return false;}}
    return true;   
} 


function writeTopNaviCss()
{
	if(navigator.appName.toLowerCase().indexOf("microsoft")>=0)
		document.write("<link rel='stylesheet' type='text/css' href='/tc/inc/menu_mic.css'>")
	else
		document.write("<link rel='stylesheet' type='text/css' href='/tc/inc/menu.css'>")
}

var cu_current=1;
function mouseover_cuisineImg_on(id)
{
	
		if(id!=cu_current)
		{
			document.getElementById("cu_"+id).src=document.getElementById("cu_"+id).src.replace("_off","_on");
		}

}

function mouseover_cuisineImg_off(id)
{
	
		if(id!=cu_current)
		{
			document.getElementById("cu_"+id).src=document.getElementById("cu_"+id).src.replace("_on","_off");
		}
	
}

var dishes=new Array();
dishes[0]="";      
dishes[1]="生拆蟹肉乾撈翅";
dishes[2]="冰燒三層肉";
dishes[3]="堂煎法國鵝肝伴三頭鮑魚";
dishes[4]="至尊千葉豆腐";
dishes[5]="法式沙當妮焗大蝦";
dishes[6]="龍騰四海";
dishes[7]="翠田種玉";
dishes[8]="黎作亞拉斯加蟹";
dishes[9]="";
dishes[10]="";

function setcui(id)
{
	/*
	cu_current=id;	
	var img_name=document.getElementById("cu_"+id).src	
	img_name=img_name.replace("a_on.jpg","b.jpg");
	document.getElementById("cu_large").src=img_name;
	
	for(var i=1;i<=8;i++)
	{
		if(id!=i)
		{
			document.getElementById("cu_"+i).src=document.getElementById("cu_"+i).src.replace("_on","_off");
		}
	}
	
	document.getElementById("cu_large").src=img_name;
	document.getElementById("cu_name").innerHTML=dishes[id];
	*/
	window.location.href="?id="+id;
	
}

function setDish(id)
{
	cu_current=id;	
	var img_name=document.getElementById("cu_"+id).src;
	img_name=img_name.replace("a_off.jpg","b.jpg");
	document.getElementById("cu_large").src=img_name;
	
	for(var i=1;i<=8;i++)
	{
		if(id!=i)
		{
			document.getElementById("cu_"+i).src=document.getElementById("cu_"+i).src.replace("_on","_off");
		}
		else
		{
			document.getElementById("cu_"+i).src=document.getElementById("cu_"+i).src.replace("_off","_on");
		}
	}
	
	document.getElementById("cu_large").src=img_name;
	document.getElementById("cu_name").innerHTML=dishes[id];	
}


function ban_slideright()
{	
	$("ban_1").animate({
	      left: parseInt($("ban_1").css('left'),10) == 0 ?
	        -$("ban_1").outerWidth() : 
	        0
	    });

	alert($("ban_1").outerWidth());
}

var current_cont_loc=0;
function contact_click(id)
{
	for(var i=1;i<=18;i++)
	{
		if(i!=id)
		{
			document.getElementById("loc_"+i).className='contact_div_off';
			index_tab_1_up("contact_loc_"+i);
		}
	}
	
	current_cont_loc=id;
	
	if(document.getElementById("contact_loc_"+id).style.display=="block")
		{
			index_tab_1_up("contact_loc_"+id);
			for(var i=1;i<=18;i++)
			{document.getElementById("loc_"+i).className='contact_div_off';}			
		}
	else
		{
			index_tab_1_down("contact_loc_"+id);
			document.getElementById("loc_"+current_cont_loc).className='contact_div_on'; 	
		}
}

function changeContloc_on(id)
{
	if(id!=current_cont_loc)
			{
				document.getElementById("loc_"+id).className='contact_div_on'; 	
			}
}

function changeContloc_off(id)
{
	
		if(id!=current_cont_loc)
			{
				document.getElementById("loc_"+id).className='contact_div_off'; 	
			}
	
}


function index_tab_1_down(id)
{
	/*
	$('#'+id).slideDown('slow', function() {
	    // Animation complete.
	  });
	  */
	document.getElementById(id).style.display="block";
	
	checker_1=1;
}

function index_tab_1_up(id)
{
	/*
	$('#'+id).slideUp('slow', function() {
	    // Animation complete.
	  });
	  */
	  document.getElementById(id).style.display="none";
	checker_1=1;
}

function mediaLocTit_on(id)
{
	for(var i=1;i<=2;i++)
	{
		if(i!=id)
			{
				//document.getElementById("loc_place_"+i).style.display="none";
				//document.getElementById("loc_tit_"+i).className='media_title_off'; 	
			}
		else
			{
				//document.getElementById("loc_place_"+i).style.display="inline";
				//document.getElementById("loc_tit_"+i).className='media_title_on'; 	
				window.location.href="?id="+i;
			}
	}
	
}

function mediaLoc(id)
{
	for(var i=1;i<=2;i++)
	{
		if(i!=id)
			{
				document.getElementById("loc_place_"+i).style.display="none";
				document.getElementById("loc_tit_"+i).className='media_title_off'; 	
			}
		else
			{
				document.getElementById("loc_place_"+i).style.display="inline";
				document.getElementById("loc_tit_"+i).className='media_title_on'; 	
			}
	}
	
}

var media=new Array();
total_media_div=3;
media[0]="";      
media[1]="<object width='480' height='385'><param name='movie' value='http://www.youtube.com/v/t501T-7eHdY&hl=en_US&fs=1&'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/t501T-7eHdY&hl=en_US&fs=1&' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='480' height='385'></embed></object>";
media[2]="<object width='480' height='385'><param name='movie' value='http://www.youtube.com/v/RC9VwNcSIJA&hl=en_US&fs=1&'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/RC9VwNcSIJA&hl=en_US&fs=1&' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='480' height='385'></embed></object>";
media[3]="<object width='480' height='385'><param name='movie' value='http://www.youtube.com/v/odIU1b2x7cY&hl=en_US&fs=1&'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/odIU1b2x7cY&hl=en_US&fs=1&' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='480' height='385'></embed></object>"
media[4]="<object width='480' height='385'><param name='movie' value='http://www.youtube.com/v/ANvL95jjtN8&hl=en_US&fs=1&'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/ANvL95jjtN8&hl=en_US&fs=1&' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='480' height='385'></embed></object>";
media[5]="<embed id=VideoPlayback src=http://video.google.com/googleplayer.swf?docid=3827806180032321230&hl=zh-TW&fs=true style=width:400px;height:326px allowFullScreen=true allowScriptAccess=always type=application/x-shockwave-flash> </embed>";
media[6]="<embed id=VideoPlayback src=http://video.google.com/googleplayer.swf?docid=-7135656666191044813&hl=zh-TW&fs=true style=width:400px;height:326px allowFullScreen=true allowScriptAccess=always type=application/x-shockwave-flash> </embed>";

function writeMedia(_id,_div_id)
{
	for(var i=1;i<=total_media_div;i++)
	{
		document.getElementById("media_div_"+i).style.display="none";	
	}
	document.getElementById("media_div_"+_div_id).style.display="inline";	
	document.getElementById("media_div_"+_div_id).innerHTML=media[_id];	
}


function changeLang_eng()
{
	window.location.href=window.location.href.replace("/tc/","/eng/");
}

function changeLang_sc()
{
	window.location.href=window.location.href.replace("/tc/","/sc/");
}

function clear_contact()
{
	document.getElementById("u1").value="";
	document.getElementById("uname").value="";
	document.getElementById("umail").value="";
	document.getElementById("utel").value="";
	//document.getElementById("uaddress").value="";
	//document.getElementById("ucity").value="";
	//document.getElementById("ucountry").value="";
	document.getElementById("code").value="";
	document.getElementById("ucontent").value="";
}

function clear_res()
{
	document.getElementById("name").value="";
	document.getElementById("mail1").value="";
	document.getElementById("tel").value="";
	document.getElementById("leixingname1").value="";
	document.getElementById("year").value="";
	document.getElementById("month").value="";
	document.getElementById("day").value="";
	document.getElementById("ttt").value="";
	document.getElementById("num").value="";
}

function media_on(_id)
{
	for(var i=1;i<=4;i++)
	{
		if(_id!=i)
			document.getElementById("media_id_"+i).style.display="none";	
		else
			document.getElementById("media_id_"+i).style.display="inline";	
		
	}
}

function poponload() {
    testwindow = window.open("http://www.leigarden.hk/HK_SHOWBAR card.jpeg", "_blank",
    "status=yes,toolbar=no,menubar=no,resizable=no, width=420, height=600, location=no");

}
