document.write('<script language="javascript" src="/scripte/oculus/prototype.js" type="text/javascript"></script>' );
document.write('<script language="javascript" src="/scripte/oculus/scriptaculous.js" type="text/javascript"></script>' );
document.write('<script language="javascript" src="/scripte/druck.js" type="text/javascript"></script>' );
document.write('<script language="javascript" src="/scripte/datepicker.js" type="text/javascript"></script>');

var oXmlHttpRequest = null;
// Browserweiche
var IE       = document.all&&!window.opera;
var DOM      = document.getElementById&&!IE;
var bIsMobil = false;


if( typeof($) != 'function' )
{
    $ = function(id){ return document.getElementById(id); };
}

if( typeof(String.prototype.trim) != 'function' )
{
    String.prototype.trim = function()
    {
      return this.replace(/^\s*([^ ]*)\s*$/, "$1");
    }
}

function getHttpRequest()
{
    if( oXmlHttpRequest == null )
    {
        // Mozilla
        if (window.XMLHttpRequest)
        {
            oXmlHttpRequest = new XMLHttpRequest();
        }
        // IE
        else if (window.ActiveXObject)
        {
            oXmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }

    return oXmlHttpRequest;
}

function sendHttpRequest( sPfad, param, sKey, readystatefunc )
{
    var xmlhttp = getHttpRequest();    
    
//    alert( xmlhttp );
//    alert( sPfad + '?' + param );
//    alert( encodeURI(sPfad + '?' + param) );
    if( document.URL.substr(0,6).toLowerCase() == "https:" &&
        sPfad.substr(0,5).toLowerCase()        == "http:" )
    {
        sPfad = "https:" + sPfad.substr(5);
    }
    
    try
    {        
        xmlhttp.onreadystatechange = readystatefunc;
        xmlhttp.Key = sKey;
        xmlhttp.open('GET', encodeURI(sPfad + '?' + param), true);               
        //xmlhttp.open('POST', sPfad, true);        
        xmlhttp.send('AnmeldeParameter=test');
        //xmlhttp.send(param);
    }
    catch(e){ /*alert(e);*/ }
}

function getHttpRequestString( sHttpRequestResult )
{
    var sRet  = '';
    var nPos1 = sHttpRequestResult.indexOf('<string ');
     
    if( nPos1 >= 0 )
    {
        var nPos2 = sHttpRequestResult.indexOf('>', nPos1);
        if( nPos2 > nPos1 )
        {
            nPos2++;
            nPos1 = sHttpRequestResult.indexOf('</string>', nPos2);  
            
            if( nPos2 < nPos1 )
            {
                sRet = sHttpRequestResult.substring(nPos2,nPos1);
                sRet = sRet.replace(/&gt;/g , '>');
                sRet = sRet.replace(/&lt;/g , '<');
                sRet = sRet.replace(/&amp;/g, '&');
            }
        }
    }
    
    return sRet;
}

function monatMinus( sDate )
{
    var arr = sDate.split('-');
    var dat = new Date();
    
    if( arr.length >= 3 )
    {
        arr[1] = Number(arr[1]) - 2;
        if( arr[1] < 0 )
        {
           arr[1] = 11;
           arr[0] = Number(arr[0]) -1;
        } 
        dat.setFullYear(arr[0], arr[1], 1);
        
        sDate = dat.getFullYear() + '-' + (dat.getMonth()+1) + '-' + dat.getDate();        
    }
    
    return sDate;
}

function monatPlus( sDate )
{
    var arr = sDate.split('-');
    var dat = new Date();
    if( arr.length >= 3 )
    {
        //arr[1] = Number(arr[1]) + 1;
        if( arr[1] >= 11 )
        {
           arr[1] = 0;
           arr[0] = Number(arr[0]) + 1;
        } 
        dat.setFullYear(arr[0], arr[1], 1);        
        
        sDate = dat.getFullYear() + '-' + (dat.getMonth()+1) + '-' + dat.getDate();
    } 

    return sDate;
}

/******************** FormularPostback-Funktion *******************/
function doPostBack(eventTarget, eventArgument) 
{
	var theform = document.forms[0];
	if( theform )
	{
		if( theform.elements['__EVENTTARGET'] && 
		    theform.elements['__EVENTARGUMENT'] )
		{
			theform.elements['__EVENTTARGET'].value   = eventTarget.split("$").join(":");
			theform.elements['__EVENTARGUMENT'].value = eventArgument;
			window.bCloseOk = true;			
			theform.submit();
		}
	}
}

function findElement( sId, bById )
{
	if( document.forms[0] )
	{
		var form = document.forms[0];
		var n    = 0;
		var nCnt = form.elements.length;
		for( ; n < nCnt; n++ )
		{		 
			if( bById == true && form.elements[n].id.indexOf(sId) >= 0 )
				return form.elements[n];
			else if( bById == false && form.elements[n].name.indexOf(sId) >= 0 )
				return form.elements[n];
		}
    }
    return null;
}

function findButton( sTyp, sId, bById )
{
	var elems = document.getElementsByTagName(sTyp);
	if( elems )
	{
		for( n = 0; n < elems.length; n++ )
		{
			if( bById == true && 
			    elems[n].id.indexOf(sId) >= 0 )
			{
				return elems[n];
			}
			else if( bById == false && 
			         elems[n].name.indexOf(sId) >= 0 )
			{
				return elems[n];
			}
		}
	}
	
	return null;
}

function findElementIdPraefix()
{
	if( document.forms[0] )
	{
		var form = document.forms[0];
		var n    = 0;
		var nIdx = 0;
		var nCnt = form.elements.length;
		for( ; n < nCnt; n++ )
		{		 
			nIdx = form.elements[n].name.indexOf(':');
			if( nIdx >= 0 )
				return form.elements[n].name.substr(0,nIdx)+'_';
		}
    }
    return '';
}

function findElementsByClass(searchClass,node,tag) 
{
	var classElements = new Array();
	
	if ( node == null )
	{
		node = document;
	}
	if ( tag == null )
	{
		tag = '*';
	}
		
	var els     = node.getElementsByTagName(tag);
	var elsLen  = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	
	for (i = 0, j = 0; i < elsLen; i++) 
	{
		if ( pattern.test(els[i].className) ) 
		{
			classElements[j] = els[i];
			j++;
		}
	}
	
	return classElements;
}

function findValue( sId, bById )
{
	var sRet = "";
	var oEle = findElement( sId, bById );
	if( oEle )
	{
		if( oEle.type.indexOf("text") >= 0  )
			sRet = oEle.value;
		else if( oEle.type == "radio" ||
		         oEle.type == "checkbox" )
			sRet = oEle.checked ? "1" : "";
		else if( oEle.type.indexOf("select") >= 0 )
		    sRet = oEle.selectedIndex;
			
	}	
	return sRet;
}

function KlappElement(elemId, imgId, statusElem, nHeight, sFirstAktion)
{
    var obj = document.getElementById( elemId );
    var img = document.getElementById( imgId );
    var sta = document.forms[0].elements[statusElem];
    var src = (img && img.src ? img.src : ''); 
    var auf = '';
    var zu  = '';
    
    if( src.length > 0 )
    {
        var arr  = src.split('/');
        var hilf = arr[arr.length-1];
        
        if( hilf.indexOf('auf') >= 0 )
        {
            arr[arr.length-1] = hilf.replace('auf','zu');
            if( sta )
            {
                sta.value = arr[arr.length-1];
            }
        }
        else //if( hilf.indexOf('zu') )
        {
            arr[arr.length-1] = hilf.replace('zu','auf');
            if( sta )
            {
                sta.value = arr[arr.length-1];
            }
        }
        
        src = arr.join("/");
    }
    
    if( obj )
    {
        if( !obj.style.height )
        {
            if( sFirstAktion == 'auf' )
            {
                obj.style.height = 'auto';                                                
            }
            else //if( sFirstAktion == 'zu' )
            {
                obj.style.height = nHeight+'px';
                if( !obj.style.overflow ||
                     obj.style.overflow != 'hidden')
                { 
					obj.style.overflow = 'hidden';
				}				
            }
            
            if( sta )
            {
                sta.value = sFirstAktion;
            }
            
            if( img )
            {
			    img.src = src;
            }
        }
        else if( sFirstAktion != sta.value )
        {
            if( sFirstAktion != sta.value && obj.style.height == 'auto' )
            {
                obj.style.height = nHeight+'px';
                if( !obj.style.overflow ||
                     obj.style.overflow != 'hidden')
                { 
				    obj.style.overflow = 'hidden';
			    }
    			
			    if( sta )
                {
                    sta.value = 'zu';
                }
            }
            else 
            {
                obj.style.height   = 'auto';
                if( sta )
                {
                    sta.value = 'auf';
                }
            }
            
            if( img )
            {
			    img.src = src;
            }
        }        
    }
    return false;
}

function noEnter(e) 
{
    var c = 0;
    
    if (!e)
    {
        e = window.event;
    }
    if (e.which) 
    {
        c = e.which;
    } 
    else if (e.keyCode) 
    {
        c = e.keyCode;
    }
    
    if( c == 13 )
    {
        return false;
    }
}

function sendEnter(e) 
{
    var theform = document.forms[0];
    var c       = 0;
    
    if (!e)
    {
        e = window.event;
    }
    if (e.which) 
    {
        c = e.which;
    } 
    else if (e.keyCode) 
    {
        c = e.keyCode;
    }
    
    if( c == 13 )
    {        
        if( this.Eventtarget )
        {
//          if( __doPostBack )
//          {
//              __doPostBack(this.Eventtarget,(this.EventArgument?this.EventArgument:''));
//              return false;
//          }  
            if( theform )
            {
                theform.elements['__EVENTTARGET'].value   = this.Eventtarget.split("$").join(":");
			    theform.elements['__EVENTARGUMENT'].value =(this.EventArgument ? this.EventArgument : '');	
			    
			    var bSubmit = true;
			    
			    if( this.EventButton )
			    {
			        var oBut = $(this.EventButton);
			        if( oBut )
			        {
			            oBut.click();
			            bSubmit = false;
			        }
			    }
			    		
			    if( bSubmit )
			    {
		            theform.submit();                      
		        }
		        
		        return false;
		    }
        }                
    }    
}

function addNotiz(item,id)
{
    var win = window.open("/ssl/kd/notizen.aspx?aktion=NotizBlockAdd&NotizBlockItem="+item+"&NotizBlockItemID="+id, "notizblock", "width=300,height=400");
    win.focus();
    return true;
}

function addNotizWithParams(item, id, params)
{
    var win = window.open("/ssl/kd/notizen.aspx?aktion=NotizBlockAdd&NotizBlockItem="+item+"&NotizBlockItemID="+id, "notizblock", params);
    win.focus();
    return true;
}

function doPostBackNotiz(eventTarget, eventArgument) 
{
    var theform = null;
    
    if( opener && opener.document.forms[0])
    {
        theform = opener.document.forms[0];
    }
    else
    {
	    theform = document.forms[0];
	}
	
	if( theform )
	{
	    if( eventTarget == 'KalenderLink' )
	    {
	        theform.action = "/shop/vstdetails.aspx";
	    }
	    else if( eventTarget == 'ArtikelListeLink' )
	    {
	        theform.action = "/shop/artdetails.aspx";
	    }
	    
	    if( theform.elements['__VIEWSTATE'] )
	    {
	        theform.elements['__VIEWSTATE'].value = '';
	    }
	    
		if( theform.elements['__EVENTTARGET'] && 
		    theform.elements['__EVENTARGUMENT'] )
		{
			theform.elements['__EVENTTARGET'].value   = eventTarget.split("$").join(":");
			theform.elements['__EVENTARGUMENT'].value = eventArgument;
			window.bCloseOk = true;			
			theform.submit();
		}
	}
}

function doPostBackLoginByEnter(e, sBnn, sPwd, eventTarget, eventArgument) 
{
    var theform = null;
    var oPwd    = $(sPwd);
    var oBnn    = $(sBnn);
    
    if( oBnn && oBnn.value.length > 0 &&
        sPwd && oPwd.value.length > 0 &&
        e    && e.keyCode == 13 )
    {                
        theform = document.forms[0];
    	
	    if( theform )
	    {	    
		    if( theform.elements['__EVENTTARGET'] && 
		        theform.elements['__EVENTARGUMENT'] )
		    {
			    theform.elements['__EVENTTARGET'].value   = eventTarget.split("$").join(":");
			    theform.elements['__EVENTARGUMENT'].value = eventArgument;			
			    //theform.submit();
		    }
	    }
    }
    
    return false;
}


var ampel_imgs = new Array();
var ampel_akt  = 0;
var myHost     = window.location.protocol+'//'+window.location.host;

function resetAnwPlanAmpelAsynchron()
{
    if( ! getHttpRequest() )
    {
        resetAnwPlanAmpel();
    }
    else
    {
        if( document.images &&
            document.images.length > 0 )
        {
            for(n = 0; n < document.images.length; n++ )
            {
                if( document.images[n].name.indexOf('ampel_') == 0 )
                {
                    ampel_imgs[ampel_akt] = document.images[n];
                    ampel_akt++;
                }
            }

            ampel_akt = 0;
            ladeAmpel();
        }
    }
    
    //alert( ampel_imgs.length );
}

function resetAnwPlanAmpel()
{
    if( document.images &&
        document.images.length > 0 )
    {
        ampel_imgs = new Array();
        ampel_akt  = 0;

        for(n = 0; n < document.images.length; n++ )
        {
            if( document.images[n].name.indexOf('ampel_') == 0 )
            {
                var vstkey = document.images[n].name.split('_');
                var elem   = document.getElementsByName(document.images[n].name);
                document.images[n].src = myHost+'/shop/ampelstatus.aspx?ajax=0&image=&vstkey=' + vstkey[1] + '&userampel=' +(vstkey.length > 2 ? vstkey[2] : '');
                if( elem && elem.length > 0 )
                {
                    elem[0].alt   = '';
                    elem[0].title = '';
                }
            }
        }
    }
}

function ladeAmpel()
{
    if( ampel_akt < ampel_imgs.length )
    {
        //alert(ampel_imgs[ampel_akt]);

        if( ampel_imgs[ampel_akt] )
        {
            var vstkey = ampel_imgs[ampel_akt].name.split('_');
            var sPfad  = myHost+'/shop/ampelstatus.aspx?ajax=1&image=' + ampel_imgs[ampel_akt].name + '&vstkey=' + vstkey[1]+ '&userampel=' +(vstkey.length > 2 ? vstkey[2] : '');

            //alert(ampel_imgs[ampel_akt].name);
            //alert(encodeURI(sPfad));

            ampel_imgs[ampel_akt].alt   = '';
            ampel_imgs[ampel_akt].title = '';

            oXmlHttpRequest.open("GET", encodeURI(sPfad), true);
        	oXmlHttpRequest.onreadystatechange = asynchronAmpel;
            oXmlHttpRequest.send(null);
        }
    }
}

function asynchronAmpel()
{
    if(oXmlHttpRequest.readyState == 4)
    {
        if( oXmlHttpRequest.status == 200 )
        {
    	    var jstxt = oXmlHttpRequest.responseText;
            if( jstxt.indexOf( 'document.images[' ) == 0 )
            {
                eval(jstxt);
            }

            //alert(jstxt);

            ampel_akt++;
            ladeAmpel();
        }
        else 
        {
            //alert( oXmlHttpRequest.responseText );
        }
    }

}

function checkMaxOrder(nMaxAnz)
{
    var test  = 0;
    var nName = '';
    
    for(j = 0; j < document.forms[0].elements.length; j++)
    {
        nName = document.forms[0].elements[j].name;

        if(nName.match(/ADD_BESTPLATZAUSWAHL_/))
        {
            test += parseInt(document.forms[0].elements[j].selectedIndex);
        }
    }

    if(test > nMaxAnz)
    {
        alert('Sie k�nnen maximal '+ nMaxAnz +' Tickets in dieser Veranstaltung pro Bestellung erwerben.');
        return false;
    }
    /*
    else if(test <= nMaxAnz )
    {
        document.forms["kartenauswahl"].submit();
    }
    */
    
    return true;
}

function closeFehler()
{
    var oElem = $('FEHLERBACKGROUND');
    
    if( oElem )
    {
        oElem.style.display='none';
    }
    
    oElem = $('FEHLERMELDUNG'); 
    
    if( oElem )
    {
        oElem.style.display='none';
    }
    
    return false;
}

function fillDefText()
{
    var sTxt = this.value.replace(/ /g,"");
    
    //alert( sTxt );
    
    if(sTxt.length == 0)
    {                   
        this.value             = this.defText;
        this.style.color       = this.defColor;
        //this.style.textAlign = 'center';
    }

}

function clearDefText()
{
    if(this.value == this.defText)
    {                   
        this.value           = "";
        this.style.color     = this.undefColor;
        this.style.textAlign = 'left';
    }
}

function submitDefText()
{
    if( this.defElem && this.defElem.length > 0 )
    {
        var oElem = null;
        
        for(var n = 0; n < this.defElem.length; n++ )
        {
            oElem = this.defElem[n];
            
            if(oElem && oElem.defText)
            {                  
                if(oElem.value == oElem.defText)
                {
                    oElem.value           = "";
                    oElem.style.color     = this.undefColor;
                    //this.defElem.style.textAlign = 'left';
                }
            }
        }
    }
}

function initAusfuellhilfe(sId, sSub, sTxt, cDefColor, cUndefColor)
{
    var oElem = findElement(sId , true);
    var oSubm = findElement(sSub, true);
    
    if( oElem )
    {
        oElem.defText     = sTxt;  
        oElem.defColor    = cDefColor;
        oElem.undefColor  = cUndefColor;
        if( oElem.value && oElem.value != oElem.defText )
        {
            oElem.style.color = oElem.undefColor;
        }
        else
        {
            oElem.style.color = oElem.defColor;      
        }
        oElem.onblur      = fillDefText;
        oElem.onfocus     = clearDefText;
        oElem.onblur();        
        
        if( oSubm )
        {
            if( ! oSubm.defElem )
            {
                oSubm.defElem = new Array();
            }
            oSubm.defElem[oSubm.defElem.length] = oElem; 
            oSubm.onclick = submitDefText;
        }
    }
}

function sektormap( obj, aktion, sektor)
{
    if( aktion == 'mclick' )
    {
        if( typeof(sektormapClick) == 'function' )
        {
            sektormapClick(obj,sektor);
        } 
    }
    else if( aktion == 'mover' )
    {
        if( typeof(sektormapMouseOver) == 'function' )
        {
            sektormapMouseOver(obj,sektor);
        } 
    }
    else if( aktion == 'mout' )
    {
        if( typeof(sektormapMouseOut) == 'function' )
        {
            sektormapMouseOut(obj,sektor);
        } 
    }
}

function unloadSeite()
{
    var nW = 0;
    if(window.innerWidth)
    {
        nW = window.innerWidth;
    }
    else if(document.body && document.body.clientWidth)
    {
        nW = document.body.clientWidth;
    }
    else if(document.documentElement && document.documentElement.clientWidth)
    {
        nW = document.documentElement.clientWidth;
    }

    document.cookie='ScreenWidth='  + screen.availWidth;
    document.cookie='DocumentWidth='+ nW;
    
    //alert( document.cookie );
}

function TicketToHandy(sParam, oStatus)
{
    var oElem = $(oStatus);
    var oTel  = findElement('TicketToHandyNummer', true);
    var oReq  = getHttpRequest();
    var sNum  = (oTel ? oTel.value : '');
    var sUrl  = window.location.protocol + '//'  
              + window.location.host  
              + (window.location.port != '' ? ':' + window.location.port : '') 
              + '/center/onlinecenter.asmx/TicketToHandy';
    
    //alert(oStatus + '' + oElem);
    //return;
    
    if( oReq )
    {    
        if( sNum.length == 0 )
        {
            alert("Es wurde keine Telefonnummer angegeben!");
        }
        else
        {
            oReq.onreadystatechange = dummy;
            oReq.open('POST', sUrl, false);
            oReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");            
            oReq.send(encodeURI('sParam='+sParam+'&sTelnr='+sNum));
            var sRet = oReq.responseText;//getHttpRequestString(oReq.responseText);
            
            //alert( sRet );
            
            if( oElem )
            {
                var sAus = sRet;
                
                if( sRet.indexOf('<string ') >= 0 )
                {
                    sAus = getHttpRequestString(sRet);
                }
                
                //alert( sAus );
              
                if( sAus.indexOf("Die Karten wurden gesendet") >= 0 )
                {
                    var but = findButton("input", "TicketToHandyButton", true);
                    if( but )
                    {
                        but.style.visibility = 'hidden';
                    }
                } 
                oElem.innerHTML        = '<div class="TicketToHandyMeldung">' + sAus + '</div>';
                oElem.style.visibility = 'visible';
            }
        }
    }
    else if( oElem )
    {
        oElem.innerHTML        = '<div class="TicketToHandyFehler">Die Tickets konnten nicht gesendet werden!</div>';
        oElem.style.visibility = 'visible';
    }
}

function openPopWin(url, target, params, aktion, ret)
{
    var pop = window.open(url, target, params);
    var n   = 0;
    
    for( ; n < 5; n++ )
    {
        sleep(500);
        
        if( pop &&
            pop.document &&
           (pop.document.isLoaded       ||
            pop.document.forms['form1'] ||
            pop.document.form1) )
        {
            var popForm = pop.document.forms['form1'];
            if( ! popForm )
            {
                popForm = pop.document.form1;
            }
            
            if( aktion )
            {
                eval(aktion);
            }
            break;
        }            
    }
    
    return ret;
}

function sleep(ms)
{ 
    var zeit      = (new Date()).getTime(); 
    var stoppZeit = zeit + ms; 
    while( (new Date()).getTime() < stoppZeit ){}; 
}

function dummy(){ return; }

var m_oTimeLoop         = null;
var m_oTimeLoopInterval = 2 * 60 * 1000;
var m_nTimeLoopStep     = 1;

function TimeLoop()
{
    var sPfad = 'http://' + window.location.host + '/testseite.aspx';
    //alert( 'TimeLoop('+m_oTimeLoopInterval+')' );    

    if( !m_oTimeLoop )
    {        
        m_oTimeLoop = window.setInterval("TimeLoop()", m_oTimeLoopInterval);
        return;
    }      
            
    sendHttpRequest( sPfad, 'TimeLoop=' + m_oTimeLoopInterval + '&Step=' + m_nTimeLoopStep, "TimeLoop", dummy );    
    m_nTimeLoopStep++;
}

window.setTimeout( 'TimeLoop()', 1000 );

function UserJsOK()
{
    var sPfad = 'http://' + window.location.host + '/testseite.aspx';

    sendHttpRequest( sPfad
                    , 'UserScriptOk=1&ScreenWidth=' + screen.width  +
                      '&ScreenHeight='          + screen.height +
                      '&DocumentWidth='         + window.innerWidth +
                      '&DocumentHeight='        + window.innerHeight 
                    , "ScriptOk"
                    , dummy );
}


/******************************** 
 **** Base64 encode / decode ****
 ********************************/
 
var Base64 = {

	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
 
	// public methode f�r encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = Base64._utf8_encode(input);
 
		while (i < input.length) {
 
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
 
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
 
			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}
 
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
 
		}
 
		return output;
	},
 
	// public methode f�r decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
 
		while (i < input.length) {
 
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));
 
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
 
			output = output + String.fromCharCode(chr1);
 
			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}
 
		}
 
		output = Base64._utf8_decode(output);
 
		return output;
 
	},
 
	// private methode f�r UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// private methode f�r UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	} 
}


function CopyToClipboard(text)   
{   
    if(window && window.clipboardData)   
    {   
        window.clipboardData.setData('text',text);   
    }   
    else if( document )  
    {   
        var clipboarddiv = document.getElementById('divclipboardswf');   
        
        if(clipboarddiv == null)   
        {   
           clipboarddiv = document.createElement('div');   
           clipboarddiv.setAttribute("name", "divclipboardswf");   
           clipboarddiv.setAttribute("id", "divclipboardswf");   
           document.body.appendChild(clipboarddiv);   
        }   
        clipboarddiv.innerHTML = '<embed src="/scripte/clipboard.swf" FlashVars="clipboard='+   
        encodeURIComponent(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';   
    }    
      
    return false;   
} 
