var domain="www.sina.com.hk";
var overtime=false;
var imageurl="floating/floating_h1n1.gif";
var imagewidth=144;
var imageheight=100;
var imageurl2 = "floating/floating_h1n1.gif";
var imageheight2 = 0;
var imagewidth2 = 0;
var floatadlink="about_h1n1.html";
var duration=24;

var float_left_pos=Math.round(document.body.clientWidth * 0.90);


function wmadobj( n , w , h , x , y , px , py , mx , my )
{
this.name = n;
this.W = w ;
this.H = h ;
this.X = x ;
this.Y = y ;
this.posX = px ;
this.posY = py ;
this.my = my;
this.mx = mx;
this.mytmp = my;
this.mxtmp = mx;
}
function getMaxHeight( NS )
{
var ih;
if ( NS ) ih = innerHeight;
else ih = document.body.clientHeight;
return ih;
}
function getMaxWidth( NS )
{
var iw;
if ( NS ) iw = innerWidth;
else iw = document.body.clientWidth;
return iw;
}
function setPosXY( NS , wm )
{
var i;
var ih,iw;
var barW = 0;
var barH = 0;
var ih = getMaxHeight( NS );
var iw = getMaxWidth( NS );
if ( NS )
{
if (document.height > innerHeight) barW = 20;
if (document.width > innerWidth) barH = 20;
}
wm.posX = ((iw - wm.W)-barW) * (wm.X/100);
wm.posY = ((ih - wm.H)-barH) * (wm.Y/100);
}
function set_xy( wMark , x , y )
{
wMark.left = x;
wMark.top = y;
}
function N6_set_xy( wMark, x, y) {
wMark.style.left = x;
wMark.style.top = y;
}
function wRefreshs2()
{
var NS, i;
if( navigator.appName == 'Netscape' ) NS = true;
else NS = false;
for( i = 0 ; i<arguments.length ; i++ )
{
if( check_exist( arguments[i].name ) == true )
wRefresh( NS , arguments[i] );
}
}
function wRefreshs()
{
wRefreshs2( wmadobj1 )
}
function getUserObject( name )
{
if( wmadobj1 && name == wmadobj1.name ) return wmadobj1;
return null;
}
function getWmadObject( name )
{
var xb,wMark,NS;
if( navigator.appName == 'Netscape' ) NS = true;
else NS = false;
if( NS )
{
xb = name;
if (document.getElementById) {
wMark = document.getElementById( xb );
wMark = wMark.style;
} else {
wMark = document.layers[ xb ] ;
}
}
else
{
xb = 'document.all.' + name + '.style';
wMark = eval( xb );
}
return wMark;
}
function wRefresh( NS , wm )
{
var i;
var xb;
var x,y;
var wMark;
var ih = getMaxHeight( NS );
var iw = getMaxWidth( NS );
wMark = getWmadObject( wm.name );
wMark.width = wm.W;
wMark.height = wm.H;
x = wm.posX + (NS?pageXOffset:document.body.scrollLeft);
y = wm.posY + (NS?pageYOffset:document.body.scrollTop);
if( wm.my == 1 ) wm.posY++;
else if( wm.my == -1 ) wm.posY--;
if( wm.posY > ih ){
wm.posY = -wm.H;
}
else if( wm.posY < -wm.H ) wm.posY = ih;
if( wm.mx == 1 ) wm.posX++;
else if( wm.mx == -1 ) wm.posX--;
set_xy( wMark , x, y );
}
function setPosXYs2()
{
var NS, i;
if( navigator.appName == 'Netscape' ) NS = true;
else NS = false;
for( i=0; i < arguments.length ; i++ )
{
if( check_exist( arguments[i].name ) == true )
setPosXY( NS , arguments[i] );
}
}
function setPosXYs()
{
setPosXYs2( wmadobj1 );
}
function markMe()
{
var NS;
var markRefresh = 50;
if( navigator.appName == 'Netscape' ) NS = true;
else NS = false;
setPosXYs();
window.onresize=setPosXYs;
markID = setInterval ("wRefreshs()",markRefresh);
}
function check_exist( nn )
{
if ( document.getElementById && document.getElementById(nn)) return true;
else if( navigator.appName == 'Netscape' && document.layers[nn] ) return true;
else if( navigator.appName != 'Netscape' && document.all[nn] ) return true;
else
return false;
}
function domouseover(o)
{
if( !o.name )  o.name = o.id;
if( (o.name == 'float_icon') || (o.name == 'KFW') )
{
var w1 = getUserObject( o.name );
w1.mxtmp = w1.mx;
w1.mx = 0;
w1.mytmp = w1.my;
w1.my = 0;
}
show_big();
}
function domouseout(o)
{
if( !o.name )  o.name = o.id;
if( (o.name == 'float_icon') || (o.name == 'KFW'))
{
var w1 = getUserObject( o.name );
w1.mx = w1.mxtmp;
w1.my = w1.mytmp;
}
hide_big();
}

function show_big(){

//show the big picture
if (navigator.appName == 'Netscape' && ! document.getElementById){
	var bigx = document.float_icon.left;
	var bigy = document.float_icon.top;
	bigx = parseInt(bigx)-85;
	bigy = parseInt(bigy)-30;
	document.popup.left = bigx;
	document.popup.top = bigy;
	document.popup.visibility = "show";
	document.float_icon.visibility = "hide";
}
else if( document.getElementById && !document.all ){
	document.getElementById("float_icon").style.visibility="visible";
}
else{
	var bigx = document.all.float_icon.style.left;
	var bigy = document.all.float_icon.style.top;
	bigx = parseInt(bigx)-85;
	bigy = parseInt(bigy)-30;
	document.all.popup.style.left = bigx;
	document.all.popup.style.top = bigy;
	document.all.popup.style.visibility = "visible";
	document.all.float_icon.style.visibility = "visible";
}
}

function hide_big(){
//hide the big picture
if (navigator.appName == 'Netscape' && ! document.getElementById){
	document.popup.visibility = "hide";
	document.float_icon.visibility = "show";
}
else if(document.getElementById&&!document.all){
	document.getElementById("float_icon").style.visibility="visible";
}
else{

	var bigx = document.all.popup.style.left;
	var bigy = document.all.popup.style.top;
	bigx = parseInt(bigx)+85;
	bigy = parseInt(bigy)+30;
	document.all.float_icon.style.left = bigx;
	document.all.float_icon.style.top = bigy;

	document.all.popup.style.visibility = "hidden"; //hide the big picture
	document.all.float_icon.style.visibility = "visible";
}
}

function do_wmad()
{


if (!overtime) {
var w1 = getWmadObject( wmadobj1.name );
markMe();
}
}
if (!overtime) {
var wmadobj1 = new wmadobj( 'float_icon',150,100,98,5,0,0,0,1 );
}

if (!overtime)  {
var x1 = "<a href='"+floatadlink+"' target=_self><img src='"+imageurl+"' border=0 width='" + imagewidth + "' height='" + imageheight + "'></a>";
var x2 = "<a href='"+floatadlink+"' target=_self><img src='" + imageurl2 + "' border=0 width='" + imagewidth2 + "' height='" + imageheight2 + "'></a>"
if( navigator.appName == 'Netscape' && !document.getElementById)
{ // netscape
document.writeln( "<LAYER name='float_icon' id='float_icon' onMouseOver='domouseover(this)' onMouseOut='domouseout(this)'>");
document.writeln( x1 );
document.writeln( "</LAYER>");

document.writeln('<layer id=\"popup\" width=\"' + imagewidth2 + '\" height=\"' + imageheight2 + '\" z-index=\"0\" visibility=\"hide\" onMouseOver="show_big()" onMouseOut="hide_big()">');
document.writeln( x2 );
document.writeln('</layer>');

	document.popup.visibility = "hide";
}
else if(document.getElementById&&!document.all){ //ns6
	document.writeln( "<DIV id='float_icon' style='position:absolute;visibility:visible;left:" + float_left_pos + ";top:25;' onMouseOver='domouseover(this)' onMouseOut='domouseout(this)'>");
	document.writeln( x1 );
	document.writeln( "</DIV>" );
}
else{ //ie //onMouseOut='domouseout(this)'
	document.writeln( "<DIV id='float_icon' style='position:absolute;visibility:visible;left:" + float_left_pos + ";top:25;' onMouseOver='domouseover(this)' onMouseOut='domouseout(this)'>");
	document.writeln( x1 );
	document.writeln( "</DIV>" );

	document.writeln('<div id=\"popup\" style=\"position:absolute;width:\"' + imagewidth2 + '\"; height:\"' + imagewidth2 + '\"; visibility: hidden; z-index:2\" onMouseOver="show_big()" onMouseOut="hide_big()">');
	document.writeln( x2 );
	document.writeln('</div>');

	document.all.popup.style.visibility = "hidden"; //hide the big picture
}
}


window.onload=do_wmad;
