desp=0;
pxdesp=6;
delay_mov=10;

/*     page effects        */


function divTransp(rdiv, tr){
    dv=document.getElementById(rdiv);
    dv.style.display="block";
    if(dv.filters) dv.style.filter='alpha(opacity='+tr+')';
    else dv.style.opacity=tr/100;
}
function fadeInDiv(rdiv,tr){
    tm=tr+6;
    if(tm>100){
        tm=100;
        divTransp(rdiv,tm);
    }
    else{
        divTransp(rdiv,tm);
        setTimeout("fadeInDiv('"+rdiv+"',"+tm+");",50);
    }
}
function fadeOutDivAndClear(rdiv,tr){
    tm=tr-6;
    if(tm<0){
        tm=100;
        document.getElementById(rdiv).innerHTML="";
        divTransp(rdiv,tm);
    }
    else{
        divTransp(rdiv,tm);
        setTimeout("fadeOutDivAndClear('"+rdiv+"',"+tm+");",50);
    }
}
function fadeOutDivAndHide(rdiv,tr){
    tm=tr-6;
    if(tm<0){
        tm=100;
        document.getElementById(rdiv).style.display='none';
    }
    else{
        divTransp(rdiv,tm);
        setTimeout("fadeOutDivAndHide('"+rdiv+"',"+tm+");",20);
    }
}
function fadeInDivFast(rdiv,tr){
    tm=tr+15;
    if(tm>100){
        tm=100;
        divTransp(rdiv,tm);

    }
    else{
        divTransp(rdiv,tm);
        setTimeout("fadeInDiv('"+rdiv+"',"+tm+");",30);
    }
}
function showPdf(pFile){
    showPopup();
    txtTitle=document.getElementById('popup_title');
    txtTitle.innerHTML="Archivo";
    dvProduct=document.getElementById('popup_html');
    dvProduct.innerHTML="<iframe src=\""+ pFile + "\"width='770px' height='450px'></iframe>";
}
function showMenuResp(){
    resp=document.getElementById('menu_responsabilidad');
    resp.style.display='Block';
}
function hideMenuResp(){
    resp=document.getElementById('menu_responsabilidad');
    resp.style.display='None';
}
function showPopup(){
    block_cnt=document.getElementById('block_content');
    popup_cnt=document.getElementById('popup_content');
    block_cnt.style.display="block";
    popup_cnt.style.display="block";
}
function closePopup(){
    block_cnt=document.getElementById('block_content');
    popup_cnt=document.getElementById('popup_content');
    block_cnt.style.display="none";
    popup_cnt.style.display="none";
    txtTitle=document.getElementById('popup_title');
    txtTitle.innerHTML="";
    dvProduct=document.getElementById('popup_html');
    dvProduct.innerHTML="";
    createCookie('popupIntro','closed',2)
}
function showPhoto(photoPath){
    showPopup();
    txtTitle=document.getElementById('popup_title');
    txtTitle.innerHTML="Galer&iacute;as";
    dvProduct=document.getElementById('popup_html');
    dvProduct.innerHTML="<img src='"+photoPath+"' >";
}
function showGraphic(imagePath, title){
    showPopup();
    txtTitle=document.getElementById('popup_title');
    txtTitle.innerHTML=title;
    dvProduct=document.getElementById('popup_html');
    dvProduct.innerHTML="<img src='"+imagePath+"' width='100%'>";
}
function showFirstTimeIntro(){
    mandaMes('idunoBoletin','div1Content');
    cpopup=readCookie('popupIntro');
    if(cpopup==null)
        intro();
}
function intro(){
    showPopup();
    txtTitle=document.getElementById('popup_title');
    txtTitle.innerHTML="Intro Conserva";
    dvProduct=document.getElementById('popup_html');
    dvProduct.innerHTML="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"100%\" height=\"100%\" id=\"intro_conserva\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"intro/Conserva_intro.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"intro/Conserva_intro.swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100%\" height=\"100%\" name=\"intro_conserva\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
}

function setImageSlide(image_number){
    sci=document.getElementById('slide_content_image');
    new_image="images/image_slide"+image_number+".jpg";
    sci.style.background="url("+new_image+")";
}
function leaveImageSlide(){
    sci=document.getElementById('slide_content_image');
    sci.style.background="url(images/image_slide2.jpg)";
}
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=/";
}

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;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
function urlencode(str) {
    return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}

function mdshow(){
    if(desp==1){
        dv=document.getElementById('menudesp');
        //lft=dv.offsetLeft;
        wdt=dv.offsetWidth;
        if(wdt<280){
            dv.style.width=wdt+pxdesp+"px";
            setTimeout("mdshow();",delay_mov);
        }
    }
}

function mdhide(){
    if(desp==0){
        dv=document.getElementById('menudesp');
        wdt=dv.offsetWidth;
        if(wdt>22){
            dv.style.width=wdt-pxdesp+"px";
            setTimeout("mdhide();",delay_mov);
        }
    }
}

function show_menudesp(){
    desp=1;
    mdshow();
}

function hide_menudesp(){
    desp=0;
    mdhide();
}
