//ajax

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 month(mon,year) {
	$.ajax({
		url: url_base+'ajax/events.php',
		type: 'GET',
		cache: false,
		dataType: 'html',
		data: '&mon='+mon+'&year='+year,
		success: function(responseText){
			$('#calendar').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');
	}
}
