<!--
/////////////////////////////////////////////////////////////////////////////
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("Bafim","http://bafim.mdebuenosaires.gov.ar",""); 
	}else{    
		window.external.AddFavorite("http://bafim.mdebuenosaires.gov.ar","Bafim")
	}
}
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)-pos.height;
	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 ocultar_info() {
	document.getElementById('infoDiv').style.visibility='hidden';
	document.getElementById('infoDiv').innerHTML = '';
	document.getElementById('infoDiv').style.display='none';
}

function mostrar_mas_info(numero_de_objeto,tipo_user,array){
	var myConn = new XHConn();
	parametros="n="+numero_de_objeto+'&tipo_user='+tipo_user+'&array='+array;
	document.posicion = 'info_'+numero_de_objeto;
	myConn.connect("../includes_FE/FE_info.php", "GET", parametros,infoExito);
	//showL('infoDiv',posicionador,-160,20);
	
	document.getElementById('infoDiv').style.display='block';
	document.getElementById('infoDiv').style.visibility='visible';
	//new Effect.Appear('infoDiv');

	return true;
}
function infoExito(oXML){
	
	var mensaje=oXML.responseText;
	//alert(mensaje);
	//Element.hide(contenedor);
	var p=getAbsoluteElementPosition(document.posicion);
	document.getElementById('infoDiv').innerHTML = mensaje;
	
	//alert(element.offsetHeight);
	var top = p.top - document.getElementById('infoDiv').offsetHeight;
	var left = p.left + 20;
	document.getElementById('infoDiv').style.left = left + 'px';
	document.getElementById('infoDiv').style.top = top + 'px';

	//new Effect.Appear('infoDiv');
	//alert(mensaje);
	return true;
}

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

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).parentNode)) return;
  if(e.style && xDef(e.style.display)) e.style.display='block';
}
function xHide(e) {
	
  if(!(e=document.getElementById(e).parentNode)) 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)-5;
	}else if((BrowserDetect.browser=="Opera" || BrowserDetect.browser=="Safari") && orY=="top"){
		var top=(posi.top+offY)-4;	
	}else{
		var top=posi.top+offY-5;
	}
	//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){
				//document.getElementById(laid).parentNode.offsetLeft  = 0;
				//alert(document.getElementById(laid).parentNode.id);
				left = left -document.getElementById('encabezado').offsetLeft;
				document.getElementById(laid).parentNode.style.left = left + 'px';
				xShow(laid);
				if(orY=='top'){
					top=top-(document.getElementById(laid).parentNode.offsetHeight);
				}
				document.getElementById(laid).parentNode.style.top  = top+'px';
			}else{
				//xHide(laid);
			}
		}
		clearTimeout(retardo[laid])
	}
}
retardo = new Array();
var ocultar
var empezar = true
window.onload = function() {
	empezar = true
}
//-->
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function cerrar_video(){
	
	new Effect.Fade('videoDiv');
	document.getElementById('playerDiv').innerHTML = '<div  style="width:320;height:240"></div>';
	
}
function carga_video(video, autoplay){
	
	//document.getElementById([contenedor]).innerHTML = '<img src="../images/ajax-loaderB.gif" border="0" />';
	var myConn = new XHConn();
	
	parametros="accion=registrarIdV&id="+video+"&autoplay="+autoplay;
	
	document.getElementById('playerDiv').innerHTML = '<div  style="width:320;height:240;vertical-align:middle;" align="center"><img src="../images/ajax-loader.gif" border="0" /></div>';
	//document.getElementById('videoDiv').style.visibility = "visible";
	new Effect.Appear('videoDiv');
	myConn.connect("cvid.php", "GET", parametros,videoExito);
	//ajax('cvid.php?'+parametros,'playerDiv');
	//alert(ajax('cvid.php?'+parametros,'playerDiv'));
}
function Cycler (objName, name, min, max, current, interval){
    this.objName = objName;
    this.name = name;
    this.min = min;
    this.max = max;
    this.current = current;
    this.interval = interval;
    this.playing = false;
    this.timer = null;
    this.nextElement = 
      function nextElement() {
        document.getElementById(this.name + "_" + this.current).style.display = 'none';
		//document.getElementById(this.name + "_" + this.current).getElementById("id_marq_" + this.current).start();
		this.stopElement()
        if (++this.current > this.max) {
          this.current = this.min;
        } 

        document.getElementById(this.name + "_" + this.current).style.display = 'block';
		this.playElement();
        return null;
      }
      
    this.prevElement =
      function prevElement() {
        document.getElementById(this.name + "_" + this.current).style.display = 'none';

        if (--this.current < this.min) {
          this.current = this.max;
        } 

        document.getElementById(this.name + "_" + this.current).style.display = 'block';

        return null;
      }
    
    this.playElement =
      function playElement() {
        this.timer = setInterval(this.objName + ".nextElement()", this.interval);
        this.playing = true;
        return null;
      }
    
    this.stopElement =  
      function stopElement() {

        clearInterval(this.timer);
        this.playing = false;
        return null;
      }
      
    this.pauseElement = 
      function pauseElement() {
        if (this.playing) {
          this.stopElement();
        } else {
          this.playElement();
        }
      }
    
    this.showCurrent = 
      function showCurrent() 
      {
        document.getElementById(this.name + "_" + this.current).style.display = 'block';
      }
  }
var VentanaModal = {
	
	inicializado		: false,
	creado				: false,
	ancho				: 0,
	alto				: 0,
	sombra				: false,
	csombra				: null,
	tsombra				: 0,
	claseSombra			: "",
	ventana				: null,
	idVentana			: "",
	claseVentana		: "",
	MSIE				: false,
	fondo				: null,
	claseFondo			: "",
	
	getInstancia: function() {
		this.inicializar();
		this.crear();
		return this;
	},
	
	setSize: function(ancho, alto) {
		this.alto = parseInt(alto);
		this.ancho = parseInt(ancho);
		this.ventana.style.width = this.ancho + "px";
		this.ventana.style.height = this.alto + "px";
		this.csombra.style.width = this.ancho + "px";
		this.csombra.style.height = this.alto + "px";
		this.redimensionar();
		
	},
	
	setClaseVentana: function(nombreClaseVentana) {
		this.claseVentana = nombreClaseVentana;
		this.ventana.className = this.claseVentana;
	},
	
	setSombra: function(sombra) {
		if (sombra == true) {
			this.sombra = true;
			this.csombra.style.display = "inline";
		}
		else {
			this.sombra = false;
			this.csombra.style.display = "none";
		}
	},
	
	setSombraSize: function(tsombra) {
		this.tsombra = tsombra;
		this.redimensionar();
	},
	
	setClaseSombra: function(claseSombra) {
		this.claseSombra = claseSombra;
		this.csombra.className = this.claseSombra;
	},
	
	setIdVentana: function(id) {
		this.idVentana = id;
		this.ventana.id = this.idVentana;
	},
	
	setClaseFondo: function(claseFondo) {
		this.claseFondo = claseFondo;
		this.fondo.className = this.claseFondo;
	},
	
	setContenido: function(html) {
		this.ventana.innerHTML = html;
	},
	
	mostrar: function() {
		this.fondo.style.display = "inline";
		this.ventana.style.display = "inline";
		if (this.sombra)
			this.csombra.style.display = "inline";
	},

	cerrar: function() {
		this.ventana.style.display = "none";
		this.csombra.style.display = "none";
		this.fondo.style.display = "none";
	},
	
	medio: function(v1, v2) {
		if (isNaN(v1) && v1.indexOf("px") != -1)
			v1 = v1.replace("px", "");
		if (isNaN(v2) && v2.indexOf("px") != -1)
			v2 = v2.replace("px", "");
		var aux = parseInt(v1) / 2;
		aux = aux - (parseInt(v2) / 2);
		return parseInt(aux) * (+1);
	},
	
	inicializar: function() {
		if (this.inicializado) 
			return;
		window.onresize = function() {
			VentanaModal.redimensionar();
		};
		
		this.ancho = 300;
		this.alto = 200;
		this.sombra = true;
		this.tsombra = 5;
		this.claseSombra = "ventana-modal-sombra";
		this.claseFondo = "ventana-modal-fondo";
		this.claseVentana = "ventana-modal-ventana";
		
		if (navigator.userAgent.indexOf('MSIE') >= 0) 
			this.MSIE = true;
			
		this.inicializado = true;
		this.crear();
	},
	
	redimensionar: function() {
		var top = 0;
		var left = 0;
		var alto = 0;
		if (this.MSIE) {
			this.fondo.style.width = document.body.clientWidth;
			if (document.body.clientHeight)
				this.fondo.style.height = document.body.clientHeight;
			}else if (document.documentElement){
				this.fondo.style.height = document.documentElement.clientHeight;
			}else {
				 this.fondo.style.width = "100%";
				 this.fondo.style.height = "100%";
			}
			if (this.MSIE) {
				top = this.medio(document.body.clientHeight, this.alto);
				left = this.medio(document.body.clientWidth, this.ancho);
			}else{
				top = this.medio(innerHeight, this.alto);
				left = this.medio(innerWidth, this.ancho);
			}
			var dim= getPageSize();
			this.fondo.style.height = dim[1]+"px";
			this.fondo.style.width = dim[0]+"px";
			this.ventana.style.top = top + "px";
			this.ventana.style.left = left + "px";
			this.csombra.style.top = (parseInt(top) + this.tsombra) + "px";
			this.csombra.style.left = (parseInt(left) + this.tsombra) + "px";
	},
	
	crear: function() {
		if (this.creado) 
			return;
		this.fondo = document.createElement("DIV");
		this.fondo.style.position = "absolute";
		this.fondo.style.left = "0px";
		this.fondo.style.top = "0px";
		this.fondo.style.display = "none";
		this.fondo.className = this.claseFondo;

		this.fondo.style.zIndex = 90000;
		this.fondo.style.textAlign = "center";
		document.body.appendChild(this.fondo);
		
		this.ventana = document.createElement("DIV");
		document.body.appendChild(this.ventana);
		this.ventana.style.display = "none";
		this.ventana.style.position = "absolute";
		//this.ventana.style.overflow = "auto";
		this.ventana.style.zIndex = 100000;
		this.ventana.style.width = this.ancho + "px";
		this.ventana.style.height = this.alto + "px";
		this.ventana.className = this.claseVentana;
		
		this.csombra = document.createElement("DIV");
		document.body.appendChild(this.csombra);
		this.csombra.style.display = "none";
		this.csombra.style.position = "absolute";
		this.csombra.style.zIndex = 95000;
		this.csombra.style.width = this.ancho + "px";
		this.csombra.style.height = this.alto + "px";
		this.csombra.className = this.claseSombra;
		
		this.creado = true;

		this.redimensionar();
	}
};
function chequearTodosPaises(){
	var elementos = document.getElementsByName("chk_pais[]");
	if(document.getElementById("chk_pais_todos").checked==false){
		checkear=false;
	}else{
		checkear=true;
	}
	for (i=0;i<elementos.length;i++) {
		 elementos[i].checked=checkear;
	}
}
function deschequearTodosPaises(){
	var elementos = document.getElementsByName("chk_pais[]");
	var_cont=0;
	for (i=0;i<elementos.length;i++) {
		if(elementos[i].checked==true){
			var_cont++;
		}
	}
	if(var_cont==elementos.length){
		document.getElementById("chk_pais_todos").checked=true;
	}else{
		document.getElementById("chk_pais_todos").checked=false;
	}

}
///////////////////////////////////////////////
function selectReplacement(obj) {
  // append a class to the select
  obj.className += ' replaced';
  // create list for styling
  var ul = document.createElement('ul');
  ul.className = 'selectReplacement';
  var opts = obj.options;
  for (var i=0; i<opts.length; i++) {
	var selectedOpt;
	if (opts[i].selected) {
	  selectedOpt = i;
	  break;
	} else {
	  selectedOpt = 0;
	}
  }
  for (var i=0; i<opts.length; i++) {
	var li = document.createElement('li');
	var txt = document.createTextNode(opts[i].text);
	li.appendChild(txt);
	li.selIndex = opts[i].index;
	li.selectID = obj.id;
	li.onclick = function() {
	  selectMe(this);
	}
	if (i == selectedOpt) {
	  li.className = 'selected';
	  li.onclick = function() {
		this.parentNode.className += ' selectOpen';
		this.onclick = function() {
		  selectMe(this);
		}
	  }
	}
	if (window.attachEvent) {
	  li.onmouseover = function() {
		this.className += ' hover';
	  }
	  li.onmouseout = function() {
		this.className = 
		  this.className.replace(new RegExp(" hover\\b"), '');
	  }
	}
	ul.appendChild(li);
  }
  // add the input and the ul
  obj.parentNode.appendChild(ul);
}
function selectMe(obj) {
  var lis = obj.parentNode.getElementsByTagName('li');
  for (var i=0; i<lis.length; i++) {
	if (lis[i] != obj) { // not the selected list item
	  lis[i].className='';
	  lis[i].onclick = function() {
		selectMe(this);
	  }
   } else {
	  setVal(obj.selectID, obj.selIndex);
	  obj.className='selected';
	  obj.parentNode.className = 
		obj.parentNode.className.replace(new RegExp(" selectOpen\\b"), '');
	  obj.onclick = function() {
		obj.parentNode.className += ' selectOpen';
		this.onclick = function() {
		  selectMe(this);
		}
	  }
	}
  }
}
function setVal(objID, selIndex) {
  var obj = document.getElementById(objID);
  obj.selectedIndex = selIndex;
}
function setForm(id) {
  var s = document.getElementById(id);
  selectReplacement(s);
}
function closeSel(obj) {
  // close the ul
}
jQuery(document).ready(function() {
	//inicializarScroll();	
	var auto = jQuery("#chained").scrollable({circular: false, mousewheel: true});
	jQuery(".scrollable").scrollable({circular: true}).autoscroll(5000);
	jQuery(".items").mouseover(function(){
		jQuery(".scrollable a").show();
	});
	jQuery(".items").mouseout(function(){
		jQuery(".scrollable a").hide();
	});
	jQuery(".scrollable a").mouseover(function(){
		jQuery(".scrollable a").show();
	});
	jQuery(".scrollable a").mouseout(function(){
		jQuery(".scrollable a").hide();
	});

	jQuery("a[rel^='prettyPhoto']").prettyPhoto({theme: 'dark_square',slideshow:10000, autoplay_slideshow:false,show_title:false});

	jQuery('#slideshowHolder').jqFancyTransitions({ 

	effect: 'zipper', // wave, zipper, curtain
	width: 998, // width of panel
	height: 349, // height of panel
	strips: 18, // number of strips
	delay: 5000, // delay between images in ms
	stripDelay: 50, // delay beetwen strips in ms
	titleOpacity: 0.9, // opacity of title
	titleSpeed: 1000, // speed of title appereance in ms
	position: 'alternate', // top, bottom, alternate, curtain
	direction: 'fountainAlternate', // left, right, alternate, random, fountain, fountainAlternate
	navigation: true, // prev and next navigation buttons
	links: true // show images as links
});
	jQuery('.kwicks').kwicks({
		max : 485,
		spacing : 27,
		duration: 200
	});

});

var map;
var centro;
var markersArray=[];
var geocoder;
var direcc;
function googleMap(direccion,coordenadas){
	
	geocoder = new google.maps.Geocoder();
	if(coordenadas){ 	
		centro = new google.maps.LatLng(coordenadas);
		google.maps.event.addDomListener(window, 'load', initiamap); 
	}else if(direccion){
		direcc = direccion;
		getLatLong(); 
	}

}	
function initiamap() {
	
	var mapOptions = {
		center:  centro,
		zoom: 16,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		navigationControl: true,
		navigationControlOptions: {
			style: google.maps.NavigationControlStyle.ZOOM_PAN
		},
		mapTypeControl: true,
		streetViewControl: true
	};
	map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
	var marker = new google.maps.Marker({ 
			position: centro,  
			map: map
			//title:"Hello World!" 
	});
	//document.getElementById("map_canvas").innerHTML="asdasdasda asd asdasdasd adad";
	/*google.maps.event.addListener(marker, 'click', function() { 
		map.setZoom(16); 
		map.setCenter(centro);
	});
	markersArray.push(marker);*/
}
	
function getLatLong(){
	geocoder.geocode( { 'address': direcc}, function(results, status) {
		if (status == google.maps.GeocoderStatus.OK) {
			centro = results[0].geometry.location;
			initiamap();
		}else if(status=='ZERO_RESULTS'){
			centro = new google.maps.LatLng(-34.397, 150.644);
			initiamap();
		}
	});
}
function codeAddress(dir) {
	var address = dir;
	if(markersArray.length>0){
		markersArray[0].setMap(null);
		markersArray.length = 0; 
	}
	geocoder.geocode( { 'address': address}, function(results, status) {
	  if (status == google.maps.GeocoderStatus.OK) {
		map.setCenter(results[0].geometry.location);
		map.setZoom(16);
		var marker = new google.maps.Marker({
			map: map, 
			position: results[0].geometry.location
		});
		google.maps.event.addListener(marker, 'click', function() { 
			map.setZoom(16); 
			map.setCenter(results[0].geometry.location);
		});
		markersArray.push(marker);
	  } else {
		alert("Geocode was not successful for the following reason: " + status);
	  }
	});
}
scrollList=new Array();
 
function registraScroll(idAbajo, idArriba, div, velAbajo, velArriba)
{
    if(scrollList[idAbajo]==null) scrollList[idAbajo]=new Array();
    if(scrollList[idArriba]==null) scrollList[idArriba]=new Array();
    scrollList[idAbajo].push(new Array(div, velAbajo));
    scrollList[idArriba].push(new Array(div, velArriba));
}
  
function getEl(elementId)
{
    return document.getElementById(elementId);
}
 
function inicializarScroll()
{
    for(key in scrollList)
    {
        var elemento=getEl(key);
        elemento.onmouseover=iniciaScroll;
        elemento.onmouseout=detieneScroll;
    }
}
 
function iniciaScroll()
{
    scrollDivs=new Array();
    velDivs=new Array();
    for(key in scrollList[this.id])
    {
        scrollDivs.push(getEl(scrollList[this.id][key][0]));
        velDivs.push(scrollList[this.id][key][1]);
    }
    identificador=setInterval('scrollNow()', 50);
}
 
function detieneScroll()
{
    clearInterval(identificador);
}
 
function scrollNow()
{
    for(key in scrollDivs)
    {
    var desplazamientoActual=scrollDivs[key].scrollTop;
    var nuevoDesplazamiento=desplazamientoActual+velDivs[key];
    scrollDivs[key].scrollTop=nuevoDesplazamiento;
    }
}

function abrirSeccion(el){
	jQuery('#'+el).toggle('slow');
	if(jQuery('#'+el).css('width')=='1px'){
		jQuery('#'+el).prev()
.css('background','url(../images/plus.gif) 0px 4px no-repeat');
	}else{
		jQuery('#'+el).prev()
.css('background','url(../images/plus.gif) 0px -9px no-repeat');
	}
}
function ver_avanzada(){
	jQuery('#avanzada').toggle();
}
//-->
