var lastWidth, lastHeight;
browser = new checkBrowser();

function checkBrowser() {
	this.browser = navigator.userAgent.toLowerCase();
	this.version = navigator.appVersion.toLowerCase();
	this.mac = this.version.indexOf("mac")!= -1 ? 1 : 0;
	this.ns = (this.browser.indexOf("mozilla")!=-1&&this.browser.indexOf("compatible")==-1&&document.layers) ? 1 : 0;
	this.ie = (document.all) ? 1 : 0;
	this.dom = (document.getElementById) ? 1 : 0;
	this.domie = (this.dom&&this.ie) ? 1 : 0;
	this.domns = (this.dom&&!this.ie) ? 1 : 0;
	this.rollover = true;
	this.min = (this.ns||(this.ie&&(this.mac&&this.version.indexOf("msie 4")!=-1))||this.dom);
	if (this.ns) {
		document.tags.BODY.margins(-20);
		window.onresize=nsFix();
		lastWidth = window.innerWidth;
		lastHeight = window.innerHeight;
		}
	return this;
	}

function nsFix() {
	if (lastWidth||lastHeight) {
		if (lastWidth!=window.innerWidth||lastHeight!=window.innerHeight) { window.location.href = window.location.href } ;
		}
	}
	
function getElement(obj) {
	if (document.getElementById)  { return document.getElementById(obj); }
	if (document.all) { return document.all[obj];  } 
	if (document.layers)  { return getLayer(obj, document); }
	}

function getLayer(obj, currentDoc) {
	var currentLayer = currentDoc[obj];
	if (!currentLayer) {
		for (var getobjloop=0;getobjloop<currentDoc.layers.length;getobjloop++) {
			currentLayer = getLayer(obj,currentDoc.layers[getobjloop].document);
			if (currentLayer) { return currentLayer; }
			}
		}
	return currentLayer;
	}

function moveLayer(obj, x, y) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ns) { obj.moveTo(x,y) } ;
		if (browser.dom) { obj.style.left = x + 'px'; obj.style.top = y + 'px' } ;
		if (browser.ie) { obj.style.pixelLeft = x; obj.style.pixelTop = y } ;
		} else return false;
	}

function layerX(obj) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ns) { return obj.left } ; 
		if (browser.ie) { return (obj.style.pixelLeft) ? obj.style.pixelLeft : obj.offsetLeft } ;
		if (browser.dom) { return (obj.style.left) ? parseInt(obj.style.left) : parseInt(obj.offsetLeft) } ;
		} else return null;
	}

function layerY(obj) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ns) { return obj.top } ; 
		if (browser.ie) { return (obj.style.pixelTop) ? obj.style.pixelTop : obj.offsetTop } ;
		if (browser.dom) { return (obj.style.top) ? parseInt(obj.style.top) : parseInt(obj.offsetTop) } ;
		} else return null;
	}

function layerHeight(obj) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ns) { return (obj.height) ? obj.height : obj.clip.bottom - obj.clip.top } ;
		if (browser.dom) { return (obj.style.height) ? parseInt(obj.style.height) : parseInt(obj.offsetHeight) } ;	
		if (browser.ie) { return (obj.style.pixelHeight) ? obj.style.pixelHeight : obj.offsetHeight } ;	
		} else return null;
	}

function layerWidth(obj) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ns) { return (obj.width) ? obj.width : obj.clip.right - obj.clip.left } ;
		if (browser.dom) { return (obj.style.width) ? parseInt(obj.style.width) : parseInt(obj.offsetWidth) } ;	
		if (browser.ie) { return (obj.style.pixelWidth) ? obj.style.pixelWidth : obj.offsetWidth } ;	
		} else return null;
	}
	
	
function layerVisible(obj,visible) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ie||browser.dom) { obj.style.visibility = visible  } ;
		if (browser.ns) { obj.visibility = (visible=='visible') ? 'show' : 'hide' } ;
	} else  {
		return null;
	}
}

function layerBgColor(obj,color) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ns) { 
			obj.bgColor = color;
		} else { 
			obj.style.backgroundColor = color;
		}
	} 
	return true;
}

function layerColor(obj,color) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ns) { 
			obj.color = color;
		} else { 
			obj.style.color = color;
		}
	} 
	return true;
}

function clipLayer(obj,clipleft, cliptop, clipright, clipbottom) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ns) {
			obj.clip.left   = clipleft;
			obj.clip.top    = cliptop;
			obj.clip.right  = clipright;
			obj.clip.bottom = clipbottom;
			} else {
			obj.style.clip = 'rect(' + cliptop + 'px ' +  clipright + 'px ' + clipbottom + 'px ' + clipleft +'px)';
			}
		} else return null;
	}

function getzIndex(obj) {
	obj=getElement(obj);
	if (obj) {
		return (browser.ns) ? obj.zIndex : obj.style.zIndex;
		} else return null;
	}

function setzIndex(obj,z) {
	obj=getElement(obj);
	if (obj) {
		if (browser.ie||browser.dom) obj.style.zIndex = z;
		if (browser.ns) obj.zIndex = z;
		} else return false;
	}


