function slide (div)
{
		
			//$(".subs").attr ("style",'display:none;');
			///alert ("asd");
			$(".subs").hide("slow");					 

		   $("#"+div).show("slow");
}




function slide_vertical (tip)

{


	   if ($("#div"+tip+":first").is(":hidden")) 

	   {

		   //alert ('expandam');

		//$("#imag"+tip).src("../templates/skin1/images/minus-icon.gif");

		 $("#imag"+tip).attr({ 

          src: "http://ghidcompanii.ro/templates/skin1/images/minus-icon.gif",

          title: "Ascude continul",

          alt: "Ascude continul"

		  

        });

		 

        $("#div"+tip).slideDown();

	 //$("#div"+tip").text($("img").attr("alt"));

      	} 

	  else 

	  {	

		$("#imag"+tip).attr({ 

          src: "http://ghidcompanii.ro/templates/skin1/images/plus-icon.gif",

          title: "Afiseaza continul",

          alt: "Ascude continul "

        });

        $("#div"+tip).slideUp();

      }

}





function shows(str,tip,id)
{

//alert ('as');
var domainname = new String(location.host); 

	$.ajax({
		   type: "POST",
		   url: "http://"+domainname+"/shows.php",
		   data: 'tip='+tip+'&id='+id,
		   success: function(msg){
			   $("#"+str).html(msg);
			  
			   
			if (tip =="ridicare_firma")
			{
		 	  $("#metode_livrare").slideUp("slow");
			  calculeaza_total(0,'Ridica de la sediu')
				 $("input[@name='livrare']").each(function() {
					//this.checked = true;
					// or, to uncheck
					this.checked = false;
					// or, to toggle
					//this.checked = !this.checked;
				});
			}
			if (tip == "livrare")
			{
			 $("#metode_livrare").slideDown("slow");
			}
	   }
	 });

return false;
} 

function calculeaza_total(valoare,tip)
{
	var total_cos = $("#total_cos_input").val();
	$("#cost_livrare").val (valoare);
	$("#tip_livrare").val(tip);
	$("#cost_transport").text (valoare);
	total_comanda =  parseFloat(valoare) + parseFloat (total_cos);
	$("#total_cost").text(total_comanda);
}


function verifica_comanda ()
{
	var cumparator = $("#id_plata").val();
	var livrare = $("#id_livrare").val();
	var mod_plata = $("input[@name='plata']:checked").val()
	var mod_livrare = $("input[@name='livrare']:checked").val()
	var serie = $("#serie").val();
	var numar = $("#numar").val();
	var total_cos = $("#total_cos_input").val()
	
	if (cumparator ==undefined)
	{
	alert ('Va rugam alegeti un cumparator');return false;
	}
	else if (livrare ==undefined && livrare != 0)
	{
	alert ('Va rugam alegeti o adresa de livrare');return false;
	}
	else if (mod_plata ==undefined)
	{
	alert ('Va rugam alegeti o modalitate de plata');return false;
	}
	else if (mod_livrare ==undefined && livrare != 0 && Math.floor(total_cos) < 150)
	{
	alert ('Va rugam alegeti o modalitate de livrare');return false;
	}
	else if (serie =="")
	{
	alert ('Va rugam introduceti seria buletin');return false;
	}
	else if (numar =="")
	{
	alert ('Va rugam introduceti numarul buletin');return false;
	}
	else 
	{
		return true;
	}
	
	
	
}

function go_cauta ()
{
	var domainname = new String(location.host); 
	var keys = $("#cuvant").val();
window.location.href='http://'+domainname+'/cauta/'+keys;	
}
/*
 if (msg == 1)
			   {
				   
		   			$("#email").attr("value", ""); 
					
					$('<div class="error">Adresa de email mai exista in baza de date</div>')
					
						.insertAfter( $("#mesaj_email") )
						.fadeIn('slow')
						.animate({opacity: 1.0}, 3000)
						.fadeOut('slow', function() {
					
						
					
						});
	
			   }
		*/
		/* ----------------------- VERIFICARE REGISTER ---------------------------------------*/
		
	function check_email2 (email)
	{
		//alert ('asda');
		  ////// checking the imput values 
			   var filter2 = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
				if (!filter2.test(email)) {
					//alert ('asda');
					$("#mesaj").html("Va rugam introduceti o adresa de email valida");
					$("#mesaj").slideDown("slow").animate({opacity: 1.0}, 3000).slideUp('slow')
					$("#email").val("");
				}
				else
				{

							var domainname = new String(location.host); 
							$.ajax({
							   type: "POST",
							   url: "http://"+domainname+"/scripturi/useri.php",
							   data: 'verifica_email='+1+'&email='+email,
							   success: function(msg){
								  // $("#"+str).html(msg);
								  if (msg == 1)
									{
										$("#mesaj").html("Adresa de email mai exista in baza de date");
										$("#mesaj").slideDown("slow").animate({opacity: 1.0}, 3000).slideUp('slow')
										$("#email").val("");
									}
								   
							
						   }
						 });
					
				}
	}
	
/* ----------------------------MODIFICARE DE PAROLA ---------------*/

function check_parola ()
	{
		var parola = $("#parola_veche").val();
		if (parola != '')
		{
				var domainname = new String(location.host); 
				$.ajax({
				   type: "POST",
				   url: "http://"+domainname+"/scripturi/useri.php",
				   data: 'verifica_parola='+1+'&parola='+parola,
				   success: function(msg){
					  // $("#"+str).html(msg);
					  if (msg == 0)
						{
							$("#mesaj").html("Parola veche nu se potriveste");
							$("#mesaj").slideDown("fast").animate({opacity: 1.0}, 3000).slideUp('fast');
							$("#parola_veche").val("");
						}
						
			   }
			 });
				
		
		}
	}


function verifica_parole ()
{
		
		var parola_noua = $("#parola_noua").val();
		var confirmare = $("#confirmare").val();
		if (parola_noua != confirmare && parola_noua !="" && confirmare != '' )
		{
		
			$("#mesaj").html("Parola noua nu este confirmata");
			$("#mesaj").slideDown("fast").animate({opacity: 1.0}, 2000).slideUp('fast');
			return false;
		}
		else if (parola_noua =='' || confirmare =='' || parola =='')
		{
			$("#mesaj").html("Toate campurile sunt obligatorii");
			$("#mesaj").slideDown("fast").animate({opacity: 1.0}, 2000).slideUp('fast');
			return false;
		}
		else 	
		{
		
			return true;
		}
		
		return false;
						
	}
	

function check_email ()
	{
		var email = $("#email_vechi").val();
		if (email != '')
		{
				var domainname = new String(location.host); 
				$.ajax({
				   type: "POST",
				   url: "http://"+domainname+"/scripturi/useri.php",
				   data: 'verifica_email='+1+'&email='+email,
				   success: function(msg){
					  // $("#"+str).html(msg);
					  if (msg == 0)
						{
							$("#mesaj").html("Adresa de email nu este in baza de date");
							$("#mesaj").slideDown("fast").animate({opacity: 1.0}, 3000).slideUp('fast');
							$("#email_vechi").val("");
						}
						
			   }
			 });
				
		
		}
	}


function verifica_emailuri ()
{
		
		var email_nou = $("#email_nou").val();
		var confirmare = $("#confirmare").val();
		if (email_nou != confirmare && email_nou !="" && confirmare != '' )
		{
		
			$("#mesaj").html("Emailul nou nu este confirmat");
			$("#mesaj").slideDown("fast").animate({opacity: 1.0}, 2000).slideUp('fast');
			return false;
		}
		else if (email_nou =='' || confirmare =='' || parola =='')
		{
			$("#mesaj").html("Toate campurile sunt obligatorii");
			$("#mesaj").slideDown("fast").animate({opacity: 1.0}, 2000).slideUp('fast');
			return false;
		}
		else 	
		{
		
			return true;
		}
		
		return false;
						
	}

//------------------------ VOTING PRODUSE------------------------------//	
	function vote (rid,vot)
	{
		var domainname = new String(location.host); 
			$.ajax({
			   type: "POST",
			   url: "http://"+domainname+"/scripturi/useri.php",
			   data: 'voteaza_comentariu='+1+'&rId='+rid+'&vot='+vot,
			   success: function(msg){
				  // alert (msg);
				  // $("#"+str).html(msg);
				 
						$("#voting").html("Multumim pentru vot!");
		   }
		 });
	}
		
//-----------------------------QUICK SEARCH-----------------------------------//


function select_producatori(id_categorie)
{
	var domainname = new String(location.host); 
	var id_produs = $("#id_produs").val();
	var prod2 = $("#prod2").val();
		//alert ('x'+id_produs);
			$.ajax({
			   type: "POST",
			   url: "http://"+domainname+"/scripturi/ajax.php",
			   data: 'show_prod='+1+'&cId='+id_categorie+'&pId='+id_produs+'&prod22'+prod2,
			   success: function(msg){
				  // alert (msg);
				$("#producator").html (msg);
		   }
		 });
}

function select_produse(id_producator)
{
	var domainname = new String(location.host); 
	var id_categ = $("#categorie").val();
	var id_produs = $("#id_produs").val();
	//alert (id_produs);
	
			$.ajax({
			   type: "POST",
			   url: "http://"+domainname+"/scripturi/ajax.php",
			   data: 'show_produse='+1+'&bId='+id_producator+'&cId='+id_categ+'&pId='+id_produs,
			   success: function(msg){
				  //alert (msg);
				$("#produse").html (msg);
		   }
		 });
}


////////////////////////////////////////////////////////////////////SLDER

$("#demo3").hover(
      
	  function () {
		  alert("asda");
        $("#subm").show("fast");
      }
    );


   
  //Another example for mouse over effect on hyperlinks on page
  // $("a").hover(function(){$(this).fadeOut(100);$(this).fadeIn(500);});


///////////////////////////////// BANNER /////////////////////////////

function show_det (idprodus)
{
	var domainname = new String(location.host); 
	//alert (idprodus);
		$.ajax({
			   
			   type: "POST",
			   url: "http://"+domainname+"/scripturi/ajax.php",
			   data: 'show_det=1&pId='+idprodus,
			   success: function(msg){
				  //alert (msg);
				  //return msg;
				  $("#container").hide();
				$("#container").html (msg);
				$("#container").fadeIn("fast");
		   }
		 });
}


function go_show ()
{
	var nume_categorie = $("#categorie :selected").text();
	var nume_categorie = nume_categorie.replace(/ /gi,"+");
	var nume_categorie = nume_categorie.replace(/%C2%A0/gi,"+");
	var nume_categorie = nume_categorie.replace('-',"+");
	var nume_categorie = nume_categorie.replace('/',"")
		var nume_categorie = nume_categorie.replace('&nbsp;',"+")
	var val_categorie =$("#categorie").val();
	var producator = $("#producator").val();
	if (val_categorie != 0)
	{
		window.location.href="http://www.altanet.ro/"+nume_categorie+'-c'+val_categorie+'?prod2='+producator;
	}
}


function redirect (url)
{
	window.location.href=url;
}


function submit_form (forma)
{
	alert (forma);
	$(forma).submit(); 
}
