/*
window.addEvent('domready',function(){
	MM_preloadImages('/templates/default/imgs/btn-noticias-over.gif', '/templates/default/imgs/btn-conciertos-over.gif', '/templates/default/imgs/btn-disco-over.gif', '/templates/default/imgs/btn-fotos-over.gif', '/templates/default/imgs/btn-bio-over.gif', '/templates/default/imgs/btn-tienda-over.gif', '/templates/default/imgs/btn-prensa-over.gif', '/templates/default/imgs/btn-enlaces-over.gif', '/templates/default/imgs/btn-blog-over.gif', '/templates/default/imgs/btn-jukebox-over.gif', '/templates/default/imgs/twiter-marlango-over.gif', '/templates/default/imgs/facebook-marlango-over.gif', '/templates/default/imgs/myspace-marlango-over.gif', '/templates/default/imgs/canal-youtube-marlango-over.gif');
	
	$$('#div_menu img a').addEvents({
    'mouseover': function(){MM_swapImage(this.getFirst().id,'','/templates/default/imgs/'+this.id+'-over.gif',1);},
    'mouseout': function(){MM_swapImgRestore();}
	});	
	
	$$('#div_menu_pq img a').addEvents({
    'mouseover': function(){MM_swapImage(this.getFirst().id,'','/templates/default/imgs/'+this.id+'-over.gif',1);},
    'mouseout': function(){MM_swapImgRestore();}
	});	
	
})
*/

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null) 	{document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} 
}

function cambiar_comentadas_valoradas(id){
 	if(id == "noticias_mas_valoradas"){
	 	document.getElementById(id).style.display="";
		document.getElementById("noticias_mas_comentadas").style.display="none";
		document.images["valorada"].src = "/templates/default/css/images/mas_valorados.jpg";
		document.images["comentada"].src = "/templates/default/css/images/mas_comentados.gif";
	}else{
		document.getElementById(id).style.display="";
		document.getElementById("noticias_mas_valoradas").style.display="none";	
		document.images["comentada"].src = "/templates/default/css/images/mas_comentados_hover.gif";
		document.images["valorada"].src = "/templates/default/css/images/mas_valorados.gif";
	}
}

function new_captcha(){
	if(document.getElementById){
		// extract image name from image source (i.e. cut off ?randomness)
		thesrc = document.getElementById("captcha").src;

		// add ?(random) to prevent browser/isp caching
		document.getElementById("captcha").src = thesrc+"&"+Math.round(Math.random()*100000);
	}//fin if
}//fin function

function mostrar_listado(id){
	document.getElementById(id).style.display="";
}

function ocultar_listado(id){
	document.getElementById(id).style.display="none";
}

function handleHttpResponse_fotos() {
	if (http.readyState == 4) {
		if (http.responseText.indexOf('invalid') == -1) {
			var response = http.responseXML;
			if (document.getElementById('language').value == 1){ 
				document.getElementById(response.getElementsByTagName('span').item(0).firstChild.data).innerHTML = "<b>Gracias por votar</b>";
			}
			if (document.getElementById('language').value == 2){ 
				document.getElementById(response.getElementsByTagName('span').item(0).firstChild.data).innerHTML = "<b>Thanks for voting</b>";
			}
			isWorking = false;
		}
	}
}

var isWorking = false;
function me_gusta(foto){
	var ieVer = /*
				 * @cc_on function(){ switch(@_jscript_version){ case 1.0:return
				 * 3; case 3.0:return 4; case 5.0:return 5; case 5.1:return 5;
				 * case 5.5:return 5.5; case 5.6:return 6; case 5.7:return 7;
				 * case 5.8:return 8; }}()||@
				 */0;
	if (ieVer > 0 && ieVer <= 6) {
		http = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		http = new XMLHttpRequest();
	}
	if (!foto){
		alert("Ha ocurrido un error interno, consulte con el administrador de ojodepez");
		return false;
	}
	var url = "/meeting/ajax/i_like_it.php?foto="+foto;
	http.open("GET", url, true);
	http.onreadystatechange = handleHttpResponse_fotos;
	isWorking = true;
	http.send(null);
}

function ver_apuntate_meeting(){
	document.getElementById('apuntate-meeting').style.display = "";
	document.getElementById('cine-documental').style.display = "none";
	document.getElementById('fotoparticipa-fija').style.display = "";
	document.getElementById('fotoparticipa-variable').style.display = "none";
	document.getElementById('fotodocumental-fija').style.display = "none";
	document.getElementById('fotodocumental-variable').style.display = "";	
}

function ver_cine_documental(){
	document.getElementById('apuntate-meeting').style.display = "none";
	document.getElementById('cine-documental').style.display = "";
	document.getElementById('fotodocumental-fija').style.display = "";
	document.getElementById('fotodocumental-variable').style.display = "none";
	document.getElementById('fotoparticipa-fija').style.display = "none";
	document.getElementById('fotoparticipa-variable').style.display = "";	
}
