sxRefresh='true';
xRefreshInterval = '';
function update_getStuff(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (xDiv != null) {
		xDiv.style.left = (x + 20) + "px";
		xDiv.style.top 	= (y -20) + "px";
	}
}
// tooltip
xDiv = null;

function updatexDiv(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (xDiv != null) {
		xDiv.style.left = (x - (x/2)) + "px";
		xDiv.style.top 	= (y +20) + "px";
	}
}
function $(id){
	return document.getElementById(id);
}
function change_track_status(url,elem){
	    var http = false;
        if ( window.ActiveXObject ){
             try {
                http = new ActiveXObject( 'Msxml2.XMLHTTP' );
            }
            catch( e ) {
                http = new ActiveXObject( 'Microsoft.XMLHTTP' );
            }
        } else {
            http = new XMLHttpRequest();
        }
		if (!http) {
                alert("No Ajax Support !");
                return;
        }
        http.open( 'GET', url, true );
       	if ( window.XMLHttpRequest ) {
        	http.send(null?null:'');
        } else if ( window.ActiveXObject ) {    // case IE
        	http.send();
        }                   
        http.onreadystatechange = function() {                
            if (http.readyState == 4 && (http.status == 304 || http.status == 200)) {
				if(http.responseText=="OK"){
					if($(elem).className=='statuson'){
						$(elem).className=='statusoff';
						$(elem).lastChild.innerHTML = "OFF";
						$(elem).lastChild.href = $(elem).lastChild.href.replace(/RemoveChallenge/g,"AddChallenge");
					}
					else{
						$(elem).className=='statuson';
						$(elem).lastChild.innerHTML = "ON";
						$(elem).lastChild.href = $(elem).lastChild.href.replace(/AddChallenge/g,"RemoveChallenge");
					}
				}
        	}
       } 		
}
function showxDiv( inhalt, id) {
	document.onmousemove = updatexDiv;
	xDiv = document.getElementById(id);
	xDiv.innerHTML = '<blink><b><font size="+2" color="#00FF00">LOADING</font></b></blink>';
	
    var http = false;
        if ( window.ActiveXObject ){
             try {
                http = new ActiveXObject( 'Msxml2.XMLHTTP' );
            }
            catch( e ) {
                http = new ActiveXObject( 'Microsoft.XMLHTTP' );
            }
        } else {
            http = new XMLHttpRequest();
        }
        
            if (!http) {
                document.getElementById('Status').innerHTML = '... NO GET_xmlHttp()!';
                return;
                }
             
            http.open( 'GET', inhalt, true );
                if ( window.XMLHttpRequest ) {
                        http.send(null?null:'');
                    } else if ( window.ActiveXObject ) {    // case IE
                        http.send();
                    }
                   
                http.onreadystatechange = function() {
                
                 if (http.readyState == 4 && (http.status == 304 || http.status == 200)) {
	                   if (!xDiv) {
	                    return;
	                	}
                   	xDiv.innerHTML = http.responseText;
					xDiv.style.display = "block";
					xDiv.style.zIndex = 3000;
                }
            }  
}

function hidexDiv() {
	xDiv.style.display = "none";
	document.onmousemove = "none";
}
function GET_getStuff ( xWhat, xDIV, posY ){

    xDiv = document.getElementById( xDIV );
    if (!xDiv) {
         return;
        }
    var xURL=xWhat;
    var http = false;
        if ( window.ActiveXObject ){
             try {
                http = new ActiveXObject( 'Msxml2.XMLHTTP' );
            }
            catch( e ) {
                http = new ActiveXObject( 'Microsoft.XMLHTTP' );
            }
        } else {
            http = new XMLHttpRequest();
        }
        
            if (!http) {
                document.getElementById('Status').innerHTML = '... NO GET_xmlHttp()!';
                return;
                }
             
            http.open( 'GET', xURL, true );
                if ( window.XMLHttpRequest ) {
                        http.send(null?null:'');
                    } else if ( window.ActiveXObject ) {    // case IE
                        http.send();
                    }
                   
                http.onreadystatechange = function() {
                
                 if (http.readyState == 4 && (http.status == 304 || http.status == 200)) {
                   if (!xDiv) {
                    return;
                }
                   xDiv.innerHTML = http.responseText;
                   xDiv.style.zIndex = 1000;
                   xDiv.style.display='';
                   if(posY) window.scroll(parseInt(0), parseInt(1));
                }
            }                  
}


function GET_autoStuff ( xWhat, xDIV){
    xDiv = document.getElementById( xDIV );
    if (!xDiv) {
         return;
        }
    var xURL=xWhat;
    var http = false;
        if ( window.ActiveXObject ){
             try {
                http = new ActiveXObject( 'Msxml2.XMLHTTP' );
            }
            catch( e ) {
                http = new ActiveXObject( 'Microsoft.XMLHTTP' );
            }
        } else {
            http = new XMLHttpRequest();
        }
        
            if (!http) {
                document.getElementById('Status').innerHTML = '... NO GET_xmlHttp()!';
                return;
                }
             
            http.open( 'GET', xURL, true );
                if ( window.XMLHttpRequest ) {
                        http.send(null?null:'');
                    } else if ( window.ActiveXObject ) {    // case IE
                        http.send();
                    }
                   
                http.onreadystatechange = function() {
                
                 if (http.readyState == 4 && (http.status == 304 || http.status == 200)) {
                 if (!xDiv) {
                    return;
                }
                 xDiv.innerHTML = http.responseText;
                   //xDiv.style.display='';
                }
            }                  
}


function DO_it ( xWhat, xDO ){
    var xURL=xWhat;
    loader( 'go' );
    var http = false;
        if ( window.ActiveXObject ){
             try {
                http = new ActiveXObject( 'Msxml2.XMLHTTP' );
            }
            catch( e ) {
                http = new ActiveXObject( 'Microsoft.XMLHTTP' );
            }
        } else {
            http = new XMLHttpRequest();
        }
        
            if (!http) {
                document.getElementById('Status').innerHTML = '... NO GET_xmlHttp()!';
                return;
                }
             
            http.open( 'GET', xURL, true );
                if ( window.XMLHttpRequest ) {
                        http.send(null?null:'');
                    } else if ( window.ActiveXObject ) {    // case IE
                        http.send();
                    }
                   
                http.onreadystatechange = function() {
                
                 if (http.readyState == 4 && (http.status == 304 || http.status == 200)) {
                    if(xDO) xDO;
                   loader( 'stop' );
                }
            }                  
}

function EvilReplace( xString){
 
 	xString = xString.replace("&","%26");
 	return xString;
}


function DO_post( adr, xreturn, xform){
var post_http = false;
var xParam = '';
var error = false;

    var f = document.getElementById( xform );
    for( var i = 0; i < f.elements.length; i++ ) { 
     		
    
		   xParam = xParam+f.elements[i].name+'='+Url.encode(f.elements[i].value)+'&';
	} 

    if(!error){
      document.getElementById(xreturn).innerHTML = "<blink><font size='+2' color='#FFFFFF'>LOADING</font></blink>";
      post_http = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         post_http = new XMLHttpRequest();
         if (post_http.overrideMimeType) {
            post_http.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            post_http = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               post_http = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!post_http) {
         return false;
      }
      
      post_http.onreadystatechange = function () {
             if (post_http.readyState == 4) {
                    if (post_http.status == 200) {
                        
						 	document.getElementById(xreturn).innerHTML =post_http.responseText;
						
                    }
                       //loader( 'stop' );
                }  
           }
      post_http.open('POST', adr, true);
      post_http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      post_http.setRequestHeader("Content-length", xParam.length);
      post_http.setRequestHeader("Connection", "close");
      post_http.send(encodeURI(xParam));
    }          
}

function ajaxSendFormTrack( ajSite, ajA1, ajA2, ajA3, ajA4, ajA5, ajA6, ajA7, ajA8, ajA9, ajA10, ajLogin, ajDiv ){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if (ajaxRequest.readyState==4&& ajaxRequest.status == 200){
			var ajaxDisplay = document.getElementById(ajDiv);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		            document.getElementById('SearchLoader').style.width=  1;
                    document.getElementById('SearchLoader').style.height=  1;                    
                    document.getElementById('SearchLoader').style.visibility = 'hidden';        
                  } else {
                  
                  document.getElementById('SearchLoader').style.width=  1;
                  document.getElementById('SearchLoader').style.height=  1;
                  document.getElementById('SearchLoader').innerHTML = "<p align='center'><img src='grf/ajax-loader.gif' border=0 /></p>";
                  document.getElementById('SearchLoader').style.visibility = 'visible'; 
                  }  
	}                                     
	var formdata1 = document.getElementById('formdata1').value;
	var formdata2 = document.getElementById('formdata2').value;
	var formdata3 = document.getElementById('formdata3').value;
	var formdata4 = document.getElementById('formdata4').value;
	var formdata5 = document.getElementById('formdata5').value;
	var formdata6 = document.getElementById('formdata6').value;
	var formdata7 = document.getElementById('formdata7').value;
	var formdata8 = document.getElementById('formdata8').value;
	var formdata9 = document.getElementById('formdata9').value;
	var formdata10 = document.getElementById('formdata10').value;

    var queryString = ajA1 + formdata1 + ajA2 + formdata2 + ajA3 + formdata3 + ajA4 + formdata4 + ajA5 + formdata5 + ajA6 + formdata6 + ajA7 + formdata7 + ajA8 + formdata8 + ajA9 + formdata9 + ajA10 + formdata10 + ajLogin;

	ajaxRequest.open("GET", ajSite + queryString, true);
	ajaxRequest.send(null); 
}
function ajaxSendFormPlayer( ajSite, ajA1, ajA2, ajA3, ajA4, ajLogin, ajDiv ){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if (ajaxRequest.readyState==4&& ajaxRequest.status == 200){
			var ajaxDisplay = document.getElementById(ajDiv);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		            document.getElementById('SearchLoader').style.width=  1;
                    document.getElementById('SearchLoader').style.height=  1;                    
                    document.getElementById('SearchLoader').style.visibility = 'hidden';        
                  } else {
                  
                  document.getElementById('SearchLoader').style.width=  1;
                  document.getElementById('SearchLoader').style.height=  1;
                  document.getElementById('SearchLoader').innerHTML = "<p align='center'><img src='grf/ajax-loader.gif' border=0 /></p>";
                  document.getElementById('SearchLoader').style.visibility = 'visible'; 
                  }  
	}                                     
	var formdata1 = document.getElementById('formdata1').value;
	var formdata2 = document.getElementById('formdata2').value;
	var formdata3 = document.getElementById('formdata3').value;
	var formdata4 = document.getElementById('formdata4').value;

    var queryString = ajA1 + formdata1 + ajA2 + formdata2 + ajA3 + formdata3 + ajA4 + formdata4 + ajLogin;

	ajaxRequest.open("GET", ajSite + queryString, true);
	ajaxRequest.send(null); 
}

function ajaxSendForm3( ajSite, ajAction3a, ajAction3b, ajAction3c, ajLogin, ajDiv ){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById(ajDiv);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			
		}
	}                                     
	var formdata3a = document.getElementById('formdata3a').value;
	var formdata3b = document.getElementById('formdata3b').value;
	var formdata3c = document.getElementById('formdata3c').value;

    var queryString = ajAction3a + formdata3a + ajAction3b + formdata3b + ajAction3c + formdata3c + ajLogin;

	ajaxRequest.open("GET", ajSite + queryString, true);
	ajaxRequest.send(null); 
}

/**
*
*  URL encode / decode
*  http://www.webtoolkit.info/
*
**/

var Url = {

    // public method for url encoding
    encode : function (string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode : function (string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for 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 method for 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;
    }

}