// MENU DESPLEGABLE

var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

// REGISTRO NUEVOS USUARIOS

function showRegistro(){
	document.getElementById('registro').style.visibility='visible';
	document.getElementById('registro').style.position='fixed';
	document.getElementById('password').disabled=true;
	}

function hideRegistro(){
	document.getElementById('registro').style.visibility='hidden';
	document.getElementById('registro').style.position='absolute';
	document.getElementById('password').disabled=false;
	}
	
function retry(){
document.getElementById('registro').style.visibility='visible';
document.getElementById('registro').style.position='fixed';
document.getElementById('new-user').checked=true;
	}
	
function AdvancedSearch(){
	if(document.getElementById('advancedsearch').style.visibility!='visible') {
	document.getElementById('advancedsearch').style.visibility='visible';
	document.getElementById('advancedsearch').style.position='fixed';
	document.getElementById('bulletsearch').src='./img/bdown.gif';
	} else {
	document.getElementById('advancedsearch').style.visibility='hidden';
	document.getElementById('advancedsearch').style.position='absolute';
	document.getElementById('bulletsearch').src='./img/bullet.gif';
	}
}

function recuperaPWD(cuenta)
{ 
    var xhr; 
    try { xhr = new XMLHttpRequest(); }                 
    catch(e) 
    {    
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
    } 
 
    xhr.onreadystatechange  = function()
    { 
         if(xhr.readyState  == 4)
         {
              if(xhr.status  == 200) 
                  document.getElementById('error').innerHTML = xhr.responseText; 
              else 
                 document.getElementById('error').innerHTML="Error. La operación no pudo concretarse. Haga <a href='http://www.revistapostdata.com.ar/inc/es/ajaxpwd.php?id="+cuenta+"'>click aquí</a> para intentar nuevamente.";
         }
    }; 

   xhr.open("GET", "http://www.revistapostdata.com.ar/inc/es/ajaxpwd.php?id="+cuenta,  true); 
   xhr.send(null); 
}

function agregarFavoritos(title,url){
if (window.sidebar)
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)
	window.external.AddFavorite(url, title);
}

function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function muestra_panelEmail() {

var panelEmail = new YAHOO.widget.Panel("panelEmail", 
	{ 
		fixedcenter:true,constraintoviewport:true,underlay:'shadow',close:true,visible:false,draggable:false,modal:true,width:"410px", height:"185px", zindex:"1500"
	} 
) 
panelEmail.render();
}

function recomiendaNOTA(nombre,email,art,dest,cc)
{ 
    
	document.getElementById('panelEmail_btnsubmit').value = 'Enviando...';
	document.getElementById('panelEmail_btnsubmit').disabled = true;
	
	var xhr; 
    try { xhr = new XMLHttpRequest(); }                 
    catch(e) 
    {    
      xhr = new ActiveXObject("Microsoft.XMLHTTP");
    } 
 
    xhr.onreadystatechange  = function()
    { 
         if(xhr.readyState  == 4)
         {
              if(xhr.status  == 200) 
                  panelEmail.hide();
              else 
                 document.getElementById('error').innerHTML="Error. La operación no pudo concretarse. Haga <a href='http://www.revistapostdata.com.ar/inc/es/ajaxpwd.php?id="+cuenta+"'>click aquí</a> para intentar nuevamente.";
         }
    }; 

   xhr.open("GET", "http://www.revistapostdata.com.ar/inc/es/recomiendaNota.php?t1="+nombre+"&t2="+email+"&t3="+art+"&t4="+dest+"&t6="+cc,  true); 
   xhr.send(null); 
}

function XrecomiendaNOTA() {

var a,b,c,d,e;

a = document.getElementById('panelEmail_nombre').value;
b = document.getElementById('panelEmail_email').value;
c = document.getElementById('panelEmail_art').value;
d = document.getElementById('panelEmail_dest').value;
if(document.form2.panelEmail_cc.checked) { e=0 } else { e = 1 };

recomiendaNOTA(a,b,c,d,e);

}