// this script writes the non-static breadcrumbs
function writeBreadcrumbs(){
var path = "";
var href = document.location.href;
var s = href.split("/"); 
// a string is not allowed to appeare twice identically in the url, otherwise the script doesen't work
// properly, because of "indexOF(), compare: http://www.pageresource.com/jscript/jstring1.htm

for (var i=2;i<(s.length-1);i++) {
  // dont't show paths a la "500_doc_something_0000-00-00_vom"  oder "sammlungen"
  var tempArray = s[i].split("_");
  tempArray[0] = eval(tempArray[0] * 1);
  if((tempArray[0] < 1000) && (tempArray[0] > 0)){;}
  else{
    // show normal paths
    path+="<A target=\"_self\" HREF=\""+href.substring(0,href.indexOf(s[i])+s[i].length)+"/\">"+s[i]+"</A>/";
  }
}
i=s.length-1;
path+="<A target=\"_self\" HREF=\""+href.substring(0,href.indexOf(s[i])+s[i].length)+"\">"+s[i]+"</A>";
var url = window.location.protocol + "//" + path;
document.writeln(url);
}

function writeTitle(){

  var href  = document.location.href;
  var s     = href.split("/");
  var folder = s[s.length-2];
  var name = s[s.length-1];
  
  // works for new blank pages for both netscpe and explorer
  document.write("<title>birdy1976.com :: Martin Vögeli :: Homo Faber :: Multimedia :: Texte</title>");

  var documentTitle = "birdy1976.com :: " + folder + " :: " + name;

  // works only with the internet explorer (also for framesets)
  parent.document.title = documentTitle;
}

//KONSTANTEN

// bugs:
// - netscape 6: input field
// - opera: image-link with black border instead of blue

//Definition of the possible levels

//  URL-Context            numbered    and     unnumbered File-Context

var fileLevel            = ownerLevel        = zeroLevel    = 0;
var folderLevel          = nameLevel         = firstLevel   = 1;
var subChapterLevel      = typeLevel         = seccondLevel = 2;
var chapterLevel         = orderLevel        = thirdLevel   = 3;

//Defintion of the possible delimiters

var hyphenDelimiter      = '-';
var pointDelimiter       = '.';
var slashDelimiter       = '/';
var underscoreDelimiter  = '_';
var numberSignDelimiter  = '#';

//General Errorcode Value
var undefinedOrError   //= undefined;

//*****************
//GENERAL FUNCTIONS
//*****************

function getLabel(string, level, delimiter){
  
    var s = string.split(delimiter);
    return  s[s.length-1-level];
}

//###########################
//NEW KONSTANTS AND FUNCTIONS
//###########################

function openInNewWindow(URL, windowName, height, width, features){

  features += ",height=" + height + ",innerHeight=" + height;
  features += ",width="  + width  + ",innerWidth="  + width;

  if(window.screen){
    var ah = screen.availHeight - 30; var yc = (ah - height) / 2;
    var aw = screen.availWidth  - 10; var xc = (aw - width)  / 2;

    features += ",left=" + xc + ",screenX=" + xc;
    features += ",top="  + yc + ",screenY=" + yc;
  }
  var newWindow = window.open(URL, windowName, features);
  // for internet explorer bug
  newWindow.resizeTo(width, height); 
  newWindow.moveTo(xc, yc); 
  newWindow.focus(); 
  return newWindow;
}

//Call of onClickChangeImage-function: example HTML-code
//<a href="JavaScript:onClickChangeImage('randimg', '2.jpg')"><img name="randimg" src="../_scripting/sisy-Dateien/1.jpg" width=120 height=90></a>

function onClickChangeImage(nameOfImgTag, onClickChangeImage){

  document.images[nameOfImgTag].src = onClickChangeImage;

  //Changes the alt-attribute. Doesn't work with Netscape.
  if(navigator.appName == "Microsoft Internet Explorer"){
    document.images[nameOfImgTag].alt = "Lass das - Du hast mich schon angeklickt!";
  }
}

function writeFooter(){
  var footerText1 = ("<p class='footerText'><a href='mailto:sisy@zhwin.ch'>sisy@zhwin.ch</a>, ");
  var myDate = new Date (document.lastModified);
  var temp = myDate.getDate() + ". " + (myDate.getMonth() + 1) + ". " + myDate.getFullYear();
//  document.writeln("<p class='footerText'>" + temp + " </p>");
  footerText1 = footerText1 + myDate.getDate() + ". " + (myDate.getMonth() + 1) + ". " + myDate.getFullYear() + "</p>";
//  document.write("<p class='footerText'><a href='mailto:vom@zhwin.ch'>vom@zhwin.ch</a>, </p>");
  document.write(footerText1);
}

function writeWebmasterMailAdress(){
  document.write("<a href='mailto:sisy"+"@"+"zhwin.ch'>sisy"+"@"+"zhwin.ch</a>");
}

// 2003/04/26

function changeTargetBlankLinkText(){
  var flagIE4 = document.all;
  var flagNN6 = document.getElementById && !document.all;
  if((flagIE4 || flagNN6) && (document.getElementsByTagName("a").length < 250)){
    for(var i = 0; i < document.getElementsByTagName("a").length; i++){
      if(document.getElementsByTagName("a")[i].target == "_blank"){
        // check if link has a text -> is not <a></a>
        if(document.getElementsByTagName("a")[i].firstChild){
          var myNode = document.getElementsByTagName("a")[i].firstChild;
          if(typeof myNode.nodeValue == "string"){
            // check if there is not a manually added "+" at the end...
            if(myNode.nodeValue.charAt(myNode.nodeValue.length-1)!="+"){
              myNode.nodeValue += "+";
            }
          }
        }//else{alert("Error! There is an empty <a></a> in this document.");}
      }
    }
  }
}

function onLoadDefault(){
  changeTargetBlankLinkText();
}

// overwrite in page
function onLoadCustom(){var intTest20030426 = 1976;}

// split
function searchGoogleGroups(){
  // split e.g. [http: | "" | birdy1976.com | 2003 | mailto.html]
  var arrURL = document.location.href.split("/");
  // split, e.g. [mailto | html]
  var arrDoc = arrURL[arrURL.length-1].split(".");
  // get the name of the document, e.g. mailto
  var strDoc = arrDoc[0];
  var strURL = "http://groups.google.ch/groups?q=" +
    "birdy1976+" + strDoc;
  window.open(strURL);
}


// Google Analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-11301618-1']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();