var BW = new Object();
BW.ver=navigator.appVersion;
BW.agent=navigator.userAgent;
BW.dom=document.getElementById?1:0;
BW.opera=(BW.agent.indexOf("Opera")!=-1)?1:0;
BW.ie5=(BW.ver.indexOf("MSIE 5")!=-1 && BW.dom && !BW.opera)?1:0;
BW.ie6=(BW.ver.indexOf("MSIE 6")!=-1 && BW.dom && !BW.opera)?1:0;
	
function getobj(n, d){
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length){ d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for(i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=getobj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}

function getEleft(eid){
	var e=getobj(eid);
	if(e==null) return null;
	if(e.offsetParent){
		x = e.offsetLeft;
		t = e.offsetParent;
		while (t != null){
			x += t.offsetLeft;
			t = t.offsetParent;
		}
    return x;
	}else if(e.style.left){
		return e.style.left;
	}
}

function getEtop(eid){
	var e=getobj(eid);
	if(e==null) return null;
	if(e.offsetParent){
		y = e.offsetTop;
		t = e.offsetParent;
		while (t != null){
			y += t.offsetTop;
			t = t.offsetParent;
		}
    return y;
	}else if(e.style.top){
		return e.style.top;
	}
}

function setcpos(){
	var ob=document.getElementById('clock');
	var x=getEleft('tabpos1');
	var y=getEtop('tabpos1');
	if(ob){
		ob.style.left=x-35;
		ob.style.top=y+1;
	}
}

function fxpng(){
	if(BW.ie5 || BW.ie6){
		//alert('fix');
		var io=document.getElementById('png1');
		if(io){
			io.src='img/t.gif';
			//document.getElement.ById('clock').innerHTML="<img src='img/clock.png' width='267' height='551' border='0' id='png1' style=\"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/clock.png',sizingMethod='scale');\"/>";
		}
	}
	setcpos();
	var ob=document.getElementById('clock');
	if(ob){
		//alert('pos');
		ob.style.visibility='visible';
	}
}

function PopUp(url, name, w, h, is_scroll, is_toolbar, is_resizable)
{
	if(screen.width)
	{
		var wpos_x = Math.round((screen.width-w)/2);
		if (wpos_x < 0){ wpos_x = 0;}
		var wpos_y = Math.round((screen.height-h)/2);
		if (wpos_y < 0){ wpos_y = 0;}
		else{
			if(BW.ie){wpos_y=5;}else if(BW.opera){wpos_y=-50;}
		}
	}else{
		var wpos_x = 0;
		var wpos_y = 0;
	}if(name==null){
		name = "w_test";
	}
	var scrl = (is_scroll)?1:0;
	window.open(url,name,"alwaysRaised=0,top="+wpos_y+",left="+wpos_x+",height="+h+",width="+w+",menubar=0,toolbar="+is_toolbar+",resizable="+is_resizable+",scrollbars="+scrl+",status=0");
}

onload=fxpng;
onresize=setcpos;