/*
Created By: V&H Sistemas Informáticos
Date: 13/02/2006
*/

/*-----------------------------------------------------------------------------------------------*/
/*                                    VARIABLES GLOBALES                                         */
/*-----------------------------------------------------------------------------------------------*/

    /*
     * SILVIO: Fechas de la cabecera del home
     */
    var fecha=new Date();
    var diames=fecha.getDate();
    var update=fecha.getDate()-1;
    var mes=fecha.getMonth() +1 ;
    var ano=fecha.getFullYear();
    var textomes  = new Array(12);
        textomes[1] = "Jan";
        textomes[2] = "February";
        textomes[3] = "March";
        textomes[4] = "April";
        textomes[5] = "May";
        textomes[6] = "June";
        textomes[7] = "July";
        textomes[7] = "August";
        textomes[9] = "September";
        textomes[10] = "October";
        textomes[11] = "November";
        textomes[12] = "December";


    /*
     * SILVIO: Variables para el votador
     */
    var loggedin=0; // TODO: Cambiar para utilizar la cookie
    var imagesLoc = "../../App_Themes/MPTFrontDefault/";
    var votesArray = new Array();
        votesArray[0] = 'Rate this video:';
        votesArray[1] = 'Poor';
        votesArray[2] = 'Nothing Special';
        votesArray[3] = 'Worth Watching';
        votesArray[4] = 'Pretty Cool';
        votesArray[5] = 'Awesome!';
        votesArray[6] = 'Thank you for voting!';

        var imagePath = "../../App_Themes/MPTFrontDefault/menu/";



    /*
     * Detección del browser
     */
    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.userAgent,
	            subString: "iPhone",
	            identity: "iPhone/iPod"
            },
	        {
		        string: navigator.platform,
		        subString: "Linux",
		        identity: "Linux"
	        }
        ]

    };
    BrowserDetect.init();
        

/*-----------------------------------------------------------------------------------------------*/
/*                                         FRONT-END                                             */
/*-----------------------------------------------------------------------------------------------*/


    function getVideoHome(pre,pos,filePath,image,autoplay,width,height){
	    var so = new SWFObject("../../flv/pl46664_h.swf", "player", width, height, "8.0.0", "#000000", false);
	    if(pre!= ""){
	    so.addVariable("prevideo", pre);}
	    if(pos != ""){
	    so.addVariable("posvideo", pos);
	    }
	    so.addVariable("video", filePath);
	    if(image!= ""){
	    so.addVariable("image", image);
	    }
	    so.addParam("allowFullScreen", "true");
	    so.addVariable("autoplay", autoplay);
	    so.addVariable("autoload", "true");
	    so.addVariable("id", "videoContent");
	    so.write("videoContent");
	}
    
    function getVideoHomeGenerico(div, pre, pos, filePath, image, autoplay, width, height) {
        var so = new SWFObject("../../flv/pl46664_h.swf", "player", width, height, "8.0.0", "#000000", false);
        if (pre != "") {
            so.addVariable("prevideo", pre);
        }
        if (pos != "") {
            so.addVariable("posvideo", pos);
        }
        so.addVariable("video", filePath);
        if (image != "") {
            so.addVariable("image", image);
        }
        so.addParam("allowFullScreen", "true");
        so.addVariable("autoplay", autoplay);
        so.addVariable("autoload", "true");
        var divName = "videoContent";
        if (div && div != null && div != "") {
            divName = div;
        }
        so.addVariable("id", divName);
        so.write(divName);
    }


    function writeCurrentDate() 
    {
        document.write(""+ textomes[mes] + " " + diames + " , " + ano + "");    
    }


    function writeUpdateDate() 
    {
        document.write(""+ textomes[mes] + " " + update + " , " + ano + "");    
    }


     /*
     * Determina si hay un usuario logueado para la sesión actual.
     */
    function frontUserLoggedIn()
    {
        var cFrontUser = readCookie('46664FrontUser');
        if (cFrontUser == null || cFrontUser == '') {
            return false;
        }
        var pFrontUser = getElementByLikeId('_46664FrontUser').value;
        if (pFrontUser != null && pFrontUser != '' && pFrontUser == cFrontUser) {
            return true;
        }
        return false;
    }
    
    
    function changeStars(rank) 
    {
	    var entero = parseInt(rank); // El último que va lleno
//	    alert('changeStars \n rank: ' + rank + '\n entero: ' + entero);
	    var sufix = "_gl";
	    var starFilledImg = imagesLoc + "star_filled" + sufix + ".gif";
	    var starEmptyImg = imagesLoc + "star_empty" + sufix + ".gif";
	    for (var n = 1; n <= entero; n++) 
	    {
		    document.getElementById('star_' + n).src = starFilledImg;
	    }
	    if (!(entero < 5)) 
	    {
	        return;
	    }
   	    var parcial = entero + 1;
   	    var parcialImage = starEmptyImg;
	    if (rank > entero)
	    {
		    var dec = Math.round((parseFloat(rank) - parseInt(rank)) * 10);
		    {
			    if (dec > 9) {
			        parcialImage = starFilledImg;
			    }
			    else if (dec > 0) {
			        parcialImage = "star_mid_" + dec + ".gif";
			    }
		    }
	    }
//	    alert('parcial: ' + parcial + '\n parcialImage: ' + parcialImage);
		document.getElementById('star_' + parcial).src = imagesLoc + parcialImage;
	    if (!(parcial < 5)) 
	    {
	        return;
	    }
	    for (var n = parcial + 1; n <= 5; n++) 
	    {
            document.getElementById('star_' + n).src = starEmptyImg;	    
        }	    
    }


    function starOver(starNro)
    {
        changeStars(starNro);
        document.getElementById('rateText').innerHTML = votesArray[starNro];
    }
    
    
    function starOut(rank)
    {
        changeStars(rank);
        document.getElementById('rateText').innerHTML = 'Rate this video:';
    }
    
    
    function starsOver()
    {
        document.getElementById('rateText').innerHTML = 'Click and login to vote';
    }
    
    
    function starsOut()
    {
        document.getElementById('rateText').innerHTML = 'Rate this video:';
    }
    
    
    function starClick(idMaterial, starNro)
    {
        if (!frontUserLoggedIn()) 
        {
            return;
        }
//        alert('mat. votado: ' + idMaterial + '\n puntaje: ' + starNro);        
        var hiddenId = getElementByLikeId('hiddenMaterialVotadoId');
        var hiddenPuntaje = getElementByLikeId('hiddenMaterialVotadoPuntaje');
        var boton = getElementByLikeId('botonVotacMaterial');
        hiddenId.value = idMaterial;
        hiddenPuntaje.value = starNro;
        boton.click();
    } 
    
    
    /*
     * MENÚ DE CANALES Y GALERÍAS 
     * Expande o colapsa las galerías de un canal en el menú de canales
     * title: el id del li contenedor (el que contiene al nombre del canal)
     * channel: el div dentro del li, que encierra a todas las galerías del canal)
     */
    function toggleView(channel,title)
    {
        var menu = document.getElementById(channel);
        var menuTit = document.getElementById(title);
        if(menu.className == "view")
        {
            if(menuTit.innerHTML.indexOf('selectedGallery') == -1)
            {
                menu.className = "hide";
                menuTit.className = "channelhide";
            }
        }
        else
        { 
	        menu.className = "view"; 
	        menuTit.className = "channelview";
        }
    }


//    /*
//     * MENÚ DE CANALES Y GALERÍAS 
//     * Selección de una galería 
//     */
//    function linkGalleryClicked(indGaleria, idGaleria)
//    {        
//        for (var i=1; liGaleria = document.getElementById('Tgall' + i); i++) 
//        {            
//            if (i == indGaleria) {
//                liGaleria.className = "selectedGallery";
//            }
//            else {
//                liGaleria.className = "gallery";
//            }
//        }
//        
//        //var hiddenSeleccNombreCanal = getElementByLikeId('hiddenSeleccNombreCanal');
//        
//        var hidden = getElementByLikeId('hiddenSeleccGaleria');
//        hidden.value = idGaleria;
//        var boton = getElementByLikeId('botonSeleccGaleria');
//        boton.click();
//        
//    }


    /*
     * MENÚ DE CANALES Y GALERÍAS 
     * Selección de una galería 
     */
    function linkGalleryClicked(indGaleria, idGaleria, idCanal)
    {        
        for (var i=1; liGaleria = document.getElementById('Tgall' + i); i++) 
        {            
            if (i == indGaleria) {
                liGaleria.className = "selectedGallery";
            }
            else {
                liGaleria.className = "gallery";
            }
        }
        var hiddenSeleccCanal = getElementByLikeId('hiddenSeleccCanal');
        hiddenSeleccCanal.value = idCanal;
        var hidden = getElementByLikeId('hiddenSeleccGaleria');
        hidden.value = idGaleria;
        var boton = getElementByLikeId('botonSeleccGaleria');
        boton.click();
        
    }

    
    function restoreGalleries(){
        changecss('.linklist .selectedGallery','backgroundImage','url(../../App_Themes/MPTFrontDefault/gallery.gif)');
        changecss('#menuchannel .linklist .selectedGallery','paddingTop','3px');
    }


    /*
     * Paginado 
     */
    function paginar(pagina)
    {
//        alert('paginando: '+pagina);
        var hiddenPaginadoNroPagina = getElementByLikeId('hiddenPaginadoNroPagina');
        hiddenPaginadoNroPagina.value = pagina;
        var botonPaginado = getElementByLikeId('botonPaginado');
//        alert(botonPaginado);
        botonPaginado.click();
    }


    /*
     * Hover de botones
     */
    function hov(loc,cls)
    {
        if(loc.className)
        {
            loc.className=cls;
        }
    }


    /*
     * ENCUESTA - VOTO
     */
    function votarEncuesta(idEncuesta, opciones, nombreVista) 
    { 
        var listaOpciones = document.getElementsByName(opciones);        
        var opcionesSelecc  = '';                 
        for(i=0; i < listaOpciones.length; i++)
        {         
            if(listaOpciones[i].checked)
            {               
                opcionesSelecc = opcionesSelecc + listaOpciones[i].value + ',';              
            }
        }      
        opcionesSelecc = opcionesSelecc.substring(0, opcionesSelecc.lastIndexOf(','));                      
      
        if (opcionesSelecc.length == 0) {
            alert ('You must select an option first');
            return;
        }
        
        var hiddenId = '';
        var hiddenOpcs = '';
        var boton = '';
       
        if (nombreVista == 'Default view') {
            hiddenId = getElementByLikeId('hiddenEncuestaIdDetail');
            hiddenOpcs = getElementByLikeId('hiddenEncuestaOpcsDetail');
            boton = getElementByLikeId('botonVotacEncuestaDetail');
        }
        else if (nombreVista == 'Page view') {
            hiddenId = getElementByLikeId('hiddenEncuestaIdCuerpo');          
            hiddenOpcs = getElementByLikeId('hiddenEncuestaOpcsCuerpo');
            boton = getElementByLikeId('botonVotacEncuestaCuerpo');
        }
//        else if (nombreVista == 'Ad') {
//            hiddenId = getElementByLikeId('hiddenEncuestaIdMisc');            
//            hiddenOpcs = getElementByLikeId('hiddenEncuestaOpcsMisc');
//            boton = getElementByLikeId('botonVotacEncuestaMisc');
//        }
        
        hiddenId.value = idEncuesta;
        hiddenOpcs.value = opcionesSelecc;
        
               
        boton.click();
    } 

// VIDEOS - COM

    ///////xElement,xValue
    function showVideo(pre,pos)
    {
	    var so = new SWFObject("../../flv/pl46664.swf", "player", "450", "300", "8.0.0", "#000000", false);
	    var status="";
	    if(pre)
	    {
	        status +="Pre-video | ";
	        so.addVariable("prevideo", "http://www.d-loom.com/download/video1.flv");
	    }
	    status +="Video";
	    if(pos)
	    {
	        status +=" | Post-video";
	        so.addVariable("posvideo", "http://www.d-loom.com/download/video2.flv");
	    }
	    so.addVariable("video", "http://www.d-loom.com/download/video1.flv");
	    //so.addVariable("video", "http://www.d-loom.com/download/P-Gabriel.flv");
	    so.addParam("allowFullScreen", "true");
	    so.addVariable("mute", "on");
	    so.addVariable("image", "../../App_Themes/MPTFrontDefault/PGabriel.jpg");
	    so.addVariable("autoplay", "false");
	    so.addVariable("autoload", "true");
	    so.addVariable("id", "videoContent");
	    so.write("videoContent");
	    var element = document.getElementById("vidStatus")
	    element.innerHTML = status;
	}


	function getVideo(pre, pos, filePath, image, autoload, width, height, id) {
	    if (width > 280) {
	        var so = new SWFObject("../../flv/pl46664.swf", "player", width, height, "9.0.0", "#ffffff", false);
	    } else {
	        var so = new SWFObject("../../flv/pl_md10_misc.swf", "player", width, height, "9.0.0", "#ffffff", false);
	    }
	    if (pre != "") {
	        so.addVariable("prevideo", pre);
	    }
	    if (pos != "") {
	        so.addVariable("posvideo", pos);
	    }
	    so.addVariable("video", filePath);
	    if (image != "") {
	        so.addVariable("image", image);
	    }
	    so.addParam("allowFullScreen", "true");
	    so.addVariable("autoplay", "false");
	    so.addVariable("autoload", autoload);
	    if (id != "" && id != null) {
	        so.addVariable("id", id);
	        so.write(id);
	    } else {
	        so.addVariable("id", "videoContent");
	        so.write("videoContent");
	    }
	}
    
    
//FUNCION GET VIDEO ANTES DE VIDEOS EN MISCELANEOS
//function getVideo(pre,pos,filePath,image,autoplay){
//	var so = new SWFObject("../../flv/pl46664.swf", "player", "450", "300", "8.0.0", "#000000", false);
//	if(pre!= ""){
//	so.addVariable("prevideo", pre);}
//	if(pos != ""){
//	so.addVariable("posvideo", pos);
//	}
//	so.addVariable("video", filePath);
//	if(image!= ""){
//	so.addVariable("image", image);
//	}
//	so.addParam("allowFullScreen", "true");
//	so.addVariable("autoplay", autoplay);
//	so.addVariable("autoload", "true");
//	so.addVariable("id", "videoContent");
//	so.write("videoContent");
//}
// VIDEOS -FIN


  // DETALLE - PANEL LOGIN
//    function openDetSendMail() 
//    {
//        document.getElementById('ctl00_ctl00_cuerpo_divSendMail').style.display = 'block';
//        cleanDetSendMail() 
//    }
//    function closeDetSendMail() 
//    {      
//        cleanDetSendMail()  
//        document.getElementById('ctl00_ctl00_cuerpo_divSendMail').style.display = 'none';
//     
//    }
//     function cleanDetSendMail() 
//    {
//        document.getElementById('ctl00_ctl00_cuerpo_TextBoxEmail').value = '';
//        document.getElementById('ctl00_ctl00_cuerpo_TextBoxYourName').value = '';
//        document.getElementById('ctl00_ctl00_cuerpo_TextBoxAreaNote').innerHTML = '';
//        
//    }
    
    
    function openDetSendMail2() 
    {
        //document.getElementById('ctl00_ctl00_cuerpo_efectoCurly_divSendMail2').style.display = 'block';
        abrirDivEfectoCurly('ctl00_ctl00_cuerpo_efectoCurly_divSendMail2');
        cleanDetSendMail2() 
    }
    function closeDetSendMail2() 
    {      
        cleanDetSendMail2()  
        document.getElementById('ctl00_ctl00_cuerpo_efectoCurly_divSendMail2').style.display = 'none';
     
    }
     function cleanDetSendMail2() 
    {
        document.getElementById('ctl00_ctl00_cuerpo_TextBoxEmail2').value = '';
        document.getElementById('ctl00_ctl00_cuerpo_TextBoxYourName2').value = '';
        document.getElementById('ctl00_ctl00_cuerpo_TextBoxAreaNote2').value = ''; 
        document.getElementById('ctl00_ctl00_cuerpo_LabelRequiredFileEmail2').innerHTML = '';         
        document.getElementById('ctl00_ctl00_cuerpo_LabelRequiredFileName2').innerHTML = '';
            
       
    }
    
    function openDetSendMailToOrg() 
    {
        //document.getElementById('ctl00_ctl00_cuerpo_efectoCurly_divSendMailOrg').style.display = 'block';
        abrirDivEfectoCurly('ctl00_ctl00_cuerpo_efectoCurly_divSendMailOrg');
        cleanDetSendMailToOrg() 
    }
    function closeDetSendMailToOrg() 
    {      
        cleanDetSendMailToOrg()
        document.getElementById('ctl00_ctl00_cuerpo_Label1Estado').innerHTML = ''; 
        document.getElementById('ctl00_ctl00_cuerpo_efectoCurly_divSendMailOrg').style.display = 'none';
     
    }
     function cleanDetSendMailToOrg() 
    {
        document.getElementById('ctl00_ctl00_cuerpo_TextBoxYourEmail').value = '';
        document.getElementById('ctl00_ctl00_cuerpo_TextBoxYourName').value = '';
        document.getElementById('ctl00_ctl00_cuerpo_TextBoxYourNotes').value = ''; 
        document.getElementById('ctl00_ctl00_cuerpo_LabelAsterisco2').innerHTML = '';         
        document.getElementById('ctl00_ctl00_cuerpo_LabelAsterisco').innerHTML = '';
        
            
       
    }

   /*
    *******************************************************************************************************
    * COMENTARIOS - COMIENZO
    *******************************************************************************************************
    */
   
    // COMENTARIOS - PANEL LOGIN

    function openDetLogin() 
    {
        //getOtroByLikeId('div','efectoCurly_logindiv').style.display = 'block';
        abrirDivEfectoCurly('efectoCurly_logindiv');
        cleanDetLogin();
    }


    function closeDetLogin() 
    {
        cleanDetLogin();
        getOtroByLikeId('div','efectoCurly_logindiv').style.display = 'none';
    }

    function cleanDetLogin() 
    {
        getElementByLikeId('_comm1_TextBoxLoginUsername').value = '';
        getElementByLikeId('comm1_TextBoxLoginPassword').value = '';
        getOtroByLikeId('span','comm1_LabelLoginError').innerHTML = '';       
    }

    // COMENTARIOS - PANEL FORGOT PASSWORD

    function openDetForgot() 
    {
        //getOtroByLikeId('div','comm1_efectoCurly_forgotpassdiv').style.display = 'block';
        abrirDivEfectoCurly('comm1_efectoCurly_forgotpassdiv');
        cleanDetForgot();
    }

    function closeDetForgot() 
    {
        cleanDetForgot();        
        //getOtroByLikeId('div','comm1_efectoCurly_logindiv').style.display = 'block';
        //getOtroByLikeId('div','comm1_efectoCurly_forgotpassdiv').style.display = 'none';
        getOtroByLikeId('span','comm1_LabelLoginError').innerHTML = ''; 
        abrirDivEfectoCurly('efectoCurly_logindiv'); // Si cierro forgot, reabro login (me acorde!)
    }

    function cleanDetForgot() 
    {        
        getOtroByLikeId('div','comm1_forgotpassctldiv').style.display = 'block';
        getElementByLikeId('comm1_TextBoxForgotEmail').value = '';
        getOtroByLikeId('span','comm1_LabelForgotError').innerHTML = '';
    }

    // COMENTARIOS - PANEL POST COMMENT

    function openDetPost() 
    {
        //getOtroByLikeId('div','comm1_efectoCurly_postcommdiv').style.display = 'block';
        abrirDivEfectoCurly('comm1_efectoCurly_postcommdiv'); 
        cleanDetPost();
    }

    function closeDetPost() 
    {
        cleanDetPost();
        getOtroByLikeId('div','comm1_efectoCurly_postcommdiv').style.display = 'none';
    }

    function cleanDetPost() 
    {
        getElementByLikeId('comm1_TextBoxPostText').value = '';
        getOtroByLikeId('span','comm1_LabelPostError').innerHTML = '';
    }
    
    
     // COMENTARIOS - PANEL REPORT ABUSE

    function openDetReporte(nickDenunciado, idDenunciado, idComentario) 
    {
       
        getElementByLikeId('HiddenFieldNombreDenunciado').value = nickDenunciado;
        getElementByLikeId('HiddenFieldIdDenunciado').value = idDenunciado;
        getElementByLikeId('HiddenFieldIdCommentario').value = idComentario;        
        getOtroByLikeId('span','nickDenunciado').innerHTML = nickDenunciado;
        //getOtroByLikeId('div','efectoCurly_DivReporteAbuso').style.display = 'block';
        abrirDivEfectoCurly('efectoCurly_DivReporteAbuso'); 
        cleanDetReporte();
    }

    function closeDetReporte() 
    {
        cleanDetReporte();
        getOtroByLikeId('div','comm1_efectoCurly_DivReporteAbuso').style.display = 'none';
    }

    function cleanDetReporte() 
    {
        getElementByLikeId('comm1_TextBoxReport').value = '';
        getOtroByLikeId('span','comm1_LabelReportError').innerHTML = '';
        
    }   

    function abrirDivEfectoCurly(nombreDiv)
    {
        if (nombreDiv.indexOf('efectoCurly_') == -1){
            return;
        }
        var divAAbrir = getOtroByLikeId('div',nombreDiv);
        if (divAAbrir)
        {
            divAAbrir.style.display = 'block';
            var divsEfectoCurly = getOtrosByLikeId('div', 'efectoCurly_');
            var nombresACerrar = new Array();
            for (i = 0; i < divsEfectoCurly.length; i++) 
            {              
                if (divsEfectoCurly[i].id.indexOf(nombreDiv) == -1){
                    divsEfectoCurly[i].style.display = 'none';
                }
                nombresACerrar[i] = divsEfectoCurly[i].id;
            }
            //alert('voy a abrir: '+nombreDiv+'\nvoy a cerrar: '+nombresACerrar);
        }
    }
    
   /*
    *******************************************************************************************************
    * COMENTARIOS - FIN
    *******************************************************************************************************
    */   
    
    // DETALLE - REFRESH DEL HEADER (LOG IN / LOG OUT)
    
    function refreshHeadLogin()
    {
        if (frontUserLoggedIn())
        {
            alert ('esta logueado');
            if (document.getElementById('ctl00_ctl00_botonLogIn'))
            {
                
                document.getElementById('ctl00_ctl00_botonLogIn').innerHTML = 'Log out';      
                document.getElementById('ctl00_ctl00_botonSignUp').innerHTML = 'My account';      
            }
        }
        else 
        {
            alert ('no esta logueado');
            if (document.getElementById('ctl00_ctl00_botonLogOut'))
            {
                document.getElementById('ctl00_ctl00_botonLogOut').innerHTML = 'Log in';      
                document.getElementById('ctl00_ctl00_botonMyAccount').innerHTML = 'Sign up';      
            }
        }
    }
    




   
    function deleteOn(imgName) {
		document.getElementById(imgName).src = imagesLoc + "delete_icoO.gif";
    }
    
    function deleteOf(imgName) {
		document.getElementById(imgName).src = imagesLoc + "delete_ico.gif";
    }
    
    //AGRANDAR Y ACHICAR FUENTE
    
    
    var max_size = 32;
    var min_size = 10;
    var tamagnoLetrasTitulo = 22;
    var tamagnoLetrasRestoTexto = 12;
    


 	function IncreaseFontSize()
 	{	        
 	 
       if(tamagnoLetrasTitulo >= max_size){

           alert("Cannot increase the font size")

       }
       else
       {
            

         tamagnoLetrasTitulo += 2;
         tamagnoLetrasRestoTexto += 1;          
        
         var elemento = document.getElementById('trailtitulo');
         if(elemento!=null)
         {
           elemento.style.fontSize = tamagnoLetrasTitulo+'px';
         }
         var elemento = document.getElementById('trailcabecera');
         if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';
         } 
         
         var elemento =  document.getElementById('trailranking');        
         if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';
         }
         
          var elemento =  document.getElementById('spanRanking');
          if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';
         }
         
         var elemento = document.getElementById('spanDescImagen');
          if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px'; 
         }
         
         var elemento =document.getElementById('vidStatus');
          if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px'; 
         }
         
         var elemento =   document.getElementById('trailtexto');         
         if(elemento!=null)
         {             
        elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }
        var elemento =   document.getElementById('trailtitulostatement');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }    
         var elemento =   document.getElementById('trailstatement');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }           
         var elemento =   document.getElementById('trailtituloabout');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }    
         var elemento =   document.getElementById('trailabout');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }           
        
         var elemento =   document.getElementById('trailcantvisitas');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }           
        
         var elemento =   document.getElementById('trailcantcomentarios');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }           
        
           var elemento =   document.getElementById('eventotexto');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }  
        
    
    

        }
    
     }
    

    function DecreaseFontSize() {


   if(tamagnoLetrasTitulo <= min_size){

       alert("Cannot decrease font size")

   }
   else
   {
   
         tamagnoLetrasTitulo -= 2;
         tamagnoLetrasRestoTexto -= 1; 
          
          
          var elemento = document.getElementById('trailtitulo');
         if(elemento!=null)
         {
           elemento.style.fontSize = tamagnoLetrasTitulo+'px';
         }
         var elemento = document.getElementById('trailcabecera');
         if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';
         } 
         
         var elemento =  document.getElementById('trailranking');        
         if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';
         }
         
          var elemento =  document.getElementById('spanRanking');
          if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';
         }
         
         var elemento = document.getElementById('spanDescImagen');
          if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px'; 
         }
         
         var elemento =document.getElementById('vidStatus');
          if(elemento!=null)
         {
         elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px'; 
         }
         
         var elemento =   document.getElementById('trailtexto');         
         if(elemento!=null)
         {             
        elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }
          var elemento =   document.getElementById('trailtitulostatement');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }    
         var elemento =   document.getElementById('trailstatement');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }           
         var elemento =   document.getElementById('trailtituloabout');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }    
         var elemento =   document.getElementById('trailabout');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }           
         var elemento =   document.getElementById('trailcantvisitas');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }           
        
         var elemento =   document.getElementById('trailcantcomentarios');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }           
          var elemento =   document.getElementById('eventotexto');         
         if(elemento!=null)
         {             
          elemento.style.fontSize =  tamagnoLetrasRestoTexto+'px';         
         }  
         
          
          
          
//        document.getElementById('trailtitulo').style.fontSize = tamagnoLetrasTitulo+'px';
//         document.getElementById('trailcabecera').style.fontSize =  tamagnoLetrasRestoTexto+'px';
//         document.getElementById('trailranking').style.fontSize =  tamagnoLetrasRestoTexto+'px';
//         document.getElementById('spanRanking').style.fontSize =  tamagnoLetrasRestoTexto+'px';
//         document.getElementById('spanDescImagen').style.fontSize =  tamagnoLetrasRestoTexto+'px'; 
//         document.getElementById('vidStatus').style.fontSize =  tamagnoLetrasRestoTexto+'px'; 
//         document.getElementById('trailtexto').style.fontSize =  tamagnoLetrasRestoTexto+'px';
//         document.getElementById('ctl00_ctl00_cuerpo_LabelTituloComments').style.fontSize =  tamagnoLetrasRestoTexto+'px';             
//         document.getElementById('ctl00_ctl00_cuerpo_LabelCantComments').style.fontSize =  tamagnoLetrasRestoTexto+'px';             
//         document.getElementById('ctl00_ctl00_cuerpo_LabelMustLoginTop').style.fontSize =  tamagnoLetrasRestoTexto+'px';            
//         document.getElementById('ctl00_ctl00_cuerpo_LabelLoginTop').style.fontSize =  tamagnoLetrasRestoTexto+'px';               
//         document.getElementById('ctl00_ctl00_cuerpo_LabelNotRegisteredTop').style.fontSize =  tamagnoLetrasRestoTexto+'px';               
//         document.getElementById('ctl00_ctl00_cuerpo_LabelSignUpTop').style.fontSize =  tamagnoLetrasRestoTexto+'px';               

     }


    }

    

//    function dzResetFontSize(idElemento) {

//     var elemento = document.all[idElemento];

//     elemento.body.style.fontSize = '100%';

//        //    document.body.style.fontSize = '100%';//-->

//        }





    function desfavMaterial(idMaterial)
    {
        if (!frontUserLoggedIn()) 
        {
            return;
        }
//        alert('mat. a desfavorecer: ' + idMaterial);        
        var hiddenId = getElementByLikeId('hiddenMaterialDesfavId');
        var boton = getElementByLikeId('botonDesfavMaterial');
        hiddenId.value = idMaterial;
        boton.click();
    } 


//    function blanquearCampos(){
//    
//        var sPath = window.location.pathname;
//        var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
//        if (sPage == 'Signup.aspx')
//        {        
//            alert('voy a blanquear ctl00_cuerpo_TextBoxSignUpNick');
//            blanquearCampo('ctl00_cuerpo_TextBoxSignUpNick');
//        }  

//    }
//    
//    
//    function blanquearCampo(idCampo)
//    {
//        var campoABlanquear = document.getElementById(idCampo);
//        alert('campoABlanquear: ' + campoABlanquear.value);
//        if (campoABlanquear) 
//        {
//            campoABlanquear.value = "";
//        }
//    }
    
    
//    function toggleRelated(divID,arrow) 
//    {
//        if(document.getElementById(divID).style.display == 'block' || !document.getElementById(divID).style.display )
//        {
//            alert('pasa');
//            document.getElementById(divID).style.display = 'none';
//            document.getElementById(arrow).innerHTML='<img src="../../App_Themes/MPTFrontDefault/arrow_h.png"  alt=""/>';
//        }
//        else
//        {
//            document.getElementById(divID).style.display = 'block';
//            document.getElementById(arrow).innerHTML='<img src="../../App_Themes/MPTFrontDefault/arrow_v.png"  alt=""/>';
//        }
//    }

  

    function toggleViewInc(channel,title,id) {
        var menu = document.getElementById(channel);
        var menuTit = document.getElementById(title);
        if(menu.className == "view")
        {
            if(menuTit.innerHTML.indexOf('selectedGallery') == -1)
            {
                menu.className = "hide";
                menuTit.className = "channelhide";
            }
        }
        else
        { 
            menu.className = "view"; 
            menuTit.className = "channelview";
        }
        
        setDivSize(id);
    }

    
    
/*-----------------------------------------------------------------------------------------------*/
/*                                         GENERALES                                             */
/*-----------------------------------------------------------------------------------------------*/

    /* 
     * Creación de una cookie 
     */
    function createCookie(name,value,days) {
	    if (days) {
		    var date = new Date();
		    date.setTime(date.getTime()+(days*24*60*60*1000));
		    var expires = "; expires="+date.toGMTString();
	    }
	    else var expires = "";
	    document.cookie = name+"="+value+expires+"; path=/";
    }


    /* 
     * Eliminación de una cookie 
     */
    function eraseCookie(name) {
	    createCookie(name,"",-1);
    }


    /*
     * Lectura de una cookie
     * Dada una cookie por su nombre, devuelve el (primer) valor de dicha cookie
     */
    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
    }    
         
         
    /*
     * Determina si se cliqueó el botón "Atrás".
     */
    function backButtonPressed()
    {
        var cts = readCookie('46664PageTimestamp');
        var pts = getElementByLikeId('_46664PageTimestamp').value;
        //alert('cts = ' + cts + '\n pts = ' + pts);
        if(pts != null && cts != null && cts != pts)
        {
            return true;
        } 
        return false;
    }


    /*
     * Devuelve el primer elemento que contenga, en su Id, el string del argumento.
     * Útil para recuperar elementos usando el id que les damos en la página .aspx (ya que luego .NET
     * lo renombra al convertir en HTML puro)
     */
    function getElementByLikeId(likeString)
    {
        var frm = document.forms[0];

        for (i=0; i<frm.length; i++) 
        {
            if (frm.elements[i].id.indexOf(likeString) != -1)
            {
                return frm.elements[i];
            }
        }
        return null;
    }
    
    function getDivByLikeId(likeString)
    {
        var divs = document.getElementsByTagName('div');
        for (i=0; i<divs.length; i++) 
        {              
            if (divs[i].id.indexOf(likeString) != -1)
            {                
                return divs[i];
            }
        }
        return null;
    }
    
    function getOtroByLikeId(tagname,likeString)
    {
        var divs = document.getElementsByTagName(tagname);
        for (i=0; i<divs.length; i++) 
        {              
            if (divs[i].id.indexOf(likeString) != -1)
            {                
                return divs[i];
            }
        }
        return null;
    }

    function getOtrosByLikeId(tagname,likeString)
    {
        var divs = document.getElementsByTagName(tagname);
        var divsLike = new Array(); 
        var j = 0;
        for (i=0; i < divs.length; i++) 
        {              
            if (divs[i].id.indexOf(likeString) != -1)
            {                
                divsLike[j] = divs[i];
                j++;
            }
        }
        return divsLike;
    }


//    function toggleDisplay (elId) {        
//        if (document.getElementById(elId)) {
//            if (document.getElementById(elId).style.display == 'none') 
//            {
//                document.getElementById(elId).style.display = 'block';
//            }
//            else 
//            {
//                document.getElementById(elId).style.display = 'none';
//            }
//	    }
//    }

 
    function toggleDisplayBlock (elId) {
        if (document.getElementById(elId)) {
            if (document.getElementById(elId).style.display == 'none') 
            {
                document.getElementById(elId).style.display = 'block';
            }
	    }
    }


    function toggleDisplayNone (elId) {
        if (document.getElementById(elId)) {
            if (document.getElementById(elId).style.display == 'block') 
            {
                document.getElementById(elId).style.display = 'none';
            }
	    }
    }

    
    function changecss(theClass, element, value){
           var cssRules;
        if (document.all) {
            cssRules = 'rules';
        }
        else 
            if (document.getElementById) {
                cssRules = 'cssRules';
            }
        var added = false;
        for (var S = 0; S < document.styleSheets.length; S++) {
            for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
                if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
                      if (document.styleSheets[S][cssRules][R].style[element]) {
                         document.styleSheets[S][cssRules][R].style[element] = value;                   
                        added = true;
                        break;
                    }
                }
            }
            if (!added) {
                if (document.styleSheets[S].insertRule) {
                    document.styleSheets[S].insertRule(theClass + ' { ' + element + ': ' + value + '; }', document.styleSheets[S][cssRules].length);
                             }
                else 
                    if (document.styleSheets[S].addRule) {
                        document.styleSheets[S].addRule(theClass, element + ': ' + value + ';');
                     }
            }
        }
    }


/*-----------------------------------------------------------------------------------------------*/
/*                                       BACKEND                                                 */
/*-----------------------------------------------------------------------------------------------*/


     /*
     * Determina si hay un usuario logueado para la sesión actual.
     */
    function backUserLoggedIn()
    {
        var backUser = readCookie('46664BackUser');
        if (backUser == null) {
            return false;
        }
        var pbu = getElementByLikeId('_46664BackUser').value;
        if (pbu != null && backUser == pbu) {
            return true;
        }
        return false;
    }
    
    
    /*
     * Cambia el estado de "check" de los checkboxes identificados como 'CheckBox1' (en realidad, de 
     * los que contengan 'CheckBox1' en su id), al estado especificado en el argumento.
     */
   
    function changeCheckState( checked )
    {
        var frm = document.forms[0];

        for (i=0; i<frm.length; i++) 
        {
            if (frm.elements[i].id.indexOf('CheckBox1') != -1)
            {
                frm.elements[i].checked = checked;
            }
        }
    }
    
    
    /*
     * Antes de la descarga de una página, verifica si hay cambios no salvados en la misma y, en caso afirmativo,
     * Agrega una leyenda de advertencia al cartel que (por default) desplegará el browser.
     */
    function beforeUnloadPage()
    {
       var unsavedChanges = readCookie('46664UnsavedChanges');
       if (BrowserDetect.browser == "Explorer") {
            //Explorer
           if (!ignoreUnload) {
                if(unsavedChanges != null && unsavedChanges == "Y")
                {
                    return "UNSAVED CHANGES!";
                } 
           }
           else {
                ignoreUnload = false;
           }
       }
       else {
            //Firefox
            if(unsavedChanges != null && unsavedChanges == "Y")
            {
                return "UNSAVED CHANGES!";
            } 
       }
       return;
    }
    

    function unloadPage()
    {
        //Resetea la cookie de cambios pendientes
        createCookie('46664UnsavedChanges', 'N', '');
    }



    function resaltarParent(idParent)
    {
    
     var parent = document.getElementById("ctl00_" + idParent);
     parent.className = "menu_items_resaltar_parent";   
        
    }
    
    function restaurarParent(idParent)
    {    
      
        var parent =  document.getElementById("ctl00_" + idParent);
        parent.className = "menu_items"; 
             
    }

//    function submenuVisible(idSubmenu)
//    {
//        
//        var subMenu =  document.getElementById("ctl00_" + idSubmenu);       
//        subMenu.visible = true;
//        

//    }
//    

       function popUpCentrado()
      {
          
          document.getElementById('divPopUpCentrado').style.display = "block";  
          
          
      }
     
       function ocultarPopUpCentrado()
      {
     
        document.getElementById('divPopUpCentrado').style.display = "none";
       
        
      }

//      function FCKEditor1(cant)
//      {    
//           
//            
//          if(cant == 1)
//          {
//            
//            document.getElementById('ctl00_ContentPlaceHolder1_HiddenFieldFCK').value = 'Yes';
//            
//          }
//          else
//          {
//           
//            document.getElementById('ctl00_ContentPlaceHolder1_HiddenFieldFCK').value = 'No';
//           
//          
//          }                 
//      }
//      function FCKEditor2(cant)
//      {    
//    
//          if(cant == 2)
//          {
//            
//            document.getElementById('ctl00_ContentPlaceHolder1_HiddenFieldFCK').value = 'Yes';
//           
//          }
//          else
//          {
//           
//            document.getElementById('ctl00_ContentPlaceHolder1_HiddenFieldFCK').value = 'No';
//          
//          }                 
//      }

    /*
    ARTICLE = "1"; 2
    FREE_CONTENT = "4"; 2
    PHOTO = "5"; 1
    PROFILE = "6"; 4
    PROJECT = "7"; 2
    QANDA = "8"; 2
    VIDEO = "9"; 1
    */
    function cargaFCKsOK(tipoMaterial, cantFCKs)
    {    
    
        var listo = 'No';
        if (tipoMaterial == 1) // NEWS
        {
            if (cantFCKs == 2)
            {
                listo = 'Yes';
            }
        }
        else if (tipoMaterial == 4) // FREE CONTENTS
        {
            if (cantFCKs == 2)
            {
                listo = 'Yes';
            }
        }
        else if (tipoMaterial == 5) // PHOTO
        {
            if (cantFCKs == 1)
            {
                listo = 'Yes';
            }
        }
        else if (tipoMaterial == 6) // PROFILE
        {
            if (cantFCKs == 4)
            {
                listo = 'Yes';
            }
        }
        else if (tipoMaterial == 7) // PROJECT
        {
            if (cantFCKs == 2)
            {
                listo = 'Yes';
            }
        }
        else if (tipoMaterial == 8) // QANDA
        {
            if (cantFCKs == 2)
            {
                listo = 'Yes';
            }
        }
        else if (tipoMaterial == 9) // VIDEO
        {
            if (cantFCKs == 1)
            {
                listo = 'Yes';
            }
        }
        
        document.getElementById('ctl00_ContentPlaceHolder1_HiddenFieldFCK').value = listo;
        
        //alert('cargaFCKsOK(' + tipoMaterial + ',' + cantFCKs + ') = ' + listo);
    }
      
     
/*-----------------------------------------------------------------------------------------------*/
/*                                       REDISEÑO - FUNCIONES DE MENÚ
/*                                       VIENE DE menuFunctions.js                                                  */
/*-----------------------------------------------------------------------------------------------*/


//function adTitle(id,text){
//	var so = new SWFObject("../../flash/adTitle.swf", id+"swf", "100%", "100%", "8.0.0", "#000000", false);
//	so.addVariable("titleText", text);
//	so.addVariable("fontSize", 28);
//	so.addVariable("fontColor","0x666666");
//	so.addVariable("id", id);
//	so.write(id);
//	if(navigator.appName.indexOf("Microsoft") != -1) {
//	var oDiv = document.getElementById(id);
//	oDiv.attachEvent("onmouseover", function (e) {overTitleJS(id+"swf");});
//	oDiv.attachEvent("onmouseout",  function (e) {outTitleJS(id+"swf")});
//	}else {
//	var oDiv = document.getElementById(id);
//	oDiv.addEventListener('mouseover',function (e) {
//	  overTitleJS(id+"swf");
//	},false);
//	oDiv.addEventListener('mouseout',function (e) {outTitleJS(id+"swf");},false);
//	}
//}
//
function adMenu(id,text,size,type){

	var so = new SWFObject("../../flash/adMenu.swf", id+"swf", "100%", "100%", "8.0.0", "#000000", false);
	so.addVariable("titleText",text);
	so.addVariable("fontSize", size);
	so.addVariable("itemType",type);
	so.addVariable("id", id);
	so.write(id);
	if(navigator.appName.indexOf("Microsoft") != -1) {
	var oDiv = document.getElementById(id);
	oDiv.attachEvent("onmouseover", function (e) {overTitleJS(id+"swf");});
	oDiv.attachEvent("onmouseout",  function (e) {outTitleJS(id+"swf")});
	}else {
	var oDiv = document.getElementById(id);
	oDiv.addEventListener('mouseover',function (e) {
	  overTitleJS(id+"swf");
	},false);
	oDiv.addEventListener('mouseout',function (e) {outTitleJS(id+"swf");},false);
	}
}
//
function overTitleJS(id) {
	var flash;
	if(navigator.appName.indexOf("Microsoft") != -1) {
	div=document.getElementById(id)
	flash =window.div;
	flash.overTitle();
	}else {
	flash =document.getElementById(id)
	flash.overTitle();
	}
}	

function outTitleJS(id) {
	var flash;
	if(navigator.appName.indexOf("Microsoft") != -1) {
	div=document.getElementById(id)
	flash =window.div;
	flash.outTitle();
	}else {
	flash =document.getElementById(id)
	flash.outTitle();
	}
}





var markedMenu = '';

function unmarkMenu() {
    imgOf('tab_02');
    imgOf('tab_03');
    imgOf('tab_04');
    imgOf('tab_05');
    imgOf('tab_06');
    imgOf('tab_07');
    imgOf('tab_08');
    imgOf('tab_09');
    imgOf('tab_10');
    imgOf('tab_11');
}

function remarkMenu(menu) {
    unmarkMenu();
    if (markedMenu != '') {
        imgOn(markedMenu);
    }
}

function markMenu() {
    unmarkMenu();
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
    if (sPage == 'Home.aspx') {
        markedMenu = 'tab_02';
    }
    else if (sPage == 'About.aspx') {
    markedMenu = 'tab_03';
    }
    else if (sPage == 'Projects.aspx') {
    markedMenu = 'tab_04';
    }
    else if (sPage == 'FundraisingInitiatives.aspx') {
    markedMenu = 'tab_05';
    }
    else if (sPage == 'Blogs.aspx') {
    markedMenu = 'tab_06';
    }
    else if (sPage == 'Photos.aspx') {
    markedMenu = 'tab_07';
    }
    else if (sPage == 'FAQ.aspx') {
    markedMenu = 'tab_10';
    }
    else if (sPage == 'Links.aspx') {
    markedMenu = 'tab_11';
    }
    else {
        markedMenu = '';
    }
    if (markedMenu != '') {
        imgOn(markedMenu);
    }
    else {
        markMenuPlease(sPath);
    }   
}

function markMenuTitulo(titulo) {
    unmarkMenu();
    if (titulo == 'Projects' || titulo == 'Project') {
        markedMenu = 'tab_04';
    }
    else if (titulo == 'Fundraising Initiatives' || titulo == 'Fundraising Initiative') {
    markedMenu = 'tab_05';
    }
    else if (titulo == 'Blogs' || titulo == 'Blog') {
    markedMenu = 'tab_06';
    }
    else if (titulo == 'Photos' || titulo == 'Photo') {
    markedMenu = 'tab_07';
    }
    else {
        markedMenu = '';
    }
    if (markedMenu != '') {
        imgOn(markedMenu);
    }
}


function markMenuPlease(sPath) {
    if (sPath.indexOf('/Projects/') != -1 || sPath.indexOf('/Project/') != -1) {
        markedMenu = 'tab_04';
    }
    else if (sPath.indexOf('/FundraisingInitiatives/') != -1 || sPath.indexOf('/FundraisingInitiative/') != -1) {
    markedMenu = 'tab_05';
    }
    else if (sPath.indexOf('/Blogs/') != -1 || sPath.indexOf('/Blog/') != -1) {
    markedMenu = 'tab_06';
    }
    else if (sPath.indexOf('/Photos/') != -1 || sPath.indexOf('/Photo/') != -1) {
    markedMenu = 'tab_07';
    }
    if (markedMenu != '') {
        imgOn(markedMenu);
    }
    
}

//SCRIPT PARA LA PAGINA ABOUT.ASPX
//
//  <script type="text/javascript" language="javascript">         
//      var queryString = window.top.location.search.substring(1);
//      getParameter(queryString);   
//  </script>  


//FUNCION PARA ACTIVAR LA SECCION CRONOLOGIA EN ABOUT.ASPX
//
//function getParameter ( queryString ) { 
//  if ( queryString.length > 0 ) {      
//      // Find the beginning of the string      
//      begin = queryString.indexOf ( parameterName );      
//      // If the parameter name is not found, skip it, otherwise return the value      
//      if ( begin != -1 ) {         // Add the length (integer) to the beginning         
//          begin += parameterName.length;         
//          // Multiple parameters are separated by the "&" sign         
//          end = queryString.indexOf ( "&" , begin );      
//          if ( end == -1 ) {         
//            end = queryString.length      
//          }            
//       toggleAbout('navAbout_2','navAbout_1','chrono','46664');  
//       }   // Return "null" if no parameter has been found   
//    
//       return "null";   
//       }
//   }


function toggleAbout(imgName,num,view,hide) {
    
	document.getElementById(imgName).src = "../../App_Themes/MPTFrontDefault/"+imgName + "_sel.gif";
	document.getElementById(imgName).className = "selected";
	document.getElementById(num).src = "../../App_Themes/MPTFrontDefault/"+num + ".gif";
	document.getElementById(num).className = "noselected";
	var divToHide = document.getElementById(hide);
	var divToShow = document.getElementById(view);
	divToHide.style.display="none";
    divToShow.style.display="block";
}

var cssPath = '../../App_Themes/';
var imagesPath = '../../App_Themes/MPTFrontDefault/';
var preloadArray = new Array();
    preloadArray[0] = 'tab-right.gif'; 
    preloadArray[1] = 'tab_0_left.gif'; 
    preloadArray[2] = 'tab_0_left.png'; 
    preloadArray[3] = 'tab_0_left_F.gif'; 
    preloadArray[4] = 'tab_0_leftIE.gif'; 
    preloadArray[5] = 'tab_0_right.gif'; 
    preloadArray[6] = 'tab_0_right.png'; 
    preloadArray[7] = 'tab_0_rightIE.gif'; 
    preloadArray[8] = 'tab_F_left.gif'; 
    preloadArray[9] = 'tab_F0_left.gif'; 
    preloadArray[10] = 'tab_L_right.gif'; 
    preloadArray[11] = 'tab_L0_right.gif'; 
    preloadArray[12] = 'tab_left.gif'; 
    preloadArray[13] = 'tab_right.gif';


function preCarga() 
{
    if (!document.images) 
    {
        return;
    }
    imgArray = new Array(preloadArray.length);
    for (var i = 0; i < preloadArray.length; i++) 
    {
        imgArray[i] = new Image();
        imgArray[i].src = imagesPath + preloadArray[i];
    }
}




//function imgOn(imgName) {   
//    alert('hola');
//    document.getElementById(imgName).src = imagePath + "tab-ov_" + imgName + ".gif";
//}

//function imgOf(imgName) {
//alert('hola');
//    document.getElementById(imgName).src = imagePath + "tab_" + imgName + ".gif";
//}

function imgOnTop(imgName) {
    if (document.getElementById(imgName).className.indexOf('Sprites ') != -1) {
        imgOnTopSprite(imgName);
    }
    else {
        if (document.getElementById(imgName).className != "selected") {
                document.getElementById(imgName).src = imagePath + "navtop-ov_" + imgName + ".gif";
        }
    }   
}

function imgOnTopSprite(imgName) {
    document.getElementById(imgName).className = 'Sprites sprite-' + imgName + '-ov';
}


function imgOfTop(imgName) {

    if (document.getElementById(imgName).className.indexOf('Sprites ') != -1) {
        imgOfTopSprite(imgName);
    }
    else {
        if (document.getElementById(imgName).className != "selected") {
            document.getElementById(imgName).src = imagePath + "navtop_" + imgName + ".gif";            
        }
    }   

        
   
}

function imgOfTopSprite(imgName) {
    document.getElementById(imgName).className = 'Sprites sprite-' + imgName;
}
//function imgOn(imgName) {
//        document.getElementById(imgName).src = "../../App_Themes/MPTFrontDefault/" + imgName + "_ov.gif";
//}

//function imgOf(imgName) {
//        document.getElementById(imgName).src = "../../App_Themes/MPTFrontDefault/" + imgName + ".gif";
//}

//function imgOn(imgName) {
//        if (document.getElementById(imgName).className != "selected") {
//            document.getElementById(imgName).src = "../../App_Themes/MPTFrontDefault/" + imgName + "_ov.gif";
//        }
//}

//function imgOf(imgName) {
//        if (document.getElementById(imgName).className != "selected") {
//            document.getElementById(imgName).src = "../../App_Themes/MPTFrontDefault/" + imgName + ".gif";
//        }
//}

function imgOn(imgName) {
    if (document.getElementById(imgName).className.indexOf('Sprites ') != -1) {        
        imgOnSprite(imgName);
    }
    else {       
        if (document.getElementById(imgName).className != "selected") {
            document.getElementById(imgName).src = "../../App_Themes/MPTFrontDefault/menu/" + imgName + "_ov.gif";
        }
    }
}

function imgOnSprite(imgName) {
    
    if (document.getElementById(imgName).className.indexOf('selected') == -1) {
        document.getElementById(imgName).className = 'Sprites sprite-' + imgName + '_ov';       
    }
}

function imgOf(imgName) {    
    if (document.getElementById(imgName).className.indexOf('Sprites ') != -1) {       
        imgOfSprite(imgName);
    }
    else {
       
        if (document.getElementById(imgName).className != "selected") {           
            document.getElementById(imgName).src = "../../App_Themes/MPTFrontDefault/menu/" + imgName + ".gif";
        }
    }
}

function imgOfSprite(imgName) {   
    if (document.getElementById(imgName).className.indexOf('selected') == -1) {
        document.getElementById(imgName).className = 'Sprites sprite-' + imgName;
    }
}





function setDivSize(divIV) {
    
    //<Silvio > 14-09-09 [agrego el condicional para qué no dé error si falta el elemento]
    if (document.getElementById(divIV)) {                
        var divHeigth = document.getElementById(divIV).offsetHeight;
    }
    //</Silvio >    
    if (divHeigth < 380) {
        //document.getElementById("ctl00_ctl00_" + divIV).style.height = "auto";
        document.getElementById("ctl00_ctl00_" + divIV).style.height = divHeigth + "px";    
        document.getElementById("ctl00_ctl00_" + divIV).style.overflow = "hidden";
    }
    else
        if (divHeigth > 400) {
        if (scrollObj.isSupported()) {
            var scrollHTML = '<div id="up_' + divIV + '">' +           
                '<a class="mouseover_up" href=""><img src="' + imagesPath + 'scroll-up.png" alt="" border="0" /></a>' +
                '</div><div id="track_' + divIV + '"><div id="dragBar_' + divIV + '"><ul><li class="top"></li><li class="bottom"></li></ul></div></div>' +
                '<div id="down_' + divIV + '">' +
                '<a class="mouseover_down" href=""><img src="' + imagesPath + 'scroll-dn.png" alt="" border="0" /></a></div>';
            document.getElementById("scrollbar_" + divIV).innerHTML = scrollHTML;
            function init_Scroll() {
                var wndo = new scrollObj('wn_' + divIV, 'lyr1_' + divIV);
                wndo.setUpScrollbar("dragBar_" + divIV, "track_" + divIV, "v", 1, 1);
                wndo.setUpScrollControls('scrollbar_' + divIV);
            }

            // if code supported, link in the style sheet and call the init function onload
            writeStyleSheet(cssPath + 'scrollbar_' + divIV + '.css');
            //writeStyleSheet(cssPath + 'scrollbar.css')
            Event.add(window, 'load', init_Scroll);
        } else {
            document.getElementById("ctl00_ctl00_" + divIV).style.height = divHeigth + "px";
            //document.getElementById("ctl00_ctl00_" + divIV).style.height = "auto";
            document.getElementById("ctl00_ctl00_" + divIV).style.overflow = "auto";
            document.getElementById("ctl00_ctl00_" + divIV).style.overflowX = "hidden";
        }

    }
}
function toggleRelated(divID, arrow) {
    if (document.getElementById(divID).style.display == 'block' || !document.getElementById(divID).style.display) {
        document.getElementById(divID).style.display = 'none';
        // document.getElementById(arrow).innerHTML='<img src="'+"  alt=""/>';
        
        document.getElementById(arrow).src = imagesPath + 'arrow_h.png'

    }
    else {


        document.getElementById(divID).style.display = 'block';
        //document.getElementById(arrow).innerHTML='<img src="'+imagesPath+'arrow_v.png"  alt=""/>';
        
        document.getElementById(arrow).src = imagesPath + 'arrow_v.png'

    }
}
