var IE = document.all?true:false;

$(document).ready(function() {
	$('img.btn_over').mouseover(function(){
		$(this).attr('src', $(this).attr('src').toString().replace('.g','_over.g').replace('.j','_over.j'));
    }).mouseout(function(){
		$(this).attr('src', $(this).attr('src').toString().replace('_over.g','.g').replace('_over.j','.j'));
    });
});

function AdjustHeight()
	{
		for (var i=0;i<$(".product_list").length;i=i+4)
	{
		//alert($(".tag_container:eq("+i+")").html());
		var maxheight_top=0;
		var maxheight_cell=0;
		var maxheight_btn=0;
		for (var j=0;j<4;j++)
		{
			if ((i+j)>=$(".product_list").length)
				break;
			if ($(".product_list:eq("+(i+j)+") .img_top").height()>maxheight_top)
				maxheight_top=$(".product_list:eq("+(i+j)+") .img_top").height();
			
			if ($(".product_list:eq("+(i+j)+") .content_cell").height()>maxheight_cell)
				maxheight_cell=$(".product_list:eq("+(i+j)+") .content_cell").height();	
				
			if ($(".product_list:eq("+(i+j)+") .content2_btn").height()>maxheight_btn)
				maxheight_btn=$(".product_list:eq("+(i+j)+") .content2_btn").height();	
		}
		
		for (var j=0;j<4;j++)
		{
		$(".product_list:eq("+(i+j)+") .img_top").height(maxheight_top);
		$(".product_list:eq("+(i+j)+") .content_cell").height(maxheight_cell);
		$(".product_list:eq("+(i+j)+") .content2_btn").height(maxheight_btn);
		}
	}
	}
	
function AdjustHeight2()
	{
		for (var i=0;i<$(".maxh").length;i=i+2)
	{
		//alert($(".tag_container:eq("+i+")").html());
		var maxheight_h=0;
		for (var j=0;j<2;j++)
		{
			if ((i+j)>=$(".maxh").length)
				break;
			if ($(".maxh:eq("+(i+j)+") .maxh_h").height()>maxheight_h)
				maxheight_h=$(".maxh:eq("+(i+j)+") .maxh_h").height();	
		}
		
		for (var j=0;j<2;j++)
		{
		$(".maxh:eq("+(i+j)+") .maxh_h").height(maxheight_h);
		}
	}
	}
function jump(secNum)//'sec Num,sub Sec Num'
	{
		//find the href from the tree
		//jump to the href
		new_href=get_href(secNum, rootMenu);
		if (new_href!='')
			window.location.href=new_href;
	}
	
	function get_href(secNum, parentMenu)
	{
		href_found=''
		for (var i=0;i<parentMenu.childs.length;i++)
		{
			var m=parentMenu.childs[i];
			if (m.contentId==secNum)
				return (currentPathLang+m.href);
			if (m.childs.length>0)
				href_found=get_href(secNum, m);
			if (href_found!='')
				return href_found;
		}
		return '';
	}
	
	
		$(window).load(function (){
			adjust_width();
	});	
	
		$(window).resize(function (){
			adjust_width();
	});	
	
	function adjust_width()
	{
		if (($.browser.msie&& /MSIE 6\.0/i.test(window.navigator.userAgent)&& !/MSIE 7\.0/i.test(window.navigator.userAgent))){
				if ($(window).height()<parseInt($('body').css('min-height')))
				{
					$('body').css('height', $('body').css('min-height'))
				}
				else if ($('body').css('height')==$('body').css('min-height'))
					$('body').css('height','100%');
				if ($(window).width()<parseInt($('body').css('min-width')))
				{
					$('body').css('width', $('body').css('min-width'))
					if ($('.top_flash').length>0)
					$('.top_flash').css('width', $('body').css('min-width'))
				}
				else if ($('body').css('width')==$('body').css('min-width'))
				{
					$('body').css('width','100%');
					if ($('.top_flash').length>0)
					$('.top_flash').css('width', '100%')
				}
			}
	}
	
	function jumpPopup(langnum)
	{
		var url;
		if (langnum==1)
			url='http://webordering.kfchk.com/KFC/KFC/Index.action?request_locale=EN_US';
		else if (langnum==2)
			url='http://webordering.kfchk.com/KFC/KFC/Index.action?request_locale=zh_TW';
			
			window.open(url,'new_popup','scrollbars=yes,width=850,height=600,resizable=no');
	}
	
	
	function jumpBanner(bannernum)
	{
		if (bannernum==1)
			location.href=currentPathLang+'new/index.html';
			
		else if  (bannernum==2)
			{
				url=currentPath+'/filemanager/pdf/coupons.pdf';
				window.open(url,'new_popup6','scrollbars=yes,width=880,height=600,resizable=yes');
			}
			
		else if  (bannernum==3)
			location.href=currentPathLang+'menu/am_riser.html';
			
		else if  (bannernum==4)
			{
				url=currentPath+'/filemanager/pdf/delivery_20100902.pdf';
				window.open(url,'new_popup6','scrollbars=yes,width=880,height=600,resizable=yes');
			}
			
		else if (bannernum==5)
				url=currentPath+'/filemanager/pdf/aeon_special_combo.pdf';
				window.open(url,'new_popup6','scrollbars=yes,width=880,height=600,resizable=yes');
	}
	
	global_stores=['http://www.kfc.com.cn','http://www.kfchk.com/','http://www.kfc.co.in/','http://www.kfcindonesia.com','http://www.kfc.co.jp/','http://www.kfckorea.com/','http://www.kfc.com.my','http://www.kfcpakistan.com/','http://www.kfc.ph/','http://www.kfc.com.sg/','http://www.kfcclub.com.tw/','http://www.kfc.co.th/','http://www.kfcturkiye.com/','http://www.kfcvietnam.com/','http://www.kfc.ca/','http://www.kfc.com.mx/','http://www.kfc-pr.com/','http://www.kfc.com/','http://www.kfc.cz/','http://www.kfc.fr/','http://www.kfc.de/','http://www.kfc.gr/','http://www.kfc-malta.com/','http://www.kfc.nl/','http://www.kfc.pl/','http://www.kfc.ro/','http://www.kfc.co.uk/','http://www.kfc.com.au/','http://www.kfc.co.nz/'];
	
	function jumpPlace(place_num)
	{
		window.open(global_stores[place_num-1],'new_popup');
	}
	
	function clickFacebook() 
	{
		url='http://www.facebook.com/pages/KFC-Foodmania/37702709081';
		window.open(url,'new_popup1');
	}