/* includes default functions (all non-dreamweaver) for rag-intranet */
/* author: wolfgang.beyer@rohoel.at */

//Linkverwaltung RAG-Intranet 
        function intranetlink(intraneturl){
        switch(intraneturl){
        /*HOMELINK*/
                case "intranethome":
                //window.open("http://localhost/RAG-Intranet"); 
                location.href="http://localhost/RAG-Intranet/index.htm";        
                break;
                default:
                location.href="http://localhost/RAG-Intranet/index.htm";
                break;
        /* DATAMANAGEMENT */
                case "dataman":
                window.open("http://oracle02-wien/uPortal");
                break;
        /* INFRASTRUCTURE */ 
                case "ishome":
                top.location.href="http://coldfusion/RAG-IS-Net";        
                break;
        /* E&P */ 
                case "gewinnungsfelder":
                window.open("http://coldfusion/gewfelder");
                break;         }      
        }


//Linkverwaltung RAG-IS-Net
        function raglink(ragurl){
        switch(ragurl){
        /*Link oeffnen im neuen Fenster = window.open*/
        /*Link oeffnen im Hauptframe = parent.mainFrame.location.href*/
        /*HOMELINK*/
                case "home":
                top.location.href="http://coldfusion";        
                break;
                case "ishome":
                top.location.href="http://coldfusion/RAG-IS-Net";        
                break;
        /*Beginn Links der Startseite*/
        /* MAPPING */
                case "webmap_ooe":
                var mywindow = window.open("http://coldfusion/webmap/");
                mywindow.width = window.screen.width
                mywindow.height = window.screen.height
                break;
                case "webmap_noe":
                window.open("http://coldfusion/webmap/default.asp?meridian=34");
                break;
                case "wienplan":
                window.open("http://www.wien.gv.at/wiengrafik/suche.htm");
                break;
                case "routenplaner":
                window.open("http://www.map24.de");
                break;
                case "doris":
                window.open("http://www.doris.ooe.gv.at/");
                break;
                case "sagis":
                window.open("http://www.land-sbg.gv.at/sagis/");
                break;
        /* PLANWERKZEUGE */
                case "livelink":
                window.open("http://livelnk1.rohoel.at/livelink/livelink.exe");
                break;
                case "motiva":
                parent.mainFrame.location.href="http://coldfusion/RAG-IS-Net/motiva-ersatz.htm";
                break;
                case "planbestellung":
                parent.mainFrame.location.href="http://coldfusion/rag-planbestellung/index.cfm";
                break;
        /* RICHTLINIEN */
                case "richtlinien":
                window.open("http://coldfusion/RAG-Generelle/index.htm");
                break;
                case "cd_bestellung":
                parent.mainFrame.location.href="http://coldfusion/RAG-Generelle/cd_bestellung/cd_form.cfm";
                break;
        /* NORMEN */
                case "normen":
                window.open("http://coldfusion/Normen/index.cfm");
                break;
        /* PROJEKTE */
                case "projektuebersicht":
                parent.mainFrame.location.href="http://coldfusion/RAG-Projekte";
                break;
                case "projektnummern":
                parent.mainFrame.location.href="http://coldfusion/RAG-Nummerngenerator/index.htm";
                break;
        /* DATA */
                case "dataman":
                window.open("http://oracle02-wien/uPortal");
                break;
        /* INFORMATION */
                case "zis":
                window.open("http://ragln03/C12568CD005526C3?OpenDatabase");
                break;
                case "gefahrgut":
                window.open("http://www.giz.at/rag4851");
                break;
                case "newsboard":
                window.open("http://ragln01.rohoel.at/bboards/vienw.nsf");
                break;
                case "mitarbeiter":
                window.open("http://ragln01.rohoel.at/mitarbei.nsf");
                break;
                case "adressen":
                window.open("http://ragln01.rohoel.at/adressen.nsf");
                break;
                case "reservierungen":
                /*window.open("http://ragln01.rohoel.at/reserve.nsf");*/
                window.open("http://ragln01/reserve.nsf/78e7e22e2d5f3cf0c1256bcf004c2fb5?OpenView"); 
                break;
                case "zeiterfassung":
                window.open("http://oracle02-wien:8889/forms90/f90servlet?config=Zeiterfassung"); 
                break;
                case "anwesenheit":
                window.open("http://oracle02-wien/Anwesenheit"); 
                break;
                case "nachrichten":
                parent.mainFrame.location.href="http://coldfusion/RAG-IS-Net/nachrichten.htm";
                break;
         /* BOHRUNGEN */
                case "gewinnungsfelder":
                window.open("http://coldfusion/gewfelder");
                break;
                case "sonden":
                parent.mainFrame.location.href="http://coldfusion/RAG-Sonden";
                break;
                case "sondenooe":
                parent.mainFrame.location.href="http://coldfusion/wells_ooe";
                break;
                case "drillinglivelink":
                window.open("http://livelnk1.rohoel.at/livelink/livelink.exe?func=ll&objId=42738&objAction=browse&sort=name");
                break;
                case "drilling":
                window.open("http://ragln01/PPDrilling.nsf");
                break;
                case "prospect":
                window.open("http://oracle02-wien:8888/PI");
                break;
        /* SHELL */
                case "shell_online":
                window.open("http://sww.shell.com");
                break;
                case "shell_ep":
                window.open("http://sww.siep.shell.com");
                break;
                case "shell_global":
                window.open("http://sww1.epglobal.shell.com");
                break;
                case "shell_step":
                window.open("http://sww.siep.shell.com/step");
                break;
                case "shell_hse":
                window.open("http://sww.siep.shell.com/hse");
                break;
                default:
                parent.mainFrame.location.href="http://coldfusion";
                break;
        /*Ende Links der Startseite*/

        /*Beginn Links der Projektseite*/
                case "projektliste-laufend":
                parent.inhalt.location.href="fertige_projekte.cfm?abschluss=0&id_priori_aktuell=1,2,3,4,6";
                break;
                case "projektliste-fertig":
                parent.inhalt.location.href="fertige_projekte.cfm?abschluss=1&id_priori_aktuell=1,2,3,4,6";
                break;
        /*Ende Links der Projektseite*/
         }
        }
// Breadcrumbs auf RAG-Intranet
        function breadCrumbs(base,delStr,defp,cStyle,tStyle,dStyle,nl) { // by Paul Davis - http://www.kaosweaver.com
                loc=window.location.toString();subs=loc.substr(loc.indexOf(base)+base.length+1).split("/");
                //Originale Codezeile:
                //document.write('<a href="'+getLoc(subs.length-1)+defp+'" class="'+cStyle+'">Home</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');
                //Modifizierte Codezeile:
                 document.write('<a href="'+getLoc(subs.length-1)+'" class="'+cStyle+'">Home</a>'+'<span class="'+dStyle+'">'+delStr+'</span>');
                 a=(loc.indexOf(defp)==-1)?1:2;for (i=0;i<(subs.length-a);i++) { subs[i]=makeCaps(unescape(subs[i]));
                //Originale Codezeile:
                //document.write('<a href="'+getLoc(subs.length-i-2)+defp+'" class="'+cStyle+'">'+subs[i]+'</a>  '+'<span class="'+dStyle+'">'+delStr+'</span> ');}
                //Modifizierte Codezeile:
                document.write('<a href="'+getLoc(subs.length-i-2)+'" class="'+cStyle+'">'+subs[i]+'</a>'+'<span class="'+dStyle+'">'+delStr+'</span>');}
                 if (nl==1) document.write("<br>");document.write('<span class="'+tStyle+'">'+document.title+'</span>');
        }
        
        function makeCaps(a) {
                  g=a.split(' ');for (l=0;l<g.length;l++) g[l]=g[l].toUpperCase().slice(0,1)+g[l].slice(1);
                  return g.join(" ");
        }
        
        function getLoc(c) {
                  var d="";if (c>0) for (k=0;k<c;k++) d=d+"../"; return d;
        }

// Bohrer auf Intranetstartseite verschieben
        ns4 = (document.layers)? true:false;
        ie4 = (document.all)? true:false;
        function move (id, x, y) {
          if (ns4) obj = document.layers[id];
          if (ie4) obj = document.all[id].style;
          obj.xpos = parseInt(obj.left) + parseInt(x);
          obj.ypos = parseInt(obj.top) + parseInt(y);
          obj.left = obj.xpos;
          obj.top = obj.ypos;
        }

//RAG-Intranet-QuickNavigation
        function ragfind(ragurl) {
         if(ragurl == "nothing") {
                document.navigation.reset();
                document.navigation.elements[0].blur();
           return;
         }
        /* Beenden der QuickNavigation  */
        
        //else if(ragurl == "end")
        //   top.location.href = parent.frames[1].location;
         else {
                /* Aufruf des gewaehlten Links */
                raglink(ragurl);
                /* Zurücksetzen der Navigation */
                document.navigation.reset();
                /* Deaktivieren des ersten Navigationseintrages */
                document.navigation.elements[0].blur();
         }
        }

//Bookmark setzen       
        function bookmark() {
        window.external.AddFavorite('http://coldfusion/', 'RAG-Intranet Startseite');
        }

//absolutely positioned scrollable area object scripts 
        /*
        Extension developed by David G. Miles (www.z3roadster.net/dreamweaver)
        Original Scrollable Area code developed by Thomas Brattli 
        To add more shock to your site, visit www.DHTML Shock.com
        */
        
        function verifyCompatibleBrowser(){ 
            this.ver=navigator.appVersion 
            this.dom=document.getElementById?1:0 
            this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
            this.ie4=(document.all && !this.dom)?1:0; 
            this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
         
            this.ns4=(document.layers && !this.dom)?1:0; 
            this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
            return this 
        } 
        bw=new verifyCompatibleBrowser() 
         
         
        var speed=50 
         
        var loop, timer 
         
        function ConstructObject(obj,nest){ 
            nest=(!nest) ? '':'document.'+nest+'.' 
            this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
            this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
            this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
            this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
            this.up=MoveAreaUp;this.down=MoveAreaDown; 
            this.MoveArea=MoveArea; this.x; this.y; 
            this.obj = obj + "Object" 
            eval(this.obj + "=this") 
            return this 
        } 
        function MoveArea(x,y){ 
            this.x=x;this.y=y 
            this.css.left=this.x 
            this.css.top=this.y 
        } 
         
        function MoveAreaDown(move){ 
                if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
            this.MoveArea(0,this.y-move) 
            if(loop) setTimeout(this.obj+".down("+move+")",speed) 
                } 
        } 
        function MoveAreaUp(move){ 
                if(this.y<0){ 
            this.MoveArea(0,this.y-move) 
            if(loop) setTimeout(this.obj+".up("+move+")",speed) 
                } 
        } 
         
        function PerformScroll(speed){ 
                if(initialised){ 
                        loop=true; 
                        if(speed>0) objScroller.down(speed) 
                        else objScroller.up(speed) 
                } 
        } 
         
        function CeaseScroll(){ 
            loop=false 
            if(timer) clearTimeout(timer) 
        } 
        var initialised; 
        function InitialiseScrollableArea(){ 
            objContainer=new ConstructObject('divContainer') 
            objScroller=new ConstructObject('divContent','divContainer') 
            objScroller.MoveArea(0,0) 
            objContainer.css.visibility='visible' 
            initialised=true; 
        } 
        // end absolutely positioned scrollable area object scripts 
        
//Auswahlcheck CDbestellung     
        function CheckSelectCD() {
          if (document.form_cdbestellung.sel_ort.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie einen Lieferort aus der Liste aus!');
                document.form_cdbestellung.sel_ort.focus();
                return false;
                }
        }

//Auswahlcheck Neues Projekt in der Projektuebersicht anlegen   
        function CheckSelectProjekt() {
          if (document.form_neuesprojekt.projekttitel.value == "") {
                alert('Bitte geben Sie einen Projekttitel ein!');
                document.form_neuesprojekt.projekttitel.focus();
                return false;
                }
          if (document.form_neuesprojekt.sel_id_asset.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie ein Asset aus der Liste aus!');
                document.form_neuesprojekt.sel_id_asset.focus();
                return false;
                }
          if (document.form_neuesprojekt.sel_id_bereich.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie einen Bereich aus der Liste aus!');
                document.form_neuesprojekt.sel_id_bereich.focus();
                return false;
                }
          if (document.form_neuesprojekt.projektabschluss.value == "") {
                alert('Bitte geben Sie die KW der gew\u00fcnschten Projektfertigstellung ein (1 - 52)!');
                document.form_neuesprojekt.projektabschluss.focus();
                return false;
                }
          if (document.form_neuesprojekt.sel_projektjahr.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie das Projektjahr aus der Liste aus!');
                document.form_neuesprojekt.sel_projektjahr.focus();
                return false;
                }
          if (document.form_neuesprojekt.user.value == "") {
                alert('Bitte geben Sie einen Auftraggeber ein!');
                document.form_neuesprojekt.user.focus();
                return false;
                }
        }

//Auswahlcheck Planbestellung   
        function CheckSelectPlan() {
          if (document.form_planbestellung.titel.value == "") {
                alert('Bitte geben Sie einen Zeichnungstitel ein!');
                document.form_planbestellung.titel.focus();
                return false;
                }
          if (document.form_planbestellung.sel_planart.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie eine Planart aus der Liste aus!');
                document.form_planbestellung.sel_planart.focus();
                return false;
                }
          if (document.form_planbestellung.sel_feld_sonde.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie ein Feld bzw. eine Sonde aus der Liste aus!');
                document.form_planbestellung.sel_feld_sonde.focus();
                return false;
                }
           if (document.form_planbestellung.sel_projektant.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie einen Projektanten aus der Liste aus!');
                document.form_planbestellung.sel_projektant.focus();
                return false;
                }
           if (document.form_planbestellung.intern_extern.selectedIndex < 1) {
                alert('Bitte w\u00e4hlen Sie eine Firma und einen Ersteller aus der Liste aus!');
                document.form_planbestellung.intern_extern.focus();
                return false;
                }
           if (document.form_planbestellung.ersteller_name.selectedIndex < 1) {
                alert('Bitte w\u00e4hlen Sie einen Ersteller aus der Liste aus!');
                document.form_planbestellung.ersteller_name.focus();
                return false;
                }
       }

//Auswahlcheck Nummerngenerator  
        function CheckSelectNum() {
          if (document.form_add.sel_asset.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie ein Asset aus der Liste!');
                document.form_add.sel_asset.focus();
                return false;
          }
        }

//Auswahlcheck Nummerngenerator  
        function CheckRadioNum(formname) {
                doc=false;
                for (k=0;k<3;k++) {
                if (document.form_add.sel_dokumenttypen[k].checked) doc=true;
                }
                if (!doc){
                alert('Bitte w\u00e4hlen Sie einen Dokumenttyp aus der Liste!');
                event.returnValue=false;
                }
        }
        
//Auswahlcheck Dokumentnummerngenerator  
        function CheckSelect() {
          if (document.dokumentart.sel_doc.selectedIndex <= 1) {
                alert('Bitte w\u00e4hlen Sie eine Dokumentart aus der Liste aus!');
                return false;
          }
        }

//Auswahlcheck Dokumentnummerngenerator  
        function CheckRadio(formname) {
                kom=false;
                for (k=0;k<3;k++) {
                if (document.forms[formname].kom_art[k].checked) kom=true;
                }
                if (!kom){
                alert('Bitte w\u00e4hlen Sie eine Kommunikationsform!');
                event.returnValue=false;
                }
        }
        
        function changeDetail(object) {
          if (document.all[object].style.display == "none")
                document.all[object].style.display = "block";
          else
                document.all[object].style.display = "none";
        }
        
   
// Beginn Script Quickfinder
        function quickfind() {
           if (document.quickform.quickselect.options[document.quickform.quickselect.selectedIndex].value != "")  
           {
                   dieURL = document.quickform.quickselect.options[document.quickform.quickselect.selectedIndex].value.substring(0,document.quickform.quickselect.options[document.quickform.quickselect.selectedIndex].value.length-2);
                   Modus =  document.quickform.quickselect.options[document.quickform.quickselect.selectedIndex].value.substring(document.quickform.quickselect.options[document.quickform.quickselect.selectedIndex].value.length-1,document.quickform.quickselect.options[document.quickform.quickselect.selectedIndex].value.length);
          
                   if (Modus==0) { // Link im gleichen Fenster öffnen
                   parent.location.href=dieURL;
                        }
                   if (Modus==1) { // PopUpFenster1024x768
                   Neufenster = window.open(dieURL,'Fenster','status=yes,scrollbars=yes,width=1024,height=768,location,menubar,toolbar');
                        }
                   if (Modus==3) { // Link im mainframe öffnen
                   parent.mainframe.location.href=dieURL;
                        }                       
         }
        }
//Ende Script Quickfinder;

/* Begin Quickfinder */
                function leapto(form) {
                var myindex=form.subpages.selectedIndex
                parent.mainFrame.location.href=(form.subpages.options[myindex].value);
                // You can output to ANY frame using:  parent.[framename].location.href
                }
/* End Quickfinder */

//Beginn script zum highlighten der zeilen 
        /*
        Highlight Table Cells Script- 
        Last updated: 99/01/21
        © Dynamic Drive (www.dynamicdrive.com)
        For full source code, installation instructions,
        100's more DHTML scripts, and Terms Of
        Use, visit dynamicdrive.com
        */
        function changeto(highlightcolor){
        source=event.srcElement
        if (source.tagName=="TH"||source.tagName=="TABLE")
        return
        while(source.tagName!="TR")
        source=source.parentElement
        if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
        source.style.backgroundColor=highlightcolor
        }
        
        function changeback(originalcolor){
        if (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")
        return
        if (event.toElement!=source)
        source.style.backgroundColor=originalcolor
        }
// Ende script zum highlighten der zeilen

// Maschinengeschriebener Lauftext am Beginn der Generellen Richtlinien
        function YY_Typewriter(yydiv, yytxt, yyto, yycnt) { //v3.03
        //copyright (c)2000,2001 Yaromat.com
         if (document.layers||document.all||document.getElementById){
          if(!yycnt){yycnt=0;
                yytxt = unescape(yytxt);
          }
          yydiv = MM_findObj(yydiv);
          var myInner = "<table width=500><tr><td class=\"schreib\">"+yytxt.substr(0,yycnt++)+"</td></tr></table>";
          if(document.layers){
                yydiv.document.open();
                yydiv.document.write(myInner);
                yydiv.document.close();
          }
          if (document.all||document.getElementById){
                yydiv.innerHTML = myInner;
          }
          if(yycnt>yytxt.length){clearTimeout(yydiv.to)}else{
                yydiv.to = setTimeout("YY_Typewriter('"+yydiv.id+"', '"+yytxt+"', '"+yyto+"', "+yycnt+")", yyto);
          }
         }
        }


//Scrollbalken in Kasten auf Startseite
        function XMObjects(c,s) { //v1.0
                var d=document,a=new Array(c,s);d.obj=new Array();n=(d.all||d.getElementById);e=d.all;
                        for(i=0;i<a.length;i++){d.obj[i]=(n)?MM_findObj(a[i]).style:MM_findObj(a[i]);
                        o=d.obj[i];d.obj[i].x=(!e)?parseInt(o.left):o.pixelLeft;
                        d.obj[i].y=(!e)?parseInt(o.top):o.pixelTop;d.obj[i].w=parseInt(o.width)||o.clip.width;
                        d.obj[i].h=parseInt(o.height)||o.clip.height;}d.px=(n)?"px":"";
        }

        function XMMoveObject(x,y){
                var d=document;if (x!=0) {d.obj[1].x=d.obj[1].x+x;d.obj[1].left=d.obj[1].x+d.px;}
                if (y!=0) {d.obj[1].y=d.obj[1].y+y;d.obj[1].top=d.obj[1].y+d.px;}
                m=d.obj[1];o=d.obj[0];XMSlide=(m.x<o.w&&m.x>-m.w&&m.y<o.h&&m.y>-m.h)?
                setTimeout("XMMoveObject("+x+","+y+")",50):setTimeout("XMMoveObject(0,0)",50)
        }


