var fb, currFlashPluginVersion="10.0.12.36";

function menuScript(path)
	{
	var str;
	
	str='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,47,0" name="menu" width="120" height="340" id="menu">';
	str+='<param name="movie" value="'+path+'menu.swf">';
	str+='<param name="quality" value="high">';
	str+='<param name="allowScriptAccess" value="sameDomain">';
	str+='<embed src="'+path+'menu.swf" width="120" height="340" swLiveConnect="true" allowScriptAccess="sameDomain" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" name="menu"></embed>';
	str+='</object>';
	
	document.writeln(str);
	}
	
	
function occupiersScript(path,ctg)
	{
	var str;
	
    str='  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" width="615" height="20" id="occupiers">';
    str+='    <param name="movie" value="'+path+'Occupiers.swf">';
    str+='    <param name="quality" value="high">';
    str+='    <param name="FlashVars" value="ctg='+ctg+'">';
    str+='    <embed src="'+path+'Occupiers.swf" FlashVars="ctg='+ctg+'" swLiveConnect="true" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="615" height="20" name="occupiers"></embed>';
    str+='  </object>';
	
	document.writeln(str);
	}
	
	
function savePosition()
	{
	var obj=document.getElementById("occupiers");

	if (!obj) return;
	document.cookie="fashPosXen="+obj.getPosition();
	}
	
	
function readPosition()
	{
	var arr=readCookies();
	var obj=document.getElementById("occupiers");

	if (!obj || !arr.fashPosXen) return null;
	
	return arr.fashPosXen;
	}
//*****************************************	
	

function fb_animateBox()
	{
	this.currOffset+=this.step;
	if (this.currOffset>0) 
		this.currOffset=0;
	else if (this.currOffset<this.maxOffset)
		this.currOffset=this.maxOffset;
		 
	this.boxObj.style.right=this.currOffset+"px";
	if (this.currOffset==0 || this.currOffset==this.maxOffset)
		{
		clearInterval(this.timerId);
		this.timerId=null;	
		}
	}
	
	
function fb_mouseOver()
	{
	var tmp;
	
	with(this.parentObj)
		{
		if (isOpened) return;
		isOpened=true;
		step=10;
		if (!timerId) timerId=setInterval(animateFbBox,10);
		}
	}
	
	
function fb_mouseOut()
	{
	var tmp;
	
	with(this.parentObj)
		{
		if (!isOpened) return;
		isOpened=false;
		step=-10;
		if (!timerId) timerId=setInterval(animateFbBox,10);
		}
	}
	
	
function facebookClass()
	{
	this.isOpened=false;
	this.boxObj=document.getElementById("facebook");
	this.maxOffset=-320;
	this.currOffset=this.maxOffset;
	this.step=0;
	this.timerId=null;
	
	this.mouseOver=fb_mouseOver;
	this.mouseOut=fb_mouseOut;
	this.animateBox=fb_animateBox;
	
	if (!this.boxObj) return;
	this.boxObj.parentObj=this;
	this.boxObj.onmouseover=this.mouseOver;
	this.boxObj.onmouseout=this.mouseOut;
	}
	
	
function animateFbBox()
	{
	fb.animateBox();	
	}	

	
	
function initPage()
	{
	var obj;
	
	fb=new facebookClass();	
	}
	
	
window.onunload=savePosition;
initClassObj.registerFunction(initPage);
