//
function open_window(tupagina){
    var altura_popup = 480;
    var H = (screen.height - altura_popup) / 2;
    var anchura_popup = 640;
    var L = (screen.width - anchura_popup) / 2;
    pop_up = window.open(tupagina, "Popup", "status=yes,scrollbars=yes,resizable=yes,height=" + altura_popup + ",width=" + anchura_popup + ",top=" + H + ",left=" + L);
}

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

//
function eliminarElementoYouTube(){
    youtube = document.getElementById('objetoCargador');
    if (!youtube) {
        alert("El elemento selecionado no existe (eliminar)");
    }
    else {
        padre = youtube.parentNode;
        padre.removeChild(youtube);
    }
    
}

function agregarElementoYouTube(linkYou){
    var youtube = document.getElementById('youtubeObject');
    var objectElement = '<div id="objetoCargador"><object width="425" height="355"><param name="movie" value="' + linkYou + '"></param><param name="wmode" value="transparent"></param><embed src="' + linkYou + '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></div>';
    if (!youtube) {
        alert("El elemento selecionado no existe (agregar)");
    }
    else {
        youtube.innerHTML = objectElement;
    }
}

/***********************************************
 * Sticky Note script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
 * Visit DynamicDrive.com for hundreds of DHTML scripts
 * This notice must stay intact for legal use
 * Go to http://www.dynamicdrive.com/ for full source code
 ***********************************************/
//Specify display mode. 3 possible values are:
//1) "always"- This makes the fade-in box load each time the page is displayed
//2) "oncepersession"- This uses cookies to display the fade-in box only once per browser session
//3) integer (ie: 5)- Finally, you can specify an integer to display the box randomly via a frequency of 1/integer...
// For example, 2 would display the box about (1/2) 50% of the time the page loads.

var autohidebox = ["no", 0] //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var showonscroll = "yes" //Should box remain visible even when user scrolls page? ("yes"/"no)
////////No need to edit beyond here///////////


function displayYoutubeBox(linkYou){

	agregarElementoYouTube(linkYou)
	
	var ie = document.all && !window.opera
	
	var dom = document.getElementById
	
	iebody = (document.compatMode == "CSS1Compat") ? document.documentElement : document.body
	
	objref = (dom) ? document.getElementById("youTubeBox") : document.all.fadeinbox
	
	var scroll_top = (ie) ? iebody.scrollTop : window.pageYOffset
	
	var docwidth = (ie) ? iebody.clientWidth : window.innerWidth
	
	docheight = (ie) ? iebody.clientHeight : window.innerHeight
	
	var objwidth = objref.offsetWidth
	
	objheight = objref.offsetHeight
	
	objref.style.left = docwidth / 2 - objwidth / 2 + "px"
	
	objref.style.top = scroll_top + docheight / 2 - objheight / 2 + "px"
	
	objref.style.visibility = "visible"

}


function hideYoutubeBox(){

    eliminarElementoYouTube();
    
    objref.style.visibility = "hidden"
        
}

function get_cookie(Name){

    var search = Name + "="
    
    var returnvalue = ""
    
    if (document.cookie.length > 0) {
    
        offset = document.cookie.indexOf(search)
        
        if (offset != -1) {
        
            offset += search.length
            
            end = document.cookie.indexOf(";", offset)
            
            if (end == -1) 
            
                end = document.cookie.length;
            
            returnvalue = unescape(document.cookie.substring(offset, end))
            
        }
        
    }
    
    return returnvalue;
    
}
///////////////////////////////////////////////////////////////////////////
// a partir de aca para el frame de las notas
///////////////////////////////////////////////////////////////////////////

//

function eliminarElementoNota(){
    nota = document.getElementById('frameNota');
    if (!nota) {
        alert("El elemento selecionado no existe (eliminar)");
    }
    else {
        padre = nota.parentNode;
        padre.removeChild(nota);
    }
    
}

function agregarElementoNota(idNota){
	//notaActiva = idNota
    var nota = document.getElementById('notaHolderCaja');
    var objectElementPress = '<iframe id="frameNota" frameborder="0" src="notaholder.php5?idNota='+idNota+'" width="540px" height="460"> </iframe>';
    if (!nota) {
        alert("El elemento selecionado no existe (agregar)");
    }
    else {
        nota.innerHTML = objectElementPress;
    }
}
function getNota(){
	return notaActiva
}
function displayPressBox(cuerpoNota){

	agregarElementoNota(cuerpoNota)
	
	var ie = document.all && !window.opera
	
	var dom = document.getElementById
	
	iebody = (document.compatMode == "CSS1Compat") ? document.documentElement : document.body
	
	objref2 = (dom) ? document.getElementById("notaBox") : document.all.fadeinbox
	
	var scroll_top = (ie) ? iebody.scrollTop : window.pageYOffset
	
	var docwidth = (ie) ? iebody.clientWidth : window.innerWidth
	
	docheight = (ie) ? iebody.clientHeight : window.innerHeight
	
	var objwidth = objref2.offsetWidth
	
	objheight = objref2.offsetHeight
	
	objref2.style.left = docwidth / 2 - objwidth / 2 + "px"
	
	objref2.style.top = scroll_top + docheight / 2 - objheight / 2 + "px"
	
	objref2.style.visibility = "visible"
	
	/*objref2.style.display = "block"*/
}


function hidePressBox(){

    eliminarElementoNota();
    
    objref2.style.visibility = "hidden"
	
	/*objref2.style.display = "none"*/
    
    if (typeof showonscrollvar != "undefined") 
    
        clearInterval(showonscrollvar)
    
}

function get_cookie(Name){

    var search = Name + "="
    
    var returnvalue = ""
    
    if (document.cookie.length > 0) {
    
        offset = document.cookie.indexOf(search)
        
        if (offset != -1) {
        
            offset += search.length
            
            end = document.cookie.indexOf(";", offset)
            
            if (end == -1) 
            
                end = document.cookie.length;
            
            returnvalue = unescape(document.cookie.substring(offset, end))
            
        }
        
    }
    
    return returnvalue;
    
}
