var DEBUG= 0;
var iINF = 1;
var iWRN = 2;
var iERR = 3;
var slogs= "";

var dSiteBegin       = new Date();
var adSiteOnLoadBegin= new Array();
var dSiteOnLoadBegin = null;
var searchValue="";
var expandedValue="";
var g_topWindowName;
var lastPopUpFrame;
var lastPopUp;
var lastStart;

/**
 * @author mf
 * @return true if browser is ie7
 */
function isIE7() {
	return navigator.appVersion.indexOf("MSIE 7.") != -1;
}

/**
 * @author mf
 * @return true if browser is ie8
 */
function isIE8() {
	return navigator.appVersion.indexOf("MSIE 8.") != -1;
}

/**
 * Legacy Wrapper  
 * @author MR
 */
function printDoc() {	
	printDocWithID('documentwindow');
}

/**
 * Prints currently showed document from iframe. prevents shrink to fit 
 * @author *, mf
 */
function printDocWithID(iframeID) {	
	// to prevent shrink to fit in ie7 & 8 a 'slightly' different function call is needed to print the iframe content.
	if (isIE7() || isIE8()) {
		// fetch the showed document of the iframe
		var iFrameDoc = document.getElementById(iframeID).contentWindow.document;
		
		// the print function must be in the context of the iframe document
		iFrameDoc.executePrint = function executePrint(iFrameDoc) {
			iFrameDoc.focus(); 
			// this call instead of .print() is needed to prevent shrink to fit!
			iFrameDoc.execCommand('print', false, null);
		}
		// call the special print method from iframe document context
		document.getElementById(iframeID).contentWindow.document.executePrint(iFrameDoc);
	} else {
		frames[iframeID].focus();
		frames[iframeID].print();
	}		
}

/**
 * Prints self. prevents shrink to fit 
 * @author *, mf
 */
function printDocSelf() {
	self.focus();
	// to prevent shrink to fit in ie7 & 8 a 'slightly' different function call is needed to print.
	if (isIE7() || isIE8()) {
		// this call instead of .print() is needed to prevent shrink to fit!
		document.execCommand('print', false, null);
	} else {
		// normal print call for firefox browser and others.
		self.print();
	}		
}

/**
 * Oeffnet einen Layer
 * @param popId
 * @param framepopId
 * @param start
 * @param startDistance, Abstand von start Element
 */
function popUp(popId,framepopId,start,startDistance,posLeft) {
 	//Letze geöffnete Fenster schliessen
 	if (lastPopUpFrame != null && lastPopUp != null && lastStart != null)
 	{
 	  if (lastPopUpFrame != framepopId && lastPopUp != popId )
 	  {
 	        dojo.lfx.implode(lastPopUp, lastStart, 500).play();
            dojo.lfx.implode(lastPopUpFrame, lastStart, 500).play();
            //shiFadeElementIn('documentwindow');<-- macht Probleme bei der PDF anzeige
      }
 	} 
   
    var newLeftPosition;
    var popDivElement = document.getElementById(popId);
    var windowWidth = getWindowWidth();
    var newTopPosition = getPosTop(start) + startDistance+"px"
    var popDivElementWidth = popDivElement.style.width.replace("px","");
    var iPosLeftStart = getPosLeft(start);
    
    if (iPosLeftStart < 1)
    	iPosLeftStart = document.all ? (document.documentElement.clientWidth  ? document.documentElement.clientWidth  : document.body.clientWidth)  : window.innerWidth;

    if (posLeft == 'r')
    {
    	
       posLeft = windowWidth - iPosLeftStart - popDivElementWidth;
       newLeftPosition = iPosLeftStart + posLeft + "px";
    }
    else if (posLeft == 'c')
    {
    	// centered
    	newLeftPosition = ((windowWidth - popDivElementWidth)/2) + "px";
    }
    else
    {
       newLeftPosition = iPosLeftStart - posLeft + "px";
    }
    
	popDivElement.style.top  = newTopPosition;
    popDivElement.style.left = newLeftPosition;

	var popupDivIframeS = document.getElementById(framepopId);
	
	popupDivIframeS.style.top = newTopPosition;
	popupDivIframeS.style.left= newLeftPosition;
	
	if(popDivElement.style.display=='none')
	{
            dojo.lfx.explode(start,framepopId, 500).play();
            dojo.lfx.explode(start,popId, 500).play();
            //shiFadeElementOut('documentwindow');<-- macht Probleme bei der PDF anzeige
            lastStart=start;
            lastPopUpFrame=framepopId;
            lastPopUp=popId;
	}
	else
	{
            implode(popId,framepopId,start);
            lastStart=null;
    		lastPopUpFrame=null;
    		lastPopUp=null;
	}
 }

/**
* Last den letzten Layer
*/ 
function implodeLast(){
   if (lastPopUpFrame != null && lastPopUp != null && lastStart != null){
         implode(lastPopUp,lastPopUpFrame,lastStart);
         lastStart=null;
    	 lastPopUpFrame=null;
    	 lastPopUp=null;
      }
} 

/**
*Klappt layer zusammen
*/
function implode(popId,framepopId,start)
{
    if(typeof onimplode == 'function')
		onimplode(true);

    dojo.lfx.implode(popId, start, 500).play();
    dojo.lfx.implode(framepopId, start, 500).play();
    shiFadeElementIn('documentwindow');
    
    if(typeof onimplode == 'function')
		onimplode(false);    
} 

function getCookie(cookieName) {
    if(!cookieName)
        return null;

    var cookie = document.cookie;
    if(!cookie)
        return null;

    var cookies = cookie.split(";");

    for(var i = 0; i < cookies.length; i++) {
        cookies[i] = cookies[i].replace(/^ /, "");
        if(cookies[i].length < cookieName.length + 1)
            continue;

        if(cookies[i].toLowerCase().substring(0,cookieName.length + 1) == (cookieName.toLowerCase() + "="))
            return cookies[i].substring(cookieName.length + 1);
    }

    return null;
}


var cookie = getCookie('shiColumnRightWidth');
var notesMarginalID="";

if (cookie !=null && cookie < 144) {
     notesMarginalID="docColumnStartHidden";
} else {
     notesMarginalID="docColumnStart";
}




function notesMarginalChange(id){
    notesMarginalID=id;
}

function getExpandedSearchText(){
  return this.expandedValue;
}

function setExpandedSearchText(text){
  this.expandedValue=text;
}

function getSearchText(){
  return this.searchValue;
}

function setSearchText(text){
  this.searchValue=text;
}
function setSearchTextOnLoad(){
  var searchField = document.getElementById('panelForm:inputFullTextHidden');
  if (searchField  == null)
    searchField = document.getElementById('panelForm:inputFullTextExtendedHidden');
  if (searchField  == null)
    searchField = document.getElementById('panelForm:inputFullText');
  if (searchField  == null)
    searchField = document.getElementById('panelForm:inputFullTextExtended');
  if (searchField != null)
    this.searchValue=searchField.value;

    // workaround for jetty umlaut problems
    var searchFieldNotHidden = document.getElementById('panelForm:inputFullText');
    if(searchFieldNotHidden == null)
        searchFieldNotHidden = document.getElementById('panelForm:inputFullTextExtended');
    if(searchFieldNotHidden != null && searchField != null)
        searchFieldNotHidden.value = searchField.value;
}


function timestamp(s)
{
    this.s = s;
    this.d = new Date();
}
function onbeginonload(s)
{
    if(adSiteOnLoadBegin.length < 1)
        dSiteOnLoadBegin = new Date();
    adSiteOnLoadBegin.push(new timestamp(s));
}

function onendonload()
{

    var endload = new Date();
    var diff    = new Date();
    var s = "";

    for(i=0; i < adSiteOnLoadBegin.length; i++)
    {
        if(i==0)
            s += ("dauer:\t"+((adSiteOnLoadBegin[i].d) - dSiteBegin)+"\t("+i+")\t("+adSiteOnLoadBegin[i].s+")\n");
        else
            s += ("dauer:\t"+((adSiteOnLoadBegin[i].d) - (adSiteOnLoadBegin[i-1].d))+"\t("+i+")\t("+adSiteOnLoadBegin[i].s+")\n");
        /*
        diff.setTime(Math.abs(endload.getTime() - (adSiteOnLoadBegin[i]).getTime()));
        var timediff = diff.getTime();
        weeks = Math.floor(timediff / (1000 * 60 * 60 * 24 * 7));
        timediff -= weeks * (1000 * 60 * 60 * 24 * 7);
        days = Math.floor(timediff / (1000 * 60 * 60 * 24));
        timediff -= days * (1000 * 60 * 60 * 24);
        hours = Math.floor(timediff / (1000 * 60 * 60));
        timediff -= hours * (1000 * 60 * 60);
        mins = Math.floor(timediff / (1000 * 60));
        timediff -= mins * (1000 * 60);
        secs = Math.floor(timediff / 1000);
        timediff -= secs * 1000;
        s += (mins + " minutes til siteonloadbegin("+i+")\n" + secs + " seconds til siteonloadbegin("+i+")\nrest:"+timediff+" til siteonloadbegin("+i+")\n");
        */
    }
    //s += ("dauer: "+(endload - dSiteOnLoadBegin)+" (onload-dauer)\n");
    s += ("dauer:\t"+(endload - dSiteBegin)+"\t(site-lade-dauer-summe gesamt)");

    alert(s);
}
function selectHitListDropDownAction(selectElement)
{
    selectElement.form.submit();
    //if(selectElement.value==1)
}
function removesessionid(s)
{
    return s.replace(/;jsessionid=\w+/gi, "");
}
function getDocRelUrl()
{
    if(trim(getparam("xsltfilename", getelement("documentwindow").src)) != "")
    {
        return getparam("xsltfilename", getelement("documentwindow").src);
    }
    var sMyPath = getpath(self.location.href)+"/";
    var sDocUrl = getelement("documentwindow").src;
    sDocUrl = sDocUrl.replace(sMyPath, "");
    sMyPath = getpath(getpath(self.location.href))+"/";
    return removesessionid(sDocUrl.replace(sMyPath, ""));
}

function doSHIDownload(sUrl){
    var body = document.getElementsByTagName("body")[0];
    var ifr  = document.createElement("iframe");
    ifr.height = "0";
    ifr.width = "0";
    body.appendChild(ifr);
    ifr.src = sUrl;
}

function doSHIBinaryDownload(sAbsoluteFilePath){
    var body = document.getElementsByTagName("body")[0];
    var ifr  = document.createElement("iframe");
    ifr.height = "0";
    ifr.width = "0";
    body.appendChild(ifr);
    ifr.src = "./binary.load?binaryPath=" + escape(sAbsoluteFilePath);
}

function doSHIHTMLPrint(sAbsoluteFilePath){
    var body = document.getElementsByTagName("body")[0];
    var ifr  = document.createElement("iframe");
    ifr.height = "0";
    ifr.width = "0";
    body.appendChild(ifr);
    ifr.src = "./binary.load.html?binaryPath=" + escape(sAbsoluteFilePath);
}

function selectDocumentAction(selectElement, sISBN, sFN, sAli, sAnchor, sTitle,sDocType)
{
    if(selectElement.value.toLowerCase() == "pdf")
    {
        openFeatPopup(12, './weka/static/wmhtml2pdf.jsp?fn='+getDocRelUrl()+"&isbn="+sISBN+"&alias="+sAli+"&anchor="+sAnchor+"&doctype="+sDocType+"&title="+sTitle+"#"+sAnchor, 'pdf2html', 'dependent=yes,width=400,height=400,resizable=yes,scrollbars=yes,menubar=no,status=yes');
        return false;
    }
    if((selectElement.value.toLowerCase() == "favourite") || (selectElement.value.toLowerCase() == "favourites"))
    {
        openFeatPopup(12, './weka/static/wmfavourites.html?fn='+getDocRelUrl()+"&isbn="+sISBN+"&alias="+sAli+"&anchor="+sAnchor+"&doctype="+sDocType+"&title="+sTitle+"#"+sAnchor, 'favourites', 'dependent=yes,width=700,height=200,resizable=yes,scrollbars=yes,menubar=no,status=yes');
        return false;
    }
    //Do nothing
    if(selectElement.value==1)
    {
        return;
    }

    //Print it
    if(selectElement.value==2)
    {
        if(frames['documentwindow'].location.href.toLowerCase().indexOf("q=") > 0)
        {
            var sUrl = setparam(frames['documentwindow'].location.href, "q","");
            sUrl = setparam(sUrl, "printyourself","1");
            doSHIDownload(sUrl);
            return;
        }
        frames['documentwindow'].focus();
        frames['documentwindow'].print();
        selectElement.value=1;
        return;
    }

    //Send it as PDF
    if(selectElement.value==3)
    {
        document.forms['documentSelected'].submit();
        selectElement.value=1;

    }

    //Add to Favorites
    if(selectElement.value==4)
    {
        document.forms['documentSelected'].submit();
        selectElement.value=1;
    }
}

function selectTreeFilterAction(selectElement){
    document.forms['outlookform'].submit();

    }





function getelement(sValue)
{
    var getElementx = document.getElementById(sValue);
    if (getElementx == null)
    {
        getElement1x = document.getElementsByName(sValue);
        if (getElement1x.length == 0)
            return null;
        getElementx = getElement1x[0];
    }
    return getElementx;
}

function spezialSearchPopUp(start)
{
    alert("is in");
        var implodeDiv = document.getElementById('exps');
    var popupDivSps = document.getElementById('sps');
    popupDivSps.style.top = getPosTop(start)+23;
    popupDivSps.style.left = getPosLeft(start)-581;

        var popupIframe = document.getElementById('frameSps');
    popupIframe.style.top = getPosTop(start)+25;
    popupIframe.style.left = getPosLeft(start)-581;

        if(implodeDiv.style.display!='none')
        {
            dojo.lfx.implode("exps",start, 500).play();
            dojo.lfx.implode("frameExps", start, 500).play();
        }
    if(popupDivSps.style.display=='none')
    {
            dojo.lfx.explode(start,"frameSps", 500).play();
            dojo.lfx.explode(start,"sps", 500).play();
    }
    else
        {
            dojo.lfx.implode("sps", start, 500).play();
            dojo.lfx.implode("frameSps", start, 500).play();
    }
        //Spez_WebNG_V1.0.pdf, page 12:
        //>>Whlt der Nutzer erneut die erweiterte Suche, so sollen die einzelnen Felder so
        //>>erscheinen, wie dies per default definiert ist;
        //var ofrm = getelement("expandedsearchform");
        //if (ofrm)   ofrm.reset();
}

function getElementsByClassName(myName){
    var CONTROLS = ["TABLE", "A"];
    var result = [];
    var searchExpression = new RegExp( "\\b" + myName + "\\b" );
    for (var i = 0; i < CONTROLS.length;i++)
    {
     var objects = document.getElementsByTagName(CONTROLS[i]);
     for (var j = 0; j < objects.length;j++) {
         if (objects[j].className.match(searchExpression)) {
             result.push(objects[j]);
         }
     }
    }
    return result;
}


//*** Scroll the Div to the selected Treenode ***
function shiJump2searchword(styleClassTarget, elementId, iScrollTop)
{
    var classElemets = getElementsByClassName(styleClassTarget);
    if(classElemets[0] == null) return;

    classElemets[0].scrollIntoView(true);
    var divTreeElement = document.getElementById(elementId);
    if (divTreeElement == null) return;

    if(iScrollTop > 0 && divTreeElement.scrollTop>iScrollTop)
        divTreeElement.scrollTop = divTreeElement.scrollTop-iScrollTop;

    divTreeElement.scrollLeft = '0px';
}

function scrollIntoViewIfNecessary(elementId) {
	
	var element = document.getElementById(elementId);
	if(element == null) {
		return;
	}
	
	if(isScrolledIntoView(elementId)) {
		return;
	}
	
	element.scrollIntoView(true);
}

function isScrolledIntoView(elementId) {
    var elt = document.getElementById(elementId);
    if (!elt) {
        // Element not found.
        return false;
    }
    // Get the top and bottom position of the given element.
    var posTop = getPosTop(elt);
    var posBottom = posTop + elt.offsetHeight;
    // Get the top and bottom position of the *visible* part of the window.
    var visibleTop = document.body.scrollTop;
    var visibleBottom = visibleTop + document.documentElement.offsetHeight;
    return ((posBottom >= visibleTop) && (posTop <= visibleBottom));
}

function resizeRow(thisElement)
{
    thisElement.style.cursor='e-resize';
    setResizeColumns(
        thisElement,
        thisElement,
        thisElement
    );
}


//*** Helpfunctions ****

function getPosLeft(element)
{
	if(typeof(element) == "string")
		element = document.getElementById(element);
	if(element == null)
		return 0;

    var el = element;
    var posL = 0;
    var stri =element.id+"\n";
    while(el)
    {
    	stri=stri+"ID: "+el.id+"Type: "+el.tagName+", Left: "+el.offsetLeft+"\n";
        posL += el.offsetLeft;
        el = el.offsetParent;
    }
   // alert(stri);

    return posL;
}

function getPosTop(element)
{

	if(typeof(element) == "string")
		element = document.getElementById(element);
	if(element == null)
		return 0;

    var el = element;
    var posTop = 0;
    while(el)
    {
        posTop += el.offsetTop;
        el = el.offsetParent;
    }
    return posTop;
}

/**
* Gibt die Breite von dem Fenster zurueck
*/
function getWindowWidth(){
 if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }

}

function getWindowHeight() {
	if (window.innerHeight) {
		return window.innerHeight;
	} else if (document.body && document.body.offsetHeight) {
		return document.body.offsetHeight;
	} else {
		return 0;
	}
}

function getFormElementFromType(frm, sType)
{
    if(frm == null) return null;
    sType = sType.toLowerCase();
    var iElems = frm.elements.length;
    var i=0;
    for(i=0; i < iElems; i++)
    {
        if(frm.elements[i].type.toLowerCase() == sType)
            return frm.elements[i];
    }
    return null;
}
function getFormElement(frm, s)
{
    if(frm == null) return null;
    s = s.toLowerCase();
    var iElems = frm.elements.length;
    var i=0;
    for(i=0; i < iElems; i++)
    {
        if(frm.elements[i].name.toLowerCase() == s)
            return frm.elements[i];
        if(frm.elements[i].name.toLowerCase().indexOf(":"+s) > -1)
            return frm.elements[i];
    }
    return null;
}
function onChangeListCH(checkbox, sList)
{
	elem = getFormElement(checkbox.form, sList);
	if(!elem)   
		return;
	if(checkbox.checked == true)
		changeCheckedState(elem.id, true);
	else
		changeCheckedState(elem.id, false);
}

function changeCheckedState(listBoxId, selected)
{
    elem = document.getElementById(listBoxId);
    if(!elem)   return;
    var iOpts = elem.options.length;
    var i=0;
    for(i=iOpts-1; i >=0; i--)
    {
        elem.options[i].selected = selected;
    }
}

function selectAllInListBox(listBoxId)
{
    elem = document.getElementById(listBoxId);
    if(!elem)   return;
    var iOpts = elem.options.length;
    var i=0;
    for(i=iOpts-1; i >=0; i--)
    {
        elem.options[i].selected = true;
    }
}

function expandedsearch_onsubmit_checkuserentry(elem, bDoSubmit)
{
    setSearchText("");

    elem = getFormElement(elem.form == null ? elem : elem.form, "text");
    if((elem != null) && (elem.value == ""))
    {
        if(bDoSubmit)alert("Tragen Sie einen Suchbegriff ein!");
        return false;
    }
    if(!bDoSubmit)
    {
        //var frm = ((elem.form == null) ? elem : elem.form);
        //alert("ok.1-->!submitform:"+frm.name);
        return true;
    }
    var frm = ((elem.form == null) ? elem : elem.form);
    //alert("ok.2-->submitform:"+frm.name);
    frm.submit();
    return false;
    var sbmt = getFormElementFromType(elem.form == null ? elem : elem.form, "submit");
    sbmt.focus();
    sbmt.click();
    return false;
    getFormElementFromType(elem.form == null ? elem : elem.form, "submit").click();
    var bRe = expandedsearchform_submit_clicked;
    expandedsearchform_submit_clicked = true;
    alert(bRe);
    return bRe;
}
function openFeatPopup(n, src, name, sFeatures, bBigPopup)
{
  try
  {
   if((sFeatures == null) || (sFeatures == ""))
       sFeatures = "dependent=yes,width=480,height=650,resizable=yes,menubar=no,status=yes";
    name = name.replace("-", "_");

    src = src.replace(/String.fromCharCode(228)/g, "%e4");	//auml
    src = src.replace(/String.fromCharCode(246)/g, "%f6");
    src = src.replace(/String.fromCharCode(252)/g, "%fc");
    src = src.replace(/String.fromCharCode(223)/g, "%df");
    src = src.replace(/String.fromCharCode(196)/g, "%C4");
    src = src.replace(/String.fromCharCode(214)/g, "%D6");
    src = src.replace(/String.fromCharCode(220)/g, "%DC");

    win = window.open(src, name, sFeatures);

//    if(bBigPopup == true)
//        win.moveTo(300,5);
//    else
//        win.moveTo((screen.width/2)-300,(screen.height/2)-374);
    win.focus();
   }
   catch(e)
   {

   }
}
function removeparams(sUrl)
{
    var iPR = sUrl.indexOf('#');
    var iPQ = sUrl.indexOf('?');
    var iP = (iPR < 1) ? iPQ : iPR;
    if (iPQ > -1 && iPQ < iPR)
        iP = iPQ;
    if (iP < 0)  return sUrl;
    return sUrl.substring(0, iP);
}
function removeanchor(sUrl)
{
    var iPR = sUrl.indexOf('#');
    if (iPR < 0)  return sUrl;
    return sUrl.substring(0, iPR);
}
function getpath(sUrl)
{
    sUrl = removeparams(sUrl);
    var iLastSlash = sUrl.lastIndexOf('/');
    if (iLastSlash < 1)
    return sUrl;
    return sUrl.substring(0,iLastSlash);
}
function trim(sTxt)
{
  if(sTxt == null) return "";
  return sTxt.replace(/^\s*|\s*$/g,"");
}
function getfilename(sUrl)
{
    sUrl = removeparams(sUrl);
    var iC = sUrl.indexOf(';');
    if (iC > 0)
    {
        sUrl = sUrl.substring(0,iC);
    }
    var iLastSlash = sUrl.lastIndexOf('/');
    if (iLastSlash < 1)
    return sUrl;
    return sUrl.substring(iLastSlash+1);

}
function getextension(sUrl)
{
    sUrl = getfilename(sUrl);
    var iDot = sUrl.lastIndexOf('.');
    if (iDot < 1)
    return "";
    return sUrl.substring(iDot+1);
}
function setElementText(oElem, sTxt)
{
    if(!oElem)
    {
        dbg(iERR, "setElementText.ERR.0\n"+oElem+"\ntxt:"+sTxt);
        return false;
    }
    if(!sTxt)   sTxt = "";
    if(sTxt == "")  sTxt = " ";
    if (oElem.nodeValue)
    {
        //dbg(iINF, "setElementText.ok.1\n"+oElem+"\ntxt:\""+sTxt+"\"\nfirstchild:"+oElem.firstChild+"==>child.nodeval:"+((oElem.firstChild==null) ? "null" : oElem.firstChild.nodeValue)+"\ninnertxt:"+oElem.innerText+"\n"+oElem.nodeValue);
        oElem.nodeValue = sTxt;
        return true;
    }
    if (oElem.firstChild/* && oElem.firstChild.nodeValue*/)
    {
        //dbg(iINF, "setElementText.ok.2\n"+oElem+"\ntxt:\""+sTxt+"\"\nfirstchild:"+oElem.firstChild+"==>child.nodeval:"+((oElem.firstChild==null) ? "null" : oElem.firstChild.nodeValue)+"\ninnertxt:"+oElem.innerText+"\n"+oElem.nodeValue);
        oElem.firstChild.nodeValue = sTxt;
        return true;
    }
    if (oElem.innerText)
    {
        oElem.innerText = sTxt;
        return true;
    }
    dbg(iERR, "setElementText.ERR.1\n"+oElem+"\ntxt:\""+sTxt+"\"\nfirstchild:"+oElem.firstChild+"==>child.nodeval:"+((oElem.firstChild==null) ? "null" : oElem.firstChild.nodeValue)+"\ninnertxt:"+oElem.innerText+"\n"+oElem.nodeValue);
    return false;
}
function setparam(sHref, sParam, sValue)
{
    if ((sParam == "") && (sValue == ""))
        return sHref;

    var iRaute = sHref.indexOf("#");
    if(iRaute == 0)
        return sHref;

    var sAnchor="";
    if(iRaute > 0)
    {
        sAnchor = sHref.substring(iRaute+1);
        sHref = sHref.substring(0, iRaute);
    }

    if (sValue == "")
        sHref = sHref.replace(sParam + "=" + getparam(sParam, sHref), "");
    else
    {
        // Get current Param
        var sParamNow = getparam(sParam, sHref);

        // Get limiter
        var limiter = "&";
        if (sHref.indexOf("?") < 0)
            limiter = "?";

        // Return URL with Param set
        if(sHref.indexOf(sParam + "=") > -1)
        {
            sHref = sHref.replace(sParam + "=" + sParamNow, sParam + "=" + sValue);
        }
        else
        {
            sHref = sHref + limiter + sParam + "=" + sValue;
        }
    }
    return sHref+"#"+sAnchor;
}
function getparam(sParName, sSearch)
{
    var iFr = sSearch.indexOf('?');
    if(iFr > -1)
        sSearch = sSearch.substring(iFr+1, sSearch.length);
    var parsarray = sSearch.split('&');
    var i=0;
    for(i=0; i < parsarray.length; i++)
    {
        var par = parsarray[i];
        var pararray = par.split('=');
        if((pararray.length == 2) && (pararray[0].toLowerCase() == sParName.toLowerCase()))
            return pararray[1];
    }
    return "";
}
function selectFavouritesDropDownAction(elem)
{
    if(elem.value == "")    return;
    elem.form.submit();
    //hinzugefürgt von Sattler Natalia. Wenn in der Aktionsliste ein element gewählt wird, so wird nach der aktionsbearbeitung wieder standart wert (index=0) gewählt
    elem.selectedIndex = 0;
}

function selectFavouritesDropDownActionNew(elemId)
{
	var elem= document.getElementById(elemId);
//    if(elem.value == "")    return;
//    elem.form.submit();
    //hinzugefürgt von Sattler Natalia. Wenn in der Aktionsliste ein element gewählt wird, so wird nach der aktionsbearbeitung wieder standart wert (index=0) gewählt
    elem.selectedIndex = 0;
}

function unselectlistitems(frm)
{
    if(frm == null) return;
    for(var i=0; i < frm.elements.length; i++)
    {
        if(frm.elements[i].type.toLowerCase() == "text")
        {
            frm.elements[i].value = "";
            continue;
        }
        if((frm.elements[i].type.toLowerCase() != "select-multiple") && (frm.elements[i].type.toLowerCase() != "select-one"))
            continue;
    for(var j=0; j < frm.elements[i].options.length; j++)
        {
            frm.elements[i].options[j].selected = false;
        }
    }
}

function selectListItemsCheckBoxes(frm)
{
    if(frm == null) return;
    for(var i=0; i < frm.elements.length; i++)
    {
        if(frm.elements[i].type.toLowerCase() == "text")
        {
            frm.elements[i].value = "";
            continue;
        }
        if(frm.elements[i].type.toLowerCase() == "checkbox")
        {
            frm.elements[i].checked = false;
            frm.elements[i].click();
            continue;
        }
        if((frm.elements[i].type.toLowerCase() != "select-multiple") && (frm.elements[i].type.toLowerCase() != "select-one"))
            continue;

     for(var j=frm.elements[i].options.length-1; j >= 0; j--)
        {
            frm.elements[i].options[j].selected = true;
        }
    /**for(var j=0; j < frm.elements[i].options.length; j++)
        {
            frm.elements[i].options[j].selected = true;
        }*/

    }
}

function selectCols(frm,selectOption)
{

    if(frm == null) return;
    for(var i=0; i < frm.elements.length; i++)
    {
        if(frm.elements[i].type.toLowerCase() == "text")
        {
            frm.elements[i].value = "";
            continue;
        }
        if(frm.elements[i].type.toLowerCase() == "checkbox")
        {
            frm.elements[i].checked = true;
            continue;
        }
        if((frm.elements[i].type.toLowerCase() != "select-multiple") && (frm.elements[i].type.toLowerCase() != "select-one"))
            continue;

    for(var j=frm.elements[i].options.length-1; j >= 0; j--)
        {
        if (frm.elements[i].options[j].value.toLowerCase() == selectOption)
            frm.elements[i].options[j].selected = true;
        }

    }
}

function cssRule(target,attrib,value) {
 // Lokale Variable definieren
 var s=0, r=0, i, result=false, clipper, sheetNo=NaN, startSheetNo, endSheetNo, mediaType, unifiedSelectorText, complete, write;
 var sheetObj=false, ruleColl=false, ruleObj=false, styleObj=false, ownerObj=false, rulePointer="", sheetIndex=NaN;

 // Kein Ziel uebergeben: Test, ob Zugriff ueberhaupt technisch moeglich ist
 if(!target && document.styleSheets) {
  result=true;
 }

 // Bereits ermitteltes Objekt uebergeben
 if(typeof(target)=="object") {
  sheetObj=true;
  styleObj=target;
  target=false;
 }

 // Existiert das benoetigte Objekt und gibt es ueberhaupt ein Stylesheet?
 if(document.styleSheets && document.styleSheets.length && target) {

  // Wurde eine direkte Adressierung der Regel ("x/y") uebergeben?
  if(!isNaN(parseInt(target)) && target.indexOf("/")>0) {
   // Adressierung aufteilen in Stylesheet-Nummer ...
   s=parseInt(target.split("/")[0],10);
   // ... und Regel-Nummer
   r=parseInt(target.split("/")[1],10);
   // Fortfahren, wenn Stylesheet existiert (mit Extra-Check als Opera-Workaround)
   if(typeof(document.styleSheets[s])=="object" && document.styleSheets[s]) {
    sheetObj=document.styleSheets[s];
    rulePointer=""+s;
    // HTML-Element ermitteln (W3C-/IE-DOM)
    ownerObj=(sheetObj.ownerNode)?sheetObj.ownerNode:sheetObj.owningElement;
    // Weitere Daten ermitteln, wenn Zugriff moeglich
    if(sheetAccessible(s)) {

     // Objekt nach IE-DOM (vor cssRules-Abfrage wg. IE/Mac, inkl. media-Abfrage wg. Konqueror) ...
     if(sheetObj.rules && typeof(sheetObj.media)=="string") {
      ruleColl=sheetObj.rules;
      // ... falls Regel existiert
      if(ruleColl[r]) {
       ruleObj=ruleColl[r];
       styleObj=ruleObj.style;
       rulePointer+="/"+r;
      }

     // Objekt nach W3C-DOM ...
     } else if(sheetObj.cssRules) {
      ruleColl=sheetObj.cssRules;
      // ... falls Regel existiert
      if(ruleColl[r]) {
       // Nur Typ 1 (Style), nicht 3 (importedStyle)
       if(ruleColl[r].type==1) {
        ruleObj=ruleColl[r];
        styleObj=ruleObj.style;
        rulePointer+="/"+r;
       }
      }
     }

    }
   }

  // Keine direkte Adressierung sondern Suche nach uebergebenem Selektor
  } else {
   // Uebergebenen Selektor in Kleinschrift umwandeln
   target=target.toLowerCase();
   // Wurde im ersten Parameter auch ein Begrenzer uebergeben?
   i=target.indexOf("@")+1;
   if(i) {
    // Ja: Begrenzer herausloesen
    clipper=target.substring(i);
    // Aus dem Rest den Selektor bilden
    target=target.substring(0,i-1);
    // Den Begrenzer als Zahl interpretieren
    sheetNo=parseInt(clipper);
    // Wenn der Begrenzer keine Zahl war, als Media-Type interpretieren - andernfalls: alle Media-Types ("*") verwenden
    mediaType=(isNaN(sheetNo))?clipper:"*"
    // Wenn Begrenzer eine Zahl: Nummer des Stylesheets - sonst: Media-Type
   } else {
    // Kein Begrenzer: alle Media-Types ("*") verwenden
    mediaType="*";
   }

   // Zu durchsuchende Stylesheets festlegen
   if(!isNaN(sheetNo)) {
    // Stylesheet wurde im Begrenzer angegeben
    startSheetNo=sheetNo;
    endSheetNo=sheetNo;
   } else {
    // Vom letzten Stylesheet ...
    startSheetNo=document.styleSheets.length-1;
    // ... bis zum ersten durchsuchen
    endSheetNo=0;
   }

   // Fortfahren, wenn Start- & End-Sheet-Nummer zulaessig sind
   if(startSheetNo>=endSheetNo && startSheetNo<document.styleSheets.length && endSheetNo>=0) {

    // (Eingegrenzte) Stylesheets (rueckwarts) durchgehen
    for(s=startSheetNo; s>=endSheetNo; s-=1) {
     // Bereits vorhandene Positionsdaten sichern
     sheetObj=document.styleSheets[s];
     rulePointer=""+s;
     // HTML-Element ermitteln (W3C-/IE-DOM)
     ownerObj=(sheetObj.ownerNode)?sheetObj.ownerNode:sheetObj.owningElement;

     // Sofern der Zugriff erlaubt ist, alle Regeln (rueckwarts) nach dem gewuenschten Selektor durchsuchen
     if(sheetAccessible(s)) {

      // Zugriff nach IE-DOM (vor cssRules-Zugriff wg. IE/Mac, inkl. media-Abfrage wg. Konqueror)
      if(sheetObj.rules && typeof(sheetObj.media)=="string") {
       ruleColl=sheetObj.rules;
       for(r=ruleColl.length-1; r>=0; r-=1) {
        // Wenn passender Media-Type & passender Selektor:
        if(((mediaType && sheetObj.media.toLowerCase().indexOf(mediaType)>=0) || (!mediaType && !sheetObj.media) || mediaType=="*") && ruleColl[r].selectorText.toLowerCase().indexOf(target)>-1) {

         // Selektor-Text browseruebergreifend vereinheitlichen
         unifiedSelectorText=unifySelectorText(ruleColl[r].selectorText);

         // Wenn passender Selektor:
         if(unifiedSelectorText==target) {
          // Restliche Positionsdaten sichern und ...
          ruleObj=ruleColl[r];
          styleObj=ruleObj.style;
          rulePointer=s+"/"+r;
          // ... Rest des Stylesheets nicht mehr durchsuchen
          break;
         }
        }
       }

      // Zugriff nach W3C-DOM
      } else if(sheetObj.cssRules) {
       ruleColl=sheetObj.cssRules;
       for(r=ruleColl.length-1; r>=0; r-=1) {
        // Wenn Regulaere Style-Regel, Media-Type passend und gesuchter Selektor im Selektor-Text enthalten:
        if(ruleColl[r].type==1 && ((mediaType && sheetObj.media.mediaText.toLowerCase().indexOf(mediaType)>=0) || (!mediaType && !sheetObj.media.mediaText) || mediaType=="*") && ruleColl[r].selectorText.toLowerCase().indexOf(target)>-1) {

         // Selektor-Text browseruebergreifend vereinheitlichen
         unifiedSelectorText=unifySelectorText(ruleColl[r].selectorText);

         // Wenn direkt passender Selektor:
         if(unifiedSelectorText==target) {
          // Restliche Positionsdaten sichern und ...
          ruleObj=ruleColl[r];
          styleObj=ruleObj.style;
          rulePointer=s+"/"+r;
          // ... Rest des Stylesheets nicht mehr durchsuchen
          break;

         // Wenn Gruppen-Selektor:
         } else if(unifiedSelectorText.indexOf(",")>-1) {
          // Selektor-Text aufteilen
          selectorArray=unifiedSelectorText.split(",");
          // Einzelne Selektoren durchgehen ...
          for(i=0; i<selectorArray.length; i++) {
           // ... trimmen ...
           while(selectorArray[i].charAt(0)==" ") { selectorArray[i]=selectorArray[i].substring(1,selectorArray[i].length); }
           while(selectorArray[i].charAt(selectorArray[i].length-1)==" ") { selectorArray[i]=selectorArray[i].substring(0,selectorArray[i].length-1); }
           // ... und bei Erfolg ...
           if(selectorArray[i]==target) {
            // Restliche Positionsdaten sichern und ...
            ruleObj=ruleColl[r];
            styleObj=ruleObj.style;
            rulePointer=s+"/"+r;
            // ... Rest des Gruppen-Selektors nicht mehr durchsuchen
            break;
           }
          }

          // Wenn Regel gefunden wurde, Rest des Stylesheets nicht mehr durchsuchen
          if(styleObj) { break; }
         }
        }
       }
      }

      // Wenn Regel gefunden wurde, restliche Stylesheets nicht mehr durchsuchen
      if(styleObj) { break; }
     }
    }
   }

   // Wenn kein Stylesheet spezifiziert und keine Regel gefunden wurde ...
   if(isNaN(sheetNo) && !styleObj) {
    // ... Zwischenergebnisse wieder loeschen
    sheetObj=false;
    ruleColl=false;
    ownerObj=false;
    rulePointer="";
   }

  }
 }

 // Stylesheet vorhanden?
 if(!sheetObj) {
  // Nein: Beim "sheetindex" anstelle des ueblichen false ein NaN zurueckgeben
  if(attrib=="sheetindex") { result=NaN; }
 } else {

  // Ja: Ueberpruefung auf Schluesselwort in attrib
  switch(attrib) {
   // War das Sheet-Objekt gewuenscht?
   case "sheetobject":
    result=sheetObj;
    break;
   // War die Rule-Collection gewuenscht?
   case "rulecollection":
    result=ruleColl;
    break;
   // War das Rule-Objekt gewuenscht?
   case "ruleobject":
    result=ruleObj;
    break;
   // War das Style-Objekt gewuenscht?
   case "styleobject":
    result=styleObj;
    break;
   // War das Owning-Objekt gewuenscht?
   case "ownerobject":
    result=ownerObj;
    break;
   // War der HTML-Markup gewuenscht?
   case "ownermarkup":
    if(ownerObj.outerHTML) {
     // Wenn outerHTML vorhanden: nutzen
     result=ownerObj.outerHTML;
     // Ergebnis trimmen
     while(result.charCodeAt(0)==13 || result.charCodeAt(0)==10) { result=result.substring(1); }
    } else {
     // Wenn outerHTML nicht vorhanden: Markup manuell zusammenstellen
     result="<"+ownerObj.tagName;
     for(i=0; i<ownerObj.attributes.length; i++) { result+=' '+ownerObj.attributes[i].name+'="'+ownerObj.attributes[i].value+'"'; }
     result+=(ownerObj.tagName=="LINK")?">":(">"+ownerObj.innerHTML+"</"+ownerObj.tagName+">");
    }
    break;
   // War der Sheet-Index gewuenscht?
   case "sheetindex":
    result=parseInt(rulePointer);
    break;
   // War der Regel-Pointer gewuenscht?
   case "rulepointer":
    // Wenn
    // - Sheet & Regel gefunden -> "x/y"
    // - Sheet gefunden aber Regel nicht -> "x" -> false
    // - Regel nicht gefunden -> false
    // - Sheet gefunden aber Zugriff verboten -> ""
    result=(rulePointer.indexOf("/")>-1 || rulePointer===false)?rulePointer:(sheetAccessible(rulePointer)?false:"");
    break;

  // Kein Schluesselwort: Gewuenschte Regel/Eigenschaft bearbeiten
  default:

   // Komplette Regel bearbeiten oder nur ein gewuenschtes Attribut daraus?
   complete=(!attrib)?true:false;

   // Gibt es einen neuen Wert (=schreiben) oder nicht (=lesen)?
   write=(typeof(value)!="undefined")?true:false;

   // Nur spezifische Eigenschaft bearbeiten?
   if(!complete) {
    // Ggf. Syntax von CSS- auf Script-Schreibweise aendern:
    attrib=propertyToStyle(attrib);
    // Gewuenschte Eigenschaft bearbeiten
    if(write) {
     // (schreiben)
     styleObj[attrib]=value;
     result=true;
    } else {
     // (auslesen)
     result=styleObj[attrib];
    }

   // Konqueror-Bug abfangen
   } else if(styleObj.cssText!=null) {
    // Kompletten Text bearbeiten
    if(write) {
     // (schreiben)
     styleObj.cssText=value;
     result=true;
    } else {
     // (auslesen)
     result=styleObj.cssText.toLowerCase();
    }
   }

  }
 }
 return result;
}

// Selektor-Text browseruebergreifend vereinheitlichen
function unifySelectorText(selText) {
 // selText='.bStil[CLASS~="bStil"] #cStil[ID"cStil"] .aStil[CLASS~="aStil"]'; // Example
 var i, addSelectors, addSelectorsRegExp;
 // Safari-Workaround: Suche nach Klassen-Selektoren, um ...
 addSelectors=selText.match(/\.([A-Za-z]+[\w-]*\[)/g);
 if(addSelectors) {
  for(i=0; i<addSelectors.length; i++) {
   addSelectorsRegExp=new RegExp("\\"+addSelectors[i].substring(0,addSelectors[i].length-1)+"\\[(CLASS|class)~=["+'"'+"|']?"+addSelectors[i].substring(1,addSelectors[i].length-1)+"["+'"'+"|']?\\]","g");
   // ... ggf. ergaenzte Attribut-Selektoren zu entfernen (.Stil[CLASS~="Stil"] -> .Stil)
   selText=selText.replace(addSelectorsRegExp,addSelectors[i].substring(0,addSelectors[i].length-1));
  }
 }
 // Safari-Workaround: Suche nach ID-Selektoren, um ...
 addSelectors=selText.match(/#([A-Za-z]+[\w-]*\[)/g);
 if(addSelectors) {
  for(i=0; i<addSelectors.length; i++) {
   addSelectorsRegExp=new RegExp(addSelectors[i].substring(0,addSelectors[i].length-1)+"\\[(ID|id)["+'"'+"|']?"+addSelectors[i].substring(1,addSelectors[i].length-1)+"["+'"'+"|']?\\]","g");
   // ... ggf. ergaenzte Attribut-Selektoren zu entfernen (#Stil[ID"Stil"] -> #Stil)
   selText=selText.replace(addSelectorsRegExp,addSelectors[i].substring(0,addSelectors[i].length-1));
  }
 }
 // Generell Kleinschreibung
 selText=selText.toLowerCase();

 return selText;
}

// Style-Schreibweise von CSS auf JS aendern
function propertyToStyle(property) {
 var syntax;
 // 1. Eigenschaften mit reserviertem Bezeichner: Unterscheidung nach JScript- bzw. JavaScript-Syntax
 if(property=="float") { property=((typeof(window.cssFloat)=="undefined")?"style":"css")+property.charAt(0).toUpperCase()+property.substring(1); }
 // 2. Eigenschaften mit Bindestrich
 else if(property.indexOf("-")>=0) {
  // CSS-Syntax am "-" auftrennen, ...
  syntax=property.split("-");
  // ... ersten Teil uebernehmen und ...
  property=syntax[0];
  // ... folgende Teile mit grossem Anfangsbuchstaben
  for(i=1; i<syntax.length; i++) { property+=syntax[i].charAt(0).toUpperCase()+syntax[i].substring(1); }
 }
 return property;
}

// Pruefen, ob Zugriff auf ein Stylesheet moeglich ist (Same-Origin-Policy)
function sheetAccessible(sheetNo) {
 // Testzugriff
 try {
  // Wenn Zugriff nach W3C- oder IE-DOM moeglich
  if(document.styleSheets[sheetNo].cssRules || document.styleSheets[sheetNo].rules) {
   // Status "Zugriff auf Sheet moeglich"
   throw "sheetAccessible";
  }
 // Statusabfrage
 } catch(e) {
  // Wenn "Zugriff auf Sheet moeglich", Rueckgabe true
  return (e=="sheetAccessible");
 }
}
function isempty(sTxt)
{
    if(sTxt == null)
        return true;
    while(sTxt.indexOf(" ") > -1)
        sTxt = sTxt.replace(" ", "");
    if(sTxt == "")
        return true;
    return false;
}
function onchangeexpslist(oLst, sChBox)
{
    var oChBox = getFormElement(oLst.form, sChBox);
    if (oChBox == null) return;
    var bAllSelected = true;
    var iOpts = oLst.options.length;
    var i=0;
    for(i=0; i < iOpts; i++)
    {
        if(oLst.options[i].selected == false)
        {
            bAllSelected = false;
            break;
        }
    }
    oChBox.checked = bAllSelected;
}
//////////////////////////////// LOGGING //////////////////////
function showlog()
{
    if(slogs == "") return;
    alert(slogs);
    slogs = "";
}
function log(s, sFunction, iSeverity)
{
  if(DEBUG < iSeverity)    return;
  var sSeverity = "";
  if(iSeverity == iINF) sSeverity = "INF";
  if(iSeverity == iWRN) sSeverity = "WRN";
  if(iSeverity == iERR) sSeverity = "ERR";
  //alert(sSeverity+" in func:"+sFunction+":\n==>"+s);
  slogs += (((slogs == "") ? "" : "\n") + sSeverity+" in func:"+sFunction+":\t"+s);
}
function dbg(i,s )
{
    return;
//  if(i != iERR)
//      return;
//  if(i != iERR && i != iWRN)
//      return;
    var sType = "ERROR";
    if(i==iWRN)        sType = "WARNING";
    else if(i==iINF)   sType = "INFO";
    alert(sType+"\n"+s);
}

function setSubElementStyle(oParent, sElIdEnd, sStyleClass)
{
    if(oParent == null || sElIdEnd == null || sElIdEnd == "" || sStyleClass == null || sStyleClass == "")
    return false;

    sElIdEnd = sElIdEnd.toUpperCase();

    var sFoundId = "";
    var iStartPos = 0;

    for(var i = 0; i < oParent.childNodes.length; i++)
    {
    if(oParent.childNodes[i].nodeType != 1)
        continue;

    sFoundId = oParent.childNodes[i].getAttribute('id');
    if(sFoundId != null)
    {
        sFoundId = sFoundId.toUpperCase();
        iStartPos = sFoundId.length - sElIdEnd.length;
    }

    if(sFoundId != null && sFoundId != "" && iStartPos > -1 && sFoundId.substr(iStartPos) == sElIdEnd)
    {
        oParent.childNodes[i].setAttribute('class', sStyleClass);
        oParent.childNodes[i].setAttribute('className', sStyleClass);
        return true;
    }

    if(setSubElementStyle(oParent.childNodes[i], sElIdEnd, sStyleClass))
        return true;
    }

    return false;
}

function setIframeSrc()
{
	if(g_sDocumentWindowID == undefined || g_sDocumentWindowID == "")
        return;

    // Prevent optical stress in case of a back navigation
	var sIsBackClicked = getCookie("back", window.parent.document);
	if(sIsBackClicked && sIsBackClicked == "backclicked")
	{
		window.parent.document.cookie='back=backposdone';
		if(frames[g_sDocumentWindowID] == null || frames[g_sDocumentWindowID].window.document.getElementsByTagName('body')[0].innerHTML)
			return;
	}
    
    var sSrc = g_sCurrentSrc;
    sSrc = replaceISO8859Encoding(sSrc);

    var oIframe;
    oIframe = document.getElementById(g_sDocumentWindowID);

    if(oIframe == null)
        return;

    var sCurrentSrc = oIframe.src;
    if(sSrc == null || sSrc == "")
        sSrc = sCurrentSrc;

    if(sSrc == sCurrentSrc && !sSrc.match(/(\.(htm[l]{0,1})|(jsp)|(jspf))$/))
        return;

    oIframe.src = sSrc;
}

function replaceISO8859Encoding(sString)
{
    if(sString == null)
    return null;

    sString = sString.replace(/&#223;/g, escape(String.fromCharCode(223)));
    sString = sString.replace(/&#196;/g, escape(String.fromCharCode(196)));
    sString = sString.replace(/&#214;/g, escape(String.fromCharCode(214)));
    sString = sString.replace(/&#220;/g, escape(String.fromCharCode(220)));
    sString = sString.replace(/&#228;/g, escape(String.fromCharCode(228)));
    sString = sString.replace(/&#246;/g, escape(String.fromCharCode(246)));
    sString = sString.replace(/&#252;/g, escape(String.fromCharCode(252)));

    return sString;
}

function getWebAppTop()
{
    if(g_topWindowName == undefined || g_topWindowName == "")
        g_topWindowName = "shiwebtop";

    var winBefore = null;
    try
    {
        win = window;
        if(win.name.toLowerCase() == g_topWindowName.toLowerCase())
            return win;

        do
        {
            win = win.parent.window;
            if(!win || win == winBefore)
                break;
        winBefore = win;
            if(win.name.toLowerCase() == g_topWindowName.toLowerCase())
                return win;
        }while(true);
   }
   catch(e)
   {
   }
   return win;
}

 //function to close FF window/tab seit FF 2.0 nicht mehr anwendbar//
function shiFFcloseWindow() {
    window.open('','_parent','');
    window.close();
}


var g_iIsFadedCounter = new Array();
function shiFadeElementOut(sFadeElementId){
    if(document.getElementById(sFadeElementId) != null){
        if(g_iIsFadedCounter[sFadeElementId] == undefined || g_iIsFadedCounter[sFadeElementId] == 0){
            void(dojo.style.setOpacity(dojo.byId(sFadeElementId), 0.3));
            g_iIsFadedCounter[sFadeElementId] = 1;
            }else{
                g_iIsFadedCounter[sFadeElementId] = g_iIsFadedCounter[sFadeElementId] +1;
                }
        }else{
            if(g_iIsFadedCounter[sFadeElementId] == undefined || g_iIsFadedCounter[sFadeElementId] == 0){
            void(dojo.style.setOpacity(dojo.byId('hitlistWindow'), 0.3));
            g_iIsFadedCounter[sFadeElementId] = 1;
            }else{
                g_iIsFadedCounter[sFadeElementId] = g_iIsFadedCounter[sFadeElementId] +1;
                }
            }
}
 function shiFadeElementIn(sFadeElementId){
     if(document.getElementById(sFadeElementId) != null){
         g_iIsFadedCounter[sFadeElementId] = g_iIsFadedCounter[sFadeElementId]-1;

         if(g_iIsFadedCounter[sFadeElementId] == 0){
             void(dojo.style.setOpacity(dojo.byId(sFadeElementId), 1.0));
         }
     }else{
         g_iIsFadedCounter[sFadeElementId] = g_iIsFadedCounter[sFadeElementId]-1;

         if(g_iIsFadedCounter[sFadeElementId] == 0){
             void(dojo.style.setOpacity(dojo.byId('hitlistWindow'), 1.0));
        }

 }
}



 function reloadWindow(isReload){
    if (isReload){
       var w=getWebAppTop()
       w.document.getElementById("reloadForm").submit();
    }
 }

  function toolsColumnPopUp2(popId,framepopId,start) {

     var popupDiv = document.getElementById(popId);
    if (popupDiv  == null)
    return;
     var topPos = getPosTop(start);

     popupDiv.style.top = topPos+10+"px";
     popupDiv.style.left = getPosLeft(start)+"px";
     var popupDivIframe = document.getElementById(framepopId);

     popupDivIframe.style.top = getPosTop(start)+10+"px";
     popupDivIframe.style.left = getPosLeft(start)+"px";


     if(popupDiv.style.display=='none') {
         dojo.lfx.explode(start,framepopId, 500).play();
         dojo.lfx.explode(start,popId, 500).play();
     }
     else {

         dojo.lfx.implode(popId, start, 500).play();
         dojo.lfx.implode(framepopId, start, 500).play();
     }
 }


 function toolsColumnPopUp(popId,framepopId,start) {

     //var implodeDiv = document.getElementById('sps');
     var popupDiv = document.getElementById(popId);
    //if (popupDiv  == null)
    //return;
     var topPos = getPosTop(start);

     popupDiv.style.top = topPos - 85+"px";
     popupDiv.style.left = getPosLeft(start)+318+"px";
    // if((getPosLeft(start)-530)<1){
    //     popupDiv.style.left = 0+"px";
    // }
     var popupDivIframe = document.getElementById(framepopId);

     popupDivIframe.style.top = getPosTop(start) - 85+"px";
     popupDivIframe.style.left = getPosLeft(start)+318+"px";
     //if((getPosLeft(start)-530)<1){
       //  popupDivIframe.style.left = 0+"px";
     //}

        /*if(implodeDiv.style.display!='none')
        {
             dojo.lfx.implode("sps",start, 500).play();
             dojo.lfx.implode("frameSps", start, 500).play();
             //shiFadeElementIn('documentwindow');
         }*/

     if(popupDiv.style.display=='none') {
         dojo.lfx.explode(start,framepopId, 500).play();
         dojo.lfx.explode(start,popId, 500).play();
         //shiFadeElementOut('documentwindow');


     }
     else {

         dojo.lfx.implode(popId, start, 500).play();
         dojo.lfx.implode(framepopId, start, 500).play();
         //shiFadeElementIn('documentwindow');
     }


 }
 function expandedSearchPopU3(start)
{

        //var implodeDiv = document.getElementById('indexSearchPopup');
    var popupDivExps = document.getElementById('expandedSearchPopup');
    if (popupDivExps == null)
        popupDivExps = document.getElementById('exps');
        var topPos = getPosTop(start);

    popupDivExps.style.top = topPos + 26+"px";
        popupDivExps.style.left = getPosLeft(start)-279+"px";
        if((getPosLeft(start)-496)<1){
    popupDivExps.style.left = 0+"px";
        }
    var popupDivIframeS = document.getElementById('expandedSearchFramePopup');
    if (popupDivIframeS == null)
        popupDivIframeS = document.getElementById('frameExps');

    popupDivIframeS.style.top = getPosTop(start) + 26+"px";
    popupDivIframeS.style.left = getPosLeft(start)-279+"px";
        if((getPosLeft(start)-496)<1){
    popupDivIframeS.style.left = 0+"px";
        }

        //if(implodeDiv.style.display!='none')
        //{
          //  dojo.lfx.implode("indexSearchPopup",start, 500).play();
            // dojo.lfx.implode("indexSearchFramePopup", start, 500).play();
            //shiFadeElementIn('documentwindow');
         //}

    if(popupDivExps.style.display=='none')
    {
            dojo.lfx.explode(start,"expandedSearchFramePopup", 500).play();
            dojo.lfx.explode(start,"expandedSearchPopup", 500).play();
            //shiFadeElementOut('documentwindow');


    }
    else
        {

            dojo.lfx.implode("expandedSearchPopup", start, 500).play();
            dojo.lfx.implode("expandedSearchFramePopup", start, 500).play();
            //shiFadeElementIn('documentwindow');

    }


}

 function notesColumnPopUp(popId,framepopId,start)
 {
	 	if (lastPopUpFrame != null && lastPopUp != null && lastStart != null){
	 	 	  if (lastPopUpFrame != framepopId && lastPopUp != popId ){
	 	 	        dojo.lfx.implode(lastPopUp, lastStart, 500).play();
	 	            dojo.lfx.implode(lastPopUpFrame, lastStart, 500).play();
	 				
	 	            //shiFadeElementIn('documentwindow');<-- macht Probleme bei der PDF anzeige
	 	      }
	 	 	}


     var popupDiv = document.getElementById(popId);
    //if (popupDiv  == null)
    //return;
     var topPos = getPosTop(start);

     popupDiv.style.top = topPos + 19+"px";
     popupDiv.style.left = getPosLeft(start)-519+"px";
    // if((getPosLeft(start)-530)<1){
    //     popupDiv.style.left = 0+"px";
    // }
     var popupDivIframe = document.getElementById(framepopId);

     popupDivIframe.style.top = getPosTop(start) + 19+"px";
     popupDivIframe.style.left = getPosLeft(start)-519+"px";
     //if((getPosLeft(start)-530)<1){
       //  popupDivIframe.style.left = 0+"px";
     //}

        /*if(implodeDiv.style.display!='none')
        {
             dojo.lfx.implode("sps",start, 500).play();
             dojo.lfx.implode("frameSps", start, 500).play();
             //shiFadeElementIn('documentwindow');
         }*/

     if(popupDiv.style.display=='none') {
         dojo.lfx.explode(start,framepopId, 500).play();
         dojo.lfx.explode(start,popId, 500).play();
         //shiFadeElementOut('documentwindow');

         lastStart=start;
         lastPopUpFrame=framepopId;
         lastPopUp=popId;

     }
     else {

         dojo.lfx.implode(popId, start, 500).play();
         dojo.lfx.implode(framepopId, start, 500).play();
         //shiFadeElementIn('documentwindow');
         
         lastStart=null;
  		lastPopUpFrame=null;
  		lastPopUp=null;
         
         setIframeSrc();
     }
 }

 function softLinkColumnPopUp(popId,framepopId,start) {

     //var implodeDiv = document.getElementById('sps');
     var popupDiv = document.getElementById(popId);
     if (popupDiv  == null)
     {
        //alert("popId:'"+popId+"'");
       return;
     }
     var topPos = getPosTop(start);

     popupDiv.style.top = topPos + 19+"px";
     popupDiv.style.left = getPosLeft(start)-519+"px";
    // if((getPosLeft(start)-530)<1){
    //     popupDiv.style.left = 0+"px";
    // }
     var popupDivIframe = document.getElementById(framepopId);

     popupDivIframe.style.top = getPosTop(start) + 19+"px";
     popupDivIframe.style.left = getPosLeft(start)-519+"px";
     //if((getPosLeft(start)-530)<1){
       //  popupDivIframe.style.left = 0+"px";
     //}

        /*if(implodeDiv.style.display!='none')
        {
             dojo.lfx.implode("sps",start, 500).play();
             dojo.lfx.implode("frameSps", start, 500).play();
             //shiFadeElementIn('documentwindow');
         }*/

     if(popupDiv.style.display=='none') {
         dojo.lfx.explode(start,framepopId, 500).play();
         dojo.lfx.explode(start,popId, 500).play();
         //shiFadeElementOut('documentwindow');


     }
     else {

         dojo.lfx.implode(popId, start, 500).play();
         dojo.lfx.implode(framepopId, start, 500).play();
         //shiFadeElementIn('documentwindow');
     }


 }


 function scrollDiv(){
     var windowSize = document.body.offsetHeight; //window.innerHeight;
     var divSize = windowSize-180;
     var mainTable = document.getElementById("mainAreaTable");
     //alert(divSize+'<'+mainTable.offsetHeight);
     if(divSize < mainTable.offsetHeight)
         mainTable.className="mainAreaTableIE";

         //cssRule(".mainAreaTableIE","width","98.4%")
         //mainTable.style.width = 98.4 +"%";

     }


var ie4 = false;
   if(document.all) {
         ie4 = true;
}

function onEnterSubmit(event,buttonName) {
	var element = document.getElementById(buttonName);
	
	if (ie4) {
        if (window.event && window.event.keyCode == 13) {
            element.click();
            return false;
        }
        else
            return true;
    } else if (event && event.which == 13) {
    	try {
    		element.click();
    	} catch(e) {}
        return false;
    } else {
    	return true;
    }
}


function unescapeUrlEncodedString(sString)
{
    if(sString == null || sString == "")
    return "";

    sString = sString.replace(/%2F/ig, "/");

    return sString;
}

function shiChangeImg(sId, sPath1, sPath2, sIdOld, sPath1old, sPath2old){
    var changeImg = document.getElementById(sId);
    var sCheckStr = changeImg.src;
    var iResult = sCheckStr.search(sPath2);

    if (iResult !=-1  ){
        changeImg.src = sPath1;
    }else{
        changeImg.src = sPath2;
    }

    var changeImgOld = document.getElementById(sIdOld);
    if(changeImgOld==null)
        return;
    //var sCheckStrOld = changeImgOld.src;
    //var iResultOld = sCheckStrOld.search(sPath2old);

    //if (iResultOld !=-1  ){
      //  changeImgOld.src = sPath1old;
    //}else{
      //
      //  changeImgOld.src = sPath1old;
   //}

}

function setSessionTimeout(){
if( typeof(sessionTimeInMillSek) != "undefined")
   window.setInterval("sesssionNoTime()", sessionTimeInMillSek);

}

function reloadmypage(sBeanName)
{
    var s=";jsessionid="+sessionid;
    self.location.href = "./index.jsf"+s+"?"+sBeanName+"&invalidatesession=false&beanname="+sBeanName+"&tmpstmp="+(new Date()).getMilliseconds();
}

function escapeInputValuesForJetty(value)
{
    value = value.replace(new RegExp(String.fromCharCode(228), "g"), "___auml___");
    value = value.replace(new RegExp(String.fromCharCode(196), "g"), "___Auml___");
    value = value.replace(new RegExp(String.fromCharCode(246), "g"), "___ouml___");
    value = value.replace(new RegExp(String.fromCharCode(214), "g"), "___Ouml___");
    value = value.replace(new RegExp(String.fromCharCode(252), "g"), "___uuml___");
    value = value.replace(new RegExp(String.fromCharCode(220), "g"), "___Uuml___");
    value = value.replace(new RegExp(String.fromCharCode(223), "g"), "___szlig___");
    value = value.replace(new RegExp(String.fromCharCode(167), "g"), "___sect___");
    return value;
}

function doJettyHandlingOnSubmit(idHidden, idVisible)
{
    var _visible = document.getElementById(idVisible);
    if(_visible == null)
        return false;

    var _hidden = document.getElementById(idHidden);
    if(_hidden == null)
        return false;

    _hidden.value = escapeInputValuesForJetty(_visible.value);
    return true;
}

function fillInputFieldWithValue(idSource, idTarget)
{
    var _idSource = document.getElementById(idSoruce);
    var _idTarget = document.getElementById(idTarget);
    if(_idSource != null && _idTarget != null)
        _idTarget.value = _idSource.value;
}
var g_searchIndexLinkId = "";
function searchIndexDoLink(doLink)
{
    if(doLink == false)
        return;

    var sId = g_searchIndexLinkId;
    sId = sId.replace(/searchIndexCommandLink$/, "indexSearchLink");
    var cmdButton = document.getElementById(sId);
    if(cmdButton == null)
        return;
    cmdButton.click();
}
function getelementfromjsfid(sId, ep)
{
	if(ep == null) 
	{
		var o = getelement(sId);
		if (o)return o;
	}
	
	ep = ((ep == null) ? document.getElementById("body") : ep);
	
    for(var i = 0; i < ep.childNodes.length; i++) 
	{
		var e = ep.childNodes[i];
		if (e.nodeType != 1)continue;
		var efound = getelementfromjsfid(sId, e);
		if (efound)return efound;
		var seid = e.getAttribute('id');
		if(!seid)continue;
		if ((seid.indexOf("_") == 0) && (seid.indexOf(":" + sId) > 1)) 
		{
			return e;
		}
	}
	return null;
}
function setiframesrcifempty(sIfrName, sUrl)
{
	var ifr = getelementfromjsfid(sIfrName,null);
	if(!ifr)return;
	if(ifr.src.indexOf("about:blank") != 0)return;
	ifr.src = sUrl;
}
function getPosTopMin(e)
{
    var iT = getPosTop(e);
    for (var i = 0; i < e.childNodes.length; i++)
    {
        var ec = e.childNodes[i];
        if (ec.nodeType != 1)continue;
        var iChildTop = getPosTopMin(ec);
        if((iChildTop > 1) && (iChildTop < iT))
            iT = iChildTop;
    }
    return iT;
}
function findele2click(e, x2click, y2click)			//ONLY4IE
{
    var iT = getPosTopMin(e);
    var iL = getPosLeft(e);
    var iW = e.offsetWidth;
    var iH = e.offsetHeight;
    var iR = iL + iW;
    var iB = iT + iH;

    if( (iT <= y2click) &&
        (iL <= x2click) &&
        (iB >= y2click) &&
        (iR >= x2click))
    {
        for (var i = 0; i < e.childNodes.length; i++)
        {
            var ec = e.childNodes[i];
            if (ec.nodeType != 1)continue;
            if(findele2click(ec, x2click, y2click))
                return true;
        }
        if((e.tagName == "FORM")||(e.tagName == "DIV")||(e.tagName == "TR")||(e.tagName == "TBODY")||(e.tagName == "TABLE"))
        {
            //setTimeout("document.getElementById('"+e.id+"').submit();" 2999);
            return false;
        }
        else if(e.tagName == "TD")
        {
            e.click();
        }
        else
        {
            e.click();
        }
        //alert("CLICKED:"+e.tagName+" "+e.id+"\n\nx2click:"+x2click+"\ny2click:"+y2click+"\niT:"+iT+"\niL:"+iL+"\niR:"+iR+"\niB:"+iB);
        return true;
    }
    return false;
}
function sendformfromparams()
{
    var s = window.location.search;
    if (s.indexOf("pleasedoreload=1") < 0)return;
    s = s.substring(1);
    s = s.replace(/pleasedoreload/,"jsreloaded");
    var as = s.split('&');
    var f  = document.createElement("form");
    f.setAttribute("method","GET");
    f.setAttribute("action","index.jsf?jsreloaded=1");
    f.setAttribute("encType","multipart/form-data");

    var sFormcontent = "";
    for (var i = 0; i < as.length; i++)
    {
        var iQ = as[i].indexOf('=');
        if (iQ < 1)continue;
        var sParamName = as[i].substring(0,iQ);
        var sParamVlue = as[i].substring(iQ+1);
        var sInput = "<input type=hidden name='"+sParamName+"' id='"+sParamName+"' value='"+sParamVlue+"' />\n";
        sFormcontent += sInput;
    }
    f.innerHTML = sFormcontent;
    document.getElementsByTagName("body")[0].appendChild(f);
    f.submit();
}
function fireEvent(obj,evt)
{
	var fireOnThis=obj;
	if(document.createEvent)
	{
        var evObj=document.createEvent('MouseEvents');
        evObj.initEvent(evt,true,false);
        fireOnThis.dispatchEvent(evObj);
    }
    else if(document.createEventObject)
    {
        fireOnThis.fireEvent('on'+evt);
    }
}
function isie()
{
    if(document.all)return true;
    return false;
}

function scrollToAnchor(aname, doc) {
	if(doc == undefined || doc == null)
		doc = document;
	
	var elList = doc.getElementsByName(aname);
	if(elList == null)
		return false;
	
	for(var i = 0; i < elList.length; i++) {
		if(elList[i].nodeName.toLowerCase() == "a") {
			elList[i].scrollIntoView(true);
			return true;
		}
	}
	
	return false;
}

function getAnchor(win) {
	
	if(win == undefined || win == null)
		win = window;
	
	var hrefSplit = win.location.href.split("#");
	if(hrefSplit == null || hrefSplit.length != 2)
		return null;
	
	return hrefSplit[1];
}

function getIdPrefix(id) {
	if(id == null || id == "")
		return "";
	
	var pos = id.lastIndexOf(":");
	if(pos < 1)
		return "";
	
	return id.substr(0, pos + 1);
}

function clickElement(id) {
	var eleToClick = document.getElementById(id);
	if (eleToClick == null)
		return false;
	try {
		eleToClick.click();
	} catch (e) {
		eleToClick.click = function() {
			var evt = this.ownerDocument.createEvent('MouseEvents');
			evt.initMouseEvent('click', true, true,
					this.ownerDocument.defaultView, 1, 0, 0, 0, 0,
					false, false, false, false, 0, null);
			this.dispatchEvent(evt);
		}
		eleToClick.click();
	}
	return true;
}
/************ dolink functions from shi.js ********************/
function DoLink(softparams)
{   
    var oTopWindow = getWebAppTop()
    oTopWindow.document.getElementById('softFormId:softCommandLinkInput').value=softparams;    
    var link=oTopWindow.document.getElementById('softFormId:softCommandLink');
	link.click();
}

function doSHIFileLink(fileName)
{
	var iPos = fileName.indexOf("#");
	var anchor = "";
	if(iPos > -1) {
		anchor = fileName.substring(iPos + 1);
		fileName = fileName.substring(0, iPos);
	}
    
	submitParamForm(new Array("fn", fileName, "anchor", anchor, "invalidatesession", "false"));
}

function doSHIAliasLink(alias)
{
    var oTopWindow = getWebAppTop();
    oTopWindow.document.SHIparamForm.alias.value		= alias;
    oTopWindow.document.SHIparamForm.invalidatesession.value 	= "false";
    oTopWindow.document.SHIparamForm.submit();
}

function doPagingLink(page, forid)
{
    var oTopWindow = getWebAppTop();
    oTopWindow.document.SHIparamForm.forid.value		= forid;
    oTopWindow.document.SHIparamForm.page.value		= page;
    oTopWindow.document.SHIparamForm.invalidatesession.value 	= "false";
    oTopWindow.document.SHIparamForm.submit();
}

function submitParamForm(parameters) {
	// parameters must be an array of param names and values, e.g. new Array("param1", "param1Value", "param2", "param2Value")

	if(parameters == null || parameters.length < 2) {
		log("parameters is null or its length is < 2", "submitParamForm", iERR);
		return false;
	}
	
	var oTopWindow = getWebAppTop();
    if(oTopWindow == null) {
    	log("oTopWindow is null", "submitParamForm", iERR);
    	return false;
    }
    
	var form = oTopWindow.document.SHIparamForm;
    if(form == undefined) {
		log("form is undefined", "submitParamForm", iERR);
		return false;
	}
    
    // reset all fields in SHIparamForm (for problems with back-button)
    if(form.hasChildNodes()) {
    	var nodes = form.childNodes;
    	for(var i = 0; i < nodes.length - 1; i++) {
    		if(nodes[i].nodeType == 1 &&
    		   nodes[i].nodeName.toUpperCase() == "INPUT")
    			nodes[i].value = "";
    	}
    }
	
	for(var i = 0; i < parameters.length - 1; i += 2) {
		var name  = parameters[i];
		var value = parameters[i + 1];
		if(eval("form." + name) == undefined) {
			log("form." + name + " is undefined", "submitParamForm", iINF);
			var newInputHidden = oTopWindow.document.createElement("input");
			newInputHidden.type  = "hidden";
			newInputHidden.name  = name;
			newInputHidden.value = value;
			form.appendChild(newInputHidden);
		} else {
			eval("form." + name).value = value;
		}
	}
	
	form.submit();
	return true;
}

function addJSRef(jsPath) {
	
	if(jsPath == undefined || jsPath == null || jsPath == "")
		return false;
	
	var absJsPath = getAbsolutePath(trim(jsPath).replace(/;jsessionid=[A-Za-z0-9]*$/, ""));

	// check if js already exists
	var scriptNodes = document.getElementsByTagName("script");
	if(scriptNodes != null) {
		for(var i = 0; i < scriptNodes.length; i++) {
			var scriptRef = scriptNodes[i].src;
			if(scriptRef != null && scriptRef != "") {
				scriptRef = getAbsolutePath(trim(scriptRef).replace(/;jsessionid=[A-Za-z0-9]*$/, ""));
				if(scriptRef == absJsPath) {
					return true;
				}
			}
		}
	}
	
	var newScriptTag = document.createElement("script");
	newScriptTag.language = "JavaScript";
	newScriptTag.src      = jsPath;
	newScriptTag.type     = "text/javascript";
	newScriptTag.charset  = "ISO-8859-1";
	if(isIE6()) {
		var tempTag = document.createElement("head");
		tempTag.appendChild(newScriptTag);
		document.write(tempTag.innerHTML);
	} else {
		document.getElementsByTagName("head")[0].appendChild(newScriptTag);
	}
}

function addCSSRef(cssPath, media) {
	if(cssPath == undefined || cssPath == null || cssPath == "")
		return false;
	
	var absCssPath = getAbsolutePath(trim(cssPath).replace(/;jsessionid=[A-Za-z0-9]*$/, ""));

	// check if js already exists
	var cssNodes = document.getElementsByTagName("link");
	if(cssNodes != null) {
		for(var i = 0; i < cssNodes.length; i++) {
			var cssRef = cssNodes[i].href;
			if(cssRef != null && cssRef != "") {
				cssRef = getAbsolutePath(trim(cssRef).replace(/;jsessionid=[A-Za-z0-9]*$/, ""));
				if(cssRef == absCssPath) {
					return true;
				}
			}
		}
	}
	
	var newCssTag = document.createElement("link");
	newCssTag.rel     = "stylesheet";
	newCssTag.href    = cssPath;
	newCssTag.type    = "text/css";
	newCssTag.charset = "ISO-8859-1";
	if(media != undefined && media != null && media != "")
		newCssTag.media = media;
	if(isIE6()) {
		var tempTag = document.createElement("head");
		tempTag.appendChild(newCssTag);
		document.write(tempTag.innerHTML);
	} else {
		document.getElementsByTagName("head")[0].appendChild(newCssTag);
	}
}

function getAbsolutePath(relPath) {
	
	if(isAbsolutePath(relPath))
		return relPath;
	
	if(!isie()) {
		// firefox always creates absolute path itself
		var aEle = document.createElement("a");
		aEle.href = relPath;
		if(isAbsolutePath(aEle.href))
			return aEle.href;
	}
	
	var basePath = self.location.href;
	if(relPath == null || relPath == "")
		return basePath;
	
	var basePathSplits = basePath.split("/");
	var relPathSplits  =  relPath.split("/");
	
	if(basePath.substr(basePath.length - 1) != "/") {
		// pop last element assuming it is a filename
		basePathSplits.pop();
	}
	
	for(var i = 0; i < relPathSplits.length; i++) {
		if(relPathSplits[i] == ".")
			continue;
		
		if(relPathSplits[i] == "..")
			basePathSplits.pop();
		else
			basePathSplits[basePathSplits.length] = relPathSplits[i];
	}
	
	return basePathSplits.join("/");
}

function isAbsolutePath(path) {
	if(path == null || path == "")
		return false;
	
	return path.search(/^(https{0,1}:|file:|mailto:|ftp:|[a-zA-Z]:)/i) > -1;
}

function getIndexUrl() {
    var indexUrl;
    if(typeof(g_indexUrl) != "undefined" && g_indexUrl != undefined && g_indexUrl != null && g_indexUrl != "")
    	indexUrl = g_indexUrl;
    else
    	indexUrl = self.location.href;
    return indexUrl;
}

function isIE6() {
	if(navigator && navigator.appName && navigator.appVersion) {
		return navigator.appName.toLowerCase().indexOf("microsoft internet explorer") > -1 &&
		       navigator.appVersion.toLowerCase().indexOf("msie 6.") > -1;
	}
	
	return false;
}

//the following lines must be the LAST in shiFunction.js!!!
if(typeof(g_doAfterLoadShiFunction) == "function") {
	g_doAfterLoadShiFunction();
	g_doAfterLoadShiFunction = null;
}

function getRadioButtonValue(radioButton) {
    for (var i = 0; i < radioButton.length; i++) {
    	if (radioButton[i].checked) {
    		return radioButton[i].value;
    	}
    }
    return null;
}
