dom = (document.getElementById)? true : false;
opera = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
ns4 = (document.layers)? true:false
ie = (document.all && !opera)? true:false
ie4 = (!dom && ie)? true:false
ns=(!opera && !ie)? true:false
function DLayer(id,nestref) {
	if (ie) {
		this.elm = this.event = document.all[id]
		this.css = document.all[id].style
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
	}
	else{ 
		if(ns4) {
			if (!nestref) var nestref = DLayer.nestRefArray[id]
			if (!DLayerTest(id,nestref)) return
			this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
			this.elm = this.event = this.css
			this.doc = this.css.document
		}
		else{
			this.elm =this.event = document.getElementById(id)
			this.css = this.elm.style
			this.doc = document
		}
		this.x = this.css.left
		this.y = this.css.top
	}
	this.id = id
	this.nestref = nestref
	this.obj = id + "DLayer"
	eval(this.obj + "=this")
}


function DLMoveTo(x,y) {
	if (x!=null) {
		this.x = x
		if (ns) this.css.left = this.x
		else this.css.pixelLeft = this.x
	}
	if (y!=null) {
		this.y = y
		if (ns) this.css.top = this.y
		else this.css.pixelTop = this.y
	}
}
function DLMoveBy(x,y) {
	this.moveTo(this.x+x,this.y+y)
}
function DLShow() {
	this.css.visibility = (ns4)? "show" : "visible"
}
function DLHide() {
	this.css.visibility = (ns4)? "hide" : "hidden"
}
function invertVis() {
	var v=this.css.visibility
	if(v=="show" || v=="visible")this.hide()
	else this.show()
}
dl=DLayer.prototype
dl.moveTo = DLMoveTo
dl.moveBy = DLMoveBy
dl.show = DLShow
dl.hide = DLHide
dl.invert = invertVis
DLayerTest = new Function('return true')


DLayer.nestRefArray = new Array()
DLayer.refArray = new Array()
DLayer.refArray.i = 0
DLayer.set = false

// Write Method
function DLWrite(html,preff,postf) {
	if (ns4) {
		this.doc.open()
		this.doc.write(preff+html+postf)
		this.doc.close()
	}
	else this.elm.innerHTML = html
}
dl.writeto = DLWrite


// CSS Function

function TC(nm,pr,apr) {
	var p,a,v,m,t,b,r,l,c,n,i,j,z;	var str ='.'+nm+'{\n'
	i=0;str+='font-family:';
	function ss(lf,pf){str+=pr.substring(i,i+lf)+pf+';\n';i+=lf}
	a='Arial, Helvetica, sans-serif'
	v='Verdana, Geneva, Arial'
	m='"MS Sans Serif", Geneva, sans-serif'
	n='"MS Serif", "New York", serif'
	c='"Courier New", Courier, monospace'
	t='"Times New Roman", Times, serif'
	str+=eval(pr.charAt(i))+';\n';i+=1;str+='font-size:';ss(2,'px');str+='color:';ss(7,'')
	b='bold';n='none';
	p='padding-';m='margin-';t='top';b='bottom';l='left';r='right';	v='ltbr'
	d='text-decoration:';u='underline';
	a='text-align:';j='justify';c='center';
	i=0;pr=apr;
	function ap(){
	if(pr.charAt(i)=='h'){str+='line-height:';i+=1;ss(2,'px')}
	if(pr.charAt(i)=='b'){str+='font-weight:bold;\n';i+=1}
	if(pr.charAt(i)=='#'){str+='background-color:';ss(7,'')}
	if(pr.charAt(i)=='p'||pr.charAt(i)=='m'){
	i+=1; for(z=0;z<=3;z++){str+=eval(pr.charAt(i-1))+eval(v.charAt(z))+':'+pr.charAt(i+z)+'px;\n'}
	i+=4;ap()}
	if(pr.charAt(i)=='a'||pr.charAt(i)=='d'){str+=eval(pr.charAt(i))+eval(pr.charAt(i+1))+';\n';i+=2;ap()}
	}if(pr!=null)ap();
	str += '}\n'
	return str
}
function wrstyle(str,showAlert) {
	dw = '<STYLE TYPE="text/css">\n'+str
		sstr = new String('')
	for (var i=0; i<DLs.length; i++){
	sstr+=(DLs[i][0].charAt(0)=='.')?DLs[i][0]:('#'+DLs[i][0])
	if(DLs[i][1]!=null && DLs[i][2]!=null){
	sstr+=' {position:absolute; left:'+((DLs[i][1]<2000)?DLs[i][1]:(winW+2000-DLs[i][1]))+'px; top:'+DLs[i][2]+'px;' }
	else {sstr+=' {position:relative;'}
	if (DLs[i][3]!=null) {sstr += ' width:'+DLs[i][3]
	sstr+=((sstr.charAt(sstr.length-1)=='%')?';':'px;')}
	if (DLs[i][4]!=null) sstr += ' height:'+DLs[i][4]+'px;'
			
	if (DLs[i][5]!=null) sstr += ' z-index:'+DLs[i][5]+';'	
	if (DLs[i][6]!=null) sstr += ' visibility:'+((DLs[i][6]==0)?'hidden':'visible')+';'
	if (DLs[i][7]!=null && DLs[i][7]!='') sstr += (ns4)? ' layer-background-color:'+DLs[i][7]+';' : ' background-color:'+DLs[i][7]+';'
	if (DLs[i][8]!=null) sstr += ' '+DLs[i][8]

	sstr += '}\n'
	}
	document.write(dw+sstr+'</STYLE>')
	if (showAlert) alert(dw+sstr+'</STYLE>')
}
dl.getZIndex=DL_zIndex
function DL_zIndex(){
  return this.css.zIndex
}
dl.setZIndex=DL_moveZ
function DL_moveZ(z){
  this.css.zIndex=z
}
var last=0
function _L_(numb){	
if(DLmenu[last]){
	DLmenu[last].hide()
	DLmenu[numb].show()
	last=numb;}
}
var winW,winH
sbar=(opera)?0:(ns4)?16:14
function findWH() {
	winW = (ie)? document.body.offsetWidth-20 : window.innerWidth-sbar
}
function _l() {
	for (var i=0; i<snapDL.length; i++){snapDL[i].moveTo(winW-snapX[i],null)}
	if(ns4||opera){winW=window.innerWidth-sbar; setTimeout('_l()',2000)}
}

function im_open(xm,row_n){
var v=im[xm].css.visibility
if(v=="show" || v=='visible'|| v=='VISIBLE'){im[xm].hide();z=-1}
else {	im[xm].show();z=1}	
for(i=xm+snap_n;i<(snapDL.length-1);i++){snapDL[i+1].moveBy(null,z*(DLs[xmptr+1][2]+row_n*xm_lh))}
}
function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function smplWindow(adddr,nnname,vdim,hdim) { 
eval('nwind=window.open("'+adddr+'","'+nnname+'","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,height='+hdim+',width='+vdim+',screenX=240,screenY=0,top=0,left=240")')}

function showhideObj(obj,expand)
{   obj.className = obj.className == "col" ? "exp" : "col";
    expand.className = expand.className == "close" ? "open" : "close"; }
    
function showInner (obj,inner)
{   obj.className = "open";
    inner.className = "vis";}

function hideInner (obj,inner)
{   obj.className = "exp";
    inner.className = "hide";}
