// JavaScript Document
function cleanClass(){	
	$(".footer li a").each(function(){
		$(this).removeClass("active");
	});
	$(".menu li a").each(function(){
		$(this).removeClass("active");
	});
	$('#bg').removeClass();	
}

function showGeneral(){
	$('#generaltext').show('fast');
	$('#detailstext').hide('fast');
	$('#advicestext').hide('fast');
	$('#recipestext').hide('fast');	
	$('#general').addClass("active");
	$('#details').removeClass("active");
	$('#advices').removeClass("active");
	$('#recipes').removeClass("active");	
}
function showDetails(){
	$('#generaltext').hide('fast');
	$('#detailstext').show('fast');
	$('#advicestext').hide('fast');
	$('#recipestext').hide('fast');	
	$('#general').removeClass("active");
	$('#details').addClass("active");
	$('#advices').removeClass("active");
	$('#recipes').removeClass("active");	
}
function showAdvices(){
	$('#generaltext').hide('fast');
	$('#detailstext').hide('fast');
	$('#advicestext').show('fast');
	$('#recipestext').hide('fast');	
	$('#general').removeClass("active");
	$('#details').removeClass("active");
	$('#advices').addClass("active");
	$('#recipes').removeClass("active");	
}
function showRecipes(){
	$('#generaltext').hide('fast');
	$('#detailstext').hide('fast');
	$('#advicestext').hide('fast');
	$('#recipestext').show('fast');	
	$('#general').removeClass("active");
	$('#details').removeClass("active");
	$('#advices').removeClass("active");
	$('#recipes').addClass("active");	
}




function amita1(){
	
	$('#amita1').addClass("active");
	$('#amita2').removeClass();
}
function amita2(){
	$('#amita1').removeClass();
	$('#amita2').addClass("active");
}



function life1(){
	
	$('#life1').addClass("active");
	$('#life2').removeClass();
	$('#life3').removeClass();
	$('#life4').removeClass();	
	$('#life5').removeClass();
	$('#bg').removeClass();
	$('#bg').addClass("kouzina");
}
function life2(){
	$('#life1').removeClass();
	$('#life2').addClass("active");
	$('#life3').removeClass();
	$('#life4').removeClass();	
	$('#life5').removeClass();
	$('#bg').removeClass();
	$('#bg').addClass("grafeio");
}
function life3(){
	$('#life1').removeClass();
	$('#life2').removeClass();
	$('#life3').addClass("active");
	$('#life4').removeClass();	
	$('#life5').removeClass();
	$('#bg').removeClass();
	$('#bg').addClass("parea");
}
function life4(){
	$('#life1').removeClass();
	$('#life2').removeClass();
	$('#life3').removeClass();
	$('#life4').addClass("active");
	$('#life5').removeClass();
	$('#bg').removeClass();
	$('#bg').addClass("zeugari");
}
function life5(){
	$('#life1').removeClass();
	$('#life2').removeClass();
	$('#life3').removeClass();
	$('#life4').removeClass();	
	$('#life5').addClass("active");
	$('#bg').removeClass();
	$('#bg').addClass("ekdromi");
}



function tetrapak1(){	
	$('#tetrapak1').addClass("active");
	$('#tetrapak2').removeClass();
	$('#tetrapak3').removeClass();
}
function tetrapak2(){
	$('#tetrapak1').removeClass();
	$('#tetrapak2').addClass("active");
	$('#tetrapak3').removeClass();
}
function tetrapak3(){
	$('#tetrapak1').removeClass();
	$('#tetrapak2').removeClass();
	$('#tetrapak3').addClass("active");
}
//function callHideFromParent(){
//d = document;
//f = d.frames ? d.frames['mediaFrame'] : //d.getElementById('mediaFrame');
//p = f.document || f.contentWindow.document;

//p.hideVideo();
	
//}


function hideVideo(){
	$('#allVideos').show('fast');
	$('#summer').hide('fast');
	$('#video1').hide('fast');
	$('#video2').hide('fast');
	$('#video3').hide('fast');
	$('#video4').hide('fast');		
	//$('#playerID').get(0).stopVideo();
}
function showSummer(){
	$('#summer').show('fast');
	$('#video1').hide('fast');
	$('#video2').hide('fast');
	$('#video3').hide('fast');
	$('#video4').hide('fast');	
	$('#allVideos').hide('fast');	
}
function showVideo1(){
	$('#summer').hide('fast');
	$('#video1').show('fast');
	$('#video2').hide('fast');
	$('#video3').hide('fast');
	$('#video4').hide('fast');	
	$('#allVideos').hide('fast');	
}
function showVideo2(){
	$('#summer').hide('fast');
	$('#video1').hide('fast');
	$('#video2').show('fast');
	$('#video3').hide('fast');
	$('#video4').hide('fast');	
	$('#allVideos').hide('fast');	
}
function showVideo3(){
	$('#summer').hide('fast');
	$('#video1').hide('fast');
	$('#video2').hide('fast');
	$('#video3').show('fast');
	$('#video4').hide('fast');	
	$('#allVideos').hide('fast');	
}
function showVideo4(){
	$('#summer').hide('fast');
	$('#video1').hide('fast');
	$('#video2').hide('fast');
	$('#video3').hide('fast');
	$('#video4').show('fast');	
	$('#allVideos').hide('fast');	
}




 $(document).ready(function(){ 
 $(document).bind("contextmenu",function(e){
		return false;
	});
 			$('#bg').addClass("kalokairi");

			$("#click").click(function(){ 
				$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
				return false;
			});
 var paneOptions=$("#panel");
 
  $('#tasteMenu1').hide('fast');	
		$('#tasteMenu2').hide('fast');	
		$('#tasteMenu3').hide('fast');
		$('[id^="tastebox_"]').hide('fast');
  
  hideVideo();
  
 $.easing.elasout = function(x, t, b, c, d) {
	 return -c * ((t=t/d-1)*t*t*t - 1) + b;
	 
	 
	 
	 
	 
	 
		/*var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;*/
	};
		// This one is important, many browsers don't reset scroll on refreshes
	// Reset all scrollable panes to (0,0)
	//$('#panel').scrollTo( 0 );
	// Reset the screen to (0,0)
	//$.scrollTo( 0 );
	
	// Options examples bindings, they will all scroll to the same place, with different options
	function reset_o(){//before each animation, reset to (0,0), skip this.
		//paneOptions.stop(true).attr({scrollLeft:0, scrollTop:0});
	};
	
	 	$('#logo').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page0', 1000, { axis:'x',easing:'elasout' } );
		$('.slideshow').cycle('resume'); 
		cleanClass();
		$('#bg').addClass("kalokairi");
		 document.getElementById("mediaFrame").src='tvc.html'
	});
	
	 $('#events').click(function(){
		 $('#events').addClass("active");
		 $('#tvc').removeClass();
		 $('#awards').removeClass();		 
	});
	
	 $('#tvc').click(function(){
		 $('#tvc').addClass("active");
		 $('#events').removeClass();
		 $('#awards').removeClass();	
	});
	$('#awards').click(function(){
		 $('#awards').addClass("active");
		 $('#events').removeClass();
		 $('#tvc').removeClass();	
	});
	
	
	
	$('#tasteCat1').click(function(){
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').show('fast');	
		$('#tasteMenu2').hide('fast');	
		$('#tasteMenu3').hide('fast');
		$('#tasteintro').hide('fast');
		$('#tastebox_1').show('fast');	
			
		
	});
	$('#tasteCat2').click(function(){
		$('[id^="tastebox_"]').hide('fast');
		$('#tastebox_7').show('fast');	
		$('#tasteMenu1').hide('fast');	
		$('#tasteMenu2').show('fast');	
		$('#tasteMenu3').hide('fast');
		$('#tasteintro').hide('fast');
		
	});
	$('#tasteCat3').click(function(){
		$('[id^="tastebox_"]').hide('fast');
		$('#tastebox_17').show('fast');	
		$('#tasteMenu1').hide('fast');	
		$('#tasteMenu2').hide('fast');	
		$('#tasteMenu3').show('fast');
		$('#tasteintro').hide('fast');
		
	});
	$('.marginL15').click(function(){
		$('#tasteMenu1').hide('fast');	
		$('#tasteMenu2').hide('fast');	
		$('#tasteMenu3').hide('fast');
		$('#tasteintro').show('fast');
		$('#tastebox_1').hide('fast');	
					
	});
	
	$('#taste_1').click(function(){
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').show('fast');	
		$('#tastebox_1').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("classic");
	});
	$('#taste_2').click(function(){
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').show('fast');	
		$('#tastebox_2').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("extra_c");
	});
	$('#taste_3').click(function(){
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').show('fast');	
		$('#tastebox_3').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("acid");
	});
	$('#taste_4').click(function(){
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').show('fast');	
		$('#tastebox_4').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("nectar");
	});
	$('#taste_5').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').show('fast');	
		$('#tastebox_5').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("pmv");
	});
	$('#taste_6').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').show('fast');	
		$('#tastebox_6').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("grapefruit");
	});
	$('#taste_7').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_7').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("visino");
	});
	$('#taste_8').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_8').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("ananas");
	});
	$('#taste_9').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_9').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("coctail");
	});
	$('#taste_10').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_10').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("mango");
	});
	$('#taste_11').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_11').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("fraoula");
	});
	$('#taste_12').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_12').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("lemon");
	});
	$('#taste_13').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_13').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("apple");
	});
	$('#taste_14').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_14').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("banana");
	});
	$('#taste_15').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_15').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("rodakino");
	});
	$('#taste_16').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu2').show('fast');	
		$('#tastebox_16').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("rodi");
	});
	$('#taste_17').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu3').show('fast');	
		$('#tastebox_17').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("vatomouro");
	});
	$('#taste_18').click(function(){	
		$('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu3').show('fast');	
		$('#tastebox_18').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("stafili");
	});
	
	
	
	$('#clickpage1').click(function(){
		// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page1', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();		 
		 $('#clickpage1').addClass("active");
		 $('#bg').addClass("amita");
		//callHideFromParent();
		 document.getElementById("mediaFrame").src='tvc.html'
		 
	});
	$('#clickpage2').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page2', 1000, { axis:'x',easing:'elasout' } );
		
		 $('.slideshow').cycle('pause'); 
		 cleanClass();		
		 $('#clickpage2').addClass("active");
		 $('#bg').addClass("coctail");
		 document.getElementById("tastes").src='tastes.html'
		 document.getElementById("mediaFrame").src='tvc.html'		 
	});
	$('#clickpage3').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page3', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage3').addClass("active");
		 $('#bg').addClass("kouzina");
		 life1();
		 document.getElementById("life").src='morning.html'
		 document.getElementById("mediaFrame").src='tvc.html'
	});
	$('#clickpage4').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page4', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage4').addClass("active");
		 $('#bg').addClass("classic");
		  document.getElementById("mediaFrame").src='tvc.html'
		 document.getElementById("frouta").src='orange.html'
	});
	$('#consumer').click(function(){// only scroll horizontally
	document.getElementById("summerpromo").src='http://summerpromo.amita.gr/index.php'
		reset_o(); paneOptions.scrollTo( '#consumer', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#consumer').addClass("active");
		 $('#bg').addClass("kalokairi");
		  document.getElementById("mediaFrame").src='tvc.html'
		  
	});
	$('#introLink').click(function(){// only scroll horizontally
	
		reset_o(); paneOptions.scrollTo( '#consumer', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#consumer').addClass("active");
		 $('#bg').addClass("kalokairi");
		 document.getElementById("summerpromo").src='http://summerpromo.amita.gr/index.php?mod=play'
	});
	
	
	
	
	$('#clickpage5').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page5', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage5').addClass("active");
		 $('#bg').addClass("amita");
		  document.getElementById("mediaFrame").src='tvc.html'
		   $('#events').removeClass();
	 $('#tvc').addClass("active");
	 $('#awards').removeClass();
	});
	$('#clickpage6').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page6', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage6').addClass("active");
		 $('#bg').addClass("amita");
		 document.getElementById("mediaFrame").src='tvc.html'
	});
	$('#clickpage7').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page7', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage7').addClass("active");
		 $('#bg').addClass("amita");
		 document.getElementById("mediaFrame").src='tvc.html'
	});
	$('#clickpage8').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page8', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage8').addClass("active");
		 $('#bg').addClass("amita");
		  document.getElementById("mediaFrame").src='tvc.html'
	});
	$('#clickpage9').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page9', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage9').addClass("active");
		 $('#bg').addClass("amita");
		 document.getElementById("mediaFrame").src='tvc.html'
	});
	$('#clickpage10').click(function(){// only scroll horizontally
		reset_o(); paneOptions.scrollTo( '#page10', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage10').addClass("active");
		 $('#bg').addClass("amita");
		 document.getElementById("mediaFrame").src='tvc.html'
	});
	
	
	
	
	
	
	
	$('#fruit_portokali').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("classic");
	});
	$('#fruit_milo').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("apple");
	});
	$('#fruit_grapefruit').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("grapefruit");
	});
	$('#fruit_rodakino').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("rodakino");
	});
	$('#fruit_lemon').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("lemon");
	});
	$('#fruit_verikoko').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("verikoko");
	});
	$('#fruit_visino').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("visino");
	});
	$('#fruit_banana').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("banana");
	});
	$('#fruit_rodi').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("rodi");
	});
	
	$('#fruit_vatomouro').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("vatomouro");
	});
	$('#fruit_red_stafili').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("stafili");
	});
	$('#fruit_white_stafili').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("stafili_white");
	});
	$('#fruit_mango').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("mango");
	});
	$('#fruit_fraoula').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("fraoula");
	});
	$('#fruit_ananas').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("ananas");
	});
	$('#fruit_carrot').click(function(){
		 $('#bg').removeClass();
		 $('#bg').addClass("carrot");
	});
 
 
});

	function callFromFlash(){
		
	var paneOptions=$("#panel");
	 paneOptions.scrollTo( '#page5', 1000, { axis:'x',easing:'elasout' } );
		 $('.slideshow').cycle('pause'); 
		 cleanClass();
		 $('#clickpage5').addClass("active");
		 $('#bg').addClass("amita");		
		
	 $("#mediaFrame").contents().find('#video2').hide('fast');
	 $("#mediaFrame").contents().find('#video3').hide('fast');
	 $("#mediaFrame").contents().find('#video4').hide('fast');	
	 $("#mediaFrame").contents().find('#allVideos').hide('fast');	
	  $("#mediaFrame").contents().find('#video1').show('fast');
	}
	
	
 function geusi1(){
 $('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').show('fast');	
		$('#tasteMenu2').hide('fast');	
		$('#tasteMenu3').hide('fast');
		$('#tasteintro').hide('fast');
		$('#tastebox_1').show('fast');
		$('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("classic");
 
 
 }
  function geusi2(){
 $('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').hide('fast');	
		$('#tasteMenu2').show('fast');	
		$('#tasteMenu3').hide('fast');
		$('#tasteintro').hide('fast');
		$('#tastebox_7').show('fast');
 $('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("visino");
 
 }
  function geusi3(){
 $('[id^="tastebox_"]').hide('fast');
		$('#tasteMenu1').hide('fast');	
		$('#tasteMenu2').hide('fast');	
		$('#tasteMenu3').show('fast');
		$('#tasteintro').hide('fast');
		$('#tastebox_16').show('fast');
 $('#bg',window.parent.document).removeClass();
		$('#bg',window.parent.document).addClass("rodi");
 
 }
 function fruitsBG(){
	$('#bg',window.parent.document).removeClass();
	$('#bg',window.parent.document).addClass("coctail");
}


$.extend({
  getUrlVars: function(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
    }
    return vars;
  },
  getUrlVar: function(name){
    return $.getUrlVars()[name];
  }
});




