function ge(item)
{
	return document.getElementById(item);
}
function gw(txt)
{
	ge("wS").innerHTML=txt;
}
function scrollItemsLeft()
{
	var itemsPosition=getPositionOffset(ge("items"));
	var scrollablePosition=getPositionOffset(ge("scrollable"));
	var itemsWidth=ge("items").offsetWidth;
	var scrollableWidth=ge("scrollable").offsetWidth;
	if((parseInt(itemsPosition.x)*1+parseInt(itemsWidth)*1)-parseInt(scrollablePosition.x) >= parseInt(scrollableWidth))
	{
		if(t==null)
		{
			amt=175;
			startPix=0;
			tmpPix=-30;
			timeToEnd=0;
			moveItemLeft();
		}
	}
}
function scrollItemsRight()
{
	var itemsPosition=getPositionOffset(ge("items"));
	var scrollablePosition=getPositionOffset(ge("scrollable"));
	var itemsWidth=ge("items").offsetWidth;
	var scrollableWidth=ge("scrollable").offsetWidth;
	if(itemsWidth>scrollableWidth)
	{
		if(t==null)
		{
			amt=175;
			startPix=0;
			tmpPix=30;
			timeToEnd=0;
			moveItemLeft();
		}
	}
}
var t=null;
var amt;
var startPix;
var timeToEnd=0;
var currentDiv='light';
function moveItemLeft()
{
	if(tmpPix<0)
	{
		if((amt+tmpPix)*1 < 0)
		{
			if(timeToEnd==0)
			{
				timeToEnd=1;
				tmpPix=-(amt);
			}
		}
		else
		{
			amt=amt+tmpPix;
		}
	}
	else
	{
		if(tmpPix > amt)
		{
			if(timeToEnd==0)
			{
				timeToEnd=1;
				tmpPix=amt;
			}
		}
		else
		{
			amt=amt-tmpPix;
		}
	}
	gw("amt:"+amt+" tmpPix:"+tmpPix);
	clearTimeout(t);
	t=null;

	if(amt>0 && timeToEnd!=2)
	{
		ge("items").style.left=(parseInt(ge("items").style.left)+tmpPix)+"px";
		if(timeToEnd==1)
		{
			timeToEnd=2;
		}
		t=setTimeout("moveItemLeft()",1);
	}
}
function addHoverImgs()
{
	var menuItems=['homeBtn','whyBtn','galleryBtn','specBtn','contactBtn','whyBtnBot','galleryBtnBot','specBtnBot','contactBtnBot'];
	for(i=0;i<menuItems.length;i++)
	{
		eval('document.getElementById("'+menuItems[i]+'").onmouseover=function (){imgOver("'+menuItems[i]+'")}');
		eval('document.getElementById("'+menuItems[i]+'").onmouseout=document.getElementById("'+menuItems[i]+'").onmousedown=function (){imgOut("'+menuItems[i]+'")}');
	}
}
function imgOver(item)
{
	var tmpSrc=document.getElementById(item).src.replace(item, item+"_ovr");
	document.getElementById(item).src=tmpSrc;
}
function imgOut(item)
{
	var tmpSrc=document.getElementById(item).src.replace(item+"_ovr",item);
	document.getElementById(item).src=tmpSrc;
}
function getPositionOffset(e)
{
	var left = 0;
	var top  = 0;
	var right = 0;
	while (e.offsetParent)
	{
		left += e.offsetLeft;
		top  += e.offsetTop;
		right+= e.offsetRight;
		e     = e.offsetParent;
	}
	left += e.offsetLeft;
	top  += e.offsetTop;
	right+= e.offsetRight;
	return {x:left, y:top, r:right};
}
function hideLightBox()
{
	document.getElementById("displayAd").style.display='none';document.getElementById('fade').style.display='none';
}
function showLightBox(curDiv,leftPos,topPos)
{
		var page = "ads/" + curDiv + ".html";
		$("#displayAd").load(page);
		
		currentDiv=curDiv;
		document.getElementById("displayAd").style.display='block';document.getElementById('fade').style.display='block';
		ge("displayAd").style.left=leftPos;
		ge("displayAd").style.top=topPos;
}