var language = ReadCookie('default_language');

jQuery(function($) {
     $("img").pngfix();
});

function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function init(){
	$("#top").load("top.php",function(){SigninContent('check');});
	$("#buttom").load("buttom.php",function(){});
	open_tab = false;
	show_tab = "";
	
	set_position();
	
	$("#vdo_button").css({"cursor":"pointer"});
	$("#recipe_button").css({"cursor":"pointer"});
	$("#new_button").css({"cursor":"pointer"});
	
	$("#where_to_buy").hide();
	$("#favorite_product").hide();
	
	$("#loading").hide();
	$("#lightbox").hide();
	$("#loading").fadeTo(0,0);
	
	$("#lightbox").css({position:"absolute","z-index":"6500"});
	
	jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
		jQuery("<img>").attr("src", arguments[i]);
	  }
	}
	$.preloadImages("images_"+ language +"/fav_vdo_cooking_tab_on.png","images_"+ language +"/member_recipe_tab_on.png","images_"+ language +"/whats_new_tab_on.png","images_"+ language +"/vdo_top_border.png","images_"+ language +"/recipe_top_border.png","images_"+ language +"/new_top_border.png","images_"+ language +"/ajax-loader.gif","images_"+ language +"/recipe/matching_chicken_img_on.jpg","images_"+ language +"/recipe/matching_pig_img_on.jpg","images_"+ language +"/recipe/matching_cow_img_on.jpg","images_"+ language +"/recipe/matching_fish_img_on.jpg","images_"+ language +"/recipe/matching_seafood_img_on.jpg");
	
	$("#vdo_button").mouseenter(function () {
		$("#vdo_button").html('<img src="images_'+ language +'/fav_vdo_cooking_tab_on.png" width="207" height="35" />');
		$("#recipe_button").html('<img src="images_'+ language +'/member_recipe_tab.png" width="207" height="35" />');
		$("#new_button").html('<img src="images_'+ language +'/whats_new_tab.png" width="207" height="35" />');
		$("#tab_top_border").html('<img src="images_'+ language +'/vdo_top_border.png" width="807" height="8" />');
		$("img").pngfix();
		if(!open_tab){
			tab_open('vdo');
		}else{
			if(show_tab != "vdo"){
				show_tab = "vdo";
				tab_loading();
				change_tab(show_tab);
			}
		}
	});

	$("#recipe_button").mouseenter(function () {
		$("#vdo_button").html('<img src="images_'+ language +'/fav_vdo_cooking_tab.png" width="207" height="35" />');
		$("#recipe_button").html('<img src="images_'+ language +'/member_recipe_tab_on.png" width="207" height="35" />');
		$("#new_button").html('<img src="images_'+ language +'/whats_new_tab.png" width="207" height="35" />');
		$("#tab_top_border").html('<img src="images_'+ language +'/recipe_top_border.png" width="807" height="8" />');
		$("img").pngfix();
		if(!open_tab){
			tab_open('recipe');
		}else{
			if(show_tab != "recipe"){
				show_tab = "recipe";
				tab_loading();
				change_tab(show_tab);
			}
		}

	});

	$("#new_button").mouseenter(function(){
		$("#vdo_button").html('<img src="images_'+ language +'/fav_vdo_cooking_tab.png" width="207" height="35" />');
		$("#recipe_button").html('<img src="images_'+ language +'/member_recipe_tab.png" width="207" height="35" />');
		$("#new_button").html('<img src="images_'+ language +'/whats_new_tab_on.png" width="207" height="35" />');
		$("#tab_top_border").html('<img src="images_'+ language +'/new_top_border.png" width="807" height="8" />');
		$("img").pngfix();
		if(!open_tab){
			tab_open('new');
		}else{
			if(show_tab != "new"){
				show_tab = "new";
				tab_loading();
				change_tab(show_tab);
			}
		}

	});
	
	$("#tab_buttom").mouseleave(function () {
		tab_close();
	});
	$("#buttom").mouseenter(function () {
		if(open_tab){
			tab_close();
		}
	});
	$("#main_content_border").mouseenter(function () {
		if(open_tab){
			tab_close();
		}
	});
	
	$("#favorite_product").load("favorite_product_content.php",function(){$("img").pngfix();});
	$("#recipe_of_the_day").load("recipe_of_the_day.php",function(){$("img").pngfix();});
	
	$("#where_to_buy").load("where_to_buy.php",function(){});
	
	$("#where_to_buy_img").mouseenter(function(){
		$("#favorite_product").stop();
		$("#favorite_product").hide();
		$("#where_to_buy").stop();
		$("#where_to_buy").show();
	});
	$("#where_to_buy").mouseleave(function(){
		$("#where_to_buy").stop();
		$("#where_to_buy").hide();
	});
	$("#favorite_product_img").mouseenter(function(){
		$("#where_to_buy").stop();
		$("#where_to_buy").hide();
		$("#favorite_product").stop();
		$("#favorite_product").show();
	});
	$("#favorite_product").mouseleave(function(){
		$("#favorite_product").stop();
		$("#favorite_product").hide();
	});
	$("#bg_content_right").mouseenter(function(){
		$("#where_to_buy").stop();
		$("#where_to_buy").hide();
		$("#favorite_product").stop();
		$("#favorite_product").hide();
	});
}
function set_position(){
	docHeight = $(window).height();
	docWidth = $(window).width();
	bodyWidth = $(window.body).width();
	bodyHeight = $(window.body).height();
	docLeft = (docWidth / 2) - 500;
	contentLeft = (docWidth / 2) - 512;
	docTop = docHeight - 58;
	setObject();
}

function tab_close(){
	$("#tab_buttom").stop();
	open_tab = false;
	show_tab = "";
	//$("#tab_buttom").animate({top: docTop - 259 +"px"},100,function(){
		//$("#tab_buttom").animate({top: docTop - 15 +"px"},200,function(){
			//$("#tab_buttom").animate({top: docTop - 45 +"px"},200,function(){
				//$("#tab_buttom").animate({top: docTop - 239 +"px"},500,function(){
				//open_tab = false;
				$("#tab_buttom").animate({top: docTop - 35 +"px"},250,function(){
					$("#vdo_button").html('<img src="images_'+ language +'/fav_vdo_cooking_tab.png" width="207" height="35" />');
					$("#recipe_button").html('<img src="images_'+ language +'/member_recipe_tab.png" width="207" height="35" />');
					$("#new_button").html('<img src="images_'+ language +'/whats_new_tab.png" width="207" height="35" />');
					$("#tab_top_border").html('<img src="images_'+ language +'/new_top_border.png" width="807" height="8" />');
					$("img").pngfix();
				});
				//});
			//});
		//});
	//});
}
function tab_open(name){
	$("#tab_buttom").stop();
	open_tab = true;
	tab_loading();
	//$("#tab_buttom").animate({top: docTop - 25 +"px"},100,function(){
		//$("#tab_buttom").animate({top: docTop - 259 +"px"},200,function(){
			//$("#tab_buttom").animate({top: docTop - 229 +"px"},200,function(){
				$("#tab_buttom").animate({top: docTop - 239 +"px"},250,function(){
					change_tab(name);
				});
			//});
		//});
	//});
}
function change_tab(name){
	if(name == "vdo"){
		$("#tab_vdo_content").load("tabs.php",{"tab":name},function(){
			$("#vdo_back").fadeTo('fast',0.33);
			$("#tab_vdo_content").css({position:"absolute"});
			$("#vdo_img_border").css({position:"relative","overflow":"hidden","width":"489px","height":"50px"});
			$("#vdo_img_content").css({position:"relative"});
		});
	}
	if(name == "recipe"){
		$("#tab_vdo_content").load("tabs.php",{"tab":name},function(){
			$("#vdo_back").fadeTo('fast',0.33);
			$("#tab_vdo_content").css({position:"absolute"});
			$("#vdo_img_border").css({position:"relative","overflow":"hidden","width":"489px","height":"50px"});
			$("#vdo_img_content").css({position:"relative"});
		});
	}
	if(name == "new"){
		$("#tab_vdo_content").load("tabs.php",{"tab":name},function(){
			$("#new_up").fadeTo('fast',0.33);
			$("#tab_vdo_content").css({position:"absolute"});
			$("#new_img_border").css({position:"relative","overflow":"hidden","width":"635px","height":"138px"});
			$("#new_img_content").css({position:"relative"});
		});
	}
	$("img").pngfix();
}
function setObject(){
	$("#content").css({position:"absolute","overflow":"hidden","left":"0px","top":"0px","width": docWidth +"px","height": docHeight +"px","z-index":"4000"});
	$("#top").css({position:"absolute","left": docLeft +"px","top":"0px","z-index":"4000"});
	$("#bg_top").css({position:"absolute","left":"0px","top":"0px","width": docWidth +"px","height":"76px","background":"url(images_"+ language +"/top_tie.gif)","z-index":"100"});
	
	$("#where_to_buy_button").css({position:"absolute","left": ((docWidth/2) + 42) +"px","top":"10px","z-index":"5500"});
	$("#where_to_buy").css({position:"absolute","left": ((docWidth/2) + 41) +"px","top":"10px","z-index":"5000"});
	$("#favorite_product_button").css({position:"absolute","left": ((docWidth/2) + 261) +"px","top":"10px","z-index":"5500"});
	$("#favorite_product").css({position:"absolute","left": ((docWidth/2) + 260) +"px","top":"10px","z-index":"5000"});
	
	$("#page_content").css({position:"absolute","left": contentLeft +"px","top":"16px","z-index":"4500"});
	
	$("#main_content_border").css({position:"absolute","overflow":"auto","left":"0px","top":"76px","width":docWidth +"px","height": docHeight - 134 +"px","z-index":"2000"});
	$("#main_content").css({position:"absolute","left":"0px","top":"0px"});
	$("#bg_content").css({position:"absolute","left":"0px","top":"76px","width": docWidth +"px","height": docHeight - 134 +"px","background-color":"#f0f7fb","z-index":"100"});
	$("#bg_content_left").css({position:"absolute","left":"0px","top":"0px","width": docWidth/2 +"px","height":"79px","background":"url(images_"+ language +"/content_bg_left.gif)","z-index":"200"});
	$("#bg_content_right").css({position:"absolute","left": docWidth/2 +"px","top":"0px","width": ((docWidth/2) - 16) +"px","height":"79px","background":"url(images_"+ language +"/content_bg_right.gif)","z-index":"200"});
	
	$("#buttom").css({position:"absolute","left": docLeft +"px","top": docTop +"px","z-index":"4000"});
	$("#bg_buttom").css({position:"absolute","left":"0px","top": docTop +"px","width": docWidth +"px","height":"58px","background":"url(images_"+ language +"/buttom_tie.gif)","z-index":"100"});

	$("#tab_buttom").css({position:"absolute","left": (docWidth/2) - 389 +"px","top": docTop - 35 +"px","height":"280px","z-index":"3000"});
	
	$("#loading").css({position:"absolute","background-image":"url(images_"+ language +"/loading_bg.png)","left":"0px","top":"0px","width": docWidth +"px","height": docHeight +"px","z-index":"6000"});
	
}
function change_vdo(param){
	$("#vdo_img_content").stop();
	$("#vdo_back").html('<img id="vdo_button_back" border="0" src="images_'+ language +'/tab_vdo_more_back.gif" width="57" height="50" />');
	$("#vdo_next").html('<img id="vdo_button_next" border="0" src="images_'+ language +'/tab_vdo_more_next.gif" width="57" height="50" />');
	$("#vdo_back").fadeTo('fast',0.33);
	$("#vdo_next").fadeTo('fast',0.33);
	div_left = $("#vdo_img_content").position().left;
	if(param == 0){
		div_left = div_left + 489;
	}else{
		div_left = div_left - 489;
	}
	$("#vdo_img_content").animate({left: div_left +"px"},1000,function(){	
		if(div_left == 0){
			$("#vdo_next").html('<a href="javascript:void(0);"><img id="vdo_button_next" border="0" src="images_'+ language +'/tab_vdo_more_next.gif" width="57" height="50" onclick="change_vdo(1);" /></a>');
			$("#vdo_next").fadeTo('fast',1);
		}else if(div_left == -489){
			$("#vdo_back").html('<a href="javascript:void(0);"><img id="vdo_button_back" border="0" src="images_'+ language +'/tab_vdo_more_back.gif" width="57" height="50" onclick="change_vdo(0);" /></a>');
			$("#vdo_back").fadeTo('fast',1);
		}else{
			$("#vdo_back").html('<a href="javascript:void(0);"><img id="vdo_button_back" border="0" src="images_'+ language +'/tab_vdo_more_back.gif" width="57" height="50" onclick="change_vdo(0);" /></a>');
			$("#vdo_next").html('<a href="javascript:void(0);"><img id="vdo_button_next" border="0" src="images_'+ language +'/tab_vdo_more_next.gif" width="57" height="50" onclick="change_vdo(1);" /></a>');
			$("#vdo_next").fadeTo('fast',1);
			$("#vdo_back").fadeTo('fast',1);
		}
	});
}
function change_recipe(param){
	$("#vdo_img_content").stop();
	$("#vdo_back").html('<img id="vdo_button_back" border="0" src="images_'+ language +'/tab_recipe_more_back.gif" width="57" height="50" />');
	$("#vdo_next").html('<img id="vdo_button_next" border="0" src="images_'+ language +'/tab_recipe_more_next.gif" width="57" height="50" />');
	$("#vdo_back").fadeTo('fast',0.33);
	$("#vdo_next").fadeTo('fast',0.33);
	div_left = $("#vdo_img_content").position().left;
	if(param == 0){
		div_left = div_left + 489;
	}else{
		div_left = div_left - 489;
	}
	$("#vdo_img_content").animate({left: div_left +"px"},1000,function(){	
		if(div_left == 0){
			$("#vdo_next").html('<a href="javascript:void(0);"><img id="vdo_button_next" border="0" src="images_'+ language +'/tab_recipe_more_next.gif" width="57" height="50" onclick="change_recipe(1);" /></a>');
			$("#vdo_next").fadeTo('fast',1);
		}else if(div_left == -489){
			$("#vdo_back").html('<a href="javascript:void(0);"><img id="vdo_button_back" border="0" src="images_'+ language +'/tab_recipe_more_back.gif" width="57" height="50" onclick="change_recipe(0);" /></a>');
			$("#vdo_back").fadeTo('fast',1);
		}else{
			$("#vdo_back").html('<a href="javascript:void(0);"><img id="vdo_button_back" border="0" src="images_'+ language +'/tab_recipe_more_back.gif" width="57" height="50" onclick="change_recipe(0);" /></a>');
			$("#vdo_next").html('<a href="javascript:void(0);"><img id="vdo_button_next" border="0" src="images_'+ language +'/tab_recipe_more_next.gif" width="57" height="50" onclick="change_recipe(1);" /></a>');
			$("#vdo_next").fadeTo('fast',1);
			$("#vdo_back").fadeTo('fast',1);
		}
	});
}
function change_new(param){
	$("#new_img_content").stop();
	$("#new_up").html('<img src="images_'+ language +'/tab_new_arrow_up.gif" width="12" height="12" vspace="3" border="0" />');
	$("#new_down").html('<img src="images_'+ language +'/tab_new_arrow_down.gif" width="12" height="12" vspace="3" border="0" />');
	$("#new_up").fadeTo('fast',0.33);
	$("#new_down").fadeTo('fast',0.33);
	div_top = $("#new_img_content").position().top;
	if(param == 0){
		div_top = div_top + 138;
	}else{
		div_top = div_top - 138;
	}
	$("#new_img_content").animate({top: div_top +"px"},1000,function(){	
		if(div_top == 0){
			$("#new_down").html('<a href="javascript:void(0);"><img src="images_'+ language +'/tab_new_arrow_down.gif" width="12" height="12" vspace="3" border="0" onclick="change_new(1);" /></a>');
			$("#new_down").fadeTo('fast',1);
		}else if(div_top == -276){
			$("#new_up").html('<a href="javascript:void(0);"><img src="images_'+ language +'/tab_new_arrow_up.gif" width="12" height="12" vspace="3" border="0" onclick="change_new(0);" /></a>');
			$("#new_up").fadeTo('fast',1);
		}else{
			$("#new_up").html('<a href="javascript:void(0);"><img src="images_'+ language +'/tab_new_arrow_up.gif" width="12" height="12" vspace="3" border="0" onclick="change_new(0);" /></a>');
			$("#new_down").html('<a href="javascript:void(0);"><img src="images_'+ language +'/tab_new_arrow_down.gif" width="12" height="12" vspace="3" border="0" onclick="change_new(1);" /></a>');
			$("#new_up").fadeTo('fast',1);
			$("#new_down").fadeTo('fast',1);
		}
	});
}
function show_loading(){
	//$("#lightbox").html('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="'+ bodyHeight +'" align="center" valign="middle"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="70" height="70"><param name="movie" value="loading.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="loading.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="70" height="70"></embed></object></td></tr></table>');
	$("#lightbox").css({"left": (docWidth/2)-35 +"px","top": (docHeight/2)-35 +"px","width":"32px","height":"32px"});
	$("#lightbox").html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="70" height="70"><param name="movie" value="loading.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="loading.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="70" height="70"></embed></object>');
	$("#lightbox").show();
	$("#loading").show();
	$("#loading").fadeTo("slow",0.85,function(){$("#lightbox").show();});
}
function change_vdo_label(text){
	$("#tab_vdo_label").html(text);
}
function tab_loading(){
	$("#tab_vdo_content").html('<table width="791" border="0" cellspacing="0" cellpadding="0"><tr><td height="200" align="center" valign="middle"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="70" height="70"><param name="movie" value="loading.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="loading.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="70" height="70"></embed></object></td></tr></table>');
}
function show_lightbox(name,w,h,root_node,data_node,id){
	$("#lightbox").css({"left": (docWidth/2)-35 +"px","top": (docHeight/2)-35 +"px","width":"32px","height":"32px"});
	$("#lightbox").html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="70" height="70"><param name="movie" value="loading.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><embed src="loading.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="70" height="70"></embed></object>');
	$("#lightbox").show();
	$("#loading").show();
	$("#loading").fadeTo("slow",0.85,function(){
		$("#lightbox").show();		
		$("#lightbox").load("lightbox.php",{"name":name,"root_node":root_node,"data_node":data_node,"id":id},function(){
			$("#lightbox").css({"left": (docWidth/2)-w +"px","top": (docHeight/2)-h +"px","width": w*2 +"px","height": h*2 +"px"});
			$("#term_border").css({position:"relative","overflow":"auto","left":"0px","top":"0px","width":"700px","height":"500px"});
			$("#term_content").css({position:"relative","left":"0px","top":"0px"});
			$("img").pngfix();
			uplaod_image();
		});

	});
}
function hide_lightbox(){
	$("#lightbox").html("");
	$("#lightbox").hide();
	$("#loading").fadeTo("slow",0,function(){
		$("#loading").hide();
	});
}
function init_roll_over(){
	for(i=1;i<=18;i++){
		$("#recipe_img"+ i).hide();
	}
	$("img").pngfix();
	$("#recipe_img1_panel").mouseleave(function () {
			$("#recipe_img1").hide();
	});
	$("#recipe_img1_panel").mouseenter(function () {
		$("#recipe_img1").show();
	});
	$("#recipe_img2_panel").mouseleave(function () {
			$("#recipe_img2").hide();
	});
	$("#recipe_img2_panel").mouseenter(function () {
		$("#recipe_img2").show();
	});
	$("#recipe_img3_panel").mouseleave(function () {
			$("#recipe_img3").hide();
	});
	$("#recipe_img3_panel").mouseenter(function () {
		$("#recipe_img3").show();
	});
	$("#recipe_img4_panel").mouseleave(function () {
			$("#recipe_img4").hide();
	});
	$("#recipe_img4_panel").mouseenter(function () {
		$("#recipe_img4").show();
	});
	$("#recipe_img5_panel").mouseleave(function () {
			$("#recipe_img5").hide();
	});
	$("#recipe_img5_panel").mouseenter(function () {
		$("#recipe_img5").show();
	});
	$("#recipe_img6_panel").mouseleave(function () {
			$("#recipe_img6").hide();
	});
	$("#recipe_img6_panel").mouseenter(function () {
		$("#recipe_img6").show();
	});
	$("#recipe_img7_panel").mouseleave(function () {
			$("#recipe_img7").hide();
	});
	$("#recipe_img7_panel").mouseenter(function () {
		$("#recipe_img7").show();
	});
	
	$("#recipe_img8_panel").mouseleave(function () {
			$("#recipe_img8").hide();
	});
	$("#recipe_img8_panel").mouseenter(function () {
		$("#recipe_img8").show();
	});
	$("#recipe_img9_panel").mouseleave(function () {
			$("#recipe_img9").hide();
	});
	$("#recipe_img9_panel").mouseenter(function () {
		$("#recipe_img9").show();
	});
	$("#recipe_img10_panel").mouseleave(function () {
			$("#recipe_img10").hide();
	});
	$("#recipe_img10_panel").mouseenter(function () {
		$("#recipe_img10").show();
	});
	$("#recipe_img11_panel").mouseleave(function () {
			$("#recipe_img11").hide();
	});
	$("#recipe_img11_panel").mouseenter(function () {
		$("#recipe_img11").show();
	});
	$("#recipe_img12_panel").mouseleave(function () {
			$("#recipe_img12").hide();
	});
	$("#recipe_img12_panel").mouseenter(function () {
		$("#recipe_img12").show();
	});
	$("#recipe_img13_panel").mouseleave(function () {
			$("#recipe_img13").hide();
	});
	$("#recipe_img13_panel").mouseenter(function () {
		$("#recipe_img13").show();
	});
	$("#recipe_img14_panel").mouseleave(function () {
			$("#recipe_img14").hide();
	});
	$("#recipe_img14_panel").mouseenter(function () {
		$("#recipe_img14").show();
	});
	$("#recipe_img15_panel").mouseleave(function () {
			$("#recipe_img15").hide();
	});
	$("#recipe_img15_panel").mouseenter(function () {
		$("#recipe_img15").show();
	});
	$("#recipe_img16_panel").mouseleave(function () {
			$("#recipe_img16").hide();
	});
	$("#recipe_img16_panel").mouseenter(function () {
		$("#recipe_img16").show();
	});
	$("#recipe_img17_panel").mouseleave(function () {
			$("#recipe_img17").hide();
	});
	$("#recipe_img17_panel").mouseenter(function () {
		$("#recipe_img17").show();
	});
	$("#recipe_img18_panel").mouseleave(function () {
			$("#recipe_img18").hide();
	});
	$("#recipe_img18_panel").mouseenter(function () {
		$("#recipe_img18").show();
	});
	
}

function ReadXML(url,root_node,data_node){
	//$("#alert_box").html("Loading data please wait...");
	$.ajax({
		type: "GET",
		url: url,
		dataType: "xml",
		success: function(xml) {
			$(xml).find(root_node).each(function(){
				data = $(this).find(data_node).text();
				alert(data);
				//$("#alert_box").html(data);
				//show_alert_box();
			});
		}
	});
}


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function isEmailAddr(email)

{

  var result = false;

  var theStr = new String(email);

  var index = theStr.indexOf("@");

  if (index > 0)

  {

    var pindex = theStr.indexOf(".",index);

    if ((pindex > index+1) || (theStr.length > pindex+1))

	result = true;

  }

  return result;

}
function CheckSearchRecipe(){
var TheForm = document.search_recipe;
var url = "data_"+ language +".xml";
	if((TheForm.keyword.value == "") || (TheForm.keyword.value == "SEARCH ALL RECIPES") || (TheForm.keyword.value == "PLEASE ENTER KEYWORD")){
		TheForm.keyword.value = "PLEASE ENTER KEYWORD";
	}else{
		TheForm.submit();
	}
}
function CheckSearchLocation(){
var TheForm = document.search_location;
	if((TheForm.keyword.value == "") || (TheForm.keyword.value == "ENTER YOUR POSTCODE") || (TheForm.keyword.value == "PLEASE ENTER KEYWORD")){
		TheForm.keyword.value = "PLEASE ENTER KEYWORD";
	}else{
		TheForm.submit();
	}
}
function CheckSendtoFriend(){
	var TheForm = document.send_friend;
	var url = "data_"+ language +".xml";
	if(TheForm.name.value == ""){
		ReadXML(url,"SEND_FRIEND_FORM","YOUR_NAME_EMPTY");
		TheForm.name.focus();
	}else if(TheForm.email.value == ""){
		ReadXML(url,"SEND_FRIEND_FORM","YOUR_EMAIL_EMPTY");
		TheForm.email.focus();
	}else if(!isEmailAddr(TheForm.email.value)){
		ReadXML(url,"SEND_FRIEND_FORM","YOUR_EMAIL_ERROR");
		TheForm.email.focus();
	}else if(TheForm.fname1.value == ""){
		ReadXML(url,"SEND_FRIEND_FORM","YOUR_FRIEND_NAME_EMPTY");
		TheForm.fname1.focus();
	}else if(TheForm.femail1.value == ""){
		ReadXML(url,"SEND_FRIEND_FORM","YOUR_FRIEND_EMAIL_EMPTY");
		TheForm.femail1.focus();
	}else if(!isEmailAddr(TheForm.femail1.value)){
		ReadXML(url,"SEND_FRIEND_FORM","YOUR_FRIEND_EMAIL_ERROR");
		TheForm.femail1.focus();
	}else{
		name = encodeURI(TheForm.name.value);
		email = TheForm.email.value;
		fname1 = encodeURI(TheForm.fname1.value);
		femail1 = TheForm.femail1.value;
		fname2 = encodeURI(TheForm.fname2.value);
		femail2 = TheForm.femail2.value;
		fname3 = encodeURI(TheForm.fname3.value);
		femail3 = TheForm.femail3.value;
		fname4 = encodeURI(TheForm.fname4.value);
		femail4 = TheForm.femail4.value;
		fname5 = encodeURI(TheForm.fname5.value);
		femail5 = TheForm.femail5.value;
		url = window.location.protocol + "//" + window.location.host + window.location.pathname +"?"+ window.location.search.substring(1);

		show_loading();
		$.post("sendtofriend.asp",{"name":name,"email":email,"fname1":fname1,"femail1":femail1,"fname2":fname2,"femail2":femail2,"fname3":fname3,"femail3":femail3,"fname4":fname4,"femail4":femail4,"fname5":fname5,"femail5":femail5,"language":language,"url":url},function(data){
			if(data.status == "true"){				
				show_lightbox("success",278,100,"SEND_FRIEND_FORM","SEND_SUCCESS");
			}else{
				show_lightbox("warning",278,150,"SEND_FRIEND_FORM","SEND_ERROR");
			}
		} , "json");
	}
}

function CheckContact(){
	var TheForm = document.contact_form;
	var url = "data_"+ language +".xml";
	if(TheForm.name.value == ""){
		ReadXML(url,"CONTACT_FORM","YOUR_NAME_EMPTY");
		TheForm.name.focus();
	}else if(TheForm.email.value == ""){
		ReadXML(url,"CONTACT_FORM","YOUR_EMAIL_EMPTY");
		TheForm.email.focus();
	}else if(!isEmailAddr(TheForm.email.value)){
		ReadXML(url,"CONTACT_FORM","YOUR_EMAIL_ERROR");
		TheForm.email.focus();
	}else if(TheForm.subject.value == ""){
		ReadXML(url,"CONTACT_FORM","SUBJECT_EMPTY");
		TheForm.subject.focus();
	}else if(TheForm.message.value == ""){
		ReadXML(url,"CONTACT_FORM","MESSAGE_EMPTY");
		TheForm.message.focus();
	}else{
		name = encodeURI(TheForm.name.value);
		email = TheForm.email.value;
		subject = encodeURI(TheForm.subject.value);
		message = encodeURI(TheForm.message.value);
		show_loading();
		$.post("contact.asp",{"name":name,"email":email,"subject":subject,"message":message},function(data){
			if(data.status == "true"){				
				show_lightbox("success",278,100,"SEND_FRIEND_FORM","SEND_SUCCESS");
			}else{
				show_lightbox("warning",278,150,"SEND_FRIEND_FORM","SEND_ERROR");
			}
		} , "json");
	}
}

function show_alert_box(){
	$("#alert_box").stop();
	$("#alert_box").fadeTo(2500,1,function(){
		$("#alert_box").fadeTo("slow",0,function(){
			$("#alert_box").html("");
			$("#alert_box").fadeTo(0,1);
		});
	});
}
function CheckRegister(url){
	var TheForm = document.form_regis;
	var i=0;
	if(TheForm.first_name.value == ""){
		ReadXML(url,"REGISTRATION_FORM","FIRST_NAME_EMPTY");
		TheForm.first_name.focus();
	}else if(TheForm.last_name.value == ""){
		ReadXML(url,"REGISTRATION_FORM","LAST_NAME_EMPTY");
		TheForm.last_name.focus();
	}else if((!TheForm.title[0].checked) && (!TheForm.title[1].checked) && (!TheForm.title[2].checked)){
		ReadXML(url,"REGISTRATION_FORM","TITLE_EMPTY");
		TheForm.title[0].focus();
	}else if(TheForm.dd.value == ""){
		ReadXML(url,"REGISTRATION_FORM","BIRTH_DATE_DD_EMPTY");
		TheForm.dd.focus();
	}else if(TheForm.mm.value == ""){
		ReadXML(url,"REGISTRATION_FORM","BIRTH_DATE_MM_EMPTY");
		TheForm.mm.focus();
	}else if(TheForm.yyyy.value == ""){
		ReadXML(url,"REGISTRATION_FORM","BIRTH_DATE_YYYY_EMPTY");
		TheForm.yyyy.focus();
	}else if(TheForm.country.value == ""){
		ReadXML(url,"REGISTRATION_FORM","COUNTRY_EMPTY");
		TheForm.country.focus();
	}else if(TheForm.education.value == ""){
		ReadXML(url,"REGISTRATION_FORM","EDUCATION_EMPTY");
		TheForm.education.focus();
	}else if(TheForm.occupation.value == ""){
		ReadXML(url,"REGISTRATION_FORM","OCCUPATION_EMPTY");
		TheForm.occupation.focus();
	}else if(TheForm.income.value == ""){
		ReadXML(url,"REGISTRATION_FORM","INCOME_EMPTY");
		TheForm.income.focus();
	}else if(TheForm.status.value == ""){
		ReadXML(url,"REGISTRATION_FORM","STATUS_EMPTY");
		TheForm.status.focus();
	}else if(TheForm.address.value == ""){
		ReadXML(url,"REGISTRATION_FORM","ADDRESS_EMPTY");
		TheForm.address.focus();
	}else if(TheForm.street.value == ""){
		ReadXML(url,"REGISTRATION_FORM","STREET_EMPTY");
		TheForm.street.focus();
	}else if(TheForm.city.value == ""){
		ReadXML(url,"REGISTRATION_FORM","CITY_EMPTY");
		TheForm.city.focus();
	}else if(TheForm.state.value == ""){
		ReadXML(url,"REGISTRATION_FORM","STATE_EMPTY");
		TheForm.state.focus();
	}else if(TheForm.zip.value == ""){
		ReadXML(url,"REGISTRATION_FORM","ZIP_EMPTY");
		TheForm.zip.focus();
	}else if((TheForm.zip.value.length != 5) || (isNaN(TheForm.zip.value))){
		ReadXML(url,"REGISTRATION_FORM","ZIP_ERROR");
		TheForm.zip.focus();
	}else if(TheForm.tel_no.value == ""){
		ReadXML(url,"REGISTRATION_FORM","TEL_NO_EMPTY");
		TheForm.tel_no.focus();
	}else if((TheForm.tel_no.value.length != 9) || (isNaN(TheForm.tel_no.value))){
		ReadXML(url,"REGISTRATION_FORM","TEL_NO_ERROR");
		TheForm.tel_no.focus();
	}else if(TheForm.email.value == ""){
		ReadXML(url,"REGISTRATION_FORM","EMAIL_EMPTY");
		TheForm.email.focus();
	}else if(!isEmailAddr(TheForm.email.value)){
		ReadXML(url,"REGISTRATION_FORM","EMAIL_ERROR");
		TheForm.email.focus();
	}else if(TheForm.password.value == ""){
		ReadXML(url,"REGISTRATION_FORM","PASSWORD_EMPTY");
		TheForm.password.focus();
	}else{
		email = TheForm.email.value;
		$.post("regis.php",{"email":email,"act":"check"},function(data){
			if(data.status == "true"){
				
			first_name = encodeURI(TheForm.first_name.value);
			last_name = encodeURI(TheForm.last_name.value);
			for(i = 0; i < TheForm.title.length; i++){
				if(TheForm.title[i].checked == true){
					title = TheForm.title[i].value;
				}
			}
			dd = TheForm.dd.value;
			mm = TheForm.mm.value;
			yyyy = TheForm.yyyy.value;
			country = TheForm.country.value;
			education = TheForm.education.value;
			occupation = TheForm.occupation.value;
			income = TheForm.income.value;
			statuss = TheForm.status.value;
			address = encodeURI(TheForm.address.value);
			street = encodeURI(TheForm.street.value);
			city = encodeURI(TheForm.city.value);
			state = TheForm.state.value;
			zip = TheForm.zip.value;
			tel_no = TheForm.tel_no.value;
			mobile_no = TheForm.mobile_no.value;
			email = TheForm.email.value;
			favorite_lobo1 = TheForm.favorite_lobo1.value;
			favorite_lobo2 = TheForm.favorite_lobo2.value;
			favorite_lobo3 = TheForm.favorite_lobo3.value;
			for(i=0;i < TheForm.update_news_by.length;i++){
				if(TheForm.update_news_by[i].checked == true){
					update_news_by = TheForm.update_news_by[i].value;
				}
			}
			for(i=0;i<TheForm.share_info.length;i++){
				if(TheForm.share_info[i].checked == true){
					share_info = TheForm.share_info[i].value;
				}
			}
			password = TheForm.password.value;
				
			show_loading();
			$.post("regis.php",{"first_name":first_name,"last_name":last_name,"title":title,"dd":dd,"mm":mm,"yyyy":yyyy,"country":country,"education":education,"occupation":occupation,"income":income,"status":statuss,"address":address,"street":street,"city":city,"state":state,"zip":zip,"tel_no":tel_no,"mobile_no":mobile_no,"email":email,"favorite_lobo1":favorite_lobo1,"favorite_lobo2":favorite_lobo2,"favorite_lobo3":favorite_lobo3,"update_news_by":update_news_by,"share_info":share_info,"password":password}, function(data)      
				{
					if(data.status == "true"){
						show_lightbox("success",278,100,"REGISTRATION_FORM","REGIS_SUCCESS");
					}else{
						show_lightbox("warning",278,150,"REGISTRATION_FORM","REGIS_ERROR");
					}
				} , "json");
			}else{
				ReadXML(url,"REGISTRATION_FORM","EMAIL_DUPLICATE");
				TheForm.email.focus();
			}
		},"json");
	}

}

function CheckSignin(url){
	var TheForm = document.signin_form;
	if(TheForm.email.value == ""){
		ReadXML(url,"SIGNIN_FORM","USER_NAME_EMPTY");
		TheForm.email.focus();
	}else if(!isEmailAddr(TheForm.email.value)){
		ReadXML(url,"SIGNIN_FORM","USER_NAME_ERROR");
		TheForm.email.focus();
	}else if(TheForm.password.value == ""){
		ReadXML(url,"SIGNIN_FORM","PASSWORD_EMPTY");
		TheForm.password.focus();
	}else{
		email = TheForm.email.value;
		password = encodeURI(TheForm.password.value);
		show_loading();
		$.post("signin.php",{"email":email,"password":password},function(data){
			if(data.status == "true"){				
				show_lightbox("success",278,100,"SIGNIN_FORM","SIGNIN_SUCCESS");
				$("#login_panel").html('<table width="376" border="0" cellspacing="0" cellpadding="0"><tr><td width="250" background="images_'+ language +'/username.gif"><table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td width="13">&nbsp;</td><td width="237">'+ data.title +' '+ data.first_name +'</td></tr></table></td><td width="126"><a href="javascript:void(0);" onClick=""><img src="images_'+ language +'/signout.gif" width="126" height="38" border="0" /></a></td></tr></table>');
			}else{
				show_lightbox("warning",278,150,"SIGNIN_FORM","SIGNIN_ERROR");
			}
		} , "json");
			
	}
}

function SigninContent(act){
	$.post("signin.php",{"act":act},function(data){
		if(data.status == "false"){
			$("#login_panel").html('<table width="376" border="0" cellspacing="0" cellpadding="0"><tr><td><a href="javascript:void(0);" onclick="show_lightbox(\'regis\',364,278);"><img src="images_'+ language +'/joinnow.gif" width="250" height="38" border="0" /></a></td><td><a href="javascript:void(0);" onclick="show_lightbox(\'signin\',278,89);"><img src="images_'+ language +'/signin.gif" width="126" height="38" border="0" /></a></td></tr></table>');
		}else{
			$("#login_panel").html('<table width="376" border="0" cellspacing="0" cellpadding="0"><tr><td width="250" background="images_'+ language +'/username.gif"><table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td width="13">&nbsp;</td><td width="237">'+ data.title +' '+ data.first_name +'</td></tr></table></td><td width="126"><a href="javascript:void(0);" onClick="SigninContent(\'signout\')"><img src="images_'+ language +'/signout.gif" width="126" height="38" border="0" /></a></td></tr></table>');
		}
	} , "json");
}


function CheckInquiery(){
	var TheForm = document.inquiery_form;
	var url = "data_"+ language +".xml";
	if(TheForm.email.value == ""){
		ReadXML(url,"SIGNIN_FORM","USER_NAME_EMPTY");
		TheForm.email.focus();
	}else if(!isEmailAddr(TheForm.email.value)){
		ReadXML(url,"SIGNIN_FORM","USER_NAME_ERROR");
		TheForm.email.focus();
	}else{
		email = TheForm.email.value;
		if(TheForm.vdo.checked == true){
			vdos = "Y"; 
		}else{
			vdos = "N";
		}
		if(TheForm.blog.checked == true){
			blogs = "Y"; 
		}else{
			blogs = "N";
		}
		show_loading();
		$.post("inquiery.php",{"email":email,"vdo":vdos,"blog":blogs},function(data){
			if(data.status == "true"){				
				show_lightbox("success",278,100,"EMAIL_UPDATE_FORM","POST_SUCCESS");
			}else{
				show_lightbox("warning",278,150,"EMAIL_UPDATE_FORM","POST_ERROR");
			}
		} , "json");
			
	}
}

function CheckForgotPassword(){
	var TheForm = document.forgot_form;
	var url = "data_"+ language +".xml";
	if(TheForm.email.value == ""){
		ReadXML(url,"FORGOT_PASSOWRD_FORM","EMAIL_EMPTY");
		TheForm.email.focus();
	}else if(!isEmailAddr(TheForm.email.value)){
		ReadXML(url,"FORGOT_PASSOWRD_FORM","EMAIL_ERROR");
		TheForm.email.focus();
	}else{
		email = TheForm.email.value;
		
		show_loading();
		$.post("forgot.php",{"email":email},function(data){
			if(data.status == "email"){				
				show_lightbox("warning",278,150,"FORGOT_PASSOWRD_FORM","NOT_FOUND_EMAIL");
			}else if(data.status == "true"){
				show_lightbox("success",278,100,"FORGOT_PASSOWRD_FORM","SEND_SUCCESS");
			}else{
				show_lightbox("warning",278,150,"FORGOT_PASSOWRD_FORM","SEND_ERROR");
			}
		} , "json");
			
	}
}

function cross_link(page){
	$("#cross_link").load("cross_link.php?page="+ page,function(){});
}

(function($) {
	
	$.fn.pngfix = function(options) {

		var elements 	= this;
		var settings 	= $.extend({
			imageFixSrc: 	false,
			sizingMethod: 	false 
		}, options);
		
		if(!$.browser.msie || ($.browser.msie &&  $.browser.version >= 7)) {
			return(elements);
		}

		function setFilter(el, path, mode) {
			var fs = el.attr("filters");
			var alpha = "DXImageTransform.Microsoft.AlphaImageLoader";
			if (fs[alpha]) {
				fs[alpha].enabled = true;
				fs[alpha].src = path; 
				fs[alpha].sizingMethod = mode;
			} else {
				el.css("filter", 'progid:' + alpha + '(enabled="true", sizingMethod="' + mode + '", src="' + path + '")');			
			}
		}
		
		function setDOMElementWidth(el) {
			if(el.css("width") == "auto" & el.css("height") == "auto") {
				el.css("width", el.attr("offsetWidth") + "px");
			}
		}

		return(
			elements.each(function() {

				var el = $(this);
				
				if(el.attr("tagName").toUpperCase() == "IMG" && (/\.png/i).test(el.attr("src"))) {
					if(!settings.imageFixSrc) {
						el.wrap("<span></span>");
						var par = el.parent();
						par.css({
							height: 	el.height(),
							width: 		el.width(),
							display: 	"inline-block"
						});
						setFilter(par, el.attr("src"), "scale");
						el.remove();
					} else if((/\.gif/i).test(settings.imageFixSrc)) {
						
						setDOMElementWidth(el);
						setFilter(el, el.attr("src"), "image");
						el.attr("src", settings.imageFixSrc);
					}
					
				} else {
					var bg = new String(el.css("backgroundImage"));
					var matches = bg.match(/^url\("(.*)"\)$/);
					if(matches && matches.length) {
						
						setDOMElementWidth(el);
						el.css("backgroundImage", "none");
						
						var sc = "crop";
						if(settings.sizingMethod) {
							sc = settings.sizingMethod;
						} 
						setFilter(el, matches[1], sc);

						el.find("a").each(function() {
							$(this).css("position", "relative");
						});


					}
				}
				
			})
		);
	}

})(jQuery)