
	$$(document).ready(function(){
		
		var is_www = (window.location.href.substr(7,3) == 'www');
		
		$$('#nwgo').click(function(e){
			e.preventDefault();
			$$.ajax({
				   type: 'post',
				   url: 'http://'+(is_www?'www.':'')+'electro6.ro/subscribe.php', 
				   data: 'email='+$$('#email_s').val(),
				   beforeSend: function(xhr) {
						$$('#error').html("Se incarca!").show();
				   },
				   error: function(xhr, text, err) {
						$$('#error').html("A intervenit o eroare, va rugam sa incercati mai tarziu!").show();
						//$$('#error').html("Eroare: "+err.message).fadeIn('slow').show();
				   },
				   success: function(data, text, xhr) {
					  stat = eval("("+ data +")");
					  if (stat.status)  {
						  $$('#error').html(stat.reason).show();
					   }
					   
					   //$$('#error').html("Success").fadeIn('slow').show();
				   }
			 });
		});
	});
	
function debug(value) {
	try{console.log(value)}
	catch(err){}
}

