/*
	file:			global_functions.js
	content:		all js functions needed on every page (navigation mainly)
	project:		Animoto HTML
	version:		1.0
	last update:	27.12.2005
	(c):			Daniel Liebig, Wevin - http://www.wevin.de
*/


//-- preload rollovers
	var Img		= new Array(8);
	var imgPath	= '../../_common/img/main_menue/';
	
//-- remember currently active image
	
	var activeImg;
	
	
	for (var i = 0; i < 8; i++)
	{
		Img[i] = new Image();
	}
	Img[0].src = imgPath + 'animoto_h.gif';
	Img[1].src = imgPath + 'services_h.gif';
	Img[2].src = imgPath + 'show_h.gif';
	Img[3].src = imgPath + 'art_h.gif';
	Img[4].src = imgPath + 'contact_h.gif';
	Img[5].src = imgPath + 'home_h.gif';
	Img[6].src = imgPath + 'sitemap_h.gif';
	Img[7].src = imgPath + 'login_h.gif';

function highlight(Img)
{
	if ( Img != activeImg )
	{
		swapIn(Img);
	}
}

function highlightOff(Img)
{
//	alert(activeImg.src);

	if ( Img != activeImg )
	{
		swapOut(Img);
	}
}

function set_active(Img)		// function name: setActive seems not to work with i.e., hell knows why
{
	if ( Img == activeImg )
	{
		return;
	}
	swapOut(activeImg);
	activeImg	= Img;
	highlight(activeImg);
}

function swapIn(Img)
{
	if ( !Img )
	{
		return;
	}
	if ( Img.src.substr(Img.src.length - 6) == '_h.gif' )
	{
		return;
	}
	overImgSrc 	= Img.src.substr(0, (Img.src.length - 4) ) + '_h.gif';
	Img.src		= overImgSrc;
}

function swapOut(Img)
{
	if ( !Img )
	{
		return;
	}
	if ( Img.src.substr(Img.src.length - 6) != '_h.gif' )
	{
		return;
	}
	outImgSrc 	= Img.src.substr(0, (Img.src.length - 6) ) + '.gif';
	Img.src		= outImgSrc;
}

function set_image_source(Img, src)
{
	document.getElementById(Img).src = src;
}


