var url = new Array();
url["home"] = "m1.php";
url["images"] = "m2.php";
url["videos"] = "m3.php";
url["mail"] = "m4.php";
url["map"] = "m5.php";
url["friends"] = "m6.php";
url["aplications"] = "m7.php";
url["album"] = "images.php";
url["image"] = "image.php";
url["valbum"] = "videos.php";
url["video"] = "video.php";
url["perfil"] = "user.php";
url["eventos"] = "events.php";
url["privado"] = "privado.php";
url["newmail"] = "newmail.php";
url["newgroup"] = "newgroup.php";
url["newimage"] = "newimage.php";
url["newvideo"] = "newvideo.php";
url["invita"] = "invita.php";
url["evento"] = "evento.php";
url["account"] = "account.php";
url["share"] = "share.php";
url["publicar"] = "publicar.php";
url["publica"] = "publica.php";
url["newfeed"] = "newfeed.php";
url["newtweet"] = "newtweet.php";
url["shareit"] = "shareit.php";
url["feed"] = "feed.php";
url["apps"] = "m7.php";
url["app"] = "app.php";
url["newapp"] = "newapp.php";
url["rss"] = "rss.php";
url["solicitudes"] = "solicitud.php";
url["nolevel"] = "nolevel.php";
url["newevent"] = "newevent.php";

var tab = new Array();
tab["album"] = "m2";
tab["image"] = "m2";
tab["valbum"] = "m3";
tab["video"] = "m3";
tab["perfil"] = "";
tab["eventos"] = "";
tab["privado"] = "m4";
tab["newmail"] = "m4";
tab["newimage"] = "m2";
tab["newvideo"] = "m3";
tab["invita"] = "";
tab["evento"] = "";
tab["account"] = "";
tab["share"] = "";
tab["publicar"] = "";
tab["publica"] = "";
tab["newfeed"] = "";
tab["newtweet"] = "";
tab["app"] = "m7";
tab["map"] = "m5";

/* GUARDAR EN FAVORITOS */
function af(){ window.external.AddFavorite('http://www.ieris.com','Ieris. Buscador Social'); }
/* PAGINA PRINCIPAL */
function sh(){ document.body.style.behavior='url(#default#homepage)'; try { document.body.setHomePage('http://www.ieris.com'); } catch(e) { location.href='setsh.php'; } }

/* BUSCADOR */
var textobusqueda = ''
function activesearch(){ 
	
	if(document.getElementById('bo').className == 'box') 
	{ 
		document.getElementById('bo').className = 'boxh'; 
		
		if(textobusqueda == '')
			textobusqueda = document.getElementById('s').value;
		
		if(document.getElementById('s').value == textobusqueda)
			document.getElementById('s').value = '';
			
	} else {
		
		if(document.getElementById('s').value == "")
			document.getElementById('s').value = textobusqueda;
			
		document.getElementById('bo').className = 'box';  
	} 
}

function textsearch(texto)
{
/*	
	if(document.getElementById('s').value == "" || document.getElementById('s').value == textobusqueda || textobusqueda == "")
		$('#s').val(texto);
		
	textobusqueda = texto;*/
}

/* COMENTARIOS */
function acomentar(div, id, tipo)
{
	$("#form1").remove();
	$.get("../modules/newcomment.php?id="+id+"&tipo="+tipo, function(data){ 
		$("#"+div).html(data);
	})
}

function textCounter(field, countfield, maxlimit)
{
	if (field.value.length > maxlimit) 
		field.value = field.value.substring(0, maxlimit);
	else 
		countfield.value = maxlimit - field.value.length;
}

/* FIN COMENTARIOS */
/* VIDEOS */
function savevideo(titulo, url, image, long) 
{
	$("ul#active").empty();
	$.get("../modules/svideo.php?titulo="+titulo+"&url="+url+"&image="+image+"&size="+long, function(data){ $("#execute").html(data); });
	aviso("Video Guardado Correctamente<br><a href=\"#videos\">Ver mis videos</a>");
};

function actualiza(accion, div) 
{	
	$.get(accion, function(data) {
		$(div).html(data);
	});
}

function change(accion, msg, form) 
{	
	$.get(accion, function(data) {
		$("#execute").html(data);
		if(msg != "")
			aviso(msg);
	});
}

function cleanimage(campo) 
{
	$("ul#"+campo).empty();
}

function openurl(url, msg)
{
	$.get(url, function(data) {
		$("#execute").html(data);
		aviso(msg);
	});
}

function show(campo)
{
	if(document.getElementById(campo).style.display == 'none')
	{
		document.getElementById(campo).style.display = 'inline';
	} else {
		document.getElementById(campo).style.display = 'none';
	}
}

pageload = 0;
function open(url, frame, loading, red)
{
	/*
	if(typeof loading == 'undefined')
	{
		$("#"+frame).html("<img src=\"../img/loading.gif\"> Cargando...");
	}
	*/
	pageload = 0;
	/* var timer1 = window.setTimeout("isloading('"+frame+"');",2000); */
	
	$("#"+frame).load(url, function(){
		// clearTimeout(timer1);
		pageload = 1;
		//$("#"+frame).fadeIn(100);
		
		if(!loading)
			window.scrollTo(0, 0);
	});
}

function isloading(frame)
{
	if(pageload == 0)
		$("#"+frame).html("<div id=\"load\"><img src=\"../img/loading.gif\" align=\"absmiddle\"> Cargando...</div>");
	
}

function URLEncode (clearString) 
{
	var output = '';
	var x = 0;
	clearString = clearString.toString();
	var regex = /(^[a-zA-Z0-9_.]*)/;
	while (x < clearString.length) 
	{
		var match = regex.exec(clearString.substr(x));
		if (match != null && match.length > 1 && match[1] != '') 
		{
			output += match[1];
			x += match[1].length;
		} else {
			if (clearString[x] == ' ')
				output += '+';
			else {
				var charCode = clearString.charCodeAt(x);
				var hexVal = charCode.toString(16);
				output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
			}
			x++;
		}
	}
	return output;
}

/* ENVIAR FORMULARIO */
	function sendform(url, message, form)
	{
		$("ul#img").append("<li id=\"liform\" style=\"display:none;\"><iframe style=\"display:none;\" id=\"ifimg\" name=\"ifimg\"></iframe> </li>");
		$("#"+form).attr("action", url);
		
		$("#"+form).submit();
		
		if(message != "")
			aviso(message);
	}
	
	function sendformclose()
	{
		$("#liform").remove();	
	}
/* FIN ENVIAR FORMULARIO */
/* CAMBIO DE PESTAÑA */
	function loadurl(cad) 
	{
		idint = cad.indexOf("?");
		if(idint == -1)
		{
			set(url[cad]);
		} else {
			base = cad.substring(0, idint);
			query = cad.substring(idint);
			open(url[base] + query, "contenido");
			
			if(tab[base] != "" && tab[base])
				setstyle(tab[base]);
		}
		//window.scrollTo(0, 0);
	}

	function set(col,t){
		var estilo = col.substring(0,col.indexOf('.'));
		
		try {
			open(col, "contenido");
		} catch(e) {
			open("base.php?id="+col.indexOf('.'), "indice");
		}
	
		document.getElementById('t').value = t; 
		setstyle(estilo)
	}
	
	function setstyle(estilo)
	{
		document.getElementById('lateral').className="w"+estilo+" f5"; 

		i = 1;
		while(document.getElementById('lm'+i))
		{
			document.getElementById('lm'+i).className = "m"+i + " eb";
			i++;
		}
	
		try {
			document.getElementById('se').className = estilo+" f"; 
			document.getElementById('l'+estilo).className = estilo+ " "+estilo+ "s eb";
			document.getElementById('imgs').src= "http://www.ieris.com/"+estilo+".jpg";
			document.search.action = "javascript:open('../search/s"+estilo+".php?s='+URLEncode(document.getElementById('s').value), 'contenido');";
		} catch(e) {; }
	}
/* FIN CAMBIO PESTAÑA */
/* ABRIR URL EN SHADOWBOX */
	function wurl(url, tit, wid, hei)
	{
		if(url.indexOf(".jpg") > 0 || url.indexOf(".gif") > 0 || url.indexOf(".png") > 0)
			Shadowbox.open({ player: 'image', content: url, title: tit });	
		else
			Shadowbox.open({ player: 'iframe', content: url, title: tit });	
	}
/* FIN ABRIR URL EN SHADOWBOX */
/* SAVE_FAVORITES */
	function savefavorites(tipo, img, love)
	{
		if(love == null)
		{
			if($("#f"+tipo+img).attr('src') == '../img/nfstar.png')
			{
				change("../modules/savefavorites.php?idtype="+img+"&type="+tipo, "", "");
				$("#f"+tipo+img).attr('src', '../img/fstar.png'); 
			} else {
				change("../modules/savefavorites.php?idtype="+img+"&type="+tipo, "", "");
				$("#f"+tipo+img).attr('src', '../img/nfstar.png'); 
			}
		} else {
			if($("#f"+tipo+img).attr('src') == '../img/nfstar16.png')
			{
				change("../modules/savefavorites.php?idtype="+img+"&type="+tipo, "", "");
				$("#f"+tipo+img).attr('src', '../img/fstar16.png'); 
				$("#t"+tipo+img).html('Ya no :-('); 
				$("#c"+tipo+img).html(parseInt($("#c"+tipo+img).html())+1);
			} else {
				change("../modules/savefavorites.php?idtype="+img+"&type="+tipo, "", "");
				$("#f"+tipo+img).attr('src', '../img/nfstar16.png'); 
				$("#t"+tipo+img).html('¡Me Encanta!'); 
				$("#c"+tipo+img).html($("#c"+tipo+img).html()-1);
			}
		}
	}
/* FIN SAVE_FAVORITES */
/* POINTS */
	function updatepoints(points, levelant, level, levelpoints, pointsnextlevel)
	{
		$('#level_percent', top.document).html("Nivel "+level+" - "+points+" (faltan "+(pointsnextlevel - points)+")");
		$('#progressbarlevel', top.document).css("width", ((points-levelpoints)*100/(pointsnextlevel-levelpoints))+"%");
		
		if(levelant < level)
		{
			$('#uplevel', top.document).show();
			setTimeout('disablediv(\'uplevel\')', 10000);
		}
	}
	
	function disablediv(div)
	{
		$('#'+div).hide();
	}
/* FIN POINTS */
/* TIPS */
	function showtips()
	{
		bimg = "<img id=\"imgtips\" src=\"../img/tip.png\" width=\"32\" class=\"online_user\" height=\"32\" align=\"absmiddle\" onmouseover=\"muestranombre('name_tips', 'litips');\" onmouseout=\"ocultanombre('name_tips')\" onclick=\"showtips();\"><div id=\"name_tips\" class=\"online_user_option\">Tutorial </div> "; 
	
		if($("#litips").length == 0)
			$("#menu").append("<li id=\"litips\">"+bimg+"</li>");
		
		$('#tips').css( { "left": (document.getElementById('litips').offsetLeft) + "px" } );
		$('#tipswbotimage').css( { "left": (document.getElementById('litips').offsetLeft + 10) + "px" } );
		$('#tips').toggle('slow');
	}
	
	
	function hidetips()
	{
		$('#tips').hide('slow');
	}
	
	function disabletips()
	{
		if(confirm('¿Está seguro que desea cerrar el tutorial?\nPara deshabilitarlo debe hacerlo desde "Mi Cuenta"'))
		{
			hidetips();
			$("#litips").remove();
		}
	}
/* FIN TIPS */
/* CONTACTOS */
	function showcontacts()
	{
		$('#wrappercon').css( { "top": (document.getElementById('selector').offsetTop+30) + "px" } );	
		$('#wrappercon').toggle('slow');
	}
	
	function hidecontacts()
	{
		$('#wrappercon').hide('slow');
	}
/* FIN CONTACTOS */
/* CHAT */
	timechat = "";
	actual = 0;
	schat = 0;
	conectado = 0;
	titlechatactivo = false;
	htmlchat = "";
	
	function setchat(num, name)
	{
		if(actual == num)
		{
			disablechat();
			actual = 0;
		} else {
			
			// Mostramos el icono abajo
			cargacharla(num, name, 0);
			$('.msgchat').hide();
			$('#msgchat'+num).show();
			
			// Cargamos el chat
			if($('#msgchat'+num).length == 0)
				$('#topchat').after("<div id=\"msgchat"+num+"\" class=\"msgchat\" align=\"left\"></div>");

			$('#msgchat'+num).html("");
				
			$('#topchat').html("<span style=\"float:right;\"> <a href=\"javascript:disablechat()\"><img src=\"../img/min.png\" align=\"absmiddle\" border=\"0\" /></a><a href=\"javascript:closechat("+num+")\"><img src=\"../img/close.png\" align=\"absmiddle\" border=\"0\" /></a></span><div style=\"padding-top:3px;\">" + name + "</div>");
			document.getElementById('userchat').value = num;
			document.getElementById('mchat').value = "";
			document.getElementById('fchat').action = "javascript:send('../modules/chat.php', "+num+", '"+name+"');";
			
			// Cargamos el texto
			if(document.getElementById("in"+num) != null)
				$.get("../modules/createcookie.php", { num: num, value: document.getElementById("in"+num).value});
			else
				$.get("../modules/createcookie.php", { num: num });

			document.getElementById('msgchat'+num).value = "";
			clearTimeout(timechat);
			actual = num;
			updatechat("../modules/chat.php?user="+num, num, name);
			
			$('#chat').css( { "left": (document.getElementById('chat_'+num).offsetLeft) + "px" } );
			$('#botimage').css( { "left": (document.getElementById('chat_'+num).offsetLeft+10) + "px" } );
			document.getElementById('chat').style.display = "inline";
		}
	}
	
	function cargacharla(num, name, aviso)
	{
		// Comprobamos si existe la imagen
		var tmp = new Image;
		var simg = "";
		tmp.src = "../avatars/" + num + ".jpg";
		if(tmp.complete) 
		{ 
			bimg = "<img id=\"imguser_"+num+"\" src=\""+tmp.src+"\" width=\"32\" class=\"online_user\" height=\"32\" align=\"absmiddle\" onmouseover=\"muestranombre('name_"+num+"', 'chat_"+num+"');\" onmouseout=\"ocultanombre('name_"+num+"')\" onclick=\"setchat("+num+", '"+name+"');\"><div id=\"name_"+num+"\" class=\"online_user_option\">"+name+" </div> "; 
		} else {
			bimg = "<img id=\"imguser_"+num+"\" src=\"../img/echat.png\" width=\"32\" class=\"online_user\" height=\"32\" align=\"absmiddle\" onmouseover=\"muestranombre('name_"+num+"', 'chat_"+num+"');\" onmouseout=\"ocultanombre('name_"+num+"')\" onclick=\"setchat("+num+", '"+name+"');\"><div id=\"name_"+num+"\" class=\"online_user_option\">"+name+" </div> "; 
		}
		
		// Añadimos el registro
		if($("#chat_" + num).length == 0)
			$("#menu").append("<li id=\"chat_" + num + "\">"+bimg+"</li>");
			
		if(aviso == 1)
		{
			
			top.jwplayer().play();
			$("#imguser_"+num).attr("class", "online_user_light");
			titlechatactivo = true;
			changetitlechat(name + ' le ha mandado un mensaje');
			 "<embed src=\"beep.wav\" autostart=\"TRUE\" hidden=\"TRUE\" loop=\"TRUE\" ><noembed><bgsound src=\"beep.wav\" loop=\"-1\"></noembed>";
		} else {
			$("#imguser_"+num).attr("class", "online_user");
			titlechatactivo = false;
		}
	}
	
	function closechat(num)
	{
		$("#chat_" + num).remove();
		disablechat();
	}
	
	function muestranombre(num, elem)
	{
		if(actual != num)
		{
			$("#"+num).css( { "left": (document.getElementById(elem).offsetLeft) + "px" } );
			$("#"+num).show();
		}
	}
	
	function ocultanombre(num)
	{
		$("#"+num).hide();
	}
	
	function disablechat()
	{
		clearTimeout(timechat);
		document.getElementById('chat').style.display = "none";
	}
	
	function chatlogin()
	{
		$("#conectar").hide();
		$("#contactos").show();
		$("#chat_lista #opciones").show();
		$("#chat_estado").attr('src', '../img/on.png');
		$("#chat_testado").html("Conectando...");
		conectado = 1;
	}
	
	function chatlogout()
	{
		$("#conectar").show();
		$("#contactos").hide();
		$("#chat_lista #opciones").hide();
		$("#chat_estado").attr('src', '../img/off.png');
		$("#chat_testado").html("Chat - Offline");
		conectado = 0;
		
	}
	
	function updatechat(page, num, name) {
		$.get(page, function(data) {
			if(htmlchat != data || $('#msgchat'+num).html() == "")
			{
				htmlchat = data;
				$('#msgchat'+num).html(data);
				document.getElementById('msgchat'+num).scrollTop = document.getElementById('msgchat'+num).scrollHeight; 
			}
		});
		timechat = setTimeout('updatechat(\''+page+'\', '+num+', \''+name+'\')', 1000);
	}
	
	function changetitlechat(title) 
	{ 
		setTimeout('changedefault()', 2000);
		
		if(titlechatactivo)
		{
			document.title = title;
			setTimeout('changetitlechat(\''+title+'\')', 4000);
		}
	}
	
	function changedefault()
	{
		document.title = 'Ieris';	
	}
	
	function showchat()
	{
		if(document.getElementById('chat_lista').style.display == 'none')
		{
			$('#botchatlistaimage').css( { "left": (document.getElementById('chat_lista').offsetLeft+200) + "px" } );
			document.getElementById('chat_lista').style.display = 'block';
		} else {
			hiddenchat();
		}
	}
	
	function hiddenchat()
	{
		document.getElementById('chat_lista').style.display = 'none';
	}
	
	function checkchat()
	{
		if(conectado == 1)
			$('#contactos').load('../modules/useronline.php');
			
		setTimeout('checkchat()', 10000);
	}
	
	function send(page, num, name)
	{
		clearTimeout(timechat);
		imchat = $('input#mchat').get(0).value;
		iuser = $('input#userchat').get(0).value;

		$("#imguser_"+iuser).attr("class", "online_user");
		titlechatactivo = false;
		$.get("../modules/createcookie.php", { num: iuser, value: document.getElementById("in"+iuser).value});
		$.post(page, { mchat: imchat, user: iuser});
		$("#mchat").val("");
		updatechat(page+"?user="+$("#userchat").val(), num, name);
	}
	
	function disabletitle()
	{
		iuser = $('input#userchat').get(0).value;
		titlechatactivo	= false;
		$("#imguser_"+iuser).attr("class", "online_user");
	}
	
/* FIN CHAT */
/* TOOLBAR ELEMENTS */
	function pushbarvideo(div, title, image)
	{
		$('#o' + div).attr('width', 400); 
		$('#o' + div).attr('height', 250); 
		
		pushbar(div, title, image); 
		
		$('#o' + div).attr('width', 640); 
		$('#o' + div).attr('height', 385);
	}

	function pushbarapp(div, title, image)
	{
		pushbar(div, title, image); 
	}
	
	function pushbarurl(title, url)
	{	
		image = "../img/www.png";
		div = url.replace(/[^A-Za-z$-]/g, "");
		
		pushbar(div, title, image, url); 
		Shadowbox.close();
	}
	
	function closeurl(url)
	{
		div = url.replace(/[^A-Za-z$-]/g, "");
		closebar(div);
		closebox();
	}
	
	function closebox()
	{
		Shadowbox.close();	
	}
	
	
	function pushbar(div, title, image, url)
	{
		if(url != null)
			bimg = "<img id=\"i"+div+"\" src=\""+image+"\" width=\"32\" class=\"online_user\" height=\"32\" align=\"absmiddle\" onmouseover=\"muestranombre('t"+div+"', 'e"+div+"');\" onmouseout=\"ocultanombre('t"+div+"')\" onclick=\"wurl('"+url+"', '"+title+"');\"><div id=\"t"+div+"\" class=\"online_user_option\">"+title+" </div><div id=\"c"+ div +"\" style=\"display:none\"></div> "; 
		else
			bimg = "<img id=\"i"+div+"\" src=\""+image+"\" width=\"32\" class=\"online_user\" height=\"32\" align=\"absmiddle\" onmouseover=\"muestranombre('t"+div+"', 'e"+div+"');\" onmouseout=\"ocultanombre('t"+div+"')\" onclick=\"showbar('"+div+"', '"+title+"');\"><div id=\"t"+div+"\" class=\"online_user_option\">"+title+" </div><div id=\"c"+ div +"\" style=\"display:none\"></div> "; 
		
		// Añadimos el registro
		if($("#e" + div).length == 0)
			$("#menu").append("<li id=\"e" + div + "\">"+bimg+"</li>");
			
		if(url != null)
		{
		} else {
			$("#"+div).hide();
			$('#c'+div).html($("#"+div).html());
			showbar(div, title);
		}
	
	}
	
	function closebar(div)
	{
		baractual = "";
		$('#wrapperbar').hide();
		$("#i"+div).remove();
		$("#t"+div).remove();
		$("#c"+div).remove();
		$("#e"+div).remove();
	
		if($("#" + div).length > 0)
			$("#"+div).show();
	}
	
	baractual = "";
	function showbar(div, titulo)
	{
		if(baractual == div)
		{
			
			if(document.getElementById('wrapperbar').style.visibility == 'hidden')
				document.getElementById('wrapperbar').style.visibility = 'visible';
			else
				document.getElementById('wrapperbar').style.visibility = 'hidden';
				
		} else {
			
			document.getElementById('wrapperbar').style.visibility = 'visible';
			$('#wrapperbar').show();
			
			// Cargamos la ventana
			$('#wrapperbar_titulo').html("<span style=\"float:right; padding-bottom:2px;\"><a href=\"javascript:showbar('"+div+"', '"+titulo+"')\"><img src=\"../img/min.png\" align=\"absmiddle\" border=\"0\" /></a><a href=\"javascript:closebar('"+div+"')\"><img src=\"../img/close.png\" align=\"absmiddle\" border=\"0\" /></a></span> " + titulo);
			$('#wrapperbar_contenido').html($('#c'+div).html());
			
			// Cargamos el texto
			baractual = div;
			
			$('#wrapperbar').css( { "left": (document.getElementById('e'+div).offsetLeft) + "px" } );
			$('#wbotimage').css( { "left": (document.getElementById('e'+div).offsetLeft+10) + "px" } );
		}
	}
/* FIN TOOLBAR ELEMENTS */
/* UPLOAD IMAGES */
	function activa(i)
	{
		document.getElementById(i).file1.disabled = false;
	}
	totalimages = 0;
	imagecompleta = 0;
	
	function addcompleta() {
		imagecompleta = imagecompleta + 1;
		
		if(imagecompleta >= totalimages)
		{
			$("ul#img").empty();
			setTimeout('cleanimage(\'img\')', 10);
			document.getElementById('upimbut').disabled = false;
			
			cleanproceso();
			aviso("Completado. Se ha/n subido "+totalimages+" Imagen/es. <a href=\"#album?id=0\">Ver Imagenes</a>");
			totalimages = 0;
			imagecompleta = 0;
		} else
			proceso("Completadas "+imagecompleta+" de "+totalimages+" Imagenes ");
	}
		
	function upload() {
		if(document.getElementById('file1').value == "")
		{
			document.getElementById('file1').className = "but fail";
		} else {
		
			proceso("Subiendo Imagenes:");
	
			i=1;
			while(document.getElementById("form"+i).file1.value != "")
			{
				$("ul#img").append("<li id=\"liupimage"+i+"\" style=\"display:none;\"> " + document.getElementById("form"+i).file1.value + " | <iframe style=\"display:none;\" id=\"ifupimg"+i+"\" name=\"ifupimg"+i+"\"></iframe> </li>");
				document.getElementById("form"+i).target = "ifupimg"+i;
				document.getElementById("form"+i).action = "../modules/uploadimages.php?album="+document.getElementById("album").value+"&if=liupimage"+i;
				document.getElementById("form"+i).submit();
				document.getElementById('upimbut').disabled = true;
				i++;
				totalimages++;
			}
		}
	};
	
/* AVISOS */
	function aviso(cad)
	{
		$('#text_aviso').html(cad);
		$('#aviso').show('slow');
		setTimeout('cleanaviso()', 5000);
	}
	
	function notifica(cad)
	{
		$('#text_notifica').html(cad);
		$('#notifica').show('slow');
		setTimeout('cleannotifica()', 5000);
	}
	
	function proceso(cad)
	{
		$('#text_proceso').html(cad);
		$('#proceso').show('slow');
	}
	
	function cleannotifica()
	{
		$('#notifica').hide('slow')
	}
	
	function cleanaviso()
	{
		$('#aviso').hide('slow')
	}
	
	function cleanproceso()
	{
		$('#proceso').hide('slow')
	}
/* FIN AVISOS*/
/* ESTABLECER IMAGEN PERSONAL */
	seleccion = null;

	function changeimage(img)
	{
		$('#imgpersonal').show();
		ias = $('#img'+img).imgAreaSelect({ aspectRatio: '1:1', fadeSpeed: 400, handles: true, instance: true, onSelectEnd: preview });
		
		if (!ias.getSelection().width)
			ias.setOptions({ show: true, x1: 0, y1: 0, x2: 150, y2: 150 });
		
		seleccion = ias.getSelection();
		//change("../modules/setimage.php?im="+img+"&album=", "Imagen Personal Actualizada", "");
	}
	
	function preview(img, selection) {
		seleccion = selection;
	}
	
	function aplicarimagen(img)
	{
		var scaleX = (seleccion.width || 1);
		var scaleY = (seleccion.height || 1);
		change("../modules/setimage.php?im="+img+"&x="+seleccion.x1+"&y="+seleccion.y1+"&w="+scaleX+"&h="+scaleY, "Imagen Personal Actualizada", "");
	}
/* FIN ESTABLECER IMAGEN PERSONAL */
/* ESTABLECER ESTADO */
	function setstatus()
	{
		valor = document.getElementById('status').value;
		
		if(valor == "Actualizar Estado..." || valor == "")
			document.getElementById('status').value = "Actualizar Estado...";
		else {
			openurl("../modules/setstatus.php?estado="+valor, "Enhorabuena ha actualizado su estado");
			document.getElementById('status').value = "Actualizar Estado...";
			actualiza("../modules/ficha.php", "#perfil");
		}
	}
	
	function resetstatus()
	{
		document.getElementById('status').value = "";
	}
/* FIN ESTABLECER ESTADO */
/* TITULAR */

m1 = new Image(30,30);
m1.src = "/m1.jpg";  
m2 = new Image(30,30);
m2.src = "/m2.jpg";
m3 = new Image(30,30);
m3.src = "/m3.jpg";
m4 = new Image(30,30);
m4.src = "/m4.jpg";
m5 = new Image(30,30);
m5.src = "/m5.jpg";
