//********************************************
//
//	Copyright Mobifriends S.L. 2007
//	
//	programador: Javier Velasco Gonzalez	
//
//********************************************


//********************************************
// devuelve la version de explorer o 0.
//--------------------------------------------
function isExplorer() {
	if (navigator.appName=="Microsoft Internet Explorer") {
		var iversion = navigator.appVersion.indexOf("MSIE ");
		if (iversion>0) {
			iversion+=5;
			var eversion = navigator.appVersion.indexOf(";",iversion);
			var version = navigator.appVersion.substring(iversion,eversion);
			return parseInt(version);
		}
	} else return 0;
}

//********************************************
// devuelve la version de firefox o 0.
//--------------------------------------------
function isFirefox() {
	if (navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)>=5) {
		var iversion = navigator.userAgent.indexOf("Firefox/");
		if (iversion>0) {
			iversion+=8;
			var eversion = navigator.userAgent.indexOf(" ",iversion);
			if (eversion<navigator.userAgent.length) eversion = navigator.userAgent.length;
			var version = navigator.userAgent.substring(iversion,iversion + 1000);
			return parseInt(version);
		} else return 0;
	} 
	else return 0;
}


function getWindowWidth() {
  var width = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    if( document.body && document.body.clientWidth) width = document.body.clientWidth;
    else width = window.innerWidth;
  } else if( document.documentElement && document.documentElement.clientWidth) {
    //IE 6+ in 'standards compliant mode'
    width = document.documentElement.clientWidth;
  } else if( document.body && document.body.clientWidth) {
    //IE 4 compatible
    width = document.body.clientWidth;
  }
  return width;
}

function getWindowHeight() {
  var height = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    if( document.body && document.body.clientHeighth) height = document.body.clientHeight;
    else height = window.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    height = document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight ) {
    //IE 4 compatible
    height = document.body.clientHeight;
  }
  return height;
}


function getDocumentHeight() {
	var height = document.height;
	if (!height) height = document.body.clientHeight;
	return height;
}


function getDocumentWidth() {
	var width = document.width;
	if (!width) width = document.body.clientWidth;
	return width;
}

function getHScrollPos() {
	var pos = document.body.scrollLeft;
	if (!pos) pos=window.pageXOffset;
	return pos;	
}

function getVScrollPos() {
	var vExplorer = isExplorer();
	var pos;
	if (vExplorer) {
		pos = document.documentElement.scrollTop;
		if (!pos) pos = document.body.scrollTop;
	} else {
		pos=window.pageYOffset;		
	}
	return pos;	
}

function getVScrollAdjustments() {
	var screenHeight = getWindowHeight();
	var vScrollPos =  getVScrollPos();
	return screenHeight +"," +vScrollPos;
}


//********************************************
// envia el formulario con el id = formid.
//--------------------------------------------
//
// @params:
//	formid: attributo id del form.
//
// @return: 
//
//********************************************
function submitFormById(formid) {
	f = document.getElementById(formid)
	f.submit();
}

//********************************************
// devuelve el valor de un campo.
//--------------------------------------------
//
// @params:
//	id: id del campo.
//
// @return: 
//	devuelve el valor de un campo en funcion de el id.
//
//********************************************
function getValue(id) {
	f = document.getElementById(id);
	return f.value;
}

//********************************************
// establece el valor de un campo.
//--------------------------------------------
//
// @params:
//	id: id del campo.
//
// @return: 
//
//********************************************
function setValue(id,value) {
	f = document.getElementById(id);
	if (f==null) return;
	switch (f.tagName.toLowerCase()) {
		case "select":
			f.value = value;
		break;
		case "input":
			f.value = value;
			if (f.type=="checkbox") {
				if (value==0) f.checked = null;
				else f.checked= true;
			}
		break;
		case "div":
			otype = document.getElementById(id+"__type");
			olenght = document.getElementById(id+"__length");
			if (otype==null) return;
			switch (otype.value) {
				case "mcheckbox":
					for (i=0;i<olenght.value;i++) {
						o = document.getElementById(id+String(i));
						if (o.value==value) {
							o.checked = true;
							return;
						}
					}
				break;				
			}
		break;
	}
}


//********************************************
// limpia los checkboxes 
//--------------------------------------------
//
// @params:
//	id: id del multiple checkbox.
//
// @return: 
//
//********************************************
function clearMCheckbox(id) {
	f = document.getElementById(id);
	if (f==null) return;
	otype = document.getElementById(id+"__type");
	olenght = document.getElementById(id+"__length");
	if (otype==null || otype.value!="mcheckbox") return;
	for (i=0;i<olenght.value;i++) {
		o = document.getElementById(id+String(i));
		o.checked=null;
	}
}

//********************************************
// establece el html dentro de una etiqueta.
//--------------------------------------------
//
// @params:
//	id: id del campo.
//
// @return: 
//
//********************************************
function setInnerHTML(id,text) {
	f = document.getElementById(id);
	if (f==null) alert("No encuentra" + id);
	else f.innerHTML = text;
}



//Rellena un campo select con valores numericos.
function fillNumbersCombo(id,nini,nfin,value,rellenarconceros) {
	options = "";
	snfin = nfin.toString();
	snini = nini.toString();
	maxlen = snfin.length;
	if (snini.length>maxlen) maxlen = snini.length ;
	/*
	for (i=nini;;) {
		stri = i.toString();
		if (rellenarconceros) {
			len = stri.length;
			for (j=0;j<maxlen-len;j++) stri = "0"+stri;
		}
		if (value!=i) options += "<option value='" + i.toString()+"'>" + stri + "</option>";
		else options += "<option selected='true' value='" + i.toString()+"'>" + stri + "</option>";
		//test del loop.		
		if (nini<nfin) {
			if (i>=nfin) break;
			i++
		} else {
			if (i<=nfin) break;
			i--;
		}
	}*/
	setInnerHTML(id,options);
}

//********************************************
// devuelve el valor de un elemento del tipo INPUT.
//--------------------------------------------
//
// @params:
//	fieldid: id del elemento INPUT.
//
// @return: 
//	devuelve una cadena con el valor del INPUT
//
//********************************************
function getInputValueById(fieldid) {
	f = document.getElementById(fieldid)
	return f.value;
}

//********************************************
// cambia el elemento seleccionado en un SELECT.
//--------------------------------------------
//
// @params:
//	formid: attributo id del form.
//	comboname: nombre del campo SELECT.
//	value: attributo value del OPTION a seleccionar.
//
// @return: 
//	devuelve una cadena con el valor del INPUT
//
//********************************************
function setComboByValue(formid,comboname,value) {
	f = document.getElementById(formid)
	if(typeof XMLHttpRequest!='undefined') {
		element = f.elements[comboname];
	} else {
		element = f.all[comboname];
	}
	var attrs="";
	for (i=0;i<element.length;i++) {
		var option = element[i];
		if (option.tagName=="OPTION" && 
			option.value==value) {
			element.selectedIndex=i;
		} 
	}
}

//********************************************
// cambia el elemento seleccionado en un SELECT.
//--------------------------------------------
//
// @params:
//	formid: attributo id del form.
//	comboname: nombre del campo SELECT.
//	text: texto de la opcion a seleccionar.
//
// @return: 
//
//********************************************
function setComboByText(formid,comboname,text) {
	f = document.getElementById(formid)
	if(typeof XMLHttpRequest!='undefined') {
		element = f.elements[comboname];
	} else {
		element = f.all[comboname];
	}
	var attrs="";
	for (i=0;i<element.length;i++) {
		var option = element[i];
		if (option.tagName=="OPTION" && 
			option.innerText==text) {
			element.selectedIndex=i;
		} 
	}
}

//********************************************
// establece el valor de un campo INPUT.
//--------------------------------------------
//
// @params:
//	formid: attributo id del form.
//	fieldname: nombre del campo INPUT.
//	value: valor para el campo INPUT.
//
// @return: 
//
//********************************************
function setInput(formid,fieldname,value) {
	f = document.getElementById(formid)
	if(typeof XMLHttpRequest!='undefined') {
		element = f.elements[fieldname];
	} else {
		element = f.all[fieldname];
	}
	element.value = value;
}

//********************************************
// devuelve el estilo de un elemento.
//--------------------------------------------
//
// @params:
//	id: attributo id del elemento.
//
// @return: 
//
//********************************************
function getStyleById(id) {
	element = document.getElementById(id)
	return element.style;
}


//Funciones de validacion

//********************************************
// valida que sea una direccion de correo valida.
//--------------------------------------------
//
// @params:
//	email: cadena de texto que contiene el email.
//
// @return: 
//	true si es correcta o false si es incorrecta.
//
//********************************************
function validateEmail(email) {
	var parts = email.split('@');
	if (parts.length!=2) return false;
	var user = parts[0];
	var server = parts[1];
	parts = server.split('.');
	if (parts.length<1) return false;
	else return true;
}

//********************************************
// valida que sea un numero.
//--------------------------------------------
//
// @params:
//	number: cadena de texto que contiene el numero.
//
// @return: 
//	true si es correcta o false si es incorrecta.
//
//********************************************
function validateIsNumber(number) {
	for (i=0;i<number.length;i++) {
		var ch = number.charAt(i);
		if (ch!='0' && ch!='1' && ch!='2' && ch!='3' && ch!='4' && ch!='5' && ch!='6' && ch!='7' && ch!='8' && ch!='9')
		return false;
	}
	return true;
}

//********************************************
// valida que sea un numero de telefono valido.
//--------------------------------------------
//
// @params:
//	number: cadena de texto que contiene el numero.
//
// @return: 
//	true si es correcta o false si es incorrecta.
//
//********************************************
function validateIsPhoneNumber(number) {
	for (i=0;i<number.length;i++) {
		var ch = number.charAt(i);
		if (ch!='0' && ch!='1' && ch!='2' && ch!='3' && ch!='4' && ch!='5' && ch!='6' && ch!='7' && ch!='8' && ch!='9')
		return false;
	}
	return true;
}


var WINDOW_TYPE_MODAL 	= 1;
var WINDOW_HCENTERED 	= 2;
var WINDOW_VCENTERED 	= 4;

var __windows = new Array();
var __zIndex = 200;

function CreateIFrame(id,x,y,width,height,color,opac) {
        var windowdiv = document.createElement('iframe');
        windowdiv.setAttribute('id',id);
        windowdiv.setAttribute('class',"windowiframe");
        zi = __zIndex++;
        var div = document.getElementsByTagName("body")[0];
        if (opac!=null) windowdiv.style.filter = "alpha(opacity=" + opac + ")";
        windowdiv.style.position="absolute";
        windowdiv.style.zIndex=zi;
        windowdiv.style.top=y;
        windowdiv.style.left=x;
        if (width!=null)  windowdiv.style.width=width;
        if (height!=null) windowdiv.style.height=height;
        if (color!=null) windowdiv.style.background = color;
        div.appendChild(windowdiv);
        __windows.push(windowdiv);
}



//********************************************
// Crea una div dinamicamente
//--------------------------------------------
//
// @params:
//	id: atributo id de la div.
//	x: posicion x dentro de la ventana, debe ser expresada como cadena indicando la unidad %,px etc.
//	y: posicion y dentro de la ventana, debe ser expresada como cadena indicando la unidad %,px etc
//	width: ancho de la ventana, debe ser expresada como cadena indicando la unidad %,px etc
//	height: alto de la ventana, debe ser expresada como cadena indicando la unidad %,px etc
//	html: contenido xhtml de la div.
//	color: color de fondo si lo tuviera sino el atributo es omitido (transparente).
//	opac: opacidad de la capa indicado en %.
//
// @return: 
//
//********************************************
function CreateWindow(id,x,y,width,height,html,color,opac) {

	var windowdiv = document.createElement('div');
	var vExplorer = isExplorer();
	windowdiv.setAttribute('id',id);
	windowdiv.setAttribute('class',"window");
	
	zi = __zIndex++;
	var div = document.getElementsByTagName("body")[0];
	if (isFirefox()) {
	    if (opac!=null) {
	    	fopac = opac/100;
	    	windowdiv.style.MozOpacity=fopac;
	    }
	} 
	if (vExplorer>6) {
		if (opac!=null) windowdiv.style.filter = "alpha(opacity=" + opac + ")";
		windowdiv.style.position="fixed";
	} else if (vExplorer<=6 && vExplorer>3) {
		if (opac!=null) windowdiv.style.filter = "alpha(opacity=" + opac + ")";
		windowdiv.style.position="absolute";
	} else {
		windowdiv.style.position="fixed";
	}
	//a�adidos para cambiar la opacity de Opera y Safari
	//como no hay funcion para detectar estos navegadores y no afecta a los otros lo he puesto directamente aqui.
	if (opac!=null) {
	  	fopac = opac/100;
	   	windowdiv.style.opacity=fopac;
	}
	
	windowdiv.innerHTML = html;
	windowdiv.style.display="block";
	windowdiv.style.zIndex=zi;
	windowdiv.style.top=y;
	windowdiv.style.left=x;
	if (width!=null)  windowdiv.style.width=width;
	if (height!=null) windowdiv.style.height=height;
	if (color!=null) windowdiv.style.background = color;
	div.appendChild(windowdiv);
	__windows.push(windowdiv);
}


function CreateIEWindow(id,x,y,width,height,html,color,opac) {
	var windowdiv = document.createElement('div');
	var vExplorer = isExplorer();
	windowdiv.setAttribute('id',id + "_parent");
	//windowdiv.setAttribute('class',"window");
	
	var div = document.getElementsByTagName("body")[0];
	if (opac!=null) windowdiv.style.filter = "alpha(opacity=" + opac + ")";
	windowdiv.style.position="absolute";
	//a�adidos para cambiar la opacity de Opera y Safari
	//como no hay funcion para detectar estos navegadores y no afecta a los otros lo he puesto directamente aqui.
	if (opac!=null) {
	  	fopac = opac/100;
	   	windowdiv.style.opacity=fopac;
	}
	divzi = __zIndex++;
	zi = __zIndex++;
	html = "<iframe style='position:absolute; "+
			" top:0px;" + 
			" left:0px;" + 
			" width: 1px;" + 
			" height: 1px;" +
			" z-index: " + zi + ";'" + 
			" id='" + id + "_iframe' >'</iframe>";
	zi = __zIndex++;
	html = html + "<div style='position:absolute; top:0px; left:0px; " + 
			"z-index:" + zi +";' id='" + id + "' ></div>";	
	windowdiv.innerHTML = html;
	windowdiv.style.display="block";
	windowdiv.style.zIndex=divzi;
	windowdiv.style.top=y;
	windowdiv.style.left=x;
	if (width!=null)  windowdiv.style.width=width;
	if (height!=null) windowdiv.style.height=height;
	if (color!=null) windowdiv.style.background = color;
	div.appendChild(windowdiv);
	__windows.push(windowdiv);
	iframe = document.getElementById(id+"_iframe");
	newdiv = document.getElementById(id);
	iframe.style.width = newdiv.clientWidth;
	iframe.style.height = newdiv.clientHeight;
}


var __window_selected=null;


// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xStartPos = null; // Horizontal position of the mouse on the screen
yStartPos = null; // Vertical position of the mouse on the screen

function captureMousePosition(e) {
	var vExplorer = isExplorer();
	if (vExplorer>5 && vExplorer<7) {
    	xMousePos = window.event.clientX;
    	yMousePos = window.event.clientY;
    	
	} else {
    	xMousePos = e.pageX;
    	yMousePos = e.pageY;
	}
	//setInnerHTML('debug',xMousePos + "," + yMousePos)
}

function MoveWindow(e) {
	captureMousePosition(e);	
	if (!xStartPos) {
		xStartPos = xMousePos;
		yStartPos = yMousePos;
	}
    if (__window_selected!=null) {
    	x = parseInt(__window_selected.style.left) + xMousePos - xStartPos;
    	y = parseInt(__window_selected.style.top) + yMousePos - yStartPos;
   		__window_selected.style.left = x + "px";
		__window_selected.style.top = y + "px";
    }
	xStartPos = xMousePos;
	yStartPos = yMousePos;
}


function StartMoveWindow(id) {
	var vExplorer = isExplorer();
	if (vExplorer==6) id=id+"_parent";
	RaiseWindow(id);
	xStartPos = null;
	__window_selected = document.getElementById(id);
	if (document.layers) { // Netscape
	    document.onmousemove = MoveWindow;
    	document.onmouseup = StopMoveWindow;
	} else if (document.all) { // Internet Explorer
	    document.onmousemove = MoveWindow;
    	document.onmouseup = StopMoveWindow;
	} else if (document.getElementById) { // Netcsape 6
    	document.onmousemove = MoveWindow;
    	document.onmouseup = StopMoveWindow;
	}
}

var ic=0;
function testScroll(e) {
	setInnerHTML('debug',ic + ":=" + getHScrollPos() + "," + getVScrollPos() + "  " + getDocumentWidth() + "x" + getDocumentHeight());
	ic++;
}

function StopMoveWindow(id) {
    document.onmousemove = null;
    document.onmouseup = null;
	__window_selected = null;
}



function CreateURLWindow(id,x,y,url) {
	var wwidth = getWindowWidth();
	var wheight = getWindowHeight();
	var vExplorer = isExplorer();
	var cx = 0;
	var cy = 0;
	CreateWindow(id + "bg","0px","0px",wwidth + "px",wheight + "px","","#000000","30");
	//if (vExplorer==6) CreateIFrame(id + "bg","0px","0px",wwidth + "px",wheight + "px","#000000","30");
	//else CreateWindow(id + "bg","0px","0px",wwidth + "px",wheight + "px","","#000000","30");
	if (vExplorer==6) {
		CreateIEWindow(id,x + 'px',y + 'px',null,null,"",null,null);
	}
	else {
		CreateWindow(id,x + 'px',y + 'px',null,null,"",null,null);
	}
	ajax_call(id,url,null);
}


//********************************************
// pone una ventana en primer plano.
//--------------------------------------------
//
// @params:
//	id: id del elemento.
//
// @return: 
//
//********************************************
function RaiseWindow(id) {
	var windowdiv = document.getElementById(id);
	zi = __zIndex++;
	windowdiv.style.zIndex=zi;
}






//********************************************
// destruye una ventana creada con CreateWindow.
//--------------------------------------------
//
// @params:
//	id: id de la div contenedora de la ventana.
//
// @return: 
//
//********************************************
function DestroyWindow(id) {
	var abody = document.getElementsByTagName("body");
	var vExplorer = isExplorer();
	var div = null;
	if (abody.length>=1) div = abody[0];
	if (div!=null) {
		var windowdiv;
		
		windowdiv = document.getElementById(id+"_parent");
		if (windowdiv!=null) div.removeChild(windowdiv);
		
		windowdiv = document.getElementById(id);
		if (windowdiv!=null) div.removeChild(windowdiv);
		
		var windowbg = document.getElementById(id + "bg");
		if (windowbg!=null) div.removeChild(windowbg);
		
		var windowiframe = document.getElementById(id + "_parent");
		if (windowiframe!=null) div.removeChild(windowiframe);
		
	}
	
}

//********************************************
// establece el estado de visibilidad de un elemento
// usando el id.
//--------------------------------------------
//
// @params:
//	id: id del elemento.
//	visible: true | false.
//
// @return: 
//
//********************************************
function Show(id,visible) {
	obj = document.getElementById(id);
	if (obj==null) return;
	if (visible) {
		obj.style.visibility = "visible";
	} else {
		obj.style.visibility = "hidden";
	}
}


function ShowAndResize(id,visible,w,h) {
	obj = document.getElementById(id);
	if (obj==null) return;
	if (visible) {
		obj.style.visibility = "visible";
	} else {
		obj.style.visibility = "hidden";
	}
	if (w) obj.style.width=w+ "px";
	if (h) obj.style.height=h+ "px";
}

function SwapShow(id) {
	obj = document.getElementById(id);
	if (obj==null) return;
	if (obj.style.visibility=="visible") {
		obj.style.visibility = "hidden";
	} else {
		obj.style.visibility = "visible";
	}
}



//********************************************
// limpia espacios al principio y al final
// de una cadena.
//--------------------------------------------
//
// @params:
//	str: la cadena a limpiar.
//
// @return: 
//	la cadena modificada.
//
//********************************************
function cleanSpaces(str) {
	//pendiente
}


function setFlashVar(flashid,varname,varvalue) {
	fl = document.getElementById("mz" + flashid);
	if (!fl) fl = document.getElementById(flashid);
 	if (fl!=null) fl.SetVariable(varname,varvalue);
}


function openChat(para,roomid,solicitud) {
	fh = document.getElementById('mzFlashMobifriends');
	if (!fh) fh = document.getElementById('FlashMobifriends');
	if (fh==null) {
		url = "miscomchat.php?para=" + para + "&solicitud=" + solicitud + "&roomid=" + roomid;
		alert(url);
		document.location=url;
		return;
	} else {
		url = "php/lanzachatprivado.php?para=" + para + "&solicitud=" + solicitud + "&roomid=" + roomid;
		alert(url);
		ajax_call("__","php/lanzachatprivado.php?para=" + para + "&solicitud=" + solicitud + "&roomid=" + roomid,null);
	}
}

function reloadChat() {
	window.location.reload();
}


function showInfoPopUp(title,msg) {
	CreateURLWindow("infowindow",
					getWindowWidth()/2-100,
					getWindowHeight()/2-100,
					"php/mostrarpopupinfo.php?ttl=" + title + 
					"&msg=" + msg);
}

//********************************************
// Funcion para en los submenus verticales.
// Resalta el fondo del submenu donde este el cursor.
//--------------------------------------------
//
// @params:
//	H: elemento donde se ha situado el cursor.
//
//********************************************
function fhover(H){
if(H.className.indexOf("HoverBGColor")>=0)
H.className=H.className.replace("HoverBGColor ","");
else H.className="HoverBGColor "+H.className;
}

//********************************************
// Funciones de la primera version del portal.
// Funciones utilizadas para mostrar y ocultar textos con los links de "comprimir todo" y "expandir todo".
function activa(tipo)
{
	if (activado!="") document.getElementById(activado).style.display="none";
	if (activado!=tipo)
	{
		document.getElementById(tipo).style.display="";
		activado=tipo;
	}
	else activado="";
}

function activa_sub(tipo,enlace)
{
	if (document.getElementById(tipo).style.display=='none')
	{ 
		document.getElementById(tipo).style.display="";
		// muestra en la subseccion el link comprimir todo
		tamsubid= tipo.length - 2;
		subid = tipo.substring(0,tamsubid);
		document.getElementById(subid).style.display="";
	}
	else 
	{
		document.getElementById(tipo).style.display="none";
		tamsubid= tipo.length - 2;
		subid = tipo.substring(0,tamsubid);
		subspans=document.getElementsByName(subid);
		subdisplay="none";
		for(i=0;i<subspans.length;i++)
		{
			if (subspans[i].style.display=="") subdisplay="";
		}
		document.getElementById(subid).style.display=subdisplay;
	}
	if (document.getElementById(enlace).className=='expandirbw') document.getElementById(enlace).className="comprimirbw";
		else document.getElementById(enlace).className="expandirbw";
}

function comprimir_todo(tipo,enlace)
{
	v_doc=document.getElementsByTagName('*');
	for(i=0;i<v_doc.length;i++)
	{
		tam=tipo.length;
		valor=v_doc[i].id.substring(0,tam);
		tam2=enlace.length;
		valor2=v_doc[i].id.substring(0,tam2);
		if (valor==tipo) v_doc[i].style.display="none";
		if (valor2==enlace) v_doc[i].className="expandirbw";
	}
}

function expandir_todo(tipo,enlace)
{
	v_doc=document.getElementsByTagName('*');
	for(i=0;i<v_doc.length;i++)
	{
		tam=tipo.length;
		valor=v_doc[i].id.substring(0,tam);
		tam2=enlace.length;
		valor2=v_doc[i].id.substring(0,tam2);
		if (valor==tipo) v_doc[i].style.display="";
		if (valor2==enlace) v_doc[i].className="comprimirbw";
	}
}

function ocultar(tipo)
{
	document.getElementById(tipo).style.display="none";
	activado="";
}

//Comprueba el formato del correo
function verifica_mail(t_mail)
{
	if ((t_mail.lastIndexOf(" ")!=-1) || (t_mail.lastIndexOf("@")==-1) || (t_mail.lastIndexOf(".")<=(t_mail.lastIndexOf("@")+1)) || (t_mail.lastIndexOf(".")==(t_mail.length-1))) return false;
		else return true;
}

var javascriptNewMessage = "";
function OnNewMessage() {
	eval(javascriptNewMessage);
}

var javascriptNewMobi = "";
function OnNewMobi() {
	eval(javascriptNewMobi);
}