var scrollbar;
function protectmail(a,b){
emailE=(a + b);
document.write('<a href="mailto:' + emailE + '" class="greylink">' + emailE + '</a>');
}
var openedsub=0;
function hidesubs(){
	$$('div.subs').each(function(a){ a.hide(); });
	$('submenu'+openedsub).show();
}
function hideallsub(){
	$$('div.subs').each(function(a){ a.hide(); });
	var lasttop=$('menu').select('a.current').first().id;
	//alert(lasttop);
	$(lasttop).removeClassName('current');

}
var cim=0;
var cartinfo={'label':'KOSÁR TARTALMA'};
/*  var myrules = {
		'a.topmenulink' : function(element){
			element.onmouseover = function(){
				this.childNodes[0].className='topmenu_a2';
				this.childNodes[1].className='topmenu_b2';
			},
			element.onmouseout= function(){
				this.childNodes[0].className='topmenu_a';
				this.childNodes[1].className='topmenu_b';
			}
		}
		
	};
	
	Behaviour.register(myrules);
*/
function showtab(id){
	$$('div.tab_sel').each(function(a){ a.className='tab'; });
	$$('div.conttab').each(function(a){ a.hide(); });
	$(id).className='tab_sel';
	$('cont_'+id).show();

}
function showsub(id){
 hideallsub();
 xy=$('submenucont').cumulativeOffset();
 try{
 $('submenu'+id).setStyle({top: parseInt(xy[1])+'px',left: (xy[0])+'px'});
 $('submenu'+id).show();
 openedsub=id;
 $('top'+id).addClassName('current');
 } catch(err) {
 }
}
var v="vmi";
function resp(event){
				var el = Event.element(event).id;
				$(el).setStyle({border: "2px solid #c00;"});
				//var a=document.getElementById(el).getAttribute('onmouseover');				
}
function at(){
 $$('img').each(function(a) {
			Event.observe(a.id,'click',resp.bindAsEventListener(this));
			}
			);
		} 
function checklogin(a,b){
	
new Ajax.Updater('login_container','checklogin.php?'+a+'='+b, {
  method: 'post',
  parameters: $('login').serialize(true),
  onComplete: function(){
	if ($('loggedok').hasClassName('logged_in')) { location.reload(true); } else {
			//$('logincont').show();
			var notice = 'Rossz e-mail cím, vagy jelszó!';
			var g = new k.Growler();
			g.warn(notice, {header: "HIBA!",life: 3});
	}
  }
  });

}
function logout(a,b){
new Ajax.Updater('login_container','logout.php', {
  method: 'get',
  parameters: { a : b },
  onComplete: function(){ //location.reload(true); 
  	location.href='index.php'; }
  });

}
function cart(mode,id,amo,variab){
	if (mode!=='mod'){
		//$('cart_content').innerHTML='<div style="padding:auto;">Adatok újraszámolása...</div>';
		$('cart_popup').show();
	}
	if (mode=='add'){ 
		new Ajax.Updater('cart_content','kosarkezelo.php', {
			method: 'post',
			parameters: {'mode':mode,'id':id,'amo':amo,'variab':variab},
			onComplete: function() { 
				$('kosarsum').innerHTML=$('cartinfo_label').innerHTML;
				var scrollbar = new Control.ScrollBar('scrollbar_content','scrollbar_track'); 
				scrollbar.recalculateLayout();    
				
			}
		});
	}
	if (mode=='show'){
		new Ajax.Updater('cart_content','kosarkezelo.php', {
			method: 'post',
			parameters: {'mode':mode},
			onComplete: function() { 
				$('kosarsum').innerHTML=$('cartinfo_label').innerHTML;
				var scrollbar = new Control.ScrollBar('scrollbar_content','scrollbar_track'); 
				scrollbar.recalculateLayout();    
				
			}
		});
	}
	if (mode=='del'){
		new Ajax.Updater('cart_content','kosarkezelo.php', {
			method: 'post',
			parameters: {'mode':mode,'id':id,'amo':amo,'variab':variab},
			onComplete: function() { 
				$('kosarsum').innerHTML=$('cartinfo_label').innerHTML;
				var scrollbar = new Control.ScrollBar('scrollbar_content','scrollbar_track'); 
				scrollbar.recalculateLayout();     
				
			}		
		});
	}
	if (mode=='mod'){
		new Ajax.Updater('cart_content','kosarkezelo.php', {
			method: 'post',
			parameters: {'mode':mode,'id':id,'amo':amo,'variab':variab},
			onComplete: function() { 
				$('kosarsum').innerHTML=$('cartinfo_label').innerHTML;
				var scrollbar = new Control.ScrollBar('scrollbar_content','scrollbar_track'); 
				scrollbar.recalculateLayout();     
				
			}
		});
	}
	
	
}

function cart_add(a,b,val,id){
var value=$(val).value;
new Ajax.Updater('cart','cart.php', {
  method: 'get',
  parameters: { a : b,"val":value,"uid":id,"mode":"add" },
  onComplete: function() {
  var g = new k.Growler();
	g.info("<span style='color: #c00; font-size: 12px;'>A kosárban lévő termékek összértéke: &nbsp;<b style='color: #c00; font-size: 14px;'>"+$('kosarossz').innerHTML+"</b></span>", {header: "A kosár tartalma megváltozott.",life: 5});
  }
  });

}
function cart_del(a,b,val,id){
var value=$(val).value;
new Ajax.Updater('cart','cart.php', {
  method: 'get',
  parameters: { a : b,"val":value,"uid":id,"mode":"del" },
  onComplete: function() {
  var g = new k.Growler();
	g.warn("A termék sikeresen törölve a kosárból.",{header: "Információ",life: 5});
  }
  });

}

function cart_add2(a,b,val,id){
var value=$(val).value;
new Ajax.Updater('cart','cart.php', {
  method: 'get',
  parameters: { a : b,"val":value,"packid":id,"mode":"addpack" },
  onComplete: function() {
  var g = new k.Growler();
	g.info("<span style='color: #c00; font-size: 12px;'>A kosárban lévő termékek összértéke: &nbsp;<b style='color: #c00; font-size: 14px;'>"+$('kosarossz').innerHTML+"</b></span>", {header: "A kosár tartalma megváltozott.",life: 5});
  }
  });

}
function cart_del2(a,b,val,id){
var value=$(val).value;
new Ajax.Updater('cart','cart.php', {
  method: 'get',
  parameters: { a : b,"val":value,"packid":id,"mode":"delpack" },
  onComplete: function() {
  var g = new k.Growler();
	g.warn("A csomag sikeresen törölve a kosárból.", {header: "Információ",life: 5});
  }
  });

}
function kedvenchez(aa,bb){
new Ajax.Request('kedvencekhez.php', {
  method: 'post',
  parameters: {a:aa,b:bb},
  onSuccess: function(transport) {
    var notice = transport.responseText;
	var g = new k.Growler();
	g.warn(notice, {header: "Információ",life: 5});
	
  }
});
}
function delkedvenc(aa,bb){
new Ajax.Request('delkedvenc.php', {
  method: 'post',
  parameters: {a:aa,b:bb},
  onSuccess: function(transport) {
    var notice = transport.responseText;
	var g = new k.Growler();
	g.warn(notice, {header: "Információ",life: 5});
	$('kedv_'+bb).remove();
  }
});
}
function keress(mit){
	var xy=$('kereso').cumulativeOffset();
	var wh=$('kereso').getDimensions();
	$('talalatok').innerHTML='';
/*	$('talalatok').setStyle({'position':'absolute','display':'block','overflow':'hidden','top':(xy.top+wh.height+3)+'px','left':xy.left-1+'px','width':(wh.width)+'px'});*/
//if (mit=="") { $('kereso').value=''; } 	
//if (mit=="") { $('kereso').activate(); } else {
	if (mit.length>1) {
		new Ajax.Updater('talalatok','search.php', {
  			method: 'post',
			parameters: { 'value': mit },
		  	onCreate: function() {
				$('talalatok').innerHTML='Keresés...';
		  	},
		  	onComplete: function() {
				$('talalatok').show();
			}
  		});
//	}
}
}
function rend_szallitas(a,b){
new Ajax.Updater('rend_data','rendeles_seged.php?'+a+'='+b, {
  method: 'post',
  parameters: $('order').serialize(true)
  });
}
function hitelkalk(param) {
new Ajax.Updater('hitelkalk','kalk/kalk.html', {
  method: 'post',
  parameters: {'hitelosszeg': param}
  });

}
function numf(nStr)
{
	nStr=Math.round(nStr,0);
	nStr += '';
	
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? ',' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + '.' + '$2');
	}
	return x1 + x2;
}

function uchk(a,b,c,d,e,f) {
	var szktg=parseInt($('szktg').getAttribute("val"));
	var szh=parseInt($('szalllim').getAttribute("val"));
	if (b==1) { 
		$('amo'+a).innerHTML="1&nbsp;db";
		$('arb'+a).hide();
		$('ara'+a).show();
		$('upsale'+a).setStyle({backgroundColor: '#fff'}); 
		$('upsale'+a).setOpacity(1);
		var nd=$('termsum').innerHTML;
		//alert(nd);
		nd=nd.replace(",","");
		nd=nd.replace(".","");
		nd=nd.replace(".","");
		//alert(nd);
		nd=parseInt(nd,0)+parseInt(c);
		if (nd>szh){ szktg=0; }
		$('szktg').innerHTML=numf(szktg);				
		$('termsum').innerHTML=numf(nd);
		$('sumsum').innerHTML=numf(nd+szktg);
		new Ajax.Updater('ug','upsalegift.php', {
		  method: 'get',
		  parameters: { e : f,"val":1,"uid":a,"mode":"add" }
		});
		
	} else {
		$('amo'+a).innerHTML="0&nbsp;db";
		$('ara'+a).hide();
		$('arb'+a).show();
		$('upsale'+a).setStyle({backgroundColor: '#e8e8e8'}); 
		$('upsale'+a).setOpacity(0.6);
		var nd=$('termsum').innerHTML;
		//alert(nd);
		nd=nd.replace(",","");
		nd=nd.replace(".","");
		nd=nd.replace(".","");
		//alert(nd);
		nd=parseInt(nd,0)-parseInt(c);
		if (nd>szh){ szktg=0; }
		$('szktg').innerHTML=numf(szktg);				
		$('termsum').innerHTML=numf(nd);
		$('sumsum').innerHTML=numf(nd+szktg);
		new Ajax.Updater('ug','upsalegift.php', {
		  method: 'get',
		  parameters: { e : f,"val":1,"uid":a,"mode":"del" }
		});
	}
}
function gchk(a,b,c,d,e,f,g) {
	var szktg=parseInt($('szktg').getAttribute("val"));
	var szh=parseInt($('szalllim').getAttribute("val"));
	var noc=g;
	if (b==1) { 
		/*$('amo'+a).innerHTML="1&nbsp;db";
		$('arb'+a).hide();
		$('ara'+a).show();
		$('upsale'+a).setStyle({backgroundColor: '#fff'}); 
		$('upsale'+a).setOpacity(1);*/
		var nd=$('termsum').innerHTML;
		//alert(nd);
		nd=nd.replace(",","");
		nd=nd.replace(".","");
		nd=nd.replace(".","");
		//alert(nd);
		nd=parseInt(nd,0)+parseInt(c);

		$$('input[rel=gift]').each(function(unc){ if (unc.id!==noc && unc.checked==true) {unc.checked=false; nd-=1; }  });
		if (nd>szh){ szktg=0; }
		$('szktg').innerHTML=numf(szktg);				
		$('termsum').innerHTML=numf(nd);
		$('sumsum').innerHTML=numf(nd+szktg);
		new Ajax.Updater('ug','gift.php', {
		  method: 'get',
		  parameters: { e : f,"val":1,"uid":a,"mode":"add" }
		});
		
	} else {
		/*$('amo'+a).innerHTML="0&nbsp;db";
		$('ara'+a).hide();
		$('arb'+a).show();
		$('upsale'+a).setStyle({backgroundColor: '#e8e8e8'}); 
		$('upsale'+a).setOpacity(0.6);*/
		var nd=$('termsum').innerHTML;
		//alert(nd);
		nd=nd.replace(",","");
		nd=nd.replace(".","");
		nd=nd.replace(".","");
		//alert(nd);
		nd=parseInt(nd,0)-parseInt(c);
		
		$$('input[rel=gift]').each(function(unc){ if (unc.id!==noc && unc.checked==true) {unc.checked=false; nd-=1; }  });
		if (nd>szh){ szktg=0; }
		$('szktg').innerHTML=numf(szktg);				
		$('termsum').innerHTML=numf(nd);
		$('sumsum').innerHTML=numf(nd+szktg);
		new Ajax.Updater('ug','gift.php', {
		  method: 'get',
		  parameters: { e : f,"val":1,"uid":a,"mode":"del" }
		});
	}
	
	//$(g).writeAttribute({'checked':true});
}
function compare(id,ertek,aa,b,c){

new Ajax.Request('compare_mod.php', {
  method: 'get',
  parameters: {aa:b,'id':id,'val':ertek},
  onSuccess: function(transport) {
  /*  var notice = transport.responseText;
	var g = new k.Growler();
	g.growl(notice, {header: "Információ",sticky:true});*/
  }
});

}

function makesort(){
 
Position.includeScrollOffsets = true;
Sortable.destroy('propcont');
Sortable.create('propcont',{tag:'div',ghosting:false /* scroll:'lightwindow_contents'*/});  }

function nyomtat(elid){
var cont=$(elid).innerHTML;
new Ajax.Request('nyomtat.php', { method:'post', parameters: {'nyomdata':cont},
				 onComplete: function (tr) { 
					 window.open('nyomtat.php','Nyomtat','width=720,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
				 } 
				 });
}
function isallok(){
if ( $('keystring').value==''){
	$('keystring').activate();
	alert('Kérem adja meg a biztonsági kódot!');
} else {
	document.order.submit();
}
}
window.k = window.k || {};
;(function(){

var noticeOptions = {
	header: 			'&nbsp;'
	,speedin: 			0.3
	,speedout: 			0.5
	,outDirection: 		{ y: -20 }
	,life: 				5
	,sticky: 			false
	,className: 		""
};
var growlerOptions = {
	location: 			"tr"
	,width: 			"250px"
};
var IE = (Prototype.Browser.IE) ? parseFloat(navigator.appVersion.split("MSIE ")[1]) || 0 : 0;
function removeNotice(n, o){
	o = o || noticeOptions;
	new Effect.Parallel([
		new Effect.Move(n, Object.extend({ sync: true, mode: 'relative' }, o.outDirection)),
		new Effect.Opacity(n, { sync: true, to: 0 }) 
	], {
		duration: o.speedout
		,afterFinish: function(){
			try {
				var ne = n.down("div.notice-exit");
				if(ne != undefined){
					ne.stopObserving("click", removeNotice);
				}
				if(o.created && Object.isFunction(o.created)){
					n.stopObserving("notice:created", o.created);
				}
				if(o.destroyed && Object.isFunction(o.destroyed)){
					n.fire("notice:destroyed");
					n.stopObserving("notice:destroyed", o.destroyed);
				}
			} catch(e){}
			try {
				n.remove();
			} catch(e){}
		}
	});
}
function createNotice(growler, msg, options){
	var opt = Object.clone(noticeOptions);
	options = options || {};
	Object.extend(opt, options);
	var notice;
	if (opt.className != ""){
		notice = new Element("div", {"class": opt.className}).setStyle({display: "block", opacity: 0});
	} else {
		notice = new Element("div", {"class": "Growler-notice"}).setStyle({display: "block", opacity: 0});
	}
	if(opt.created && Object.isFunction(opt.created)){
		notice.observe("notice:created", opt.created);
	}
	if(opt.destroyed && Object.isFunction(opt.destroyed)){
		notice.observe("notice:destroyed", opt.destroyed);
	}
	if (opt.sticky){
		var noticeExit = new Element("div", {"class": "Growler-notice-exit"}).update("&times;");
		noticeExit.observe("click", function(){ removeNotice(notice, opt); });
		notice.insert(noticeExit);
	}
	notice.insert(new Element("div", {"class": "Growler-notice-head"}).update(opt.header));
	notice.insert(new Element("div", {"class": "Growler-notice-body"}).update(msg));
	growler.insert(notice);
	new Effect.Opacity(notice, { to: 1, duration: opt.speedin });
	if (!opt.sticky){
		removeNotice.delay(opt.life, notice, opt);
	}
	notice.fire("notice:created");
	return notice;
}
function specialNotice(g, m, o, t, b, c){
	o.header = o.header || t;
	var n = createNotice(g, m, o);
	n.setStyle({ backgroundColor: b, color: c });
	return n;
}
k.Growler = Class.create({
	initialize: function(options){
		var opt = Object.clone(growlerOptions);
		options = options || {};
		Object.extend(opt, options);
		this.growler = new Element("div", { "class": "Growler", "id": "Growler" });
		this.growler.setStyle({ position: ((IE==6)?"absolute":"fixed"), padding: "10px", "width": opt.width, "z-index": "50000" });
		if(IE==6){
			var offset = { w: parseInt(this.growler.style.width)+parseInt(this.growler.style.padding)*3, h: parseInt(this.growler.style.height)+parseInt(this.growler.style.padding)*3 };
			switch(opt.location){
				case "br":
					this.growler.style.setExpression("left", "( 0 - Growler.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px'");
				  	this.growler.style.setExpression("top", "( 0 - Growler.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px'");
					break;
				case "tl":
					this.growler.style.setExpression("left", "( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px'");
				  	this.growler.style.setExpression("top", "( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px'");
					break;
				case "bl":
					this.growler.style.setExpression("left", "( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px'");
				  	this.growler.style.setExpression("top", "( 0 - Growler.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px'");
					break;
				default:
				/*	this.growler.setStyle({right: "auto", bottom: "auto"});
					this.growler.style.setExpression("left", "( 0 - Growler.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px'");
				  	this.growler.style.setExpression("top", "( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px'");
					break;*/
					this.growler.setStyle({right: "5px", bottom: "5px"});
					this.growler.style.setExpression("left", "( 0 - Growler.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px'");
				  	this.growler.style.setExpression("top", "( 0 - Growler.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px'");
					break;
			}
		} else {
			switch(opt.location){
				case "br":
					this.growler.setStyle({bottom: 0, right: 0});
					break;
				case "tl":
					this.growler.setStyle({top: 0, left: 0});
					break;
				case "bl":
					this.growler.setStyle({top: 0, right: 0});
					break;
				case "tc":
					this.growler.setStyle({top: 0, left: "25%", width: "50%"});
					break;
				case "bc":
					this.growler.setStyle({bottom: 0, left: "25%", width: "50%"});
					break;
				default:
					this.growler.setStyle({top: 0, right: 0});
					break;
			}
		}
		this.growler.wrap( document.body );		
	}
	,growl: function(msg, options) {
		return createNotice(this.growler, msg, options);
	}
	,warn: function(msg, options){
		return specialNotice(this.growler, msg, options, "Warning!", "#ED1B23", "#fff");
	}
	,error: function(msg, options){
		return specialNotice(this.growler, msg, options, "Critical!", "#F66F82", "#000");
	}
	,info: function(msg, options){
		return specialNotice(this.growler, msg, options, "Information!", "#ED1B23", "#fff");
	}
	,ungrowl: function(n, o){
		removeNotice(n, o);
	}
});

})();/*
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1C=19.1a(1D,{1b:7(c,d,e,f){4.o=t;4.h=$(c);4.8=d;4.k=e;4.5=F.G({p:1,1c:t,1d:3,q:1,1e:\'H-1E\',1f:\'H-1F\',I:\'H-1G\',J:\'H-1H\',r:t,v:K,w:\'1g\',S:\'T\'},f||{});6(4.5.w==\'L\'){4.5.r=K}4.8.1I(7(a,b){a.M=b});6(4.k){4.k.N(\'U\',\'V\',4.V.z(4))}6(4.5.v){4.h.U(\'1J\',4.v.1h(4)).U(\'1K\',4.v.1h(4))}6(4.5.1c){4.A()}6(4.5.1i){9 g=4.8.1L($(4.5.1i));6(g>(4.5.q-1)&&4.5.q>1){6(g>4.8.i-(4.5.q+1)){g=4.8.i-4.5.q}}4.l(4.8[g])}},V:7(a){4.B();9 b=a.1M(\'a\');6(!b.W(4.5.I)){6(b.W(4.5.1e)){1N("4."+b.1j+"()")}s 6(b.W(4.5.1f)){4.l(b.1j);6(4.5.J){4.k.N(\'1k\',4.5.J);b.1l(4.5.J)}}}4.X();a.B()},l:7(a){6(4.5.Y&&(Z 4.5.Y==\'7\')){4.5.Y()}4.10=4.m?4.m:4.8[0];4.m=$(a);9 b=4.h.1m();9 c=4.m.1m();6(4.o){4.o.1O()}1n(4.5.w){O\'L\':4.o=11 n.1o(4.h,{1p:1.0,1q:0,p:4.5.p,12:(7(){4.h.C=c[0]-b[0];4.h.D=c[1]-b[1];11 n.1o(4.h,{1p:0,1q:1.0,p:4.5.p,12:(7(){6(4.k){4.P()}6(4.5.u&&(Z 4.5.u==\'7\')){4.5.u()}}).z(4)})}).z(4)});Q;O\'1g\':1r:9 d;1n(4.5.S){O\'1s\':d=n.1t.1s;Q;O\'T\':1r:d=n.1t.T;Q}4.o=11 n.13(4.h,{p:4.5.p,x:(c[0]-b[0]),y:(c[1]-b[1]),S:d,12:(7(){6(4.k){4.P()}6(4.5.u&&(Z 4.5.u==\'7\')){4.5.u()}4.o=t}).z(4)});Q}R t},1u:7(){6(4.m){9 a=4.m.M;9 b=(a==0)?(4.5.r?4.8.i-1:0):a-1}s{9 b=(4.5.r?4.8.i-1:0)}6(b==(4.8.i-1)&&4.5.r&&4.5.w!=\'L\'){4.h.C=(4.8.i-1)*4.8.14().1P();4.h.D=(4.8.i-1)*4.8.14().1Q();b=4.8.i-2}4.l(4.8[b])},15:7(){6(4.m){9 a=4.m.M;9 b=(4.8.i-1==a)?(4.5.r?0:a):a+1}s{9 b=1}6(b==0&&4.5.r&&4.5.w!=\'L\'){4.h.C=0;4.h.D=0;b=1}6(b>4.8.i-(4.5.q+1)){b=4.8.i-4.5.q}4.l(4.8[b])},14:7(){4.l(4.8[0])},1R:7(){4.l(4.8[4.8.i-1])},1S:7(){6(4.10){4.l(4.8[4.10.M])}s{R t}},B:7(){6(4.E){1v(4.E)}},A:7(){4.16()},1T:7(){4.B();4.P()},1U:7(b){6(b){9 c=b.1V||b.1W;6(!c||(!4.8.1X(c)&&!4.8.1Y(7(a){R c.1Z(a)}))){4.A()}}s{4.A()}},16:7(){6(4.E!=20){1v(4.E);4.15()}4.E=21(4.16.z(4),4.5.1d*22)},v:7(a){a.23=K;a.B();9 b=0;6(!a){a=24.25}6(a.1w){b=a.1w/26}s 6(a.1x){b=-a.1x/3}6(!4.o){4.X();6(b>0){4.1u()}s{4.15()}}R 27.28(b)},X:7(){4.k.N(\'1l\',4.5.I)},P:7(){4.k.N(\'1k\',4.5.I)}});n.13=19.1a();F.G(F.G(n.13.1y,n.29.1y),{1b:7(a){4.j=$(a);9 b=F.G({x:0,y:0,1z:\'1A\'},2a[1]||{});4.A(b)},2b:7(){6(4.5.2c&&!4.j.1B){4.j.2d();4.j.1B=K;4.j.2e(4.j.2f)}4.17=4.j.C;4.18=4.j.D;6(4.5.1z==\'1A\'){4.5.x-=4.17;4.5.y-=4.18}},2g:7(a){4.j.C=4.5.x*a+4.17;4.j.D=4.5.y*a+4.18}});',62,141,'||||this|options|if|function|slides|var||||||||scroller|length|element|controls|moveTo|current|Effect|scrolling|duration|visibleSlides|circular|else|false|afterMove|wheel|effect|||bind|start|stop|scrollLeft|scrollTop|timer|Object|extend|carousel|disabledClassName|selectedClassName|true|fade|_index|invoke|case|activateControls|break|return|transition|sinoidal|observe|click|hasClassName|deactivateControls|beforeMove|typeof|previous|new|afterFinish|SmoothScroll|first|next|periodicallyUpdate|originalLeft|originalTop|Class|create|initialize|auto|frequency|controlClassName|jumperClassName|scroll|bindAsEventListener|initial|rel|removeClassName|addClassName|cumulativeOffset|switch|Opacity|from|to|default|spring|Transitions|prev|clearTimeout|wheelDelta|detail|prototype|mode|absolute|_ext|Carousel|Abstract|control|jumper|disabled|selected|each|mousewheel|DOMMouseScroll|indexOf|findElement|eval|cancel|getWidth|getHeight|last|toggle|pause|resume|relatedTarget|toElement|include|any|descendantOf|null|setTimeout|1000|cancelBubble|window|event|120|Math|round|Base|arguments|setup|continuous|cleanWhitespace|appendChild|firstChild|update'.split('|'),0,{}))*/

/*
Copyright (c) 2009 Victor Stanciu - http://www.victorstanciu.ro

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

Carousel = Class.create(Abstract, {
	initialize: function (scroller, slides, controls, options) {
		this.scrolling	= false;
		this.scroller	= $(scroller);
		this.slides		= slides;
		this.controls	= controls;

		this.options    = Object.extend({
            duration:           1,
            auto:               false,
            frequency:          3,
            visibleSlides:      1,
            controlClassName:   'carousel-control',
            jumperClassName:    'carousel-jumper',
            disabledClassName:  'carousel-disabled',
            selectedClassName:  'carousel-selected',
            circular:           false,
            wheel:              true,
            effect:             'scroll',
            transition:         'sinoidal'
        }, options || {});
        
        if (this.options.effect == 'fade') {
            this.options.circular = true;
        }

		this.slides.each(function(slide, index) {
			slide._index = index;
        });

		if (this.controls) {
            this.controls.invoke('observe', 'click', this.click.bind(this));
        }
        
        if (this.options.wheel) {            
            this.scroller.observe('mousewheel', this.wheel.bindAsEventListener(this)).observe('DOMMouseScroll', this.wheel.bindAsEventListener(this));;
        }

        if (this.options.auto) {
            this.start();
        }

		if (this.options.initial) {
			var initialIndex = this.slides.indexOf($(this.options.initial));
			if (initialIndex > (this.options.visibleSlides - 1) && this.options.visibleSlides > 1) {               
				if (initialIndex > this.slides.length - (this.options.visibleSlides + 1)) {
					initialIndex = this.slides.length - this.options.visibleSlides;
				}
			}
            this.moveTo(this.slides[initialIndex]);
		}
	},

	click: function (event) {
		this.stop();

		var element = event.findElement('a');

		if (!element.hasClassName(this.options.disabledClassName)) {
			if (element.hasClassName(this.options.controlClassName)) {
				eval("this." + element.rel + "()");
            } else if (element.hasClassName(this.options.jumperClassName)) {
                this.moveTo(element.rel);
                if (this.options.selectedClassName) {
                    this.controls.invoke('removeClassName', this.options.selectedClassName);
                    element.addClassName(this.options.selectedClassName);
                }
            }
        }

		this.deactivateControls();

		event.stop();
    },

	moveTo: function (element) {
		if (this.options.beforeMove && (typeof this.options.beforeMove == 'function')) {
			this.options.beforeMove();
        }

		this.previous = this.current ? this.current : this.slides[0];
		this.current  = $(element);

		var scrollerOffset = this.scroller.cumulativeOffset();
		var elementOffset  = this.current.cumulativeOffset();

		if (this.scrolling) {
			this.scrolling.cancel();
		}

        switch (this.options.effect) {
            case 'fade':               
                this.scrolling = new Effect.Opacity(this.scroller, {
                    from:   1.0,
                    to:     0,
                    duration: this.options.duration,
                    afterFinish: (function () {
                        this.scroller.scrollLeft = elementOffset[0] - scrollerOffset[0];
                        this.scroller.scrollTop  = elementOffset[1] - scrollerOffset[1];

                        new Effect.Opacity(this.scroller, {
                            from: 0,
                            to: 1.0,
                            duration: this.options.duration,
                            afterFinish: (function () {
                                if (this.controls) {
                                    this.activateControls();
                                }
                                if (this.options.afterMove && (typeof this.options.afterMove == 'function')) {
                                    this.options.afterMove();
                                }
                            }).bind(this)
                        });
                    }
                ).bind(this)});
            break;
            case 'scroll':
            default:
                var transition;
                switch (this.options.transition) {
                    case 'spring':
                        transition = Effect.Transitions.spring;
                        break;
                    case 'sinoidal':
                    default:
                        transition = Effect.Transitions.sinoidal;
                        break;
                }

                this.scrolling = new Effect.SmoothScroll(this.scroller, {
                    duration: this.options.duration,
                    x: (elementOffset[0] - scrollerOffset[0]),
                    y: (elementOffset[1] - scrollerOffset[1]),
                    transition: transition,
                    afterFinish: (function () {
                        if (this.controls) {
                            this.activateControls();
                        }
                        if (this.options.afterMove && (typeof this.options.afterMove == 'function')) {
                            this.options.afterMove();
                        }                        
                        this.scrolling = false;
                    }).bind(this)});
            break;
        }

		return false;
	},

	prev: function () {
		if (this.current) {
			var currentIndex = this.current._index;
			var prevIndex = (currentIndex == 0) ? (this.options.circular ? this.slides.length - 1 : 0) : currentIndex - 1;
        } else {
            var prevIndex = (this.options.circular ? this.slides.length - 1 : 0);
        }

		if (prevIndex == (this.slides.length - 1) && this.options.circular && this.options.effect != 'fade') {
			this.scroller.scrollLeft =  (this.slides.length - 1) * this.slides.first().getWidth();
			this.scroller.scrollTop =  (this.slides.length - 1) * this.slides.first().getHeight();
			prevIndex = this.slides.length - 2;
        }

		this.moveTo(this.slides[prevIndex]);
	},

	next: function () {
		if (this.current) {
			var currentIndex = this.current._index;
			var nextIndex = (this.slides.length - 1 == currentIndex) ? (this.options.circular ? 0 : currentIndex) : currentIndex + 1;
        } else {
            var nextIndex = 1;
        }

		if (nextIndex == 0 && this.options.circular && this.options.effect != 'fade') {
			this.scroller.scrollLeft = 0;
			this.scroller.scrollTop  = 0;
			nextIndex = 1;
        }

		if (nextIndex > this.slides.length - (this.options.visibleSlides + 1)) {
			nextIndex = this.slides.length - this.options.visibleSlides;
		}		

		this.moveTo(this.slides[nextIndex]);
	},

	first: function () {
		this.moveTo(this.slides[0]);
    },

	last: function () {
		this.moveTo(this.slides[this.slides.length - 1]);
    },

	toggle: function () {
		if (this.previous) {
			this.moveTo(this.slides[this.previous._index]);
        } else {
            return false;
        }
    },

	stop: function () {
		if (this.timer) {
			clearTimeout(this.timer);
		}
	},

	start: function () { 
        this.periodicallyUpdate();
    },

	pause: function () {
		this.stop();
		this.activateControls();
    },

	resume: function (event) {
		if (event) {
			var related = event.relatedTarget || event.toElement;
			if (!related || (!this.slides.include(related) && !this.slides.any(function (slide) { return related.descendantOf(slide); }))) {
				this.start();
            }
        } else {
            this.start();
        }
    },

	periodicallyUpdate: function () {
		if (this.timer != null) {
			clearTimeout(this.timer);
			this.next();
        }
		this.timer = setTimeout(this.periodicallyUpdate.bind(this), this.options.frequency * 1000);
    },
    
    wheel: function (event) {
        event.cancelBubble = true;
        Event.stop(event);
        
		var delta = 0;
		if (!event) {
            event = window.event;
        }
		if (event.wheelDelta) {
			delta = event.wheelDelta / 120; 
		} else if (event.detail) { 
            delta = -event.detail / 3;	
        }        
       
        if (!this.scrolling) {
            this.deactivateControls();
            if (delta > 0) {
                this.prev();
            } else {
                this.next();
            }            
        }
        
		return Math.round(delta); //Safari Round
    },

	deactivateControls: function () {
		this.controls.invoke('addClassName', this.options.disabledClassName);
    },

	activateControls: function () {
		this.controls.invoke('removeClassName', this.options.disabledClassName);
    }
});


Effect.SmoothScroll = Class.create();
Object.extend(Object.extend(Effect.SmoothScroll.prototype, Effect.Base.prototype), {
	initialize: function (element) {
		this.element = $(element);
		var options = Object.extend({ x: 0, y: 0, mode: 'absolute' } , arguments[1] || {});
		this.start(options);
    },

	setup: function () {
		if (this.options.continuous && !this.element._ext) {
			this.element.cleanWhitespace();
			this.element._ext = true;
			this.element.appendChild(this.element.firstChild);
        }

		this.originalLeft = this.element.scrollLeft;
		this.originalTop  = this.element.scrollTop;

		if (this.options.mode == 'absolute') {
			this.options.x -= this.originalLeft;
			this.options.y -= this.originalTop;
        }
    },

	update: function (position) {
		this.element.scrollLeft = this.options.x * position + this.originalLeft;
		this.element.scrollTop  = this.options.y * position + this.originalTop;
    }
});

function switchtab(elid){
	$$('.tab_select').each(function(el){ Element.removeClassName(el,'tab_select'); } );
	$$('.tabcont').each(function(el){ $(el.id).hide(); } );
	$(elid).addClassName('tab_select');
	$(elid+'_cont').show();
}
var variations=[ ];

function select_var(key){
	$('fokep').setStyle('background-image:url(gallery/230x220/'+variations[key].pv_pic+');');
	$('chooser-'+key).selected=true;
	new Effect.Highlight('var_chooser', { startcolor: '#ED1B23',endcolor: '#ffffff' }); 	
}
var myform=
{
	tab:
	{
		
		act:"tabno_1",
		hoverclass:"cur_step",
		fieldsets_class:"fieldset.tab_cont",
		cont_selector:'.step',
		handle: function (event)
		{
			var el;
			var ele=Event.element(event);
			var id=ele.identify();
			if (ele.tagName.toLowerCase()!='td'){ el=$(id).up('td'); } else { el=Event.element(event);
			//	alert(el.tagName);
			}
			myform.tab.activate(el.id)
		},
		activate:function(elid){
			try{
			$(myform.tab.act).removeClassName(myform.tab.hoverclass);
			$(myform.tab.act+'_cont').hide();
			$(elid).addClassName(myform.tab.hoverclass);
			$(elid+'_cont').show();
			myform.tab.act=elid;
			} catch(e){  }
		},		
		init:function ()
		{
			
			$('content').getElementsBySelector('.tab_cont').each( function(el){
										  elid=el.identify();
						$(elid).hide();
					
			} );								
			$(myform.tab.act+'_cont').show();
			$$(myform.tab.cont_selector).each(function(a){
				Event.observe(a.id,'click',myform.tab.handle.bindAsEventListener(this));
			});
		}
	}
}

function checkval(id,mode){	
	val=$(id).value;
	def=$(id).readAttribute('title');
	if (mode=='focus'){
	$(id).setStyle('font-style:normal;');
		if (val==def) { $(id).value=''; } else {$(id).activate();}
	}

	if (mode=='blur'){
		if (val==''){ $(id).value=def;	$(id).setStyle('font-style:italic;');}
	}
	
	//Passwordoknél tipusváltás is kell
		if (mode=='focus_pw'){
	$(id).setStyle('font-style:normal;');
	$(id).writeAttribute({'type':'password'}); 
		if (val==def) { $(id).value=''; } else {$(id).activate();		}
		}
	

	if (mode=='blur_pw'){
		if (val==''){ $(id).value=def; $(id).writeAttribute({'type':'text'}); 	$(id).setStyle('font-style:italic;');}
	}
	
}
function checkvalb(event,mode){
	var el=Event.element(event).id;
	checkval(el,mode); 
}
function self_labeled(){
$('content').getElementsBySelector('input[type=text].selflabeled').each(function(el){
								 var elid=el.identify();
								 checkval(elid,'blur');
								 Event.observe(elid,'focus',checkvalb.bindAsEventListener(this,'focus'));
								 Event.observe(elid,'blur',checkvalb.bindAsEventListener(this,'blur'));
								 });
$('content').getElementsBySelector('input[type=password].selflabeled').each(function(el){
								 var elid=el.identify();
							  	 checkval(elid,'blur_pw');
								 Event.observe(elid,'focus',checkvalb.bindAsEventListener(this,'focus_pw'));
								 Event.observe(elid,'blur',checkvalb.bindAsEventListener(this,'blur_pw'));
								 });
}
function form_redesign(){
//$$('
}

function checkout_recalc(mode,elem){
	if (mode=='del'){
		new Ajax.Request('checkout_recalc.php',{
						  method: 'post',
						  parameters: { 'delete':elem } ,
						  onComplete: function(transport){
							var ret=transport.responseText;
							new Ajax.Updater('tabno_1_cont','checkout_kosar.php',{ method:'post',parameters:{'ajax':'true'} });  				$('tabno-1').innerHTML=ret;
						  }
					  });
	} 
	if(mode=='mod'){
	new Ajax.Request('checkout_recalc.php',{
						  method: 'post',
						  parameters: $('checkout').serialize(true),
						  onComplete: function(transport){
							var ret=transport.responseText;
							new Ajax.Updater('tabno_1_cont','checkout_kosar.php',{ method:'post',parameters:{'ajax':'true'} });  				$('tabno-1').innerHTML=ret;
						  }
					  }
	);
	}
}
