<!--
function eliminar(nombre) {
var salida; 
salida=confirm("¿Está seguro que desea eliminar el registro '" + nombre +"'?");
	if (salida==true){
		return true;
	}else{
		return false;
	}
}

<!--
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 YY_checkform() { //v4.66
//copyright (c)1998,2002 Yaromat.com
  var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
  for (var i=1; i<args.length;i=i+4){
    if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
    var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
    myV=myObj.value;
    if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
      if (myReq&&myObj.value.length==0){addErr=true}
      if ((myV.length>0)&&(args[i+2]==1)){ //fromto
        var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==2)){
          var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
      } else if ((myV.length>0)&&(args[i+2]==3)){ // date
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
        if(myAt){
          var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
          var myDate=new Date(myY,myM,myD);
          if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
        }else{addErr=true}
      } else if ((myV.length>0)&&(args[i+2]==4)){ // time
        var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
      } else if (myV.length>0&&args[i+2]==5){ // check this 2
            var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
            if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!myObj1.checked){addErr=true}
      } else if (myV.length>0&&args[i+2]==6){ // the same
            var myObj1 = MM_findObj(args[i+1]);
            if(myV!=myObj1.value){addErr=true}
      }
    } else
    if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
          var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
          var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
      if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
      if (args[i+2]==2){
        var myDot=false;
        for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
        if(!myDot){myErr+='* ' +args[i+3]+'\n'}
      }
    } else if (myObj.type=='checkbox'){
      if(args[i+2]==1&&myObj.checked==false){addErr=true}
      if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
    } else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
      if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
    }else if (myObj.type=='textarea'){
      if(myV.length<args[i+1]){addErr=true}
    }
    if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
  }
  if (myErr!=''){alert('Existen errores:\t\t\t\t\t\n\n'+myErr)}
  document.MM_returnValue = (myErr=='');
}
//-->

function mostrarCapa(capa) {
	document.getElementById(capa).style.visibility = 'inherit';	
}   
function ocultarCapa(capa) {
	document.getElementById(capa).style.visibility = 'hidden';	
}
//Funcion de abrir Foto
var ventana
var cont=0
var titulopordefecto = "Imagen" //texto por defecto a mostrar en la barra de título en caso de omitir el argumento titulo

function afoto(cual,titulo)
{
if(cont==1){ventana.close();ventana=null}
if(titulo==null){titulo=titulopordefecto}
ventana=window.open('','ventana','resizable=yes,scrollbars=no')
ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:hidden" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" status="no" scroll="no" onUnload="opener.cont=0"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">')
ventana.document.close()
cont++
}
function redimensionar(ancho,alto)
{
ventana.resizeTo(ancho+12,alto+28)
ventana.moveTo((screen.width-ancho)/2,(screen.height-alto)/2) //centra la ventana. Eliminar si no se quiere centrar el popup
}

function mOvr(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = clrOver;
	}
}
function mOut(src,clrIn) {
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
	}
}

//Solo numeros
function fMatch(field){
    field.value = field.value.replace(/[^0-9]/g, "");
}

//Limpiar campo
function fClear(field){
    field.value = "";
}

//Submenu Panel Administrativo
function ShowSubMenu(id){
var submenu= 'subMenu_'+id;
var imagen= 'imagen_'+id;
var imagen2=document.getElementById(imagen).name;
var imagenString=String(imagen2);
if(imagenString=='closed'){
document.getElementById(submenu).style.display = "inline";
document.getElementById(imagen).src = "../images/template/icon-sub.gif";
document.getElementById(imagen).name= "open";
}else{
document.getElementById(submenu).style.display = "none";
document.getElementById(imagen).src = "../images/template/icon-add.gif";
document.getElementById(imagen).name= "closed";
}
}

//Submenu Index
function ShowSubMenuN(id){
var submenu= 'subMenu_'+id;
var estado= document.getElementById(submenu).style.display;	
var i=0;	
for(i=1;i<4;i++){
var submenu2= 'subMenu_'+i;	
	if(i==id){
		document.getElementById(submenu2).style.display = "inline";
		document.getElementById(submenu2).style.visibility = "visible";	
	}else{
		document.getElementById(submenu2).style.display = "none";
		document.getElementById(submenu2).style.visibility = "hidden";	
	}
}	
if(estado=="none"){
document.getElementById(submenu).style.display = "inline";
document.getElementById(submenu).style.visibility = "visible";
}else{
document.getElementById(submenu).style.display = "none";
document.getElementById(submenu).style.visibility = "hidden";
}
}


function imagenS(tipo, path){	
ruta=path+"/"+tipo+"/";
var imagen= showModalDialog("../editor/imagenes.php?tipo="+tipo+"&ruta="+path, "rows", "font-family:Verdana;font-size:12;dialogWidth:650px;dialogHeight:450px;help:no;status:no");
  	if(imagen!=null){
		document.form1.foto.src=ruta+imagen;
		document.form1.imagen.value=imagen;
	}
}


//Seleccionar Pais
function changePais(val){	
	document.getElementById("div_estados").style.display='inline';
}	

//Cargar ciudad
function cargar_ciudad(val){	
	document.getElementById("user_city").value = val;
}

var lineas=new Array();
function agregarLineas(check,grupo) {	
	var sel=document.getElementById(check);
	if (sel.checked==true){
	lineas=lineas+check+",";
	}else if(sel.checked==false){
	lineas = lineas.replace(check+",", "");	
	}
	document.getElementById("lineas").value=lineas;
}

var pasatiempos=new Array();
function agregarPasatiempo(check,grupo) {	
	var sel=document.getElementById(check);
	if (sel.checked==true){
	pasatiempos=pasatiempos+check+",";
	}else if(sel.checked==false){
	pasatiempos = pasatiempos.replace(check+",", "");	
	}
	document.getElementById("pasatiempos").value=pasatiempos;
}


//Seleccionar Profesion
function changeProfesion(val){	
if(val == "profesional" || val == "otro"){	
	document.getElementById("td_cual_profesion").style.display='inline';
	document.getElementById("cual_profesion").value='';
}else{
	document.getElementById("td_cual_profesion").style.display='none';
	document.getElementById("cual_profesion").value='n/a';	
}
}


//Posicionar Capas relativas al objeto


function muestra(obj,lyr)
{
	var hide  = true;
	var coors = findPos(obj);	
	var x = document.getElementById(lyr);	
	n_coord_x=coors[0]+70;	
	n_coord_y=coors[1]-50;
	x.style.left = n_coord_x + 'px';
	x.style.top = n_coord_y + 'px';	
	x.style.visibility='visible';	
}

function esconde(obj,lyr)
{
	var y = document.getElementById(lyr);	
	y.style.visibility='hidden';	
}


function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


//ALL ARGUMENTS MUST TO BE STRING TYPES
function isEmpty(value) { return /^(\s*)+$/.test(value); }
function checkDate (date_value) { return /^(3[01]|0[1-9]|[12]\d)\/(0[1-9]|1[012])\/\d{4}/.test(date_value)? null:"Bad formated date."; }
function checkTime (time_value) { return /^((2[0-3])|(0\d)|(1\d)):((0\d)|([1-5]\d)):((0\d)|([1-5]\d))$/.test(time_value)? null: "Bad formated Time.";}
function checkDateTime (datetime_value) { return /^(3[01]|0[1-9]|[12]\d)\/(0[1-9]|1[012])\/\d{4}\s((2[0-3])|(0\d)|(1\d)):((0\d)|([1-5]\d)):((0\d)|([1-5]\d))$/.test(datetime_value)? null: "Bad formated Date-Time.";}
function checkNumber(num_value) { return /^([-+]?\d*[\.|\d])?(\d+)*$/.test(num_value)? null: "Invalid number."; }
function checkInteger(int_value) { return /^([-+]?\d)*(\d+)*$/.test(int_value)? null:"Invalid integer";}
function checkNatural(nat_value) { return /\D+/.test(nat_value)? "Only digit are allowed": null;}
function trim(value) {
   var result;
   return  isEmpty(value)? "": ((result = value.match(/\S.+\S/)) != null? result: value.match(/\S+/)).toString();
}
function checkSingleWord(code_value) { return /\S.+\s+\S/.test(code_value)? "More than a word is not allowed": null; }
function checkEmail(email_value) { return /^\w+(([\.]?|[-]*)\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email_value)? null:"Bad formated email."; }

function checkDateKey(dateField, e) {
	var re = new Array(
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/(2\d{1,3}|19\d{0,2})/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/[21]?/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])/,
		/(3[01]|[21]\d|0[1-9])\/[01]?/,
		/(3[01]|[21]\d|0[1-9])/,
		/[3210]/);
	var spacers = new Array ("","","/","","","/");
	chekPatternKey(dateField, e, re, spacers);
}

function checkTimeKey(timeField, e) {
	var re = new Array(
		/([01]\d|2[0123]):[0-5]\d:[0-5]\d/,
		/([01]\d|2[0123]):[0-5]\d:[0-5]?/,
		/([01]\d|2[0123]):[0-5]\d/,
		/([01]\d|2[0123]):[0-5]?/,
		/([01]\d|2[0123])/,
		/[012]?/);
	var spacers = new Array ("","",":","","",":");
	chekPatternKey(timeField, e, re, spacers);
}

function checkDateTimeKey(dateTimeField, e) {
	var re = new Array(
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/(2\d{3}|19\d{2}) ([01]\d|2[0123]):[0-5]\d:[0-5]\d/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/(2\d{3}|19\d{2}) ([01]\d|2[0123]):[0-5]\d:[0-5]?/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/(2\d{3}|19\d{2}) ([01]\d|2[0123]):[0-5]\d/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/(2\d{3}|19\d{2}) ([01]\d|2[0123]):[0-5]?/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/(2\d{3}|19\d{2}) ([01]\d|2[0123])/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/(2\d{3}|19\d{2}) [012]?/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/(2\d{1,3}|19\d{0,2})/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])\/[21]?/,
		/(3[01]|[21]\d|0[1-9])\/(0[1-9]|1[012])/,
		/(3[01]|[21]\d|0[1-9])\/[01]?/,
		/(3[01]|[21]\d|0[1-9])/,
		/[3210]/);
	var spacers = new Array ("","","/","","","/","","","",""," ","","",":","","",":");
	chekPatternKey(dateTimeField, e, re, spacers);
}

function chekPatternKey(field, e, patterns, spacers) {
	var currentLen = field.value.length;
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (currentLen == 0 || whichCode == 8) 
		return;

	var bestValue = null;
	var addSep = "";
	for (var x=0; x < patterns.length; x++) {
		var matches;
		if (matches = field.value.match(patterns[x])) {
			bestValue = matches[0];
			if (spacers[bestValue.length]) {
				addSep = spacers[bestValue.length];
			}
			break;
		}
	}
	field.value = (bestValue? bestValue: "")+ addSep;
}


function MM_openPopup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openPopupModal(theURL,winName,features){
	window.showModalDialog(theURL,winName,features);
}

function calcHeightFrame(div)
{	
	var the_height=document.getElementById(div).contentWindow.document.body.scrollHeight;
	document.getElementById(div).height=the_height;
}