function showLoading(m, o){            
      var div = document.createElement('div'); 
      div.id ='loading'
      div.style.position = 'absolute';                 
      div.style.left = '0px';                          
      div.style.top = '0px';  
      div.style.fontSize = '20px';                    
      div.style.color = 'black';                    
      div.style.backgroundColor = 'white'; 
      div.style.filter = 'alpha(opacity='+(o*100)+')';
      div.style.opacity = ''+o;     
			div.style.width = document.body.scrollWidth;     
	    div.style.height = document.body.scrollHeight;   
	    div.innerHTML='Loading...<img src="http://www.customer-supports.com/Images/loading.gif" />';
 			document.getElementsByTagName('body')[0].appendChild(div);
			setTimeout("document.getElementsByTagName('body')[0].removeChild(document.getElementById('loading'));", m);                        
}                                                                                                                  
//showLoading(3000, 0.75); 
function Sleep(ms)
{
    this.getMs = function(d){
        return d.getHours()*60*60*1000+d.getMinutes()*60*1000+d.getSeconds()*1000+d.getMilliseconds();
    }
    var s = new Date();
    var e = new Date();
    for(;getMs(e)-getMs(s)<ms;e = new Date())
    {
        if(getMs(e)-getMs(s)<0)
        {
            break;
        }
    }
}
function PowerGet(url, callback, args){  
    var child = document.createElement('script');   
    child.language = 'javascript';   
    child.src = url; 
    document.getElementsByTagName("head")[0].appendChild(child);  
    if(document.all) {   
        child.onreadystatechange = function() {  
            if(this.readyState == 4 || this.readyState == 'complete' || this.readyState == 'loaded'){   
                if(callback)
                {    
                    try{callback(args, __cb); }catch(e){}     
                    document.getElementsByTagName("head")[0].removeChild(this);
                }
            }   
       };  
    }
    else {   
        child.onload = function() {  
            if(callback)
            {
                try{callback(args, __cb); }catch(e){}     
                document.getElementsByTagName("head")[0].removeChild(this);
            }
        }; 
    }   
   	Sleep(50);
}

function WebClient(){
	this.xmlHttp = false;
	this.Init = function(){
		var objs=new Array("Msxml2.XMLHTTP","Msxml3.XMLHTTP","Msxml4.XMLHTTP","Msxml5.XMLHTTP","Microsoft.XMLHTTP");
		var i=0;
		this.xmlHttp = false;
		while(!this.xmlHttp && i++ < objs.length){
				try {
					this.xmlHttp = new ActiveXObject(objs[i]);
				} 
				catch (e) {
					this.xmlHttp = false;
				}
		}
		if (!this.xmlHttp && typeof XMLHttpRequest != 'undefined') {
			this.xmlHttp = new XMLHttpRequest();
		}
		if(!this.xmlHttp){
			alert('Please use a high version browser!');
		}
	}
	this.OnError = function(e){
	    alert(e.Message);
	}
	this.Get = function(url)
	{
	    var data = "";
	    try{
		    this.xmlHttp.open("GET", url, false);
		    this.xmlHttp.send(null);
		    data = this.xmlHttp.responseText;
		}
		catch(e){OnError(e);}
		return data;
	}
	this.Post = function(url,values)
	{
	    var data = "";
	    try{
		    this.xmlHttp.open("POST", url, false);
		    this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		    this.xmlHttp.send(values);
		    data = this.xmlHttp.responseText;
		}
		catch(e){OnError(e);}
		return data;
	}
	this.AsyncGet = function(url, owner, callback) // callback(status, data)
	{
	    try{
	        if(owner && callback)
	        {
	            this.xmlHttp.onreadystatechange = function(){callback(owner.xmlHttp.readyState, owner.xmlHttp.readyState==4?owner.xmlHttp.responseText:'');};
	        }
		    this.xmlHttp.open("GET", url, true);
		    this.xmlHttp.send(null);
		}
		catch(e){OnError(e);}
	}
	this.AsyncPost = function(url, owner, callback) // callback(status, data)
	{
	    try{
	        if(owner && callback)
	        {
	            this.xmlHttp.onreadystatechange = function(){callback(owner.xmlHttp.readyState, owner.xmlHttp.readyState==4?owner.xmlHttp.responseText:'');};
	        }
		    this.xmlHttp.open("POST", url, true);
		    this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		    this.xmlHttp.send(values);
		}
		catch(e){OnError(e);}
	}
	this.Init();
}
function Base64(){
	var __k = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	this.Encode = function (__i) {
		if(__i=="")return "";
		__i = escape(__i);
		var __o,c1,c2,c3,e1,e2,e3,e4;
			__o=c1=c2=c3=e1=e2=e3=e4="";
		var i = 0;
		do {
			c1 = __i.charCodeAt(i++);
			c2 = __i.charCodeAt(i++);
			c3 = __i.charCodeAt(i++);
			e1 = c1 >> 2;
			e2 = ((c1 & 3) << 4) | (c2 >> 4);
			e3 = ((c2 & 15) << 2) | (c3 >> 6);
			e4 = c3 & 63;
			if (isNaN(c2)) {
				 e3 = e4 = 64;
			} 
			else if(isNaN(c3)) {
				 e4 = 64;
			}
			__o = __o + __k.charAt(e1) +__k.charAt(e2) +__k.charAt(e3) +__k.charAt(e4);
			c1 = c2 = c3 = e1 = e2 = e3 = e4 = "";
		} while (i < __i.length);
		return __o;
	}
	
	this.Decode = function (__i) {
		if(__i=="")return "";
		var __o,c1,c2,c3,e1,e2,e3,e4;
			__o=c1=c2=c3=e1=e2=e3=e4="";
		var i = 0;
		var __t = /[^A-Za-z0-9\+\/\=]/g;
		if(__t.exec(__i)) {
				////alert("encode error");
		}
		__i = __i.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		do {
			e1 = __k.indexOf(__i.charAt(i++));
			e2 = __k.indexOf(__i.charAt(i++));
			e3 = __k.indexOf(__i.charAt(i++));
			e4 = __k.indexOf(__i.charAt(i++));
			c1 = (e1 << 2) | (e2 >> 4);
			c2 = ((e2 & 15) << 4) | (e3 >> 2);
			c3 = ((e3 & 3) << 6) | e4;
			__o = __o + String.fromCharCode(c1);
			if (e3 != 64) {
				 __o = __o + String.fromCharCode(c2);
			}
			if (e4 != 64) {
				 __o = __o + String.fromCharCode(c3);
			}
			c1 = c2 = c3 = e1 = e2 = e3 = e4 = "";
		} while (i < __i.length);
		return unescape(__o);
	}
}

// onload onunload onmousemove
function AddEventListener(name, callback)
{
    this.AddEventListenerOther = function(name, callback)
    {
       // firefox              
        switch(name)
        {
        case 'onload':
        {
            //.. mac/ie5 and anything else that gets this far
            if(typeof window.onload == 'function')
            {
                var existing = window.onload;
                window.onload = function()
                {
                    callback(e);
                    existing(e);
                };
            }
            else
            {
                window.onload = callback;
            }	
        }
        break;
        case 'onunload':
        case 'onbeforeunload':
        {            
            //.. mac/ie5 and anything else that gets this far
            if(typeof window.onbeforeunload == 'function')
            {
                var existing = window.onbeforeunload;
                window.onbeforeunload = function(e)
                {
                    existing(e);
                    callback(e);
                };
            }
            else
            {
                window.onbeforeunload = callback;
            }	

        }
        break;
        case 'onmousemove':
        {
            if(typeof window.onmousemove == 'function')
            {
                var existing = window.onmousemove;
                window.onmousemove = function(e)
                {
	                existing(e);
	                callback(e);
                };
            }
            else
            {
                window.onmousemove = callback;
            }
        }
        break;
        case 'onerror':
        {
            if(typeof window.onerror == 'function')
            {
                var existing = window.onerror;
                window.onerror = function(e)
                {
	                existing(e);
	                return callback(e);
                };
            }
            else
            {
                window.onerror = callback;
            }
        }
        break;
        default:
        //alert('not support!');
        }
    }
    //
    if(typeof window.addEventListener != 'undefined')
    {  
        this.AddEventListenerOther(name, callback);
    }
    else if(typeof document.addEventListener != 'undefined')
    {
        //.. opera 7
        switch(name)
        {
        case 'onload':        
		document.addEventListener('onload', callback, true);
        break;
        case 'onunload':
        case 'onbeforeunload':
 		document.addEventListener('onbeforeunload', callback, true);
 		break;
        case 'onmousemove':
 		document.addEventListener('onmousemove', callback, true);
        break;
        case 'onerror':
 		document.addEventListener('onerror', callback, true);
        break;
        default:
        //alert('not support!');
        }
    }
    else if(typeof window.attachEvent != 'undefined')
    {
        //.. win/ie
	    switch(name)
        {
        case 'onload':
        window.attachEvent('onload', callback);
        break;
        case 'onunload':
        case 'onbeforeunload':
        window.attachEvent('onbeforeunload', callback);
        break;
        case 'onmousemove':        
	    document.attachEvent('onmousemove', callback);
        break;
        case 'onerror':        
	    document.attachEvent('onerror', callback);
        break;
        default:
        //alert('not support!');
        }
    }
    else
    {
		// others            
        this.AddEventListenerOther(name, callback);
    }
}
AddEventListener('onerror', (function(){return true;})); 
