
$(document).ready(function () {
	
	$.easing.elasout = function(x, t, b, c, d) {
		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;
	};
	
	// KATALÓGUS MENÜ
	
	/*
	
	$('a.level0').click(function(){
		var $this = $(this);
		var divID = $this.attr("id").replace("menuid_", "subid_");
		var $div = $('#'+divID);
		if ($div.is(':visible')) {
			$div.slideUp(400);
		} else {
			$div.slideDown(400);
		}
		return false;
	});
	
	$('a.level1').click(function(){
		var $this = $(this);
		var divID = $this.attr("id").replace("menuid_", "subid_");
		var $div = $('#'+divID);
		if ($div.is(':visible')) {
			$div.slideUp(400);
		} else {
			$div.slideDown(400);
		}
		return false;
	});
	
	*/
	
	// INFOBOX
	
	$("#open_infobox").click(function () {
		if($("div#information_box .inner_info").height()==0){
		 	$("div#information_box").slideDown('fast');		
		}
		else{
			$("div#information_box").height($("div#information_box .inner_info").height()+20);
		}
	});
	
	$("#close_infobox").click(function () {
		var hbefore=$("div#information_box .inner_info").height()+20;
	 	$("div#information_box").slideUp('fast',function(){$("div#information_box").height(hbefore);
});
	});
	
	$("#open_description").click(function () {
		var $inner = $("div#prod_desc .inner");
	 	$("div#prod_desc").height($inner.height()+10);
	 	$("#open_description").css("display", "none");

	});
	
});

jQuery(function( $ ){
	/**
	 * Demo binding and preparation, no need to read this part
	 */
	//borrowed from jQuery easing plugin
	//http://gsgd.co.uk/sandbox/jquery.easing.php
	$.easing.elasout = function(x, t, b, c, d) {
		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)
	$('div.scrollable').scrollTo( 0 );
	// Reset the screen to (0,0)
	$.scrollTo( 0 )
	
	// Target examples bindings
	// THIS DEMO IS NOT INTENDED TO SHOW HOW TO CODE IT
	// JUST THE MULTIPLE OPTIONS. THIS CODE IS UGLY.
	step_blue=0;
	var stepwidth=265;
	$('#stepnext_blue').click(function(){	
		$('#scrollable_blue').stop().scrollTo( {top:'+=0px',left:'+='+stepwidth}, 500 );
		var max=$('#scrollable_blue .inner').css("width").replace("px", "");
		step_blue++;
		if(step_blue*stepwidth>=max){
			step_blue=0;
			$('#scrollable_blue').stop().scrollTo( {top:'-=0px',left:'0'}, 100 );
		}
		url=$("#mb_blue .step"+step_blue).attr("href");
		$("#mb_blue .more").attr("href",url);	
	});
	step_green=0;
	$('#stepnext_green').click(function(){	
		$('#scrollable_green').stop().scrollTo( {top:'+=0px',left:'+='+stepwidth}, 500 );
		var max=$('#scrollable_green .inner').css("width").replace("px", "");
		step_green++;
		if(step_green*stepwidth>=max){
			step_green=0;
			$('#scrollable_green').stop().scrollTo( {top:'-=0px',left:'0'}, 100 );
		}
		url=$("#mb_green .step"+step_green).attr("href");
		$("#mb_green .more").attr("href",url);	
	});
	step_red=0;
	$('#stepnext_red').click(function(){	
		$('#scrollable_red').stop().scrollTo( {top:'+=0px',left:'+='+stepwidth}, 500 );
		var max=$('#scrollable_red .inner').css("width").replace("px", "");
		step_red++;
		if(step_red*stepwidth>=max){
			step_red=0;
			$('#scrollable_red').stop().scrollTo( {top:'-=0px',left:'0'}, 100 );
		}
		url=$("#mb_red .step"+step_red).attr("href");
		$("#mb_red .more").attr("href",url);	
	});
	
});
