var url = "/"

function changeLanguage(lang){window.location=url+lang+"/";}

function showModal(text){
	jQuery.facebox(text);
}

function facebox_show_data(data){
	jQuery.facebox(data);
}

function setTitle(str){
	$(".titlepage h1").html(str);
}

function ajaxUpdate(id, operation, params){
	var data = "";
	for (elemento in params){
		data += "&" + elemento + "=" + params[elemento];
	}
	
	$.ajax({
		type: "GET",
		url: "ajax.php",
		data: "operation=ajaxCaller&function=" + operation + data,
		success: function(msg){
			$('#' + id).html(msg);
			translateById(id);
		}
	});
}

function isNumeric(value) {
  if (value == null || value.length == 0 || !value.toString().match(/^[-]?\d*\.?\d*$/)) return false;
  return true;
}

function publishHigScore(score, type, categories){
	FB.ui({
     method: 'stream.publish',
     message: message,
     attachment: {
       name: 'Sonoteca',
       caption: '{user} got a new High Score of ' + score + ' points playing ' + type + ' in categories ' + categories,
       description: (
         'You can Play Sonoteca and beat your friends showing them who is the best'
       ),
	   media: [{type: 'image', src: IMAGEPATH + "category-image.png", href: FACEBOOK_URI}]
       href: 'http://apps.facebook.com/davidrojotest/'
     },
     action_links: [
       { text: 'Code', href: 'http://apps.facebook.com/davidrojotest/' }
     ],
     user_message_prompt: 'Share your New Score!!'
   }
 );
}