/******************************************************************************
 ----------------------- Controls the floating Ozen ad ------------------------
******************************************************************************/

// is the ozen displayed or not?
var ozenDisplayed = true;
var OzenLeft = "OzenLeft";

/* 
 * JSFX_FloatTopLeft
 */
function JSFX_FloatTopLeft(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;
		// to float right use this: el.sP=function(x,y){this.style.right=x+px;this.style.top=y+px;};
		el.sP=function(x,y){this.style.left=10+px;this.style.top=y+px;}; // instead
		el.x = startX; el.y = startY;
		return el;
	}
	window.stayTopLeft=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("stayTopLeft()", 20);
	}
	ftlObj = ml(div);
	stayTopLeft();
}

/* 
 * checkVisualOzen
 */
function checkVisualOzen()
{
	var viewingWidth;
	
	if (document.all)
	    viewingWidth = document.body.offsetWidth;
	else if (window.innerWidth)
	    viewingWidth = window.innerWidth;
	
	if (viewingWidth < 1054) {
	    vanishOzen(true);
	}
	else {
	    vanishOzen(false);
	}
}

/* 
 * vanishOzen
 */
function vanishOzen(vanish) 
{
	if(vanish)
	{
	    document.getElementById(OzenLeft).style.display = "none";
		ozenDisplayed = false;
	}
	else
	{
	    document.getElementById(OzenLeft).style.display = "block";	
		ozenDisplayed = true;
    }    
}

/* 
    called on body onload();
    starts the floating left ozen and/or right ozen
    the calling function on the html page 
*/
function StartOzen()
{
    if (document.getElementById(OzenLeft) == null) return;

	// start left ozen
	checkVisualOzen(OzenLeft);
	JSFX_FloatTopLeft(OzenLeft);
	
	// add onresize event
	window.onresize = function() { checkVisualOzen() };
	
	// show it
	if (ozenDisplayed) 
	    document.getElementById(OzenLeft).style.display = "block";	
}

