<!--
/////////////////////////////////////////////////////////////////////////////
setFormat(document.formatoFechaCalendario);
setMonthNames(document.enero, document.febrero, document.marzo, document.abril, document.mayo, document.junio, document.julio, document.agosto, document.septiembre, document.octubre, document.noviembre, document.diciembre);
setDayNames(document.domingo, document.lunes, document.martes, document.miercoles, document.jueves, document.viernes, document.sabado);
setLinkNames("[ " + document.tex_cerrar + " ]", "[ " + document.tex_borrar + " ]");
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////
//// Funciones de checkbox de listado ////////////
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
function buscarTagEntreHijos(src, tag)
{
	if(src.hasChildNodes()){
		for(i=0;i<src.childNodes.length;i++){
			//alert(src.childNodes[i].nodeName + ' -> ' + tag);
			if(src.childNodes[i].nodeName == tag){
				return src.childNodes[i];
				break;
			}else{
				nodoHijo = buscarTagEntreHijos(src.childNodes[i], tag);
				if(nodoHijo){
					return nodoHijo;
				}
			}
		}
	}else{
		return false;
	}
}

function buscarCampoTodos(formName)
{
	losInputs = document.forms[formName].getElementsByTagName('INPUT');
	for(i=0;i<losInputs.length;i++){
		if(losInputs[i].id.substr(0,5) == 'todos'){
			return losInputs[i];
		}
	}
	return false;
}

function trOver(src, styleOver)
{
		src.className = styleOver;
}

function trOut(src, styleNormal)
{
	src.className = styleNormal;
}

function trClickMenu(src)
{
	tagA = buscarTagEntreHijos(src, 'A');
	if(tagA){
		window.location=tagA.href;
		//window.top.location=tagA.href; /// para ir al frame superior
	}
}



//// fin funciones de checkbox de listado ////////////
//////////////////////////////////////////////////////
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_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_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 MM_findObj(n, d) { //v4.0

       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 && document.getElementById) x=document.getElementById(n); return x;
}
function openBrWindow(theURL,winName,features) { //v2.0
   self.name = "versadoMain";
   window.open(theURL,winName,features);
}

function FE_rusure(msg, object, href){
	question = confirm(msg + '\t\t\n\n' + object)
	if (question !="0"){
		location.href = href;
	}
}

function FE_validateForm() { //v4.0

   var i,p,q,nm,test,num,min,max,errors='',args=FE_validateForm.arguments;
   for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isDate')!=-1) { // fecha

		var fmt = document.formatoFecha;

		var parte = fmt.split(fmt.charAt(1));
		var patron = '^';
		if(val.indexOf('/') != -1){
			var fecha = val.split('/');	var sep = '/';
		}else if(val.indexOf('-') != -1){
			var fecha = val.split('-');	var sep = '-';
		}else{
			var fecha = val.split('.'); var sep = '\.';
		}
		for(j=0;j<parte.length;j++){
			if(parte[j] == 'd' || parte[j] == 'm' || parte[j] == 'M' || parte[j] == 'F'){
				patron += '\(\\d{1,2}\)';
				if(parte[j] == 'd'){
					dia = fecha[j];
				}else{
					mes = fecha[j] - 1;
				}
			}else if(parte[j] == 'Y'){
				patron += '\(\\d{4}\)';
				anio = fecha[j];
			}else if(parte[j] == 'y'){
				patron += '\(\\d{2}\)';
				anio = fecha[j];
			}
			if(j < (parte.length-1)){
				patron += sep;
			}
		}
		patron += '$';

		var arrFecha=val.match(patron);
		if(arrFecha){

			var myDate=new Date(anio,mes,dia);
			if(myDate.getFullYear()!=anio||myDate.getDate()!=dia||myDate.getMonth()!=mes){
				errors+='* ' + nm + ' ' + document.msg_valid_debeSerFecha + '\n';
			}

		}else{
			errors+='* ' + nm + ' ' + document.msg_valid_debeSerFecha + '\n';
		}

	  } else if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='* '+nm+' ' + document.msg_valid_debeSerEmail + '\n';
      } else if (test.indexOf('isEqual')!=-1) { p=test.indexOf('isEqual');
	  	valorIgualar = test.substring(p+8);
		valorIgualar = MM_findObj(valorIgualar);
		valorIgualar = valorIgualar.value;
		//alert(valorIgualar);
		if(val != valorIgualar){
			errors += '* ' + document.msg_valid_passDebeSerIguales + '\n';
		}
	  } else if (test!='R') {
        if (isNaN(val)) errors+='* '+nm+' ' + document.msg_valid_debeSerNumero + '\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if ((val*1)<(min*1) || (max*1)<(val*1)) errors+='* '+nm+' ' + document.msg_valid_debeSerNumeroEnt + ' '+min+' ' + document.tex_y + ' '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '* '+nm+' ' + document.msg_valid_obligatorio + '\n'; }
   } if (errors) alert(document.msg_valid_ocurrieronErrores + '\t\t\t\t\n\n'+errors);
    document.returnValue = (errors == '');

}
function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}


function mailAntiSpam(usuario, dominio, clase)
{
	//var usuario = "nombre_de_usuario"
	//var dominio = "dominio.com"
	if(clase!=""){
		miclase=' class="'+clase+'"';
	}
	document.write("<a href=\"mailto:" + usuario + "@" + dominio + "\" style=\"text-decoration:none\""+miclase+">" + usuario + "@" + dominio + "</a>")
	
}

function mostrar_bases(){
	if(document.getElementById('bases').style.visibility == 'hidden'){
		document.getElementById('bases').style.visibility = 'visible';
		document.getElementById('bases').style.display = 'block';
	}else{
		document.getElementById('bases').style.visibility = 'hidden';
		document.getElementById('bases').style.display = 'none';
	}
}

function ValidateChk(campo) { 
	var errors='';
	loscheck=document.getElementById(campo);
	if(document.getElementById(campo).checked== false){
		errors ='Los siguientes errores han ocurrido:\n Debe aceptar las bases y condiciones antes de continuar.';
	}
	if (errors) alert(errors);
	document.ValidateChk_returnValue = (errors == '');
}

function otra_insc() 
{ 
  vent=confirm("Recuerde imprimir su cupón antes de realizar otra inscripción.\nPulse aceptar si ya imprimió su cupón, pulse cancelar para imprimir el mismo.") 
  if(vent) 
  { 
     window.location='logout.php';
  } 
  else 
  { 
     return false; 
  } 
} 

function Popup(url,name,width,height,resize,scroll) {
	var dialogWin = new Object();
	dialogWin.width = width;
	dialogWin.height = height;
	if (navigator.appName == "Netscape") {
		dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
		dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
		var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	} else if (document.all) {
		dialogWin.left = (screen.width - dialogWin.width) / 2;
		dialogWin.top = (screen.height - dialogWin.height) / 2;
		var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
	}
	window.open(url,name,attr);
}


function imprimirPagina() {
  if (window.print)
    window.print();
  else
    alert("Lo siento, pero a tu navegador no se le puede ordenar imprimir" +
      " desde la web. Actualizate o hazlo desde los menús");
}

function agregarFavoritos() { 
	if (window.sidebar&&window.sidebar.addPanel){   
		window.sidebar.addPanel("Ministaerio de desarrollo económico","http://mde.mdebuenosaires.gov.ar",""); 
	}else{    
		window.external.AddFavorite("http://mde.mdebuenosaires.gov.ar","MDE Buenos Aires")
	}
}
function getAbsoluteElementPosition(element) {
  if (typeof element == "string")
    element = document.getElementById(element)
    
  if (!element) return { top:0,left:0 };
  
  var y = 0;
  var x = 0;
  while (element.offsetParent) {
    x += element.offsetLeft;
    y += element.offsetTop;
    element = element.offsetParent;
  }
  return {top:y,left:x};
}

function showL(elemento,posicionador,offY,offX) {
	
	var pos = getAbsoluteElementPosition(document.getElementById(posicionador));

	var top=pos.top+offY;
	var left=pos.left+offX;
	//document.getElementById([elemento]).style.display = "block";
	
  	new Effect.Appear(elemento);
	document.getElementById([elemento]).style.left = left + 'px';
	document.getElementById([elemento]).style.top = top + 'px';
  //alert("top="+pos.top+" left="+pos.left);
}

function hideL(elemento) {
	//alert(elemento);
	new Effect.Fade(elemento);
	//document.getElementById([elemento]).style.display = "none";
  //alert("top="+pos.top+" left="+pos.left);
}

function videoExito(oXML){
	
	var mensaje=oXML.responseText;
	//alert(mensaje);
	//Element.hide(contenedor);
	document.getElementById('videoDiv').innerHTML = mensaje;
	new Effect.Appear('videoDiv');
}

function cambiarVideo(video,contenedor,id){
	//alert(video);
	//document.getElementById([contenedor]).innerHTML = '<img src="../images/ajax-loaderB.gif" border="0" />';
	var myConn = new XHConn();
	parametros="accion=registrarIdV&id="+id+"&video="+video+"&contenedor="+contenedor;
	myConn.connect("cvid.php", "GET", parametros,videoExito);
}
var ap_instances = new Array();

function ap_stopAll(playerID) {
	for(var i = 0;i<ap_instances.length;i++) {
		try {
			if(ap_instances[i] != playerID) document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);
			else document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);
		} catch( errorObject ) {
			// stop any errors
		}
	}
}

function ap_registerPlayers() {
	var objectID;
	var objectTags = document.getElementsByTagName("object");
	for(var i=0;i<objectTags.length;i++) {
		objectID = objectTags[i].id;
		if(objectID.indexOf("audioplayer") == 0) {
			ap_instances[i] = objectID.substring(11, objectID.length);
		}
	}
}

var ap_clearID = setInterval( ap_registerPlayers, 100 );

function colapse(elemento){
	el=document.getElementById(elemento).style;
	if(el.display=='none'){
		new Effect.BlindDown(elemento, {duration:1})	
	}else{
		new Effect.BlindUp(elemento, {duration:1})
	}
}
function hideL(elemento) {
	//alert(elemento);
	
	if (empezar){
		ocultar =capa
		clearTimeout(retardo)
		retardo = setTimeout("xHide('" + ocultar + "')",1000)
	 }

	//document.getElementById([elemento]).style.display = "none";
  //alert("top="+pos.top+" left="+pos.left);
}
function xDef() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}
function xShow(e) {
  if(!(e=document.getElementById(e))) return;
  if(e.style && xDef(e.style.display)) e.style.display='block';
}
function xHide(e) {
	
  if(!(e=document.getElementById(e))) return;
  if(e.style && xDef(e.style.display)) e.style.display='none';
}
function muestra_coloca(capa){
 if (empezar){
	for (i=0;i<capas.length;i++){
		if (capas[i] != capa) xHide(capas[i])
	}
	clearTimeout(retardo)
	xShow(capa)
 }
}
function oculta_retarda(capa){
 if (empezar){
	ocultar = capa
	clearTimeout(retardo[capa])
	retardo[capa] = setTimeout("xHide('" + ocultar + "')",1000)
 }
}

function muestra_retarda(ind){
	 if (empezar){
		clearTimeout(retardo[ind])
	 }
}

function showSubCatmenu(cat,status,pos,div1,div2,offX,offY,orY){
	
	var posi = getAbsoluteElementPosition(document.getElementById(pos));
	var left=posi.left+offX;
	if(BrowserDetect.browser=="Firefox" && orY=="top"){
		var top=posi.top;
	}else if(BrowserDetect.browser=="Firefox"){
		var top=(posi.top+offY)-8;
	}else if((BrowserDetect.browser=="Opera" || BrowserDetect.browser=="Safari") && orY=="top"){
		var top=(posi.top+offY)-4;	
	}else{
		var top=posi.top+offY;
	}
	//alert(div1);
	theObjects=document.getElementsByName(div1);
	if (empezar){
		for (var i = 0; i < theObjects.length; i++) {
			var laid=div2+i;
			//alert(laid);
			if(cat==i){
				//alert(document.getElementById(laid).offsetHeight);
				document.getElementById(laid).style.left = left + 'px';
				xShow(laid);
				if(orY=='top'){
					top=top-(document.getElementById(laid).offsetHeight);
				}
				document.getElementById(laid).style.top  = top+'px';
			}else{
				xHide(laid);
			}
		}
		clearTimeout(retardo[laid])
	}
}
retardo = new Array();
var ocultar
var empezar = false
window.onload = function() {
	empezar = true
}
//-->
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
function getLength(l,m){
window.status = l + " de " + m + " un máximo de caracteres.";
return l < m;
}
function maxLength(t,m){
var l = t.value.length;
if (l > m){
alert("Su ingreso de " + l
+ " caracter excede el máximo permitido que es de " + m + ".\n"
+ "Se Lo ingresado por Ud. se recortará a la cantidad máxima permitida.");
t.value = t.value.substring(0,m);
}
getLength(t.value.length,m);
}
function deshabilitarcombo(id,valor){
	campo=id;
	document.getElementById(campo).value=valor;
	document.getElementById(campo).disabled=true;
}
function habilitarcombo(id,valor){
	campo=id;
	document.getElementById(campo).value=valor;
	document.getElementById(campo).disabled=false;
}
function deshabilitar(id) {
	campo=id;
	document.getElementById(campo).value="-";
	document.getElementById(campo).readOnly=true;
} 
function habilitar(id) {
	campo=id;
	document.getElementById(campo).value="";
	document.getElementById(campo).readOnly=false;
} 
function habilitarGrupoA() {

	document.getElementById('2.2.1_Si_actualmente_se_encuentra_trabajando,_por_favor,_indique_si_lo_hace').value="En relación de dependencia";
	document.getElementById('2.2.1_Si_actualmente_se_encuentra_trabajando,_por_favor,_indique_si_lo_hace').disabled=false;
	
	document.getElementById('2.2.2_Área_o_actividad').value="";
	document.getElementById('2.2.2_Área_o_actividad').readOnly=false;
	
	document.getElementById('2.2.3_Antigüedad').value="";
	document.getElementById('2.2.3_Antigüedad').readOnly=false;
} 

function deshabilitarGrupoA() {

	document.getElementById('2.2.1_Si_actualmente_se_encuentra_trabajando,_por_favor,_indique_si_lo_hace').value="No Aplica";
	document.getElementById('2.2.1_Si_actualmente_se_encuentra_trabajando,_por_favor,_indique_si_lo_hace').disabled=true;
	
	document.getElementById('2.2.2_Área_o_actividad').value="-";
	document.getElementById('2.2.2_Área_o_actividad').readOnly=true;
	
	document.getElementById('2.2.3_Antigüedad').value="-";
	document.getElementById('2.2.3_Antigüedad').readOnly=true;
} 

function habilitarSoloSi(valor,id,campo) {
	if(valor == id){
		document.getElementById(campo).value="";
		document.getElementById(campo).readOnly=false;
	}else{
		document.getElementById(campo).value="-";
		document.getElementById(campo).readOnly=true;
	}
} 
function llamaFuncionesSoloSi(valor,id){
	if(valor == id){
		deshabilitarGrupoA();
		document.getElementById('10_No').checked=true;
	}
}