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

var arrayHeaderImages=new Array();
var currentShowingImage=0;
var currentShowingDiv=1;

/*variable de configuracion de la lista de imagenes*/
var movLeftListaImages=-870;
var direccionListaImages = -1;
var margenListaImages = 870+650;
var velListaImages = 1;
var velRefreshListaImages = 25;

/*     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 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 closePopup2(){
    block_cnt=document.getElementById('block_content2');
    block_cnt.style.display="none";    
}
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 search_site(){
    tsearch=document.getElementById('txtsearch').value;
    if(tsearch.length>0 && tsearch!="Buscar..."){
        tsearch=urlencode(tsearch);
        window.location='http://www.google.com.mx/search?hl=es&q='+tsearch+'+site%3Aenergysaving-radiantheatbarrier.com';
    }
}

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

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

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

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

function display_direct(imagen,puesto,nombre){
    window.scrollTo(0,0);
    document.body.style.overflow='hidden';
    document.getElementById('direct_content').innerHTML="<br><br>"+nombre+"<br><b>"+puesto+"</b><br><img src='images/"+imagen+".jpg' width='500' align='absbottom'><br><br><a href='javascript:void();' onclick='close_direct();'>[x] Cerrar</a>";
    document.getElementById('direct_div').className='direct_on';
    document.getElementById('direct_content').className='direct_content_on';
}
function close_direct(){
    document.body.style.overflow='auto';
    document.getElementById('direct_div').className='direct_off';
    document.getElementById('direct_content').className='direct_content_off';
}

function show_photo(path,desc){
    window.scrollTo(0,0);
    document.body.style.overflow='hidden';
    div_f=document.getElementById('dvgal');
    div_c=document.getElementById('dvphoto');
    div_l=document.getElementById('dvlist');
    div_f.className='dvg-on';
    div_c.className='dvp-on';
    div_l.className='dvl-on';
    div_c.innerHTML="[ X ] <a href='javascript:void();' onclick='close_view();'>Cerrar Vista</a><br><br><h2>"+desc+"</h2><br><img src='"+path+"'>";
}
function close_view(){
    window.scrollTo(0,0);
    document.body.style.overflow='auto';
    div_f=document.getElementById('dvgal');
    div_f.className='dvg-off';
    div_c=document.getElementById('dvphoto');
    div_l=document.getElementById('dvlist');
    div_c.innerHTML="";
    div_c.className='dvp-off';
    div_l.className='dvg-off';
}

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 muestraArchivoBoletin(vid)
{
    var boletinFile = document.getElementById(vid);
    cBol = boletinFile.innerHTML.substr(0,7);
    if(cBol=="<iframe" || cBol=="<IFRAME")
    {
            showPdf(boletinFile.innerHTML);
            return;
    }

    if(boletinFile.style.display=="none"){
            boletinFile.style.display="block";
    }
    else
    {
            boletinFile.style.display="none";
    }
}

function animaDespliega(div2Modif,divRef)
{
    var a = document.getElementById(div2Modif);
    var b = document.getElementById(divRef);

    if(b.style.display=="block"){
            a.className="linkBoletinOver";
    }
    else
    {
            a.className="linkBoletin";
    }
}

function replaceimg()
{
	sms = '<img src="'+mySlideData[countArticle++]+'" />';
	if(countArticle>=mySlideData.length)
		countArticle=0;
	document.getElementById("pic-grupo").innerHTML = sms;

	setTimeout("replaceimg(); ",10000);
}

function moveImageList()
{
    var lista = document.getElementById('lista');
    lista.style.left=movLeftListaImages+"px";
    movLeftListaImages+=velListaImages*direccionListaImages;
    if(direccionListaImages==-1){
        if(movLeftListaImages!=(margenListaImages*direccionListaImages)){
            setTimeout("moveImageList();",velRefreshListaImages);
        }
        else{ direccionListaImages = 1; setTimeout("moveImageList();",velRefreshListaImages);}
    }
    else
    {
        if(movLeftListaImages!=(-870)){
            setTimeout("moveImageList();",velRefreshListaImages);
        }
        else{ direccionListaImages = -1; setTimeout("moveImageList();",velRefreshListaImages);}
    }
}


