// OnSalsa Common javascript

var NavObj;
var PictureObj;

function moveNav()
{
NavObj.style.top = NavTop +'px';
NavTop +=1;
if (NavTop < 110)
	{
	setTimeout("moveNav()",8);
	}
}

function CheckNav4Resize(init)
{  
if (init==true) with (navigator)
	{

	if ((appName=="Netscape")&&(parseInt(appVersion)==4))
		{
		document.MM_pgW=innerWidth;
		document.MM_pgH=innerHeight;
		onresize=CheckNav4Resize;
		return true;
		}
	}
else 
	if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
		location.reload();
return false;
}

var Animate;

function CheckResize()
{

GetWindowSize();

if (PictureObj && PictureObj.style)
	{
	var fixit = document.getElementById('fixit');
	fixit.style.width = winWidth-fixit.offsetLeft + "px";
	//var fix = document.getElementById('winSize');
	//alert("PO:"+ PictureObj.offsetLeft + ","+PictureObj.clientWidth +","+ PictureObj.offsetTop + ","+PictureObj.clientHeight
	//	+"\nFO:"+ fixit.offsetLeft +","+ fixit.clientWidth + fixit.offsetTop +","+ fixit.clientHeight
	//	);

	BannerSize = 1;
	}
if (window.Animate)
	{
	Animate.CheckOnScreen();
	}
}


// Scroll and Size the moving Banner
var BannerPos,oBan,BannerSize=1;
function BannerMove()	// Background to Div version
{
if (BannerSize && oBan.offsetParent)
	{
	BannerSize = 0;
	var h = oBan.offsetParent.clientHeight;
	if (h < winHeight)
		h = winHeight;
	oBan.style.height = h +"px";	// Default for noscript is 100%
	}

setTimeout('BannerMove()',50);
if (++BannerPos >= BannerHeight)	// Need to find actual size??  - 0.2% would jump
	BannerPos = 0;
oBan.style.backgroundPosition="0px " + BannerPos +"px";

}

// Scroll and Size the moving Banner
function XBannerMove()				// Clipped Image(s) in Div version
{
if (BannerSize && oBan.offsetParent)
	{
	BannerSize = 0;
	var h = oBan.offsetParent.clientHeight;
	if (h < winHeight)
		h = winHeight;
	oBan.style.height = h+160 +"px";	// Default for noscript is 100%
	//alert("pow" + oBan.offsetParent.clientHeight + "," + winHeight);
	
	}

setTimeout('XBannerMove()',80);
if (++BannerPos >= BannerHeight)				// Need to find actual size??  - 0.2% would jump
	BannerPos = 0;

var oBanMove = document.getElementById("XOverMove");
oBanMove.style.top= BannerPos-BannerHeight +"px";
}



// Tile in h&V manner to make up total space - dynamically make duplcate images
// Move as directed (0,U,D,L,R)
// Allow user to drag around?


var BannerObjects = new Array();	// Used to provide referance for SetTimer()

function ScrollBanner(sParentDiv,Size)	
{
// class locals

// The Parent Div that Everything must be relative to

this.ParentDiv = (typeof sParentDiv == 'string') ? document.getElementById(sParentDiv) : sParentDiv;
if (!this.ParentDiv)
	{
	alert("Banner Div not found");
	this.IsOK = 0;
	return;
	}

this.Bannerheight = Size;
this.BannerPos = 0;

this.index = BannerObjects.length;
BannerObjects[BannerObjects.length] = this;	// Store for call backs

this.Move = function()
	{
	if (BannerSize)
		{
		BannerSize = 0;
		var h;
		if (document.all)
			{
			h = this.ParentDiv.offsetParent.clientHeight;
			if (h < winHeight)
				h = winHeight;
			h += this.ParentDiv.offsetParent.scrollTop;
			}
		else
			h = winHeight + window.pageYOffset;
		this.ParentDiv.style.height = h +"px";	// Default for noscript is 100%
//		alert("its:"+this.ParentDiv.offsetParent.scrollTop +"type"+ typeof this.ParentDiv.offsetParent.scrollTop +"other:"+window.pageYOffset);
		}

	setTimeout('BannerObjects['+this.index +'].Move()',30);
	if (++this.BannerPos >= this.BannerHeight)				// Need to find actual size??  - 0.2% would jump
		this.BannerPos = 0;
	this.ParentDiv.style.backgroundPosition="0px " + this.BannerPos +"px";
	};

this.Move();
this.IsOK = 1;
return;
}


function FixIeMenu(id)
{
if (document.all && document.getElementById)
	{
	menu = document.getElementById(id);
	if (menu)
		{
		menu.onmouseover=function() { this.className+=" iehover"; }
		menu.onmouseout=function()  { this.className=this.className.replace(" iehover", "");}
		}
	}
}


function cmjaRevealE(o,u)
{
if (o && o.href.indexOf("#") > -1)
	{
	var dd = '.co';
	u += 'info';
	o.href = 'mailto:' + u + '@cmja' + dd +'.uk';
	o.innerHTML=u + '@cmja' + dd +'.uk';
	return false;
	}

return true;
}