// =====================================================================================
//
//  wipolib.js        Historie     
//
// =====================================================================================
//
//
//  01.08.2004  001  upk  neu angelegt
//  20.03.2007  016  upk  das aufgenommen
//  01.04.2007  017  upk  org aufgenommen
//  30.05.2007  019  upk  lit aufgenommen
//  08.11.2008  020  upk  villa aufgenommen
//
//
//







function wipo_cnst_subrelease () {

         return ( "020" );


}














function wipo ( mode, submode, dbid, entry, aux ){






// ----- ident                            

         username       = "DummyUserName";




// ----- dbid plausi


         if ( dbid == "" ){

              alert  ( "Fehler beim Aufruf wipo() : dbid nicht uebergeben" );
              return;
         }


         if ( dbid != "awd"    &&
              dbid != "poq"    &&
              dbid != "isf"    && dbid != "iwd" &&
              dbid != "qpshop" && dbid != "qpshop_en" &&
              dbid != "qporg"  && dbid != "org"       &&
              dbid != "daf"    && dbid != "das"       &&
              dbid != "bbs"    && dbid != "lit"       &&
              dbid != "villa"  && 
              dbid != "wipo"   ){

              alert  ( "Fehler beim Aufruf wipo() : dbid '" + dbid + "' unbekannt" );
              return;
         }



// ----- Mitgliederfunktionen : nur Arthrose-Wissen-Datenbank awd

         if ( dbid == "awd" ){


           if ( mode == 'wissensXmaskXportal' ){   


              if (!( cookie_query   ( 'nodebug', 'username_existiert' ))){

                 //  Nichtmitglied : Portalaufruf umlenken auf aussagefaehige Seite

                     submode = "default";
                     entry   = "Therapie-Verzeichnis";

              }
           }
           else
           if ( submode == 'search' || submode == 'fullindex' ){   


              if (!( cookie_query   ( 'nodebug', 'username_existiert' ))){


                 //  Nichtmitglied : Umlenken auf aussagefaehige Seite

                     submode = "default";
                     entry   = "Therapie-Verzeichnis";

              }
           }
           else 

                 //  alle anderen Fälle : nach N Transaktionen Anmeldung verlangen


           if ( top.document.forms[0].UserLoginFlag.value == '0' ){

                // Aufruf-Zaehler + Blockade

                parent.document.forms[0].ConfigAdministrationMessageNumber.value = 
                parseInt ( parent.document.forms[0].ConfigAdministrationMessageNumber.value ) + 1;


                // alert("DEBUG Check: " + parent.document.forms[0].ConfigAdministrationMessageNumber.value);


                if ( parent.document.forms[0].ConfigAdministrationMessageNumber.value > 3  ){


                     if ( submode == "indexStyleABC" ){

                          // keine Aktion
                     }
                     else
                     if ( entry   == "HomePage" ){
                          entry   =  "Therapie-Verzeichnis";

                          // keine Aktion

                     }
                     else {
                          top.document.forms[0].Stack_00.value="javascript:wipo_navigation_to_home(\'" + dbid + "\')";

                          cgi_access_counter ( 0, "wipo-" + dbid + "-forcedlogin",  "add" );
                          cgi_access_user    ("forcedlogin" );
                          return;
                     }
                }


           }
         } // Ende if awd



// ----- direkter Aufruf eines Eintrags

         local_entry = "";


  
 






// ----- spezielle submodes

         switch ( submode ){



             case 'default' :
                   local_entry = "action=browse";

                   if ( entry != "" ){
                        local_entry = local_entry + "&id=" + entry;
                   }


                   break;



             case 'drucken' :
                   local_entry = "action=browse";

                   if ( entry != "" ){
                        local_entry = local_entry + "&id=" + entry + "&submode=drucken";
                   }


                   break;


             case 'DBAdmin' :

                   local_entry = "action=DBAdmin&id=dummyDBAdmin";
                   break;

             case 'DBSearchLog' :

                   local_entry = "action=DBSearchLog&id=dummyDBSearchLog";
                   break;

             case 'admin.reorg' :

                   local_entry = "action=admin.reorg&id=dummyadminreorg";
                   break;

             case 'editThisDBCSS' :

                   local_entry = "action=editThisDBCSS&id=" + entry;
                   break;

             case 'indexStyleABC' :

                   local_entry = "action=index&id=indexStyleABC";
                   break;

             case 'fullindex' :

                   local_entry = "dosearch=1&&id=fullindexdummy&action=forcedupkdummy&search=";
                   break;

             case 'search' :

                   local_entry = "dosearch=1&action=forcedupkdummy&id=searchdummy&search=" + entry;
                   break;

             case 'history' :

                   local_entry = "action=history&id=" + entry;
                   break;

             case 'difference' :

                   local_entry = "action=browse&diff=1&id=" + entry;
                   break;

             case 'backlinks' :

                   local_entry = "&id=backlinkdummy&action=forcedbacklinkdummy&back=" + entry;
                   break;

             case 'aenderungen' :

                   local_entry = "action=RecentChanges&id=recentchangedummy";
                   break;

             case 'edit' :

                   local_entry = "action=edit&id=" + entry;
                   break;


             case 'customizePage' :

                   local_entry = "action=customizePage&id=" + entry;
                   break;


             case 'editlinks' :

                   local_entry = "action=editlinks&id=editlinksdummy";
                   break;



             default :

                  alert ( "unbekannter submode '" + submode + "' in  wipo( )" );
                  return;

          } 






// ----- Standalone Parameter für Zentrierung unter Nutzung der 1/2 Bildschirm Breite und 2/3 Bildschirmlaenge


         // Ermittlung der Laengen

         var width_fix  =   screen.availWidth;
         var height_fix =   screen.availHeight;


         // Ermittlung der Postionen

         var l = ( screen.availWidth  - width_fix  ) / 2;
         var t = ((screen.availHeight - height_fix ) / 2);






// ----- direct : editor call 

         switch ( mode ){



             case 'samewindow' :

                   top.location.href = cgi_fullserverpath () + "/wipo/wipo.cgi?" + local_entry + "&sid=" + cnst_sid() + "&dbid=" + dbid + "&release=" + cnst_release() + "&username=" + username; 
                   break;



             case 'embedded' :

                   top.portal_middle_frame.location.href = cgi_fullserverpath () + "/wipo/wipo.cgi?" + local_entry + "&sid=" + cnst_sid() + "&dbid=" + dbid + "&release=" + cnst_release() + "&username=" + username; 
                   break;



             case 'wissensXmaskXportal' :

//                 self.name = "hauptfenster"; 

                   fullpath = navigation_get_portal_root() + '/stat/portal/mainwipo.php?' + local_entry + '&mode=' + submode  + '&sid=' + cnst_sid() +  '&release=' + cnst_release() + '&dbid=' + dbid + '&parm01=' + entry + '&parm02=abc&parm03=abc&parm04=abc&referrer=abc';
                   f1 = open( fullpath,"_blank","menubar=1,location=1,status=1,title=1,scrollbars=1,resizable=1,toolbar=1,"+"width="+width_fix+",height="+height_fix+",screenX="+l+",screenY="+t+",left=" +l+",top="+t);
                   break;


             case 'standalone' :


                   fullpath = cgi_fullserverpath () + "/wipo/wipo.cgi?" + local_entry + "&sid=" + cnst_sid() + "&dbid=" + dbid + "&release=" + cnst_release(); ; 
//                 f1 = open( fullpath,"_blank","menubar=1,location=1,status=1,title=0,scrollbars=1,resizable=1,toolbar=1,"+"width="+width_fix+",height="+height_fix+",screenX="+l+",screenY="+t+",left=" +l+",top="+t);

                   f1 = open( fullpath,"_blank","menubar=1,location=1,status=1,title=0,scrollbars=1,resizable=1,toolbar=1,");

                   break;


             default :

                  alert ( "unbekannter mode '" + mode + "' in  wipo( )" );
                  return;

          } 




}




function wipo_navigation_to_home ( dbid ){




// ----- Filter

         if (!( top.document.all.TopBody )){
                return;
         }





// ----- dbid plausi


         if ( dbid == "" ){

              alert  ( "Fehler beim Aufruf wipo_navigation_to_home() : dbid nicht uebergeben" );
              return;
         }




         if ( dbid != "awd"    &&
              dbid != "poq"    &&
              dbid != "isf"    && dbid != "iwd" &&
              dbid != "qpshop" && dbid != "qpshop_en" &&
              dbid != "qporg"  && dbid != "org"       && 
              dbid != "daf"    && dbid != "das"       &&
              dbid != "bbs"    && dbid != "lit"       &&
              dbid != "villa"  && 
              dbid != "wipo"   ){

              alert  ( "Fehler beim Aufruf wipo_navigation_to_home() : dbid '" + dbid + "' unbekannt" );
              return;
         }




         var local_ConfigLanguage = "";

         if ( top.document.forms[0].ConfigLanguage.value != "#n/a" && top.document.forms[0].ConfigLanguage.value != "" ){

              local_ConfigLanguage = "_" + top.document.forms[0].ConfigLanguage.value;
         }
         else {
              local_ConfigLanguage = "";
         }

         if ( top.document.forms[0].ConfigLanguage.value == "de" ){  // Deutsch ist Standard

              local_ConfigLanguage = "";  
         }


         wipo('embedded','default', dbid, 'HomePage');


         top.portal_left_frame.location.href   = navigation_get_portal_root() + '/dyn/contents/data/wik-504-0002'   + local_ConfigLanguage + '.php?dbid=' + dbid;
         top.portal_right_frame.location.href  = navigation_get_portal_root() + '/dyn/contents/data/wik-504-0003'   + local_ConfigLanguage + '.php?dbid=' + dbid;

}




