﻿

function justShow(elementid)
{
  
            document.getElementById(elementid).style.display = 'block';
       
} 
function justHide(elementid)
{
  
            document.getElementById(elementid).style.display = 'none';
       
} 

function showHide(elementid)
{

    
    
    if (document.getElementById(elementid).style.display == 'none' || document.getElementById(elementid).style.display == ''){
            
            
            document.getElementById(elementid).style.display = 'block';
            
        } else {
        
            document.getElementById(elementid).style.display = 'none';            
            
        }
} 


function showHideNew(elementid,linkText,linkObj)
{
    eraseCookie(elementid)
    
    if (document.getElementById(elementid).style.display == 'none'){
    
            createCookie(elementid,"block",365)
            document.getElementById(elementid).style.display = 'block';
            document.getElementById(linkObj).innerHTML = 'Esconder';
            
        } else {
            
            createCookie(elementid,"none",365)
            document.getElementById(elementid).style.display = 'none';
            document.getElementById(linkObj).innerHTML = 'Mostrar';
            
        }
} 


function showHideNewText(elementid,linkTextShow,linkTextHide,linkObj)
{
    eraseCookie(elementid)
    
    if (document.getElementById(elementid).style.display == 'none'){
    
            createCookie(elementid,"block",365)
            document.getElementById(elementid).style.display = 'block';
            document.getElementById(linkObj).innerHTML = linkTextHide;
            
        } else {
            
            createCookie(elementid,"none",365)
            document.getElementById(elementid).style.display = 'none';
            document.getElementById(linkObj).innerHTML = linkTextShow;
            
        }
} 

//Just hide item
function AutoShowHide(ObjName, linkText, linkObj)
{       
    divObj = document.getElementById(ObjName)  
    
    
    if(divObj)
    {
        myStyle = readCookie(ObjName)
          
          
        
        
        if(myStyle==null)
        {
            //JustShow(ObjName)       
            document.getElementById(ObjName).style.display = 'block';
            document.getElementById(linkObj).innerHTML = 'Esconder';
        }
        else
        {
            if(myStyle=="block")
            {
                //JustShow(ObjName)  
                document.getElementById(ObjName).style.display = 'block';         
                document.getElementById(linkObj).innerHTML = 'Esconder';
            }
            else
            {       
                 document.getElementById(ObjName).style.display = 'none';  
                 document.getElementById(linkObj).innerHTML = 'Mostrar';          
            }   
        }
    }
    
    
        

}


//Just hide item
function AutoShowHideV2(ObjName, linkText, linkObj)
{       
    divObj = document.getElementById(ObjName)  
    
    
    if(divObj)
    {
        myStyle = readCookie(ObjName)
          
          
        
        
        if(myStyle==null)
        {
            //JustShow(ObjName)       
            document.getElementById(ObjName).style.display = 'block';
            document.getElementById(linkObj).innerHTML = linkText;
        }
        else
        {
            if(myStyle=="block")
            {
                //JustShow(ObjName)  
                document.getElementById(ObjName).style.display = 'block';         
                document.getElementById(linkObj).innerHTML = linkText;
            }
            else
            {       
                 document.getElementById(ObjName).style.display = 'none';  
                 document.getElementById(linkObj).innerHTML = linkText;          
            }   
        }
    }
    
    
        

}

function PopUp(mypage, myname, w, h) 
{

    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable=0'
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    
}
function PopUpResize(mypage, myname, w, h) 
{

    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable=yes'
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    
}

function AreYouSure(alertStr)
{
    x = confirm(alertStr + "\n\nRinconChileno.com")
    if(x==false)
    return false;

}

  

// Popup chat

var fonster = null;
var x = 0; var y = 0; 
function chat(url) {
if(parseInt(navigator.appVersion) > 3 || navigator.appName == "Netscape") {
  if(!fonster || fonster.closed) {
    fonster = window.open("", "subwinchat", "toolbar=no,directories=no,location=no,status=yes,menubar=no,resizable=no,copyhistory=no,scrollbars=no,width=300,height=160");
    fonster.location.href = "" + url
    fonster.focus();
  } else {
    fonster.location.href = "" + url;
    fonster.focus();
  }
}else{
  location.href = "" + url;
}
}
	
 function OpenVoteWindow()
 {
 aWindow=window.open('','VOTEWIN','width=560,height=250,toolbar=No,resize=No,scrollbars=yes,menubar=No');
 aWindow.focus();
 } 



//flash active x disable

function CreateFlash(classid, width, height, movie)
{

	document.write('<object classid="'+ classid +'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ width +'" height="'+height+'">');
    document.write('<param name="movie" value="'+ movie +'" />');
    document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
    document.write('<embed src="'+ movie +'" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ width +'" height="'+height+'" />');
    document.write('</object>');
}

function CreateFlashVars(classid, width, height, movie, FlashVars)
{

	document.write('<object classid="'+ classid +'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ width +'" height="'+height+'">');
    document.write('<param name="movie" value="'+ movie +'" />');
    document.write('<param name="quality" value="high" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="FlashVars" value="'+ FlashVars +'">');
    document.write('<embed src="'+ movie +'" quality="high" menu="false" flashvars="'+ FlashVars +'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ width +'" height="'+height+'" />');
    document.write('</object>');
}

objects = document.getElementsByTagName("object");
for (var i = 0; i < objects.length; i++)
{
    objects[i].outerHTML = objects[i].outerHTML;
}



//Cookie handling for windows objects
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);
}
