/* begin Page */
/* Created by Artisteer v3.0.0.45570 */
// css hacks
(function($) {
    // fix ie blinking
    var m = document.uniqueID && document.compatMode && !window.XMLHttpRequest && document.execCommand;
    try { if (!!m) { m('BackgroundImageCache', false, true); } }
    catch (oh) { };
    // css helper
    var data = [
        {str:navigator.userAgent,sub:'Chrome',ver:'Chrome',name:'chrome'},
        {str:navigator.vendor,sub:'Apple',ver:'Version',name:'safari'},
        {prop:window.opera,ver:'Opera',name:'opera'},
        {str:navigator.userAgent,sub:'Firefox',ver:'Firefox',name:'firefox'},
        {str:navigator.userAgent,sub:'MSIE',ver:'MSIE',name:'ie'}];
    for (var n=0;n<data.length;n++)	{
        if ((data[n].str && (data[n].str.indexOf(data[n].sub) != -1)) || data[n].prop) {
            var v = function(s){var i=s.indexOf(data[n].ver);return (i!=-1)?parseInt(s.substring(i+data[n].ver.length+1)):'';};
            $('html').addClass(data[n].name+' '+data[n].name+v(navigator.userAgent) || v(navigator.appVersion)); break;			
        }
    }
})(jQuery);

var _artStyleUrlCached = null;
function artGetStyleUrl() {
    if (null == _artStyleUrlCached) {
        var ns;
        _artStyleUrlCached = '';
        ns = jQuery('link');
        for (var i = 0; i < ns.length; i++) {
            var l = ns[i].href;
            if (l && /style\.ie6\.css(\?.*)?$/.test(l))
                return _artStyleUrlCached = l.replace(/style\.ie6\.css(\?.*)?$/, '');
        }
        ns = jQuery('style');
        for (var i = 0; i < ns.length; i++) {
            var matches = new RegExp('import\\s+"([^"]+\\/)style\\.ie6\\.css"').exec(ns[i].html());
            if (null != matches && matches.length > 0)
                return _artStyleUrlCached = matches[1];
        }
    }
    return _artStyleUrlCached;
}

function artFixPNG(element) {
    if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 7) {
		var src;
		if (element.tagName == 'IMG') {
			if (/\.png$/.test(element.src)) {
				src = element.src;
				element.src = artGetStyleUrl() + 'images/spacer.gif';
			}
		}
		else {
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
			if (src) {
				src = src[1];
				element.runtimeStyle.backgroundImage = 'none';
			}
		}
		if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "')";
	}
}

jQuery(function() {
    jQuery.each(jQuery('ul.art-hmenu>li:not(.art-hmenu-li-separator),ul.art-vmenu>li:not(.art-vmenu-separator)'), function (i, val) {
        var l = jQuery(val); var s = l.children('span'); if (s.length == 0) return;
        var t = l.find('span.t').last(); l.children('a').append(t.html(t.text()));
        s.remove();
    });
});/* end Page */

/* begin Box, Sheet */

function artFluidSheetComputedWidth(percent, minval, maxval) {
    percent = parseInt(percent);
    var val = document.body.clientWidth / 100 * percent;
    return val < minval ? minval + 'px' : val > maxval ? maxval + 'px' : percent + '%';
}/* end Box, Sheet */

/* begin Menu */
jQuery(function() {
    jQuery.each(jQuery('ul.art-hmenu>li:not(:last-child)'), function(i, val) {
        jQuery('<li class="art-hmenu-li-separator"><span class="art-hmenu-separator"> </span></li>').insertAfter(val);
    });
    if (!jQuery.browser.msie || parseInt(jQuery.browser.version) > 6) return;
    jQuery.each(jQuery('ul.art-hmenu li'), function(i, val) {
        val.j = jQuery(val);
        val.UL = val.j.children('ul:first');
        if (val.UL.length == 0) return;
        val.A = val.j.children('a:first');
        this.onmouseenter = function() {
            this.j.addClass('art-hmenuhover');
            this.UL.addClass('art-hmenuhoverUL');
            this.A.addClass('art-hmenuhoverA');
        };
        this.onmouseleave = function() {
            this.j.removeClass('art-hmenuhover');
            this.UL.removeClass('art-hmenuhoverUL');
            this.A.removeClass('art-hmenuhoverA');
        };

    });
});

/* end Menu */

/* begin Layout */
jQuery(function () {
     var c = jQuery('div.art-content');
    if (c.length !== 1) return;
    var s = c.parent().children('.art-layout-cell:not(.art-content)');

    if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 8) {

        jQuery(window).bind('resize', function () {
            var w = 0;
            c.hide();
            s.each(function () { w += this.clientWidth; });
            c.w = c.parent().width(); c.css('width', c.w - w + 'px');
            c.show();
        })

        var r = jQuery('div.art-content-layout-row').each(function () {
            this.c = jQuery(this).children('.art-layout-cell:not(.art-content)');
        });

        jQuery(window).bind('resize', function () {
            r.each(function () {
                if (this.h == this.clientHeight) return;
                this.c.css('height', 'auto');
                this.h = this.clientHeight;
                this.c.css('height', this.h + 'px');
            });
        });
    }

    var g = jQuery('.art-layout-glare-image');
    jQuery(window).bind('resize', function () {
        g.each(function () {
            var i = jQuery(this);
            i.css('height', i.parents('.art-layout-cell').height() + 'px');
        });
    });

    jQuery(window).trigger('resize');
});/* end Layout */

/* begin Button */
function artButtonSetup(className) {
    jQuery.each(jQuery("a." + className + ", button." + className + ", input." + className), function (i, val) {
        var b = jQuery(val);
        if (!b.parent().hasClass('art-button-wrapper')) {
            if (b.is('input')) b.val(b.val().replace(/^\s*/, '')).css('zoom', '1');
            if (!b.hasClass('art-button')) b.addClass('art-button');
            jQuery("<span class='art-button-wrapper'><span class='art-button-l'> </span><span class='art-button-r'> </span></span>").insertBefore(b).append(b);
            if (b.hasClass('active')) b.parent().addClass('active');
        }
        b.mouseover(function () { jQuery(this).parent().addClass("hover"); });
        b.mouseout(function () { var b = jQuery(this); b.parent().removeClass("hover"); if (!b.hasClass('active')) b.parent().removeClass('active'); });
        b.mousedown(function () { var b = jQuery(this); b.parent().removeClass("hover"); if (!b.hasClass('active')) b.parent().addClass('active'); });
        b.mouseup(function () { var b = jQuery(this); if (!b.hasClass('active')) b.parent().removeClass('active'); });
    });
}
jQuery(function() { artButtonSetup("art-button"); });

/* end Button */


/* -------------------MIOS-------------------------*/
function NewWindow(mypage, myname, w, h, scroll) {

	var winl = (screen.width - w) / 2;

	var wint = (screen.height - h) / 2;

	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'

	win = window.open(mypage, myname, winprops)

	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

	}
function borrarAudio(id) {
	if(confirm('Realmente quieres borrar el audio?')) {
		document.location.href= 'eliminarAudio.php?id='+id;
	}
}  

function borrarMensaje(id) {
	if(confirm('Realmente quieres borrar el mensaje?')) {
		document.location.href= 'eliminarMensaje.php?id='+id;
	}
} 

function borrarComentario(id) {
	if(confirm('Realmente quieres borrar el comentario?')) {
		document.location.href= 'eliminarComentario.php?id='+id;
	}
} 

function borrarMensajeResp(id) {
	if(confirm('Realmente quieres borrar la respuesta ?')) {
		document.location.href= 'eliminarRespuesta.php?id='+id;
	}
}

function borrarAlbum(id) {
	if(confirm('Realmente quieres borrar el album?')) {
		document.location.href= 'eliminarAlbum.php?id='+id;
	}
}

function borrarComentarioFoto(id,idFoto,idAlbum) {
	if(confirm('Realmente quieres borrar el comentario de la foto?')) {
		document.location.href= 'eliminarComentarioFoto.php?id='+id+'&idFoto='+idFoto+'&idAlbum='+idAlbum;
	}
}
function tab(pestana,panel)
{
	pst 	= document.getElementById(pestana);
	pnl 	= document.getElementById(panel);
	psts	= document.getElementById('tabs').getElementsByTagName('li');
	pnls	= document.getElementById('paneles').getElementsByTagName('div');
	
	// eliminamos las clases de las pesta–as
	for(i=0; i< psts.length; i++)
	{
		psts[i].className = '';
	}
	
	// A–adimos la clase 'actual' a la pesta–a activa
	pst.className = 'actual';
	
	// eliminamos las clases de las pesta–as
	for(i=0; i< pnls.length; i++)
	{
		pnls[i].style.display = 'none';
	}
	
	// A–adimos la clase 'actual' a la pesta–a activa
	pnl.style.display = 'block';
}

/*ALBUM DE FOTOS CARGAR VARIAS IMAGENES A LA VEZ*/

function MostrarFoto2(Foto){
	document.getElementById(encima_de_todo).style.display = 'block';
	document.getElementById(encima_de_todo).innerHTML='<img src="images/album/'+Foto+'">';
	
	}


function objetoAjax()
{
    var xmlhttp=false;
    try{
            xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
    }catch(e){
            try {
                    xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
            }catch(E){
                    xmlhttp = false;
            }
    }       
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
            xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}
function mostrarError(codigo){
		var divTarget = document.getElementById('Error');
		var ajax = objetoAjax();
		ajax.open('GET','verificarUsuario.php?codigo='+codigo);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				divTarget.innerHTML = ajax.responseText;}
		}
		ajax.send(null);
	}
function mostrarError2(codigo){
	var divTarget = document.getElementById('Error');
	var ajax = objetoAjax();
	ajax.open('GET','admin/verificarClave.php?codigo='+codigo);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divTarget.innerHTML = ajax.responseText;}
	}
	ajax.send(null);
}
   
function vacio(texto){
		if (texto == null || texto.length == 0 || /^\s+$/.test(texto)){
			document.getElementById('errorVacio').innerHTML='El campo no puede estar vacio';
			return false;
		}else{
			document.getElementById('errorVacio').innerHTML='';
			return true;
		
	}}
function vacio2(texto){
		if (texto == null || texto.length == 0 || /^\s+$/.test(texto)){
			document.getElementById('errorVacio2').innerHTML='El campo no puede estar vacio';
			return false;
		}else{
			document.getElementById('errorVacio2').innerHTML='';
			return true;
		
	}}
function vacio3(texto){
	if (texto == null || texto.length == 0 || /^\s+$/.test(texto)){
		document.getElementById('errorVacio3').innerHTML='El campo no puede estar vacio';
		return false;
	}else{
		document.getElementById('errorVacio3').innerHTML='';
		return true;
	
}}
function vacio4(texto){
	if (texto == null || texto.length == 0 || /^\s+$/.test(texto)){
		document.getElementById('Error').innerHTML='El campo no puede estar vacio';
		return false;
	}else{
		document.getElementById('Error').innerHTML='';
		return true;
	
}}

function vacio5(texto){
	
	if (texto == null || texto.length == 0 || /^\s+$/.test(texto)){
		document.getElementById('errorVacio5').innerHTML='El campo no puede estar vacio';
		return false;
	}else{
		document.getElementById('errorVacio5').innerHTML='';
		return true;
	
}

	}

function esNum(texto){
		if (isNaN(texto)||texto == null || texto.length == 0 || /^\s+$/.test(texto)){
			document.getElementById('errorNum').innerHTML='El campo debe ser numerico y no puede estar vacio';
			return false;
		}else{
			document.getElementById('errorNum').innerHTML='';
			return true;
		
	}}
function esMail(texto){
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(texto))){
			document.getElementById('errorMail').innerHTML='El campo no e-mail';
			return false;
		}else{
			document.getElementById('errorMail').innerHTML='';
			return true;
		
	}}
/*function esMail(valor){
	  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3,4})+$/.test(valor)){
			document.getElementById('errorMail').innerHTML='El campo no es un mail';
			return false;
		}else{
			document.getElementById('errorMail').innerHTML='';
			return true;
		
	}}*/
	function esTel(valor){
		if( (!(/^\d{14}$/.test(valor)))||(!/^\(\d{5}\)\s\d{9}$/.test(valor)) ) {
			document.getElementById('errorTel').innerHTML='El campo no es un numero de telefono';
			  return false;
			}
		else{
			document.getElementById('errorTel').innerHTML='';
			return true;
			}
		}
function validar(f)  {
	 /* if (isNaN(f.ciudad.value)) {
		  document.getElementById('errores').innerHTML='Corrija los errores marcados';
		  return (false);
	   }*/
	   if(f.nombre.value == null || f.nombre.value.length == 0 || /^\s+$/.test(f.nombre.value)){
		   document.getElementById('errores').innerHTML='Corrija los errores marcados';
		   document.getElementById('errorVacio').innerHTML='El campo no puede estar vacio';
			  return (false);
		   }
	   if(f.apellido.value == null || f.apellido.value.length == 0 || /^\s+$/.test(f.apellido.value)){
		   document.getElementById('errores').innerHTML='Corrija los errores marcados';
		   document.getElementById('errorVacio2').innerHTML='El campo no puede estar vacio';
			  return (false);
		   }
	   if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(f.email.value))){
		   document.getElementById('errores').innerHTML='Corrija los errores marcados';
			document.getElementById('errorMail').innerHTML='El E-mail no es valido';
			return false;
	   }
	   if (isNaN(f.dni.value)||f.dni.value == null || f.dni.value.length == 0 || /^\s+$/.test(f.dni.value)){
		   document.getElementById('errores').innerHTML='Corrija los errores marcados';
			document.getElementById('errorNum').innerHTML='El campo debe ser numerico y no puede estar vacio';
			return false;
		}
		if (f.nomUsuario.value == null || f.nomUsuario.value.length == 0 || /^\s+$/.test(f.nomUsuario.value)){
			document.getElementById('errores').innerHTML='Corrija los errores marcados';
				document.getElementById('errorVacio3').innerHTML='El campo no puede estar vacio';
				return false;
			}
	   if(f.nomUsuario.value == null || f.nomUsuario.value.length == 0 || /^\s+$/.test(f.nomUsuario.value)){
		   document.getElementById('errores').innerHTML='Corrija los errores marcados';
		   document.getElementById('Error').innerHTML='El campo no puede estar vacio';
			  return (false);
		   }
	  
		   if (!(f.contrasenia.value==f.clave2.value)||f.contrasenia.value == null || f.contrasenia.value.length == 0 || /^\s+$/.test(f.contrasenia.value)){
					document.getElementById('errores').innerHTML='Corrija los errores marcados';
					 document.getElementById('ErrorClave').innerHTML='La clave tienen que tener algun valor';
					return (false);
					}
return true;

	   
	  }
function clave(clave2){
		var divTarget = document.getElementById('ErrorClave');
		var clave1=document.getElementById('contrasenia');
		if (clave1.value==clave2){
			divTarget.innerHTML = '';
			}else{
				divTarget.innerHTML = 'Las claves no coinciden';
				}
	}
function borrarPersona(dni) {
	if(confirm('Realmente quieres borrar a la Persona?')) {
		document.location.href= 'eliminarPersona.php?id='+dni;
	}
}





