function get_votes(id){
    new Ajax.Updater('voted_rank','/voteRank/'+id, {method: 'get'});
}

function vote(pos, id){
    new Ajax.Updater('vote','/vote/'+id+'/'+pos, {method: 'get'});
	get_votes(id);
}

function get_votes_restaurant(id){
    new Ajax.Updater('voted_rank','/voteRankRestaurant/'+id, {method: 'get'});
}

function voteRestaurant(pos, id){
    new Ajax.Updater('vote','/voteRestaurant/'+id+'/'+pos, {method: 'get'});
	get_votes_restaurant(id);
}

function get_votes_hotel(id){
    new Ajax.Updater('voted_rank','/voteRankHotel/'+id, {method: 'get'});
}

function voteHotel(pos, id){
    new Ajax.Updater('vote','/voteHotel/'+id+'/'+pos, {method: 'get'});
	get_votes_hotel(id);
}

function get_votes_excursion(id){
    new Ajax.Updater('voted_rank','/voteRankExcursion/'+id, {method: 'get'});
}

function voteExcursion(pos, id){
    new Ajax.Updater('vote','/voteExcursion/'+id+'/'+pos, {method: 'get'});
	get_votes_Excursion(id);
}

function mark(pos, MEDIA_URL, SKIN){
	for(var i=1; i<=pos; i++){
		element = document.getElementById('star'+i);
		element.style.background = "url("+MEDIA_URL+"skins/"+SKIN+"/images/stars_blue_bg.gif) no-repeat 0 0";
	}
}

function unmark(pos, MEDIA_URL, SKIN){
	for(var i=1; i<=pos; i++){
		element = document.getElementById('star'+i);
		element.style.background = "url("+MEDIA_URL+"skins/"+SKIN+"/images/stars_blue_bg.gif) no-repeat -27px 0";
	}
}

function isEmail(s) 
{
  if (s=="")
    {
       return false;
    }
  if (/[^@]+@[^@]+/.test(s))
       return true;
  return false;
}

function send_comment(){
	var name = document.getElementById('id_name').value;
	var email = document.getElementById('id_email').value;
	var comment = document.getElementById('id_comment').value;
	var comment_form = document.getElementById('custom_comment_form');
	if((isEmail(email)) && (name!="") && (comment!="")){
	 	try{
			comment_form.submit();
		}
		catch(e){
		}
	}
	else{
	}
}