//var domain="primecomhk.com";
var overtime=false;
var imageurl="./images/sp_logo.jpg";
var imagewidth=45;
var imageheight=160;
var imageurl2 = "./images/sp_logo.jpg";
var imagewidth2 = 45;
var imageheight2 = 160;
var floatadlink="http://www.primecomhk.com/sp_menu.shtml";
var duration=24;

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 = 18; 
if( navigator.appName == 'Netscape' ) {
	markRefresh=30;
}
//alert(navigator.appName);
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 == 'KFE') || (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 == 'KFE') || (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.KFE.left;
	var bigy = document.KFE.top;
	bigx = parseInt(bigx)-50;
	bigy = parseInt(bigy)-10;
	document.POP.left = bigx;
	document.POP.top = bigy;
	document.POP.visibility = "show";
	document.KFE.visibility = "hide";
}
else if( document.getElementById && !document.all ){
	document.getElementById("KFE").style.visibility="visible";
}
else{
	var bigx = document.all.KFE.style.left;
	var bigy = document.all.KFE.style.top;
	bigx = parseInt(bigx)-50;
	bigy = parseInt(bigy)-10;
	document.all.POP.style.left = bigx;
	document.all.POP.style.top = bigy;	
	document.all.POP.style.visibility = "visible";
	document.all.KFE.style.visibility = "hidden";
}
}

function hide_big(){
//hide the big picture
if (navigator.appName == 'Netscape' && ! document.getElementById){
	document.POP.visibility = "hide";
	document.KFE.visibility = "show";
}
else if(document.getElementById&&!document.all){
	document.getElementById("KFE").style.visibility="visible";
}
else{

	var bigx = document.all.POP.style.left;
	var bigy = document.all.POP.style.top;
	bigx = parseInt(bigx)+50;
	bigy = parseInt(bigy)+10;
	document.all.KFE.style.left = bigx;
	document.all.KFE.style.top = bigy;	

	document.all.POP.style.visibility = "hidden"; //hide the big picture
	document.all.KFE.style.visibility = "visible";
}
}

function do_wmad()
{
if (!overtime) {
var w1 = getWmadObject( wmadobj1.name );
markMe();
}
}
if (!overtime) {
var wmadobj1 = new wmadobj( 'KFE',100,100,98,0,0,0,0,1 );
}

if (!overtime)  {
var x1 = "<a href='"+floatadlink+"' target=_top><img src='"+imageurl+"' border=0 width='" + imagewidth + "' height='" + imageheight + "'></a>";
var x2 = "<a href='"+floatadlink+"' target=_top><img src='" + imageurl2 + "' border=0 width='" + imagewidth2 + "' height='" + imageheight2 + "'></a>"
if( navigator.appName == 'Netscape' && !document.getElementById)
{ // netscape
document.writeln( "<LAYER name='KFE' id='KFE' onMouseOver='domouseover(this)' onMouseOut='domouseout(this)'>");
document.writeln( x1 );
document.writeln( "</LAYER>");

document.writeln('<layer id=\"POP\" width=\"' + imagewidth2 + '\" height=\"' + imageheight2 + '\" z-index=\"0\" visibility=\"hide\" onMouseOver="show_big()" onMouseOut="hide_big()">');
document.writeln( x2 );
document.writeln('</layer>');

	document.POP.visibility = "hide";
}
else if(document.getElementById&&!document.all){ //ns6 
	document.writeln( "<DIV id='KFE' style='position:absolute;visibility:visible' onMouseOver='domouseover(this)' onMouseOut='domouseout(this)'>");
	document.writeln( x1 );
	document.writeln( "</DIV>" );
}
else{ //ie //onMouseOut='domouseout(this)'
	document.writeln( "<DIV id='KFE' style='position:absolute;visibility:visible' onMouseOver='domouseover(this)' onMouseOut='domouseout(this)'>");
	document.writeln( x1 );
	document.writeln( "</DIV>" );

	document.writeln('<div id=\"POP\" 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.POP.style.visibility = "hidden"; //hide the big picture
}
}


