function CollapsiblePanel(panelId, _cookieName){ 		
		this.panel = $(panelId);
		var cookieName = _cookieName;
		
		var panelOpenedIndexArray = [];
		var panelOpenedIndex = $.cookie(cookieName);
					
		if(panelOpenedIndex)
		{
			 panelOpenedIndexArray = panelOpenedIndex.split(";");	
		}
		 		

		$("dt", this.panel).each(function(index, item){
				if($.inArray(index + "", panelOpenedIndexArray) != -1)
				{
					$(item).addClass("opened");	
					$(item).next().show();
				}
				else
				{
					$(item).addClass("closed");
				}
		});
		
				 
		$("dt", this.panel).click(function(){
					//$("#adminmenu dd:visible").hide();
					if($(this).hasClass("opened"))
					{
						$(this).removeClass("opened");
						$(this).addClass("closed");					
						$(this).next().slideUp("slow");
						
						var panelOpenedIndexArray = [];

						$("dt", this.panel).each(function(index, item){
								if($(item).hasClass("opened"))
								{
									panelOpenedIndexArray.push(index);
								}
						});
	
						$.cookie(cookieName, panelOpenedIndexArray.join(";"), {expires: 1, path: '/'});
					}
					else
					{
						$(this).removeClass("close");
						$(this).addClass("opened");					
						$(this).next().slideDown("slow");

						var panelOpenedIndexArray = [];

						$("dt", this.panel).each(function(index, item){
								if($(item).hasClass("opened"))
								{
									panelOpenedIndexArray.push(index);
								}
						});
	
						$.cookie(cookieName, panelOpenedIndexArray.join(";"), {expires: 1, path: '/'});
					}					
				});
		
		$("dt", this.panel).hover(function(){ $(this).addClass("hover");}, function(){ $(this).removeClass("hover"); });
	}
	
var zoomKep = new Image();			
															
zoomKep.onload = function() {								
				
				var imageIndex = 0;
				var imageCount = 0;
				
				$('.kepnagyitlink').each(function(i, element){
					
					if(element.href == zoomKep.currentImage)
					{
						imageIndex = i;
					}
					
					imageCount++;
				});
				
				var imagePrev = "#";
				var imageNext = "#";
				
				if(imageCount > 0 && imageIndex > 0)
				{
					imagePrev = $('.kepnagyitlink:nth('+ (imageIndex - 1) +')').attr('href'); 
				}

				if(imageCount > 0 && imageIndex < imageCount - 1)
				{
					imageNext = $('.kepnagyitlink:nth('+ (imageIndex + 1) +')').attr('href'); 
				}
				
				//alert("imageIndex: "+imageIndex+ "\nimageCount"+imageCount+"\nimagePrev: "+imagePrev+"\nimageNext: "+imageNext);
				 																
				var winH = 0;
		    	var winW = 0;
		    	
		    	
				if( typeof( window.innerWidth ) == 'number' ) 
				{
				    //Non-IE
					winW = window.innerWidth;
				    winH = window.innerHeight;
				} 
				else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
				{
				    //IE 6+ in 'standards compliant mode'
				 	winW = document.documentElement.clientWidth;
				    winH = document.documentElement.clientHeight;
				} 
				else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
				{
				    //IE 4 compatible
				    winW = document.body.clientWidth;
				    winH = document.body.clientHeight;
				}	    	
		    
		    	var scrollX = 0;
		        if (typeof window.pageXOffset == "number") 
		            scrollX = window.pageXOffset;
		        else if (document.documentElement && document.documentElement.scrollLeft)
		            scrollX = document.documentElement.scrollLeft;
		        else if (document.body && document.body.scrollLeft) 
		            scrollX = document.body.scrollLeft; 
		        else if (window.scrollX) 
		        	scrollX = window.scrollX;
        
		    	var scrollY = 0;    
			    if (typeof window.pageYOffset == "number") 
				    scrollY = window.pageYOffset;
			    else if (document.documentElement && document.documentElement.scrollTop)
			    	scrollY = document.documentElement.scrollTop;
			    else if (document.body && document.body.scrollTop) 
			    	scrollY = document.body.scrollTop; 
			    else if (window.scrollY) 
			    	scrollY = window.scrollY;
			   	
			   	
			   	var kepnagyitpopup = $('#kepnagyitpopup');
			   	var kepnagyitpopupbelso = $('#kepnagyitpopupbelso');
			   	
			   		
			   	/*					   	
			    var popupwidth = this.width + 14;
			    var popupheight = this.height + 39; 

			    var popupbelsowidth = this.width;
			    var popupbelsoheight = this.height + 25; 
			    */
			    
			    
			    var popupwidth = 414;
			    var popupheight = 414; 

			    var popupbelsowidth = 400;
			    var popupbelsoheight = 400; 
			    			    	
			    popupheight += 25;				    
				popupbelsoheight += 25;
							    
			    if(imagePrev != "#" || imageNext != "#")			    {				    
				    if(imagePrev != "#")
				    {
				    	$('.elozo', kepnagyitpopup).attr('href', imagePrev);
				    	$('.elozo', kepnagyitpopup).css('display', "inline");
				    	
				    	if(imageNext == "#")
				    	{
				    		//$('.elozo', kepnagyitpopup).css('margin-right', "220px");
				    		$('.elozo', kepnagyitpopup).addClass('nincsmasik');
				    	}
				    	else
				    	{
				    		//$('.elozo', kepnagyitpopup).css('margin-right', "80px");
				    		$('.elozo', kepnagyitpopup).removeClass('nincsmasik');
				    	}				    	
				    }
				    else
				    {
				    	$('.elozo', kepnagyitpopup).css('display', "none");
				    }
					
					
					
				    if(imageNext != "#")
				    {
				    	$('.kovetkezo', kepnagyitpopup).attr('href', imageNext);
				    	$('.kovetkezo', kepnagyitpopup).css('display', "inline");
				    	
				    	if(imagePrev == "#")
				    	{
				    		//$('.kovetkezo', kepnagyitpopup).css('margin-left', "220px");
				    		$('.kovetkezo', kepnagyitpopup).addClass('nincsmasik2');
				    	}
				    	else
				    	{
				    		//$('.kovetkezo', kepnagyitpopup).css('margin-left', "80px");
				    		$('.kovetkezo', kepnagyitpopup).removeClass('nincsmasik2');
				    	}
				    }
				    else
				    {
				    	$('.kovetkezo', kepnagyitpopup).css('display', "none");
				    }				    				     			    				    	
			    }
			    else
			    {
			    	$('.elozo', kepnagyitpopup).css('display', "none");
			    	$('.kovetkezo', kepnagyitpopup).css('display', "none");
			    }
			    

			    
			    //var kntop = (winH - popupheight) / 2 + scrollY;
			    var kntop = scrollY + 80;
			    
			    //var knleft = (winW  - popupwidth) / 2 + scrollX;
			    var knleft = (winW  - popupwidth) / 2 + scrollX;
			    			    			    
			    if(isNaN(kntop) || kntop < 0) kntop = 0; 
			    if(isNaN(knleft) || knleft < 0) knleft = 0;
			    
			    //alert("winH: "+winH+"\npopupwidth: "+popupwidth+"\nscrollY:"+scrollY+"\nkntop: "+kntop+"\nwinW"+winW+"\npopupheight"+popupheight+"\nscrollX"+scrollX+"\nknleft:"+knleft);
			   			    			    
			    kepnagyitpopup.css('top', kntop  + 'px');			    
			    kepnagyitpopup.css('left', knleft + 'px');
 

			    kepnagyitpopup.css('width', popupwidth + 'px');
				kepnagyitpopup.css('height', popupheight + 'px');			

   			    kepnagyitpopupbelso.css('width', popupbelsowidth + 'px');
				kepnagyitpopupbelso.css('height', popupbelsoheight + 'px');			

				$("#dlbl", kepnagyitpopup).css('position', 'absolute').css('z-index', 100).css('width', popupbelsowidth + 'px').css('height', popupbelsoheight + 'px');
			    
			    kepnagyitpopup.css('display', "block");
			    
			    														
				$('#popkep').attr('src', this.src);								 
			}; 
			
	$(function(){
		
		$('.kepnagyitlink').click(function(){						
			zoomKep.currentImage = $(this).attr('href');
			zoomKep.src = $(this).attr('href');
			return false;			
		});	
		

		$('#kepnagyitpopup .elozo, #kepnagyitpopup .kovetkezo').click(function(){						
			zoomKep.currentImage = this.href;
			zoomKep.src = this.href.replace(/termeknagy/, "termekoldalzoom").replace(/termekkis/, "termekoldalzoom");
			return false;			
		});	
		
		$('#kepnagyitpopup .close').click(function(){
							$('#kepnagyitpopup').css('display', "none");
							return false;
		});
	});		
		
$(function(){

	$('#index-gyartomenu .menu li').hover(function(){
		$(this).addClass('hover');
		 
		 if($.browser.msie&&parseInt($.browser.version)<=7)
		 {
			$('select').css('visibility', 'hidden');
		 }
	
	}, function(){
		$(this).removeClass('hover');
		
		if($.browser.msie&&parseInt($.browser.version)<=7)
		{
			$('select').css('visibility', 'visible');
		}
	});

	$('#index-gyartomenu .menu li.utolsoli').hover(function(){
		$('.holder', this).css('left', $('#index-wrapper').get(0).offsetLeft + 818 + 'px');
	}, function(){
		
	});

	CollapsiblePanel('#tipuskategoriak', 'tipuskategoriak');
	/*
	scrollProducts = function(scrollby)
	{
		$('#akciok .termekholder').each(function(i, element){				
			var top = $(element).css('top');
			top.replace(/px/, "");
			top = parseInt(top);		
			top -= scrollby;
			
			if(top + 113 < 0)
			{
				top = ($('#akciok .termekholder').length - 1) * 113 - scrollby; 
			}
									
			$(element).css('top', top + 'px');		
		});
	}
	
	var scrollingProductsInterval = null;
	
	var startScrollingProducts = function()
	{
		scrollingProductsInterval = setInterval(function(){
												scrollProducts(1);		
											}, 10);
	}

	var stopScrollingProducts = function()
	{
		if(scrollingProductsInterval != null)
		{
			clearInterval(scrollingProductsInterval);
		}
		scrollingProductsInterval = null;
	}
 

	$('#akciok .termekholder').each(function(i, element){
		$(element).css('position', 'absolute');
		$(element).css('top', i*113 + 'px');
		
		$(element).hover(function(){
			stopScrollingProducts();		
		},function(){
			if($('#akciok .termekholder').length > 3)
			{
				startScrollingProducts();		
			}
		});		
	});

	if($('#akciok .termekholder').length > 3)
	{
		startScrollingProducts();
	}
*/

});

function MM_openBrWindow(theURL,winName,features) 
{ 
 var w = window.open(theURL,winName,features);
 w.opener = window;
 w.focus();
} 

function MM_openContactWindow(theURL,winName,features) 
{ 
 var w = window.open(theURL,winName,features);
 w.opener = window;
	 
 var gterkep1 = document.getElementById('gterkep');
	 	
 w.mapCenter = gterkep1.contentWindow.map.getCenter();				 				 
 w.mapZoom = gterkep1.contentWindow.map.getZoom();			
 w.mapShowLogo = false;
	 	 			 	 	 
 w.focus();
} 

