var isWin = (navigator.platform == "Win32") || (navigator.platform == "Windows");
var isIE=navigator.userAgent.indexOf("IE")>0;
var isIE5=navigator.userAgent.indexOf("IE 5.0")>0;
var isIE6=navigator.userAgent.indexOf("IE 6.0")>0;
var isNav=(navigator.appName.indexOf("Netscape")!=-1);
var element;
function $(obj){
	return typeof(obj) == "string" ? document.getElementById(obj) : obj;
}
String.prototype.trim=function(){
	return this.replace(/(^[\s]*)|([\s]*$)/g, "");
};

/*swich the layer*/
function layerswich(){	
	if($('boxswitch') === null ) {return;}
	var e, i = 0;
	var evtType = $('boxswitch').getAttribute('evt');	
	while (e = $('boxswitch').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'on' || e.className == 'off') {
			if(evtType=='click'){
				e.onclick = function () {
					var getEls = $('layer_switch').getElementsByTagName('DIV');
						for (var z=0; z<getEls.length; z++) {
						getEls[z].className=getEls[z].className.replace('show', 'hide');
						getEls[z].className=getEls[z].className.replace('on', 'off');
						}
					this.className = 'on';
					var max = this.getAttribute('title');
					$(max).className = "show";
				}
			}
			else{
				e.onmouseover = function () {
					var getEls = $('layer_switch').getElementsByTagName('DIV');
						for (var z=0; z<getEls.length; z++) {
						getEls[z].className=getEls[z].className.replace('show', 'hide');
						getEls[z].className=getEls[z].className.replace('on', 'off');
						}
					this.className = 'on';
					var max = this.getAttribute('title');
					$(max).className = "show";
				}
			}
		}	
	}

}
/*swich the layer*/
function clicklayerswich(){	
	if($('boxswitch') == null ) return;
	var e, i = 0;
	while (e = $('boxswitch').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'on' || e.className == 'off') {
		e.onclick = function () {
			var getEls = $('layer_switch').getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('show', 'hide');
				getEls[z].className=getEls[z].className.replace('on', 'off');
				}
			this.className = 'on';
			var max = this.getAttribute('title');
			$(max).className = "show";
			}
		}		
	}
}
