function XPlatform(){
    var _browser = navigator.userAgent.toLowerCase(); 
    try{
        this._mac = agent.indexOf('mac') != -1;
    }catch(e){
        this._mac = null;
    }
    this._win = !this._mac;
    this._w3c = document.getElementById;
    this._iex = document.all;
    this._ns4 = document.layers;


    // BEGIN: ClassMethode
    if( typeof XPlatform._initialized == "undefined" ){
        //alert("init XPlatform()");      

		XPlatform.prototype.getEventTarget = function(event){
			if(this._iex){
				return event.srcElement;
			}else{
				return event.target;
			}
		}

        XPlatform.prototype.getBrowser = function(){
            return _browser;
        }
    
        XPlatform.prototype.getElementById = function(name){
            if(this._w3c){
                return document.getElementById(name);
            }else if(this._iex){
                return document.all[name];
            }else if(this._ns4){
                return this.getObjNS4(document,name);
            }
        }
    
        XPlatform.prototype.getObjNS4 = function(obj, name){
            var d = obj.layers;
            var result,temp;
            for(var i=0; i<d.length; i++){
                if(d[i].id == name){
                    result = d[i];
                }else if(d[i].layers.length){
                    var temp = this.getObjNS4(d[i],name);
                }
                if(temp){
                    result = temp;
                }
            }
            return result;
        }

		XPlatform.prototype.getWidth = function(obj){
			return pixelToInt(obj.style.width);
		}

		XPlatform.prototype.getHeight = function(obj){
			return pixelToInt(obj.style.height);
		}

		XPlatform.prototype.getX = function(obj){
			return pixelToInt(obj.style.left);
		}

		XPlatform.prototype.getY = function(obj){
			return pixelToInt(obj.style.top);
		}

		XPlatform.prototype.pixelToInt = function(strPixel){
			p = /(\d+)/;
			var result = p.exec(strPixel);
			return RegExp.$1;
		}

        XPlatform.prototype.getStyle = function(obj){
            return (this._ns4) ? obj : obj.style;
        }

		XPlatform.prototype.getInnerWidth = function(){
			return (this._iex) ? document.body.clientWidth : window.innerWidth;
		}
		
		XPlatform.prototype.getInnerHeight = function(){
			return (this._iex) ? document.body.clientHeight : window.innerHeight;
//			return (this._iex) ? document.documentElement.clientHeight : window.innerHeight;
		}
		
		XPlatform.prototype.setObjectOpacity = function(obj, opacity){
			if(this._iex){
				obj.style.filter = "alpha(opacity:"+opacity+")";
			}else{
				obj.style.opacity = opacity/100;
			}
		}

		XPlatform.prototype.setObjectByIdOpacity = function(id, opacity){
			obj = this.getElementById(id);
			if(this._iex){
				this.getStyle(obj).filter = "Alpha(opacity="+opacity+")";
				//this.getStyle(obj).height = "10px";
			}else{
				obj.style.opacity = opacity;
			}
		}
		
		/** Methode removeAllChilds
		  *
		  */
		XPlatform.prototype.removeAllChilds = function(oNode){
			if (oNode.childNodes.length != 0){
				for(var i = 0; i<oNode.length; i++){
					oNode.removeChlid(oNode.childNodes[i]);
				}
			}
		}

        XPlatform._initialized = true;
    }// END ClassMethode
}

