var wm = null;
var plazDiv = null;
var displayedOrNot = true;

function JSFX_FloatTopRight(div)
{
	var startX = 0, startY = 22;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	var px = document.layers ? "" : "px";
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.right=x+px;this.style.top=y+px;};
		el.x = startX; el.y = startY;
		return el;
	}
	window.stayTopRight=function()
	{
		var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		var dY = (pY > startY) ? pY : startY;
		ftlObj.y += (dY - ftlObj.y)/8;
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopRight()", 20);
	}
	ftlObj = ml(div);
	stayTopRight();
}

function checkVisualOzen(div)
{
	var viewingWidth;
	
	if (document.all)
	    viewingWidth = document.body.offsetWidth;
	else if (document.layers)
	    viewingWidth = window.innerWidth;
	    
	if(viewingWidth < 1004)
		if(displayedOrNot)
			vanishOzen(true, div);
	
	if(viewingWidth >= 1004)
		if(!displayedOrNot)
			vanishOzen(false, div);
}

function vanishOzen(vanish, div)
{
	if(vanish)
	{
		document.getElementById(div).style.display = "none";
		displayedOrNot = false;
	}
	else
	{
		document.getElementById(div).style.display = "block";	
		displayedOrNot = true;
	}
}

/* 
	starts the floating left ozen and right ozen
	the calling function on the html page 
*/
function SetScroller()
{
	// start right
	//checkVisualOzen("floatLayer");
	//JSFX_FloatTopRight("floatLayer");
	
	// start left
	checkVisualOzen("floatLayer2");
	JSFX_FloatTopRight("floatLayer2");
	
	// add onresize event
	addResizeEvent(checkBothVisualOzens);
}

function checkBothVisualOzens() {
	//checkVisualOzen("floatLayer");
	checkVisualOzen("floatLayer2");
}

function addResizeEvent(func) 
{
    var oldonresize = window.onresize;
    if (typeof window.onresize != 'function') 
        window.onresize = func;
    else 
    {
        window.onresize = function() 
            {
                if (oldonresize) 
                    oldonresize();
                func();
            }
    }
}
