$(document).ready(function(){
	$("#categorii a:odd").addClass("nomargin");
	$(".produs:last-child").addClass("nobg");
	$("#port-all").click(function(event){
		event.preventDefault();
	});

/*	$('.media').media({ width: 750, height: 500, autoplay: true });*/
	$('a.lightbox').lightBox();
	$(".produs a").lightBox();
	$(".magazin h2 a").lightBox();
	$(".MsoNormal").attr('style', '').removeClass('MsoNormal');
	$("a[href='#']").attr("href", "javascript:void(0)");
	
	
	$('.stirea > .stire > h2').click(function() {
	var $this = $(this);

                if( $this.is('.inchide') ) {
                        $this.removeClass('inchide');
                        $this.addClass('deschide');
                }
                else {
                        $this.removeClass('deschide');
                        $this.addClass('inchide');
                }
		$(this).next().slideToggle();

	});
});

function fereastra(id) {
	if ($("#buton"+id).is(".galben"))
	{
		$("#buton"+id).removeClass("galben");
		$("#fereastra"+id).fadeOut("fast");
		$("#fereastra"+id).removeClass("feractiv");
	} else {
		$(".galben").removeClass("galben");
		$("#buton"+id).addClass("galben");
		$(".feractiv").fadeOut("fast");
		$("#fereastra"+id).fadeIn("fast");
		$("#fereastra"+id).addClass("feractiv");
	}
}

function abonare_news(){
	var email = $("#email").val();
	
	$.post("ajax.php",{optiune:"abonare_news",email:email},function(data){
		$("#raspuns_news").html(data.raspuns);
		if(data.eroare==0) $("#email").val("");
	},"json");
	
	setTimeout("$('#raspuns_news').html('')",10000);
}

function contact(){
	var nume = $("#nume").val();
	var email = $("#emailu").val();
	var telefon = $("#telefon").val();
	var mesaj = $("#mesaj").val();
	var cod_produs = $("#cod_produs").val();
	
	$.post("ajax.php",{optiune:"contact",nume:nume,email:email,mesaj:mesaj,cod_produs:cod_produs,telefon:telefon},function(data){
		if(data.eroare==1){
			if(data.eroare_nume==1) $("#td_nume").css("color","red");
			else $("#td_nume").css("color","white");
			if(data.eroare_email==1) $("#td_email").css("color","red");
			else $("#td_email").css("color","white");
				if(data.eroare_telefon==1) $("#td_telefon").css("color","red");
			else $("#td_telefon").css("color","white");
		}
		else {
			$("#raspuns_contact").html(data.raspuns);
			goleste_contact();
		} 
	},"json");
}

function goleste_contact(){
	$("#nume").val("");
	$("#telefon").val("");
	$("#emailu").val("");
	$("#mesaj").val("");
}

function byebyeflash() {
/*	setTimeout("$('#poza1').removeClass('flbg')",3300);
	setTimeout("$('#ambientul').removeClass('statix')",3300);
	setTimeout("$('#flashul').fadeOut('')",3000); */
}
function hideflash() {
	$('#poza1').removeClass('flbg');
	$('#ambientul').removeClass('statix');
	$('#flashul').fadeOut('');
	$('#hideflash').fadeOut('');
}