/* Winter RePrperties JS file */

$(document).ready(function(){
			
			var path_rev3A ="url(/winter/images/winter_tgb_3a_rewerse.png) 50% 61px no-repeat";
			var path_Hover ="url(/winter/images/winter_tgb_clk.png) 0 0 repeat-x";

			var  path_3A ="url(/winter/images/winter_tgb_3a.png) 50% 61px no-repeat";
			var path_Normal ="url(/winter/images/winter_tgb.png) 0% 0% repeat-x";	
				 
			var last_clk ='0';
			var og = 0;
			var tg = 0;
			var bLinks = ["",
							"/catalog/category/1/"+perpage,
							"/catalog/category/2/"+perpage,
							"/catalog/category/3/"+perpage,
							"/catalog/category/4/"+perpage,
							"/catalog/category/5/"+perpage];
				 
	
		 	/* top catalog hoverfunc */
				$('.c_main').hover	(   
					function(){
								if ($(this).attr('id') != 'cm_active')
									{
										$(this).css("background", "#2987c5");
										$(this).find('a').addClass("c_main_hover");
									}	
							   },
					function(){
								if ($(this).attr('id') != 'cm_active')
									{
										$(this).css("background", "#fff");
										$(this).find('a').removeClass("c_main_hover");
							   }
				}) 
				/* filter hoverfunc */
				$('.c_once').hover	(   
					function(){
								if ($(this).attr('id') != 'co_active_filter')
									{
										$(this).css("background", "#0667b6");
										$(this).find('.co_txt').css('color','#95dfed');
									}	
							   },
					function(){
								if ($(this).attr('id') != 'co_active_filter')
									{
										$(this).css("background", "#fff");
										$(this).find('.co_txt').css('color','#5d80a3');
							   }
				})
					   
					   
				/* MainMenu Part */	   
					   
				 /* menu cell 1 */
			   $('#mm1').hover	(   
					function(){
						$(this).css("background", "#ebfcff");
						$(this).find('.mm_level2').slideDown(300); 
					},
					function(){
						$(this).css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$(this).find('.mm_level2').slideUp(100); 
				})	  
				
				 /* menu cell 2 */
			   $('#mm2').hover	(   
					function(){
						$(this).css("background", "#ebfcff");
						$('#mm1').css("background", "none"); 
						$(this).find('.mm_level2').slideDown(300); 
						
					},
					function(){
						$(this).css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$('#mm1').css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$(this).find('.mm_level2').slideUp(100); 
				})
				
				/* menu cell 3 */
				$('#mm3').hover	(   
					function(){
						$(this).css("background", "#ebfcff");
						$('#mm2').css("background", "none"); 
						$(this).find('.mm_level2').slideDown(300); 
						
					},
					function(){
						$(this).css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$('#mm2').css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$(this).find('.mm_level2').slideUp(100); 
				})	
				
				/* menu cell 4 */
				$('#mm4').hover	(   
					function(){
						$(this).css("background", "#ebfcff");
						$('#mm3').css("background", "none"); 
						$(this).find('.mm_level2').slideDown(300); 
						
					},
					function(){
						$(this).css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$('#mm3').css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$(this).find('.mm_level2').slideUp(100); 
				})
				
				/* menu cell 5 */
				$('#mm5').hover	(   
					function(){
						$(this).css("background", "#ebfcff");
						$('#mm4').css("background", "none"); 
						$(this).find('.mm_level2').slideDown(300); 
						
					},
					function(){
						$(this).css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$('#mm4').css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$(this).find('.mm_level2').slideUp(100); 
				})
				
				/* menu cell 6 */
				$('#mm6').hover	(   
					function(){
						$(this).css("background", "#ebfcff");
						$('#mm5').css("background", "none"); 
						$(this).find('.mm_level2').slideDown(300); 
						
					},
					function(){
						$(this).css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$('#mm5').css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$(this).find('.mm_level2').slideUp(100); 
				})	
				
				/* menu cell 7 */
				$('#mm7').hover	(   
					function(){
						$(this).css("background", "#ebfcff");
						$('#mm6').css("background", "none"); 
						$(this).find('.mm_level2').slideDown(300); 
						
					},
					function(){
						$(this).css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$('#mm6').css("background", "url(/winter/images/winter_mm_sep.png) 100% 0% no-repeat");
						$(this).find('.mm_level2').slideUp(100); 
				})	
				  
				/* Menu cells second layer */
				$('.mm_level2 li').hover	(   
					function(){
						$(this).find('a:first').css("background", "url(/winter/images/winter_mm_l2_hover.png) 0% 0% no-repeat");
						$(this).find('a:first').css("color", "#95dfed");
		
					},
					function(){
						$(this).find('a:first').css("background", "url(/winter/images/winter_mm_l2_dot.png) 18px 9px no-repeat");
						$(this).find('a:first').css("color", "#5d80a3");
			
										
				})


				/* Menu cells THIRD layer */
				$('.mm_level2 li').click	(   
					function(){
						$(this).find('.mm_level3').slideToggle("fast");
				})	
				
				$('.mm_level3 li').hover	(   
					function(){
												
						$(this).css("background", "none");
						$(this).find('a').css("background", "url(/winter/images/mm_l3_dot.png) 29px 9px no-repeat");
						$(this).find('a').css("color", "#9ca18b");
						$(this).find('a').css("text-decoration", "underline");
					},
					function(){
						$(this).css("background", "none");
						$(this).find('a').css("background", "url(/winter/images/mm_l3_dot.png) 29px 9px no-repeat");
						$(this).find('a').css("color", "#9ca18b");
						$(this).find('a').css("text-decoration", "none");
				})		
				
				/* galery script part */
				$('#gb_root').hover	(function(){},function(){
						$("#Gb_img").slideUp(300);	
						last_clk ='id0';og = 0;
								$("#gb1").css("background", path_Normal);	
									$("#gb1").find(".GB_3a_down").css("background", path_3A);		  
								$("#gb2").css("background", path_Normal);			  							  
									$("#gb2").find(".GB_3a_down").css("background", path_3A);		  
								$("#gb3").css("background", path_Normal);			  
									$("#gb3").find(".GB_3a_down").css("background", path_3A);		  
								$("#gb4").css("background", path_Normal);			  
									$("#gb4").find(".GB_3a_down").css("background", path_3A);	
								$("#gb5").css("background", path_Normal);			  
									$("#gb5").find(".GB_3a_down").css("background", path_3A);	
					
				})		
				$('#galegy_bnr').hover	(function(){},function(){og = 0; })
				$('#Gb_img').hover	(function(){og = 1;},function(){})
				
				$('.GalBnr').hover	(   
					function(){	
						tg = $(this).attr('id');
						
						$("#gb_link").attr('href', bLinks[$(this).attr('id').substring(2)]);
			
						$(this).oneTime(500, function() {	
							
							if (tg == $(this).attr('id'))	
{										if (last_clk != $(this).attr('id'))
										{
												if (last_clk != '0')
													{
														$("#gb1").css("background", path_Normal);	
															$("#gb1").find(".GB_3a_down").css("background", path_3A);		  
														$("#gb2").css("background", path_Normal);			  							  
															$("#gb2").find(".GB_3a_down").css("background", path_3A);		  
														$("#gb3").css("background", path_Normal);			  
															$("#gb3").find(".GB_3a_down").css("background", path_3A);		  
														$("#gb4").css("background", path_Normal);			  
															$("#gb4").find(".GB_3a_down").css("background", path_3A);	
														$("#gb5").css("background", path_Normal);			  
															$("#gb5").find(".GB_3a_down").css("background", path_3A);
													}
												$(this).css("background",path_Hover);
												$(this).find(".GB_3a_down").css("background", path_rev3A);
																		
												if(og == 0)
												{
													$("#Gb_img").css("background", "url(/winter/images/"+$(this).attr('id')+".jpg) 0px 0px no-repeat");						
												}
												else
												{		
													$("#Gb_img").slideUp(300);
													$(this).oneTime(300, function() {	
															$("#Gb_img").css("background", "url(/winter/images/"+$(this).attr('id')+".jpg) 0px 0px no-repeat");
													});
												}
												
												$("#Gb_img").slideDown(300);
												last_clk = $(this).attr('id');							
												og = 1;	   	

											}
							
							
							} });
								
						},
					function(){ tg=0; })	

});

