$(function(){

             $('.slide-out-div').tabSlideOut({

                 tabHandle: '.handle',                              //class of the element that will be your tab

				 id: '.handle',

                 imageHeight: '510px',                               //height of tab image

                 imageWidth: '25px',                               //width of tab image   

                 tabLocation: 'left',

				 topPos: '0px',                                //side of screen where tab lives, top, right, bottom, or left

                 speed: 300,                                        //speed of animation

                 action: 'click',                                   //options: 'click' or 'hover', action to trigger animation

                 fixedPosition: false                               //options: true makes it stick(fixed position) on scroll

             });

			 

			 $('.slide-out-div1').tabSlideOut({

                 tabHandle: '.handle1',                           

				 id: '.handle1',

                 imageHeight: '510px',                    

                 imageWidth: '25px',   

				 topPos: '0px',                        

                 tabLocation: 'left',                           

                 speed: 300,                                  

                 action: 'click',                             

                 fixedPosition: false                             

             });

			 

			 

			  $('.slide-out-div2').tabSlideOut({

                 tabHandle: '.handle2',                         

				 id: '.handle2',

                 imageHeight: '510px',                           

                 imageWidth: '25px',   

				 topPos: '0px',                         

                 tabLocation: 'left',                           

                 speed: 300,                                       

                 action: 'click',                                  

                 fixedPosition: false                             

             });

			 

			   $('.slide-out-div3').tabSlideOut({

                 tabHandle: '.handle3',                         

				 id: '.handle3',

                 imageHeight: '510px',                           

                 imageWidth: '25px',   

				 topPos: '0px',                         

                 tabLocation: 'left',                           

                 speed: 300,                                       

                 action: 'click',                                  

                 fixedPosition: false                             

             });

			 

			 

			   $('.slide-out-div4').tabSlideOut({

                 tabHandle: '.handle4',                         

				 id: '.handle4',

                 imageHeight: '510px',                           

                 imageWidth: '25px',   

				 topPos: '0px',                         

                 tabLocation: 'left',                           

                 speed: 300,                                       

                 action: 'click',                                  

                 fixedPosition: false                             

             });

			 

			 

			 

			   $('.slide-out-div5').tabSlideOut({

                 tabHandle: '.handle5',                         

				 id: '.handle5',

                 imageHeight: '510px',                           

                 imageWidth: '25px',   

				 topPos: '0px',                         

                 tabLocation: 'left',                           

                 speed: 300,                                       

                 action: 'click',                                  

                 fixedPosition: false                             

             });

			 

			 

         });

function example_animate(px,id) {



	document.getElementById("div-sub-rec").style.display = 'none';

	document.getElementById("div-sub-prod").style.display = 'none';

	document.getElementById("pro-submenu-main").style.zIndex = '1';

	document.getElementById("recipe-submenu-main").style.zIndex = '1';	



	 var rollpxnew = "0px";

	 

	 $("#7").animate({"marginLeft": rollpxnew }, "slow");





	 $("#8").animate({"marginRight": rollpxnew }, "slow");





	if(id == 1)

	{

	

		pxnew = "0px";

		right_img=document.getElementById("home_slidein_image").value;
		
		setTimeout("chgImg('"+right_img+"')",300);


		//document.getElementById("imgsrc").src = '/media/files/'+right_img+'';

		hide_otherslide(id);

		$("#img1").animate({"marginRight": pxnew }, "slow");		

		hide_submenu();

		

	}

	else if(id == 2)

	{

		pxnew = "0px";

		document.getElementById('aboutContent').style.display='';

		//init_dw_Scroll1();

		right_img=document.getElementById("about_slidein").value;
		
		setTimeout("chgImg('"+right_img+"')",300);
		

		//document.getElementById("imgsrc").src = '/media/files/'+right_img+'';

		hide_otherslide(id);

		$("#img1").animate({"marginRight": pxnew }, "slow");		

		hide_submenu();

		setTimeout("init_dw_Scroll1()",1000);

	}

	else if(id == 3)

	{

		pxnew = "0px";

		right_img=$("#product_slidein").val();
		
		bgImage=$("#product_background").val();
		
		
		
		setTimeout("chgImg('"+right_img+"')",300);
		

		//document.getElementById("imgsrc").src = '/media/files/'+right_img+'';	

		hide_otherslide(id);
		orginalImg = "url('/media/files/"+bgImage+"')";
		
		$("#3").css('background-image', orginalImg);

		$("#img1").animate({"marginRight": pxnew }, "slow");

		//$("#div-head-prod").fadeIn(1000);

		document.getElementById("div-head-prod").style.display = 'block';

		document.getElementById("div-head-recipe").style.display = 'none';

		//$("#div-head-recipe").fadeOut("fast");

			

				

	}

	

	else if(id == 4)

	{

		
		document.getElementById("menuMain").style.backgroundImage = '';

		document.getElementById("content-main").style.left = '-980px';

		pxnew = "0px";

		right_img=$("#recipe_slidein").val();
		
		setTimeout("chgImg('"+right_img+"')",500);
		
		//document.getElementById("imgsrc").src = '/media/files/'+right_img+'';		

		hide_otherslide(id);	

		$("#img1").animate({"marginRight": pxnew }, "slow");

		//$("#div-head-prod").fadeOut("fast");

		document.getElementById("div-head-prod").style.display = 'none';	

		document.getElementById("div-head-recipe").style.display = 'block';

		//$("#div-head-recipe").fadeIn(1000);

		

	}

	

	else if(id == 5)

	{

		pxnew = "0px";

		document.getElementById('stockist_main').style.display='block';

		document.getElementById('scrollbar').style.display='block';

		init_dw_Scroll();

		right_img=$("#stockist_slidein").val();
		
		setTimeout("chgImg('"+right_img+"')",300);
		

		//document.getElementById("imgsrc").src = '/media/files/'+right_img+'';	

		hide_otherslide(id);

		$("#img1").animate({"marginRight": pxnew }, "slow");		

		hide_submenu();	

	}

	else

	{

		pxnew = "0px";

		right_img=document.getElementById("contact_slidein").value;
		
		setTimeout("chgImg('"+right_img+"')",300);
		

		//document.getElementById("imgsrc").src = '/media/files/'+right_img+'';

		hide_otherslide(id);

		$("#img1").animate({"marginRight": pxnew }, "slow");		

		hide_submenu();

		init_dw_Scroll2();

	}



	

	if(id !=4)

{	

	document.getElementById('8').style.display='none';
	
	document.getElementById("menuMain").style.backgroundImage = 'url(/media/images/bg-menu.gif)';

	document.getElementById("content-main").style.left = '0px';

	
}

	var idnew = '#'+id;
	var pxgnew = 980;
	//alert(id);
	//alert(px);
	$(idnew).animate({"marginLeft": px }, "slow");
	$("#img1").animate({"marginRight": pxgnew }, "slow");	
}

function subProducts(id,zindexdiv){
	var px = 0;
	var idnew = '#'+id;
	if(id == "div-sub-prod")
	{
		document.getElementById("div-sub-rec").style.display = 'none';
		document.getElementById(zindexdiv).style.zIndex = '10';
	}
	else
	{
		document.getElementById("div-sub-prod").style.display = 'none';
		document.getElementById(zindexdiv).style.zIndex = '10';
	}
	document.getElementById(id).style.display = 'block';
	$(idnew).animate({"marginLeft": px }, "slow");
	//document.getElementById("div-sub-prod").style.display = 'block';
}
function detailproduct(iddisp,slideImg){
	var pxnew1 = 980;
	var pxnew2 = 0;
	$("#img1").animate({"marginRight": pxnew2 }, "slow");		
	$("#3").animate({"marginLeft": pxnew2 }, "slow"); 
	$("#3").css('background-image','');
	//example_animate('730px','3');
	
/*	
Product background image
if(slideImg!=''){
		document.getElementById("imgsrc").src = '/media/files/'+slideImg+'';
		}
	else
	{
	document.getElementById("imgsrc").src = '/media/images/cont-pics-rgt.jpg';
	}
	$("#img1").animate({"marginRight": pxnew1 }, "slow");
	*/
	
	var px = '-200px';
	var idnew = '#div-sub-prod';
	document.getElementById("pro-submenu-main").style.zIndex = '1';	
	$("#8").animate({"marginRight": pxnew2 }, "slow");		
	$(idnew).animate({"marginLeft": px }, "slow");

	var html = $.ajax({
  					url: "/page/itemId/"+iddisp,

  					async: false

 				}).responseText;

	html_new = html.replace(/'/gi,'@@@');
	html ="'"+encodeURIComponent(html_new)+"'";
    var pxnew = "730px";
	var rollpxnew = "0px";
    $("#7").animate({"marginLeft": rollpxnew }, "slow");

	 $("#7").animate({"marginLeft": pxnew }, "slow");

	 //getContent(html);

	 setTimeout("getContent("+html+")",400);
$("#3").animate({"marginLeft": 730}, "slow");
}

function getContent(html)
{
	var curr_html = decodeURIComponent(html);
	var htm=  curr_html.replace(/@@@/gi,"'");
	document.getElementById("7").innerHTML = htm;
	init_dw_Scroll4();
}

function getContentRecipe(html)
{
	var curr_html = decodeURIComponent(html);
	var htm = curr_html.replace(/@@@/gi,"'");
	document.getElementById("8").innerHTML =htm;
	init_dw_Scroll3();
}

function chgImg(img){

	document.getElementById("imgsrc").src = '/media/files/'+img+'';
}

function disable_menu_image(){
	document.getElementById("menuMain").style.backgroundImage = '';
	}
function detailrecipe(iddisp,slideImg){
	
	var arrow_id ='Reci_'+iddisp;

	var pxnew1 = 980;
	var pxnew2 = 0;
	$("#img1").animate({"marginRight": pxnew2 }, "slow");		
	//
	$("#content-main").animate({"left": -980 }, "slow");	
	//document.getElementById("content-main").style.left = '-980px';
	

	setTimeout("chgImg('"+slideImg+"')",300);
	setTimeout("disable_menu_image()",300);

	$("#7").animate({"marginRight": pxnew2 }, "slow");		

	$("#img1").animate({"marginRight": pxnew1 }, "slow");		
	var px = '-400px';
	var idnew = '#div-sub-rec';
    $(idnew).animate({"marginLeft": px }, "slow");
	var html = $.ajax({

  					url: "/page/recipe/recipeId/"+iddisp,

  					async: false

 				}).responseText;
	
	

	 html_new = html.replace(/'/gi,'@@@');
	  html ="'"+encodeURIComponent(html_new)+"'";
	 // alert(html);

	 //document.getElementById("8").innerHTML =html;

	 setTimeout("getContentRecipe("+html+")",400);



	 var pxnew = "548px";

	 var rollpxnew = "0px";

	document.getElementById("recipe-submenu-main").style.zIndex = '1';	
	
	document.getElementById("8").style.display='';

	 $("#8").animate({"marginRight": rollpxnew }, "slow");

	setTimeout("slow_slice_recipe('"+pxnew+"')",2000);
	setTimeout("chgRecipeArrow('"+arrow_id+"','arrow-rgt.gif')",5500);

	 
}


function slow_slice_recipe(pxnew){
	$("#8").animate({"marginRight": pxnew }, 3600);
}


function hide_otherslide(id)
{

	for(var i=1; i<=6; i++)

		{

			if(i!=id)

			 {

				$("#"+i+"").animate({"marginLeft": pxnew }, "slow"); 

			 }

			

		}

}



function hide_submenu()

{

	document.getElementById("div-head-prod").style.display = 'none';

	document.getElementById("div-head-recipe").style.display = 'none';

	

}

function onclickRecipe(idnew,imagename){

	//example_animate('730px','4');
	hide_submenu();

	$('.slide-out-div2').animate({left:'-350px'},  300).removeClass('open');
	$("#3").animate({"marginLeft": 0 }, "slow"); 
	//document.getElementById("3").style.marginLeft="0px";
	$("#7").animate({"marginLeft": 0 }, "slow"); 
	//document.getElementById("7").style.marginLeft="0px";
	
	//detailrecipe('12','3_4af00a2d0d756.jpg');

	detailrecipe(idnew,imagename);
	//document.getElementById("div-head-recipe").style.display = '';
	//$('.slide-out-div3').animate({left:'-75px'},  2000).addClass('open');

	setTimeout("tes()",1);
	}

	function tes(){
		document.getElementById("div-head-recipe").style.display = '';
		$('.slide-out-div3').animate({left:'-75px'},  300).addClass('open');
		}
	

function onclickProduct(id,image){
	
hide_submenu();


	$('.slide-out-div3').animate({left:'-350px'},  300).removeClass('open');
	document.getElementById("menuMain").style.backgroundImage = 'url(/media/images/bg-menu.gif)';
	
//document.getElementById("pro-submenu-main").style.zIndex = '10';	
//example_animate('730px','3')


document.getElementById("menuMain").style.backgroundImage = 'url(/media/images/bg-menu.gif)';

	document.getElementById("content-main").style.left = '0px';

	detailproduct(id,image);
	//document.getElementById("3").style.marginLeft=730+"px";
	setTimeout("testing()",1);
	}	
	
	function testing(){
	
	$('.slide-out-div2').animate({left:'-50px'},  300).addClass('open');
	document.getElementById("div-head-prod").style.display ='';
	document.getElementById("div-sub-prod").style.display ='';
	document.getElementById("3").style.marginLeft=730+"px";
	
	}	
	

function onclickProductnew(com){
	
	if(com.title == "open")
	{
		//alert("enters1");
	
	 var pxnew = "37px";



	 var rollpxnew = "0px";

	document.getElementById("recipe-submenu-main").style.zIndex = '1';	

	 //$("#8").animate({"marginRight": rollpxnew }, "slow");


	 $("#8").animate({"marginRight": pxnew }, 4000);
	
	document.getElementById(com.id).title = 'close';
	
	setTimeout("chgRecipeArrow('"+com.id+"','arrow-lft.gif')",4000);
	
	
	}
	else
	
	{
				//alert("enters2");
	document.getElementById(com.id).title = 'open';
	
	 var pxnew = "540px";



	 var rollpxnew = "0px";

	document.getElementById("recipe-submenu-main").style.zIndex = '1';	

	 //$("#8").animate({"marginRight": rollpxnew }, "slow");


	 $("#8").animate({"marginRight": pxnew }, 4000);
	
	setTimeout("chgRecipeArrow('"+com.id+"','arrow-rgt.gif')",4000);
	}
	//com.title = "close";

}		

function chgRecipeArrow(id,Img){
	var currImg = '/media/files/'+Img;
	document.getElementById(id).innerHTML ='<img src="'+currImg+'" />'
	}

	
function createCookie(name, value, days)
{
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
    }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
  var ca = document.cookie.split(';');
  var nameEQ = name + "=";
  for(var i=0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
  return null;
}

function eraseCookie(name)
{
  createCookie(name, "", -1);
}


function onloadflash(){
	if(readCookie('flashcheck') == 1)
	{
	$("#flashdiv").hide();
	//eraseCookie('flashcheck');
	}
	else
	createCookie('flashcheck', 1, 1);

}

function chageImageover(itemId,ImageName,thisvalue){
	$(thisvalue).attr('src','/media/files/'+ImageName);
	
}

function chageImageout(itemId,ImageName,thisvalue){
	$(thisvalue).attr('src','/media/files/'+ImageName);
	
}

function showProductDiv(id){
	document.getElementById(id).style.display = 'block';	
	document.getElementById("pro-submenu-main").style.zIndex = '10';
	
}
function hideProductDiv(id){
	document.getElementById("pro-submenu-main").style.zIndex = '1';		
	document.getElementById(id).style.display = 'none';
	
}
function showRecipeDiv(id){
	document.getElementById("recipe-submenu-main").style.zIndex = '10';	
	document.getElementById(id).style.display = 'block';	
}
function hideRecipeDiv(id){
document.getElementById("recipe-submenu-main").style.zIndex = '1';		
	document.getElementById(id).style.display = 'none';	
}
