//ajax

function login() {
	if($('#pass').val()!="" && $('#user').val()!=""){
		user=$('#user').val();
		pass=$('#pass').val();
		$('#login-content').html("<span style='padding-left:500px;' align='center'><img src='"+url_base+"css/images/loader.gif' border='0' style='margin-top:3px;' /></span>");
		$.ajax({
			url: url_base+'ajax/login.php',
			type: 'GET',
			cache: false,
			dataType: 'html',
			data: 'user='+user+'&pass='+pass,
			success: function(responseText){
				$('#login-content').html(responseText);
			}
		});
	}
}
function newsletter() {
	if($('#email_subscribe').val()!=""){
		email=$('#email_subscribe').val();
		$('#abonare').html("<div style='height:20px;margin:0px auto;' align='center'><img src='"+url_base+"css/images/loader.gif' border='0'></div>");
		$.ajax({
			url: url_base+'ajax/newsletter.php',
			type: 'GET',
			cache: false,
			dataType: 'html',
			data: '&email='+email,
			success: function(responseText){
				$('#abonare').html(responseText);
			}
		});
	}
}

function add_comment(id, type){
	if($('#desc').val()!=""){
		val=$('#nr').html();
		$.ajax({
			url: url_base+'ajax/add_comm.php',
			type: 'GET',
			cache: false,
			dataType: 'html',
			data: 'id='+id+'&desc='+encodeURI( $("#desc").val() )+'&type='+type,
			success: function(responseText){
				$('#nr').html(parseInt(val)+1);
				$('#comment').hide();
				$('#comments').show();
				$('#comments').prepend(responseText);
				$('#add_comm').removeClass();
				$('#comm').removeClass();
				$('#comm').addClass('active');
			}
		});
	}
}

function show_comm(what){
	if(what=="comm"){
		$('#comments').show();
		$('#comment').hide();
		$('#add_comm').removeClass();
		$('#comm').removeClass();
		$('#comm').addClass('active');
	}else if(what=="add_comm"){
		$('#comments').hide();
		$('#comment').show();
		$('#comm').removeClass();
		$('#add_comm').removeClass();
		$('#add_comm').addClass('active');
	}
}

