// Detect Constructor

Detect = function() {
	var agent = navigator.userAgent.toLowerCase(); 
	this._mac = agent.indexOf('mac') != -1;
	this._win = !this._mac;
	this._w3c = document.getElementById;
	this._iex = document.all;
	this._ns4 = document.layers;
}
Detect.prototype.getObj = 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);
	}
}
Detect.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;
}
Detect.prototype.getStyle = function(obj) {
	return (this._ns4) ? obj : obj.style;
}
Detect.prototype.getScrollTop = function(){
	return this._iex ? document.body.scrollTop : window.pageYOffset;
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

// MenuDiv Constructor

BannerDiv = function(name){
	if(name){
		this._inherit = Detect; this._inherit(name);
		this._id  = name;
		this._el  = this.getObj(this._id);
		this._css = this.getStyle(this._el);
		this._by  = this.getTop();
		return this;
	}
}
BannerDiv.prototype = new Detect();

BannerDiv.prototype.getTop = function(){
	return parseInt(this._css.top || 0);
}
BannerDiv.prototype.scrollBanner = function(){
	var ty = this._by+this.getScrollTop();
	var my = this.getTop();
	
	if(this.getScrollTop() <= 355){
		this._css.top = 355;
	} else {
		ty = this.getScrollTop() ;
		this._css.top = my+(ty-my)/3;
	}
}

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

API = new Detect();

function createObjects(){
	API.banner = new BannerDiv('banner');
	bannerInterval = setInterval('API.banner.scrollBanner()',40);
}

onload = createObjects;

// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
