function esIE30()
 {
  var browserType=navigator.userAgent;
   if (browserType.indexOf("MSIE")==-1)
	return false;
   else
	return true;
 }
function busca(lugar)
 {
  if(lugar=="profesional")
   { 
    window.parent.frames['cuerpo'].location = "profesional.php";
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?biblio=profesional";
	 else
	  window.parent.frames['navigator'].location = "navigator.php?biblio=profesional";
	window.parent.frames['upload'].location = "login.php";
   }
  if(lugar=="centros")
   { 
    window.parent.frames['cuerpo'].location = "search.php?sit=centros"; 
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?biblio=centros";
	 else
	  window.parent.frames['navigator'].location = "navigator.php?biblio=centros";
	window.parent.frames['upload'].location = "login.php";
   }
  if(lugar=="cursos")
   { 
    window.parent.frames['cuerpo'].location = "search.php?sit=cursos";
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?biblio=cursos";
	 else
	  window.parent.frames['navigator'].location = "navigator.php?biblio=cursos";
	window.parent.frames['upload'].location = "login.php";
   }
  if(lugar=="programas")
   { 
    window.parent.frames['cuerpo'].location = "search.php?sit=programas";
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?biblio=programas";
	 else
	  window.parent.frames['navigator'].location = "navigator.php?biblio=programas";
	window.parent.frames['upload'].location = "login.php";
   }
  if(lugar=="bibliobolivia")
   { 
    window.parent.frames['cuerpo'].location = "search.php?sit=bibliobolivia";
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?biblio=bol";
	 else
	  window.parent.frames['navigator'].location = "navigator.php?biblio=bol";
	window.parent.frames['upload'].location = "login.php";
   }
  if(lugar=="otrabiblio")
   { 
    window.parent.frames['cuerpo'].location = "search.php?sit=otrabiblio";
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?biblio=otro";
	 else
	  window.parent.frames['navigator'].location = "navigator.php?biblio=otro";
	window.parent.frames['upload'].location = "login.php";
   }
  if(lugar=="revista")
   { 
    window.parent.frames['cuerpo'].location = "search.php?sit=revista";
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?biblio=revista";
	 else
	  window.parent.frames['navigator'].location = "navigator.php?biblio=revista";
	window.parent.frames['upload'].location = "login.php";
   }
 }
/* 
function doubleLinkOtro(folder){
    window.parent.frames('cuerpo').location = "reg_otras.php";	
	//window.parent.frames('upload').location = "upload_frame.php?carpeta=" + folder;
	window.parent.frames('navigator').location = "navigator.php?biblio=" + folder;
}
function doubleLinkRev(folder){
    window.parent.frames('cuerpo').location = "reg_revista.php";	
	//window.parent.frames('upload').location = "upload_frame.php?carpeta=" + folder;
	window.parent.frames('navigator').location = "navigator.php?biblio=revista";	
}
function doubleLinkBol(folder){
    window.parent.frames('cuerpo').location = "reg_bol.php";	
	//window.parent.frames('upload').location = "upload_frame.php?carpeta=" + folder;
	window.parent.frames('navigator').location = "navigator.php?biblio=" + folder;
} 
*/
function instituciones(){
    window.parent.frames['cuerpo'].location = "instituciones.php";
}
function doubleCebem(){
	window.parent.frames['cuerpo'].location = "cebem_frame.php";
	window.parent.frames['upload'].location = "login.php";
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?biblio=cebem";
	 else
	  window.parent.frames['navigator'].location = "navigator.php?biblio=cebem";
}
function SiteLink(folder,seccion,ID){
    window.parent.frames['cuerpo'].location = "reg_frame.php?ID=" + folder + "&seccion=" + seccion;
	//window.parent.frames('upload').location = "upload_frame.php?carpeta=" + folder + "tipo="+ seccion;
	window.parent.frames['navigator'].location = "navigator.php?carpeta=" + folder + "&seccion="+ seccion+"&ID="+ID;
}
function doubleLink(folder){
    window.parent.frames['cuerpo'].location = "car_frame.php?ID=" + folder;	
	window.parent.frames['upload'].location = "upload_frame.php?carpeta=" + folder;
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?carpeta=" + folder;
	 else
	  window.parent.frames['navigator'].location = "navigator.php?carpeta=" + folder;
}
function FileFolder(folder){
	window.parent.frames['cuerpo'].location = "car_frame.php?ID=" + folder;
	window.parent.frames['upload'].location = "upload_frame.php?carpeta=" + folder;	
	 if (esIE30())
	  window.parent.frames('navigator').location = "navigator.php?carpeta=" + folder;
	 else
	  window.parent.frames['navigator'].location = "navigator.php?carpeta=" + folder;
}
function ShowSet2(iREL){
     var sw = document.all("T"+iREL).style.display;
	 if (sw == ""){
        document.all("T"+iREL).style.display = "none";
        document.all("ON"+iREL).style.display = "";
        document.all("OFF"+iREL).style.display = "none";
     }else{
        document.all("T"+iREL).style.display = "";
        document.all("ON"+iREL).style.display = "none";
        document.all("OFF"+iREL).style.display = "";
     }
	 /*
     if (sw == ""){
        document.all("T"+iREL).style.display = "none";
        document.all("ON"+iREL).style.display = "none";
        document.all("OFF"+iREL).style.display = "";
     }else{
        document.all("T"+iREL).style.display = "";
        document.all("ON"+iREL).style.display = "";
        document.all("OFF"+iREL).style.display = "none";
     }
	 */
   }
function ShowSet(iREL)
 {
   var sw = document.all("T"+iREL).style.display;
   //alert ("SW=" + sw + " REL= " + iREL)
    if (sw == "")
	 {
        document.all("T"+iREL).style.display = "none";
        document.all("ON"+iREL).style.display = "";
        document.all("OFF"+iREL).style.display = "none";	
     }
	else
	 {
		document.all("T"+iREL).style.display = "";
        document.all("ON"+iREL).style.display = "none";
        document.all("OFF"+iREL).style.display = "";
		 if(iREL=='m2')
		  {
		   //window.parent.frames['cuerpo'].location = "page.php?ID=1";
		   window.parent.frames['cuerpo'].location = "page.php?ID=3";
		    if (esIE30())
			 window.parent.frames('navigator').location = "navigator.php?biblio=areas";
		    else
		     window.parent.frames['navigator'].location = "navigator.php?biblio=areas";
		  }
     }
 } 
//------------------------------biblioteca cebem------------
 function ShowSet4(iREL)
 {
   var sw = document.all("T"+iREL).style.display;
   //alert ("SW=" + sw + " REL= " + iREL)
    if (sw == "")
	 {
        document.all("T"+iREL).style.display = "none";
        document.all("ON"+iREL).style.display = "";
        document.all("OFF"+iREL).style.display = "none";	
     }
	else
	 {
		document.all("T"+iREL).style.display = "";
        document.all("ON"+iREL).style.display = "none";
        document.all("OFF"+iREL).style.display = "";
		 if(iREL=='m4')
		  {
		   window.parent.frames['cuerpo'].location = "cebem_frame.php";
		    if (esIE30())
			 window.parent.frames('navigator').location = "navigator.php?biblio=areas";
		    else
		     window.parent.frames['navigator'].location = "navigator.php?biblio=areas";
		  }
     }
 }

function ShowUpgrades(TURel){
	 document.all("TU"+TURel).style.display = "none";
	/*
   var TUSw = (document.all("TU"+TURel).style.display == "");
   if (TUSw) {
     document.all("TU"+TURel).style.display = "none";
     document.all("I"+TURel).style.display = "";
     document.all("IC"+TURel).style.display = "none";
     
     
   switch(TURel){

    case 'MenSup':
     document.all("TUMenSup").style.display = "none"; 
     break;

   case 'Settings':
    document.all("TUserManager").style.display = "none";
    document.all("TPartnersManager").style.display = "none";
    document.all("TConfigure").style.display = "none";
    document.all("TCountries").style.display = "none";    
    break;   
   } 
     
     
   }else{
     document.all("TU"+TURel).style.display = "";
     document.all("I"+TURel).style.display = "none";
     document.all("IC"+TURel).style.display = "";
   }
   */
}


function DoNothing(){

}


function Show(TuRel){
   var TDSw = (document.all("T"+TuRel).style.display == "");
   
   if (TDSw) {
       document.all("T"+TuRel).style.display = "none";
   }else{
       document.all("T"+TuRel).style.display = "";
   }

}

function Prueba(sName,sURL,iValue){
      
  var sTyp = "";
  var sCad = "";
  //alert(sName);
  //alert(sURL);
  //alert(iValue);
  //iValue = 1 Significa padre
  //iValue = 2 Significa solo link
  //ivalue = 3 significa opcion  de editar, delete o print aparece cuadro
  
  if (document.all("VALOR").value != ""){
     sTyp = document.all("VALOR").value;
     sCad = document.all("NOMBRELINK").value;
     //alert(sTyp);
  }
  
  switch(iValue){
   case 3:
     document.all("VALOR").value = 3
     document.all("NOMBRELINK").value = sName;
   
     var TDSw = (document.all("T"+sName).style.display == "");
   
     if (TDSw) {
         document.all("T"+sName).style.display = "none";
     }else{
         document.all("T"+sName).style.display = "";
     }

     if (sTyp == 3 && sCad != sName){document.all("T"+sCad).style.display = "none";}     
     
     break;
   case 2:  
     //alert(sURL);
     window.parent.frames("Main").location = sURL;
     
     document.all("VALOR").value = 2;
     document.all("NOMBRELINK").value = sName;
     if (sTyp == 3){document.all("T"+sCad).style.display = "none";}
     
     
     
     break;
     
     case 1:
       document.all("VALOR").value = 1;
       document.all("NOMBRELINK").value = sName;
       

       var TUSw = (document.all("TU"+sName).style.display == "");
       if (TUSw) {
         document.all("TU"+sName).style.display = "none";
         document.all("I"+sName).style.display = "";
         document.all("IC"+sName).style.display = "none";
        }else{
         document.all("TU"+sName).style.display = "";
         document.all("I"+sName).style.display = "none";
         document.all("IC"+sName).style.display = "";
        }

        if (sTyp == 3){document.all("T"+sCad).style.display = "none";}
        if (sTyp == 1 && sCad != sName){
           document.all("TU"+sCad).style.display = "none";
           document.all("I"+sCad).style.display = "";
           document.all("IC"+sCad).style.display = "none";
        }          
       break;

  }

}

function SendAction(){
   sCad = "";
   if (document.frmEditPrint.PEOrder.value != ""){
   
  if (!isInteger(document.frmEditPrint.PEOrder.value)) 
   { alert("Order Number invalid!!!");}
   else
   {
   if (!document.frmEditPrint.PE(0).checked && !document.frmEditPrint.PE(1).checked ){
    alert("Please select Print or Edit Order");
   }
   else{
    if (document.frmEditPrint.PE(0).checked){
      sCad = "EditOrder.asp?target=EDIT&OID=" + document.frmEditPrint.PEOrder.value + "&ED=1";   
    }
    if (document.frmEditPrint.PE(1).checked){
      sCad = "PrintOrder.asp?OrderID=" + document.frmEditPrint.PEOrder.value + "&NoClose=yes";   
    }
   window.parent.frames("Main").location = sCad;
  }
  
  }
  
  }else
  { alert("Please, input number order");
  
  }
    
}

function DeleteAction(){
   var sCad = "";
   if (document.frmDelete.DeleteOrder.value == ""){
      alert("Please, input order number to Delete");
   }else{
     if (!isInteger(document.frmDelete.DeleteOrder.value))
     { alert("Order Number Invalid!!");}
     else{
     window.parent.frames["Main"].location = "DeleteOrder.asp?OID=" + document.frmDelete.DeleteOrder.value;
     }
   }
}


function SendConfirmation(){
    var sOut = "";
    if (document.frmSearch.keyword.value == ""){ 
       alert("Ingrese un criterio de busqueda!!");
	   document.frmSearch.keyword.focus();
     }else{
     
     var sKey = document.frmSearch.keyword.value;
     
     for (var i=0;i<document.frmSearch.elements.length;i++){
        var e = document.frmSearch.elements[i];
        var s = e.name;
         if ((e.type == 'radio') && (s.substr(0,4) == 'Type') && (e.checked != false)){
            var h = e.value;   
         }
      }
     
     switch(h){
      case '1': sOut = 1; break;
      case '0': sOut = 0; break;     
      case '3': sOut = 3; break;    
      case '6': sOut = 6; break;    
      case '5': sOut = 5; break;    
      case '2': sOut = 2; break;
      case '4': sOut = 4; break;   
      case '7': sOut = 7; break;  	  
     }
 
     window.parent.frames('Main').location = "SearchTools.php?Target=SEARCH&keyword=" + sKey +"&Type=" + sOut;
    
     }

}