var currFlashPluginVersion="10.0.22.87";
var fb, allowHide=true;


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(fnAnimate,10);
		}
	}
	
	
function fb_mouseOut()
	{
	var tmp;
	
	with(this.parentObj)
		{
		if (!isOpened) return;
		isOpened=false;
		step=-10;
		if (!timerId) timerId=setInterval(fnAnimate,10);
		}
	}
	
	
function facebookClass(id,width,fnAnimate)
	{
	this.isOpened=false;
	this.boxObj=document.getElementById(id);
	this.maxOffset=-width;
	this.currOffset=this.maxOffset;
	this.step=0;
	this.timerId=null;
	this.fnAnimate=fnAnimate;
	
	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 showNews()
	{
	var tmp,obj=document.getElementById("newsContainer");
	
	if (!obj) return;
	obj.style.visibility="visible";
	setPosition();	
	obj=document.getElementById("news");
	if (obj.showNews)
		{
		obj.showNews();
		return;
		}
	
	obj=document.getElementById("newsContainer");
	obj.innerHTML=obj.innerHTML;
	obj=document.getElementById("news");
	obj.showNews();
	}
	
	
function closeNews()
	{
	var tmp,obj=document.getElementById("newsContainer");
	
	if (!obj) return;
	obj.style.visibility="hidden";
	}
	
	
function hideNews()
	{
	var obj=document.getElementById("newsContainer");
	
	if (window.location.href.indexOf("index.php")!=-1) 
		{
		showNews();
		return;
		}
	if (!obj || !allowHide) return;
	obj.style.visibility="hidden";
	allowHide=false;
	}
	
	
function hideGallery()
	{
	var obj=document.getElementById("gallery");
	
	if (!obj) return;
	obj.style.display="none";
	}
	
	
function setGalleryHeight(height)
	{
	var obj=document.getElementById("gallery");
	
	obj.style.height=height+"px";
	obj.style.marginBottom="15px";
	}
	
	
function setPosition()
	{
	var tmp,obj=document.getElementById("newsContainer");
		
	if (!obj) return;
	tmp=document.getElementById("header1");
	tmp=elementPosition(tmp);
	obj.style.left=tmp[0]+"px";
	}
	
	
function animateFbBox()
	{
	fb.animateBox();	
	}
	

function initPage()
	{
	swfobject.embedSWF("Skins/pl/photos/headerMenu.swf","header2",727,179,currFlashPluginVersion,"/common/expressInstall.swf",{menu:"jazz"},{quality:"high",wmode:"opaque",menu:"false",bgcolor:"#09111C"},{id:"headerMenu"});
	swfobject.embedSWF("Skins/pl/photos/news.swf","newsEmbed",225,485,currFlashPluginVersion,"/common/expressInstall.swf",{ctg:"news"},{quality:"high",wmode:"transparent",menu:"false",bgcolor:"#09111C"},{id:"news"});
	setPosition();
	fb=new facebookClass("facebook",320,animateFbBox);	
	}


window.onload=init;
window.onresize=setPosition;
initClassObj.registerFunction(initPage);
