

	// PageLoad function
	
	
	
	var base='http://www.shoppmp.ro/catalog/';
	// var base='localhost/shoppmp.ro/';
	
	$(document).ready(function() {
		  
		  

	
	
	
//			var initialHash = $.history.getCurrent();
//			if(initialHash != '') {
//				url=base+initialHash+'?display=ajax';
//				ajaxNavigate(url,"middleContent");
//			}
			
	
		
		
		
    
		
		  
			$("a.imageBox").fancybox({
				'transitionIn'			: 'elastic',
				'transitionOut'			: 'elastic',
                'overlayShow'			: true,
				'hideOnContentClick'	: true,
				centerOnScroll          : true
			});
            
   
            
            $("a.popup1").fancybox({
                'hideOnContentClick': false,                
                'overlayShow'			: true,
                'zoomSpeedIn': 300,
                'zoomSpeedOut': 300,
                'frameWidth':300,
                'frameHeight':300 
                }); 
                
	$("#fastKeywords").click(function(){
		
		if($(this).attr('value')=="cauta promotionale...")
		{
			$(this).attr('value','');
			$(this).css('color','#000000');
		}
		else
		{
			$(this).css('color','#000000');
		}
			
	});
	
	// autocomplete off
    $("#fastKeywords").attr("autocomplete", "off");
    var offsetinfo = $("#fastKeywords").offset();
    var addheight= $("#fastKeywords").css("height");
    try{
    $("#search_suggest").offset({ top: offsetinfo.top+20, left: offsetinfo.left });
    
    
    $("#search_suggest").hide();

    $("#search_suggest").mouseleave(function(){
        var second = false;
    	$.timer(300, function (timer) {
  		if (!second) {
  			second = true;
  			timer.reset(1000);
  		}
  		else {
  			$("#search_suggest").hide();  
  			timer.stop();
  		}
       });
    
    });
	}catch(err){}
	$("a[rel=category]").click(function(){
		alert($(this).attr("href"));
		return false;
	});	
	
	$("input#fastKeywords").keyup(function(){
		var keyword=$(this).attr("value");
		 $("#search_suggest").load("searchsuggest.php?keywords="+escape(keyword));
		 $("#search_suggest").show();
	});
	
	$("input#fastKeywords").click(function(){
		var keyword=$(this).attr("value");
		if(keyword==""){
		 $("#search_suggest").hide();	
		}else{
		 $("#search_suggest").load("searchsuggest.php?keywords="+escape(keyword));
		 $("#search_suggest").show("slow");
		 }
	});
	

	
	$("input#fastKeywords").blur(function(){
	//	$("#search_suggest").hide("slow");
		}); 

        
    // card fidelizare
    $("#btnCardConfirm").click(function(){
        var message='';
        
        if($("#frmNume").attr('value') == ''){
            message+="Va rugam introduceti numele dvs. \n";
            $("#frmNume").addClass("checkFiekd");
        }else{
            $("#frmNume").removeClass("checkFiekd");
        }
        
        
        if($("#frmPrenume").attr('value') == ''){
            message+="Va rugam introduceti prenumele dvs. \n";
            $("#frmPrenume").addClass("checkFiekd");
        }else{
            $("#frmPrenume").removeClass("checkFiekd");
        }
        
        
        if($("#frmCompanie").attr('value') == ''){
            message+="Va rugam introduceti numele companiei. \n";
            $("#frmCompanie").addClass("checkFiekd");
        }else{
            $("#frmCompanie").removeClass("checkFiekd");
        }
        
        
        if($("#frmEmail").attr('value') == ''){
            message+="Va rugam introduceti adresa de email dvs. \n";
            $("#frmEmail").addClass("checkFiekd");
        }else{
            $("#frmEmail").removeClass("checkFiekd");
        }
        
        
        if($("#frmCard").attr('value') == ''){
            message+="Va rugam introduceti seria cardului. \n";
            $("#frmCard").addClass("checkFiekd");
        }else{
            $("#frmCard").removeClass("checkFiekd");
        }
        
        if($("#frmNewsletter").attr('checked') != true){
            message+="Va rugam sa confirmati primirea de newslettere. \n";
            $("#frmNewsletter").addClass("checkFiekd");
        }else{
            $("#frmNewsletter").removeClass("checkFiekd");
        }
        
        
        if($("#frmSecurity").attr('value') == ''){
            message+="Va rugam introduceti codul de control. \n";
            $("#frmSecurity").addClass("checkFiekd");
        }else{
            $("#frmSecurity").removeClass("checkFiekd");
        }
        
        
        if(message != '') {
            alert(message);
            return false;
        }else{
            $("#formCard").submit();
        }
        
    });
    
    // card fidelizare
    $("#btnCardComand").click(function(){
        var error=false;
        var first=false;
        var arrinputs=new Array('frmCompanie','frmCui','frmTipcard','frmNume','frmPrenume','frmDob','frmSex','frmFunctie','frmLocalitate','frmStrada','frmNumar','frmJudet','frmCodpostal','frmEmail','frmTelefonfix','frmTelefonmobil');
        
        $.each(arrinputs, function(index, value) { 
            // alert(index + ': ' + value);
            var obj=$("#"+value);
            if(obj.attr('value')==''){
                obj.addClass('checkFiekd');
               
                if(!first){
                    first=value;
                }
                error=true;
            }else {
                obj.removeClass('checkFiekd');
            }
        });
        
    if($("#frmContact3").attr('checked') != true){
           error=true;
            $("#labelfrmContact3").addClass("checkFiekd");
            $("#frmContact3").addClass("checkFiekd");
        }else{
            $("#labelfrmContact3").removeClass("checkFiekd");
            $("#frmContact3").removeClass("checkFiekd");
        }

     if($("#confirmare_1").attr('checked') != true){
           error=true;
            $("#labelconfirmare_1").addClass("checkFiekd");
            $("#confirmare_1").addClass("checkFiekd");
        }else{
            $("#labelconfirmare_1").removeClass("checkFiekd");
            $("#confirmare_1").removeClass("checkFiekd");
        }
        
        
	       if(error) {
	           $.scrollTo("#"+first);
            alert('Va rugam sa completati toate campurile necesare.');
            
            return false;
        }else{
            $("#formComandCard").submit();
        }
    });
    
    
    //// load banners bottom
    //$("#bannersBottom").load(base+'bottom_banners.php');
    
        
        });
	
	
	/*-------------------------------------------------------------------- 
*
* Created by Dexter (http://cssclub.ru)
*
--------------------------------------------------------------------*/
function equalHeights(element) {	
		var class_name = '.equal-height';
		var maxHeight = 0;	
		var maxItem = 0;
		var maxItem_adjust = 0;		

		element.find(class_name).each(function(i){	
			$(this).wrapInner('<div></div>');				
		});	
				
		function heightChecker(){			
			element.find(class_name).each(function(i){						
				if($(this).outerHeight() > maxHeight) { 
						maxHeight = $(this).outerHeight();
						maxItem = $(this);
						setHeight(maxHeight);
					}				
			});				
			
			maxItem_adjust = maxItem.outerHeight()-maxItem.height();
			if(maxHeight > (maxItem.children().height() + maxItem_adjust)){
					maxHeight = maxItem.children().height() + maxItem_adjust;
					setHeight(maxHeight);									
				}
				
		//	setTimeout(function(){heightChecker()}, 1000)			
		 }	
		 
		function setHeight(target){
			element.find(class_name).each(function(i){
						var adjust = $(this).outerHeight()-$(this).height();						
						if($.browser.msie && $.browser.version < 7.0){
								   $(this).css({'height': target - adjust });								   
							}
							else{
  								   $(this).css({'min-height': target - adjust });	
								}
					})
		  }
		
		heightChecker();
}
function equalHeights2(element) {	
		var class_name2 = '.equal-height2';
		var maxHeight2 = 0;	
		var maxItem2 = 0;
		var maxItem2_adjust = 0;		

		element.find(class_name2).each(function(j){	
			$(this).wrapInner('<div></div>');				
		});	
				
		function heightChecker2(){			
			element.find(class_name2).each(function(j){						
				if($(this).outerHeight() > maxHeight2) { 
						maxHeight2 = $(this).outerHeight();
						maxItem2 = $(this);
						setHeight2(maxHeight2);
					}				
			});				
			
			maxItem2_adjust = maxItem2.outerHeight()-maxItem2.height();
			if(maxHeight2 > (maxItem2.children().height() + maxItem2_adjust)){
					maxHeight2 = maxItem2.children().height() + maxItem2_adjust;
					setHeight2(maxHeight2);									
				}
				
		//	setTimeout(function(){heightChecker2()}, 1000)			
		 }	
		 
		function setHeight2(target){
			element.find(class_name2).each(function(j){
						var adjust2 = $(this).outerHeight()-$(this).height();						
						if($.browser.msie && $.browser.version < 7.0){
								   $(this).css({'height': target - adjust2 });								   
							}
							else{
  								   $(this).css({'min-height': target - adjust2 });	
								}
					})
		  }
		heightChecker2();		  
}		

		
		
function equalHeights3(element) {	
		var class_name3 = '.equal-height3';
		var maxHeight3 = 0;	
		var maxItem3 = 0;
		var maxItem3_adjust = 0;		

		element.find(class_name3).each(function(j){	
			$(this).wrapInner('<div></div>');				
		});	
				
		function heightChecker3(){			
			element.find(class_name3).each(function(j){						
				if($(this).outerHeight() > maxHeight3) { 
						maxHeight3 = $(this).outerHeight();
						maxItem3 = $(this);
						setHeight(maxHeight3);
					}				
			});				
			
			maxItem3_adjust = maxItem3.outerHeight()-maxItem3.height();
			if(maxHeight3 > (maxItem3.children().height() + maxItem3_adjust)){
					maxHeight3 = maxItem3.children().height() + maxItem3_adjust;
					setHeight(maxHeight3);									
				}
				
		//	setTimeout(function(){heightChecker3()}, 1000)			
		 }	
		 
		function setHeight(target){
			element.find(class_name3).each(function(j){
						var adjust3 = $(this).outerHeight()-$(this).height();						
						if($.browser.msie && $.browser.version < 7.0){
								   $(this).css({'height': target - adjust3 });								   
							}
							else{
  								   $(this).css({'min-height': target - adjust3 });	
								}
					})
		  }
		
		heightChecker3();
}
function equalHeights_box(element) {	
		var class_name_box = '.equal-height-box';
		var maxHeight_box = 0;	
		var maxItem_box = 0;
		var maxItem_box_adjust = 0;		

		element.find(class_name_box).each(function(j){	
			$(this).wrapInner('<div></div>');				
		});	
				
		function heightChecker_box(){			
			element.find(class_name_box).each(function(j){						
				if($(this).outerHeight() > maxHeight_box) { 
						maxHeight_box = $(this).outerHeight();
						maxItem_box = $(this);
						setHeight(maxHeight_box);
					}				
			});				
			
			maxItem_box_adjust = maxItem_box.outerHeight()-maxItem_box.height();
			if(maxHeight_box > (maxItem_box.children().height() + maxItem_box_adjust)){
					maxHeight_box = maxItem_box.children().height() + maxItem_box_adjust;
					setHeight(maxHeight_box);									
				}
				
		//	setTimeout(function(){heightChecker_box()}, 1000)			
		 }	
		 
		function setHeight(target){
			element.find(class_name_box).each(function(j){
						var adjust_box = $(this).outerHeight()-$(this).height();						
						if($.browser.msie && $.browser.version < 7.0){
								   $(this).css({'height': target - adjust_box });								   
							}
							else{
  								   $(this).css({'min-height': target - adjust_box });	
								}
					})
		  }
		
		heightChecker_box();
		
}
function equalHeights4(element) {	
		var class_name4 = '.equal-height-price';
		var maxHeight4 = 0;	
		var maxItem4 = 0;
		var maxItem4_adjust = 0;		

		element.find(class_name4).each(function(j){	
			$(this).wrapInner('<div></div>');				
		});	
				
		function heightChecker4(){			
			element.find(class_name4).each(function(j){						
				if($(this).outerHeight() > maxHeight4) { 
						maxHeight4 = $(this).outerHeight();
						maxItem4 = $(this);
						setHeight(maxHeight4);
					}				
			});				
			
			maxItem4_adjust = maxItem4.outerHeight()-maxItem4.height();
			if(maxHeight4 > (maxItem4.children().height() + maxItem4_adjust)){
					maxHeight4 = maxItem4.children().height() + maxItem4_adjust;
					setHeight(maxHeight4);									
				}
				
		//	setTimeout(function(){heightChecker4()}, 1000)			
		 }	
		 
		function setHeight(target){
			element.find(class_name4).each(function(j){
						var adjust4 = $(this).outerHeight()-$(this).height();						
						if($.browser.msie && $.browser.version < 7.0){
								   $(this).css({'height': target - adjust4 });								   
							}
							else{
  								   $(this).css({'min-height': target - adjust4 });	
								}
					})
		  }
		
		heightChecker4();
}
function equalHeights5(element) {	
		var class_name5 = '.equal-height5';
		var maxHeight5 = 0;	
		var maxItem5 = 0;
		var maxItem5_adjust = 0;		

		element.find(class_name5).each(function(j){	
			$(this).wrapInner('<div></div>');				
		});	
				
		function heightChecker5(){			
			element.find(class_name5).each(function(j){						
				if($(this).outerHeight() > maxHeight5) { 
						maxHeight5 = $(this).outerHeight();
						maxItem5 = $(this);
						setHeight5(maxHeight5);
					}				
			});				
			
			maxItem5_adjust = maxItem5.outerHeight()-maxItem5.height();
			if(maxHeight5 > (maxItem5.children().height() + maxItem5_adjust)){
					maxHeight5 = maxItem5.children().height() + maxItem5_adjust;
					setHeight5(maxHeight5);									
				}
				
		//	setTimeout(function(){heightChecker5()}, 1000)			
		 }	
		 
		function setHeight5(target){
			element.find(class_name5).each(function(j){
						var adjust5 = $(this).outerHeight()-$(this).height();						
						if($.browser.msie && $.browser.version < 7.0){
								   $(this).css({'height': target - adjust5 });								   
							}
							else{
  								   $(this).css({'min-height': target - adjust5 });	
								}
					})
		  }
		heightChecker5();		  
}		

function preloadImages(imgs){
	
	var picArr = [];
	
		for (i = 0; i<imgs.length; i++){
			
				picArr[i]= new Image(100,100); 
				picArr[i].src=imgs[i]; 

			
			}
	
	}
	
	$(function(){
	$('.contentPadd h3').first().addClass('first_h3');
	$('.contentPadd.loginPage h3').addClass('first_h3');
	$('.contentInfoText, .contentInfoBlock').last().addClass('marg-bottom');
	$('.loginPage .contentInfoText').addClass('marg-top');
	
	$('.cart th').last().css('border-right','0px');
	$('.cart_prods').css('border-width','0px 1px 1px 0px');
	$('.cart_update').css('border-width','0px 1px 1px 0px');
	$('.cart_price').css('border-width','0px 0px 1px 0px');	
	$('.cart_total td:nth-child(2)').css('border-width','0px 1px 0px 0px');
	$('.desc p').first().css('padding-top','0px');
	
	$('ul').each(function (ul) {
	$(this).find('li').first().addClass('first');
	$(this).find('li').last().addClass('last');
	});	
	$('.prods_content').each(function (div) {
	$(this).find('ul.row').first().addClass('first');
	$(this).find('ul.row').last().addClass('last');
	});
});
$(function(){
	var keeper=$('.wrapper_pic_div'),
		zoomPic=$('.wrapper_pic_zoom, ').css({opacity:0})
	keeper
	 .bind('mouseenter',function(){
	  zoomPic
		.stop()
		.animate({opacity:1})
		
	 })
	 .bind('mouseleave',function(){
		zoomPic
			.stop()
			.animate({opacity:0})
	 })	

})



