/*
  $Author: llorenz $
  $Source: /var/lib/cvs/i18n-003/src/webapp/wlw/src/main/static/wlw/html/js/common.js,v $
  $Date: 2008-08-14 13:52:14 $
  $Revision: 1.31 $
*/

<!--
  function addFlash(flashSource,flashParams,width,height,encode) {
    if (flashParams != "")
    {
      if (encode == 1)
      {
        flashParams = escape(flashParams);
      }
      flashSource = flashSource+"?"+flashParams;
    }
    if (navigator.appName.indexOf("Microsoft") != -1)
    {
       _proxy_jslib_handle(document, 'write', '', 1, 0)('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=3,0,0,0" width="'+width+'" height="'+height+'">');
       _proxy_jslib_handle(document, 'write', '', 1, 0)('<param name="movie" value="'+flashSource+'" />');
    }
    else
    {
       _proxy_jslib_handle(document, 'write', '', 1, 0)('<object data="'+flashSource+'" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" class="mozilla">');
    }
     _proxy_jslib_handle(document, 'write', '', 1, 0)('<param name="allowScriptAccess" value="sameDomain" />');
     _proxy_jslib_handle(document, 'write', '', 1, 0)('<param name="quality" value="high" />');
     _proxy_jslib_handle(document, 'write', '', 1, 0)('</object>');
  }
  
  function addImage(altImage,width,height) {
     _proxy_jslib_handle(document, 'write', '', 1, 0)('<img src="'+altImage+'" width="'+width+'" height="'+height+'" border="0"/>');
  }
  
  function checkFlash(flashSource,flashParams,altImage,altText,width,height) {
    flash_versions = 20;
    var flash = new (Object)();
    flash.installed=false;
    flash.version='0.0';
    if (navigator.plugins && navigator.plugins.length) {
    	for (x=0; x < navigator.plugins.length; x++) {
    		if ( _proxy_jslib_handle(navigator.plugins, (x), 0, 0).name.indexOf('Shockwave Flash') != -1) {
    			flash.version =  _proxy_jslib_handle(navigator.plugins, (x), 0, 0).description.split('Shockwave Flash ')[1];
    			flash.installed = true;
    			break;
    		}
    	}
    }
    else if (window.ActiveXObject) {
    	for (x = 2; x <= flash_versions; x++) {
    		try {
    			oFlash = eval(_proxy_jslib_proxify_js(("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');"), 0, 0) );
    			if(oFlash) {
    				flash.installed = true;
    				flash.version = x + '.0';
    			}
    		}
    		catch(e) {}
    	}
    }
    flash.ver = Array();
    for(i = 4; i <= flash_versions; i++) 
    {
    	eval(_proxy_jslib_proxify_js(("flash.ver[" + i + "] = (flash.installed && parseInt(flash.version) >= " + i + ") ? true : false;"), 0, 0) );
    }
    if (flash.ver[6])
    {
    	addFlash(flashSource,flashParams,width,height);
    }
    else if (flash.installed)
    {
    	addFlash(flashSource,flashParams,width,height);
    }
    else
    {
      if (altImage != "")
      {
        addImage(altImage,width,height);
      }
      else
      {
         _proxy_jslib_handle(document, 'write', '', 1, 0)(altText);
      }
    }
  }
  
  function doSelect() {
    var val = "";
    var str = "";
    for (i=0;i<=document.selHs.operator.options.length;i++)
    {
      if ( _proxy_jslib_handle(document.selHs.operator.options, (i), 0, 0).selected == true)
      {
        val =  _proxy_jslib_handle( _proxy_jslib_handle(document.selHs.operator.options, (i), 0, 0), 'value', '', 0, 0);
        str =  _proxy_jslib_handle(document.selHs.operator.options, (i), 0, 0).text;
        break;
      }
    }
    if (val==228)
    {
      if(str.indexOf('Dobson') != -1)
      {
         _proxy_jslib_assign('', document.selHs.display, 'value', '=', ( "228a"));
      }
      else
      {
         _proxy_jslib_assign('', document.selHs.display, 'value', '=', ( "228b"));
      }
    }
    document.selHs.submit();
  }
    
  function sessionId() {
    var url =  _proxy_jslib_handle( _proxy_jslib_handle(window, 'location', '', 0, 0), 'href', '', 0, 0);
    var sessionId = "";
    if (url.indexOf('showxml')==-1 && url.indexOf('lycos')==-1 && url.indexOf('?')!=-1 && url.indexOf("XY")!=-1)
    {
      urlParams = url.substring((url.indexOf('?')+1),url.length);
      if (urlParams.indexOf('%26') != -1)
      {
        urlParams =  _proxy_jslib_handle(urlParams, 'replace', '', 1, 0)('%26','&');
      }
      if (urlParams.indexOf('&') != -1 )
      {
        urlParams = urlParams.split("&");
        for (var i = 0; i < urlParams.length; i++)
        {
          tmpParam =  _proxy_jslib_handle(urlParams, (i), 0, 0);
          if (tmpParam.indexOf("XY") != -1 )
          {
            tmpParam = tmpParam.split("=");
            if(tmpParam[0] == "XY")
            {
              sessionId = tmpParam[1];
              break;
            }
          }
        }
      }
      else if (urlParams.indexOf("XY") != -1)
      {
        tmpParam = urlParams.split("=");
        if(tmpParam[0] == "XY")
        {
          sessionId = tmpParam[1];
        }
      }
      if (sessionId != "")
      {
        for (var i = 0; i < document.links.length; i++)
        {
          var tmpLink =  _proxy_jslib_handle(document.links[(i)], 'href', '', 0, 0);
          if (tmpLink.indexOf("mailto:")==-1 && tmpLink.indexOf("javascript:")==-1 && tmpLink != "#" && tmpLink != "#xyz")
          {
            if (tmpLink.indexOf("?")!=-1 && tmpLink.indexOf("XY")==-1)
            {
              tmpLink = tmpLink + "&XY=" + sessionId;
               _proxy_jslib_assign('', document.links[(i)], 'href', '=', ( tmpLink));
            }
            else if (tmpLink.indexOf("XY")==-1)
            {
              tmpLink = tmpLink + "?XY=" + sessionId;
               _proxy_jslib_assign('', document.links[(i)], 'href', '=', ( tmpLink));
            }
          }
        }
        for (var i = 0; i < document.forms.length; i++)
        {
          var action =  _proxy_jslib_handle(document.forms[(i)], 'action', '', 0, 0);
          var sessionIdInForm = false;
          for (var j = 0; j < document.forms[(i)].elements.length; j++)
          {
            if ( _proxy_jslib_handle(document.forms[(i)].elements, (j), 0, 0).name == "XY")
            {
              sessionIdInForm = true;
              break;
            }
          }
          if ( _proxy_jslib_handle(null, 'action', action, 0, 0).indexOf("XY")==-1 && !sessionIdInForm)
          {
            newInput = document.createElement("input");
             _proxy_jslib_handle(newInput, 'setAttribute', '', 1, 0)("type", "hidden");
             _proxy_jslib_handle(newInput, 'setAttribute', '', 1, 0)("name", "XY");
             _proxy_jslib_handle(newInput, 'setAttribute', '', 1, 0)("value", sessionId);
            document.forms[(i)].appendChild(newInput);
          }
        }
      }
    }
  }
  
  function resizeIframe(element) {
    if ( _proxy_jslib_handle( _proxy_jslib_handle(null, 'parent', parent, 0, 0), 'frames', '', 0, 0).length > 0 &&  _proxy_jslib_handle( _proxy_jslib_handle(null, 'parent', parent, 0, 0).document, 'getElementById', '', 1, 0)(element))
    {
      var pageEndPos =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('ende').offsetTop;
      pageEndPos = pageEndPos-15;
       _proxy_jslib_handle( _proxy_jslib_handle(null, 'parent', parent, 0, 0).document, 'getElementById', '', 1, 0)(element).style.height = pageEndPos+'px';
    }
  }

  function openXML(url,windowId,treeId,width,height) {
     _proxy_jslib_handle(window, 'open', '', 1, 0)(url+"&treeid="+treeId,windowId,"width="+width+",height="+height+",left=20,top=20,dependent=yes,resizable=no,menubar=no,location=no,status=no,toolbar=no,scrollbars=yes");
  }

  function checkAjax() {
    var xmlHttp = false;  
    try
    {
      if( window.ActiveXObject )
      {
        for(var i = 5; i; i-- )
        {
          try
          {
            if( i == 2 )
            {
              xmlHttp = new (ActiveXObject)( "Microsoft.XMLHTTP" );    
            }
            else
            {
              
              xmlHttp = new (ActiveXObject)( "Msxml2.XMLHTTP." + i + ".0" );
            }
            break;
          }
          catch( excNotLoadable )
          {                        
              xmlHttp = false;
          }
        }
      }
      else if( window.XMLHttpRequest )
      {
          xmlHttp = new (XMLHttpRequest)();
      }
    }
    catch( excNotLoadable )
    {
        xmlHttp = false;
    }
    return xmlHttp ;
  }
  
  function addTime(url) {
    var currentTime = new (Date)();
    currentTime = currentTime.getTime();
    if (url.indexOf('?') != -1)
    {
      url = url+'&time='+currentTime;
    }
    else
    {
      url = url+'?time='+currentTime;
    }
    return url;
  }
  
  function ajaxRequest(url,changeElement) {
    var xmlHttp = checkAjax();
    if (xmlHttp) 
    {
      url = addTime(url);
       _proxy_jslib_handle(xmlHttp, 'open', '', 1, 0)('GET', url, true);
      xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4) 
        {
           _proxy_jslib_assign('',  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(changeElement), 'innerHTML', '=', ( xmlHttp.responseText));
        }
      };
      xmlHttp.send(null);
    }
  }
  
  function highLightTab(changeElement,boxIndex) {
    changeElement += "Nav";
    for(var i=0;i<3;i++)
    {
      if ( _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(changeElement+i))
      {
        if (i == parseInt(boxIndex))
        {
           _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(changeElement+i).className = 'jamTabLinkBox'+i+'Hi';
        }
        else
        {
           _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(changeElement+i).className = 'jamTabLinkBox'+i;
        }
      }
    }
  }
  
  function tabNaviRequest(url,changeElement,boxIndex) {
    highLightTab(changeElement,boxIndex);
    changeElement += "Box";
    ajaxRequest(url,changeElement);
  }

  function openWindow(element,windowName,windowParams) {
    var href =  _proxy_jslib_handle(element, 'href', '', 0, 0);
    if ( _proxy_jslib_handle(null, 'href', href, 0, 0).indexOf('debitel.de') != -1)
    {
       href= _proxy_jslib_assign_rval('', 'href', '=', (  _proxy_jslib_handle(null, 'href', href, 0, 0).substring( _proxy_jslib_handle(null, 'href', href, 0, 0).indexOf('http/par.jamba.de/80/'))), href);
       href= _proxy_jslib_assign_rval('', 'href', '=', (  _proxy_jslib_handle( _proxy_jslib_handle(null, 'href', href, 0, 0), 'replace', '', 1, 0)('http/par.jamba.de/80/','http://par.jamba.de/')), href);
    }
    newWindow =  _proxy_jslib_handle(window, 'open', '', 1, 0)( _proxy_jslib_handle(null, 'href', href, 0, 0),windowName,windowParams);
  }
  
  function openPrelisten(element,windowName,windowParams) {
    newWindow =  _proxy_jslib_handle(window, 'open', '', 1, 0)(element,windowName,windowParams);
  }
	
  function openPreview(element,windowName,windowParams) {
    newWindow =  _proxy_jslib_handle(window, 'open', '', 1, 0)(element,windowName,windowParams);
  }
  
  function openerRedirect(url,selfclose) {
    var openerHref = '';
    try
    {
      openerHref =  _proxy_jslib_handle( _proxy_jslib_handle( _proxy_jslib_handle(null, 'opener', opener, 0, 0), 'location', '', 0, 0), 'href', '', 0, 0);
    }
    catch(e)
    {
      //
    }
    alert(openerHref);
    if (openerHref.indexOf("debitel.de") != -1)
    {
      alert(openerHref);
      url =  _proxy_jslib_handle(url, 'replace', '', 1, 0)("http://par.jamba.de/","http/par.jamba.de/80/");
      url = openerHref+"/JAMBAmeinhandy/"+url;
    }
     _proxy_jslib_assign('',  _proxy_jslib_handle( _proxy_jslib_handle(null, 'opener', opener, 0, 0), 'location', '', 0, 0), 'href', '=', ( url));
    if (selfclose == 1)
    {
       _proxy_jslib_handle(self, 'close', '', 1, 0)();
    }
  }
  
//--> ;
_proxy_jslib_flush_write_buffers() ;