function refreshBlogList() {
	// Get sortBy
	for( i = 0; i < document.forms['blogFilterForm'].sortBy.length; i++ ){
		if( document.forms['blogFilterForm'].sortBy[i].checked == true )
		var sortBy = document.forms['blogFilterForm'].sortBy[i].value;
	}
	// Get order
	for( i = 0; i < document.forms['blogFilterForm'].order.length; i++ ){
		if( document.forms['blogFilterForm'].order[i].checked == true )
		var order = document.forms['blogFilterForm'].order[i].value;
	}	
	var location = "bloguri-inscrise";showLoader(location,1);
	var url = "index.php?action=bloguri-inscrise-ajax&sortBy="+sortBy+"&order="+order;	
	var myAJAX = new Ajax.Updater(location, url, {	method: 'get',	onFailure : function(resp) {alert("Oops, there's been an error.");}});
}

function showLoader(location,loadingType) {
	$(location).innerHTML = '<img src="/templates/default/images/loading'+loadingType+'.gif" alt="Loading">';
}

function bounceOut(divid,height) {
	$(divid).effect('height',{
		duration: 1000,
		transition: Fx.Transitions.bounceOut
	}).start(height,0);
}

function sendContact(frm) {
	var pars = Form.serialize('contactForm');	
	$('contactDiv').innerHTML = '<img src="/templates/default/images/loading1.gif" alt="Loading">';
	var myAjax = new Ajax.Updater('contactDiv', 'index.php?action=sendContact', {	method: 'post',	parameters: pars, onFailure : function(resp) {alert("Oops, there's been an error.");}});
	return(false);
}

function addPhotoPoint(articleID,currentNr) {
	var location = "photoPoint"+articleID;
	var url = "/index.php?action=addPhotoPoint&articleID="+articleID;
	$(location).innerHTML = '<img src="/templates/default/images/loading1.gif" alt="Loading">';
	var myAjax = new Ajax.Updater(
		location,
		url,
		{
			method: 'post',			
			onFailure : function(resp) {
				alert("Oops, there's been an error.");
			},
			onComplete : function(resp) {
				// Do stuff based on response
				resp = resp.responseText;
				var respStatus = getResponseValue('status',resp);
				if (respStatus == 'success') {
					$('photoPointValue'+articleID).innerHTML = currentNr+1;
					$('photoPoint'+articleID).innerHTML = "<strong>Adaugat!";
				} else {
					$('photoPoint'+articleID).innerHTML = "<strong>Articol deja votat!</strong>";
				}
			}
		}
	);
}

function manageFavBlog(blogID,status) {
	if (status == 0) {
		var q = confirm('Doriti sa stergeti acest blog din lista de favorite?');
		if (q) {
			var myAjax = new Ajax.Updater('favoritesButton', 'index.php?action=manageFavorites&blogID='+blogID+'&status='+status, {	method: 'get',	onFailure : function(resp) {alert("Oops, there's been an error.");}});
		}
	} else {
		var myAjax = new Ajax.Updater('favoritesButton', 'index.php?action=manageFavorites&blogID='+blogID+'&status='+status, {	method: 'get',	onFailure : function(resp) {alert("Oops, there's been an error.");}});
	}
}


function deleteFavBlog(blogID) {
	var q = confirm('Doriti sa stergeti acest blog din lista de favorite?')
	if (q) {
		// Visual effects
		$('favBlog'+blogID).style.display = 'none';
		// Ajax request to delete fav blog
		var myAjax = new Ajax.Updater('favoritesButton', 'index.php?action=deleteFromFavorite&blogID='+blogID, {	method: 'get',	onFailure : function(resp) {alert("Oops, there's been an error.");}});
	}
}

function setEmailNotification(blogID,status) {
	// Show loading
	$('busyIndicator'+blogID).innerHTML = '<img src="http://www.bloguri-foto.com/templates/default/images/loading1.gif" align="absmiddle">';
	// Ajax shit
	var url = 'index.php?action=setEmailNotification&blogID='+blogID+'&status='+status;
	var myAjax = new Ajax.Updater(
		'busyIndicator'+blogID,
		url,
		{
			method: 'get',			
			onFailure : function(resp) {
				alert("Oops, there's been an error.");
			}
		}
	);
}

function setMyFeedStatus(blogID,status) {
	// Show loading
	$('busyIndicator'+blogID).innerHTML = '<img src="http://www.bloguri-foto.com/templates/default/images/loading1.gif" align="absmiddle">';
	// Ajax shit
	var url = 'index.php?action=setMyFeedStatus&blogID='+blogID+'&status='+status;
	var myAjax = new Ajax.Updater(
		'busyIndicator'+blogID,
		url,
		{
			method: 'get',			
			onFailure : function(resp) {
				alert("Oops, there's been an error.");
			}
		}
	);	
}

function showRecomandaForm() {
	$('recomandaBlogForm').style.display = 'block';
}

function sendRecomandare(blogID) {
	var email = $('emailAddr').value;	
	$('recomandaBlogForm').style.display = "block";
	$('recomandaBlogForm').innerHTML = '<img src="http://www.bloguri-foto.com/templates/default/images/loading1.gif" width="16" height="16" align="absmiddle">';
	var myAjax = new Ajax.Updater('recomandaBlogForm', 'index.php?action=doRecomandaBlog&blogID='+blogID+'&email='+email, {	method: 'get',	onFailure : function(resp) {alert("Oops, there's been an error.");}});
}

function tg(some) {
	Effect.toggle(some,'slide',{duration:0.2});
}
