function checkForm() {
  var error = 0;
  var error_message = "Au aparut erori in timpul procesrii formularului tau!\nTe rugam sa faci urmatoarele corectari:\n\n";

  var review = document.product_reviews_write.review.value;

  if (review.length < 50) {
    error_message = error_message + "* Campul 'Comentarii' trebuie sa aiba cel putin 50 caractere.\n";
    error = 1;
  }

  if ((document.product_reviews_write.rating[0].checked) || (document.product_reviews_write.rating[1].checked) || (document.product_reviews_write.rating[2].checked) || (document.product_reviews_write.rating[3].checked) || (document.product_reviews_write.rating[4].checked)) {
  } else {
    error_message = error_message + "* Trebuie sa cotezi produsul pentru comentariile tale.\n";
    error = 1;
  }

  if (error == 1) {
    alert(error_message);
    return false;
  } else {
    return true;
  }
}

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}

function sendMail(){
	 var data = $("#contact_us").serialize();
	 $('#contact_us_div').html("<div align='center'><img src='/addons/colorbox/images/loading.gif' border='0'></div>");				
	 $.ajax({  
	   type: "POST",  
	   url: "/contact/send",  
	   data: data,  
	   success: function(html) {  		     
		 //.fadeIn(1500, function() {  
		 //  $('#message').append("<img id='checkmark' src='images/check.png' />");  
		 //});  
		 $('#contact_us_div').html(html);
	   }  
	 });  
	 return false;  
}

function changeList(file, type){
	if(file == "noutati")
		var	fileurl = "/parts/new_products.php";
	else
		var	fileurl = "/parts/products_listing.php";
	
	$.ajax({
	  type: "GET",
	  url: fileurl,
	  data: 'type=' + type,
	  success: function(msg){
		 $('#listTable').html(msg);
	   }

	});
}
