// Gominola Creative Media - 2006
// ------------------------------

var W3CDOM = (document.createElement && document.getElementsByTagName);
window.onload = init;
var anterior = null;

// Parpadeo rojo del botón news
var newsId = 0;
var idColorNews;

function colorNews() {
	var navnews = document.getElementById('parpadeoNews');
	if (newsId==0) {
		newsId=1;
		navnews.style.color='#FF0000'
	}
	else {
		newsId=0;
		navnews.style.color='#000000'
	}
	idColorNews = setTimeout("colorNews()",100);
}


function init() {
	
	// Pantalla completa
	moveTo(0,0);
	self.resizeTo(screen.availWidth,screen.availHeight);
	
	// Poner funciones a los enlaces del menu
	if (!W3CDOM) return;
		var nav = document.getElementById('menu');
		var as = nav.getElementsByTagName('a');
		for (var i=0; i < as.length; i++) {
		as[i].onclick = estilo;
		as[i].ref = i;
		}
	
	
	// Parpadeo rojo del botón news
	colorNews();
	
	// Menu
	BTNworkHeight = new fx.Height('BTNwork');
	BTNusHeight = new fx.Height('BTNus');
	BTNthingsHeight = new fx.Height('BTNthings');
	HOLDERtxtHeight = new fx.Height('HOLDERtxt');
	HOLDERtxtHeight.hide();
	HOLDERworkHeight = new fx.Height('HOLDERwork');
	HOLDERworkHeight.hide();
	HOLDERvisualHeight = new fx.Height('HOLDERvisual');
	HOLDERvisualHeight.hide();
	HOLDERpackHeight = new fx.Height('HOLDERpack');
	HOLDERpackHeight.hide();
	HOLDERcomHeight = new fx.Height('HOLDERcom');
	HOLDERcomHeight.hide();
	HOLDERnamHeight = new fx.Height('HOLDERnam');
	HOLDERnamHeight.hide();
	HOLDERtxtusHeight = new fx.Height('HOLDERtxtus');
	HOLDERtxtusHeight.hide();
	HOLDERtxtthingsHeight = new fx.Height('HOLDERtxtthings');
	HOLDERtxtthingsHeight.hide();
	
}

function estilo() {
	if (anterior != null)
	{
		anterior.style.color		= "#000000";
	}
	anterior = this;
	
	this.style.color		= "#FF0000";
	this.blur();
	
}

// Menu
var current = null;
var currentWork = null;

function show(id_show)
{	
	
	/*// Inicio para el parpadeo en negro ________
	if (newsId == 1 || newsId == 0) {
		newsId = 2;
		var navnews = document.getElementById('parpadeoNews');
		navnews.style.color='#000000'
		clearTimeout(idColorNews);
	}
	// Fin parar parpadeo ______________________*/
	
	
	if (current != null)
	{
		switch (current)
		{
			case 'work':
				BTNworkHeight.toggle(); // Show work menu btn
				HOLDERtxtHeight.toggle(); // Hide work txt
				HOLDERworkHeight.hide(); // Hide work submenu
				break;
			case 'us':
				BTNusHeight.toggle(); // Show us menu btn
				HOLDERtxtusHeight.toggle(); // Hide us txt
				break;
			case 'things':
				BTNthingsHeight.toggle(); // Show us menu btn
				HOLDERtxtthingsHeight.toggle(); // Hide us txt
		}
	}
	if (currentWork != null)
	{
		//HOLDERtxtHeight.hide();
		//HOLDERworkHeight.hide();
		HOLDERvisualHeight.hide();
		HOLDERpackHeight.hide();
		HOLDERcomHeight.hide();
		HOLDERnamHeight.hide();
		currentWork = null;
	}
	
	switch (id_show)
	{
		case 'news':
			parent.work.location.href = 'news.php';
			break;
		case 'awards':
			parent.work.location.href = 'awards.php';
			break;
		case 'us':
			//parent.work.location.href = 'us.php';
			BTNusHeight.toggle(); // Hide us menu btn
			HOLDERtxtusHeight.toggle(); // Show us txt
			break;
		case 'work':
			BTNworkHeight.toggle(); // Hide work menu btn
			HOLDERtxtHeight.toggle(); // Show work txt
			HOLDERworkHeight.toggle(); // Show work submenu
			break;
		case 'things':
			BTNthingsHeight.toggle(); // Hide work menu btn
			HOLDERtxtthingsHeight.toggle(); // Show work txt
			//parent.work.location.href = 'things.php';
			break;
		case 'contact':
			parent.work.location.href = 'contact.php';
			break;
	}
	
	current = id_show;
}

function work(id_work)
{
	if (currentWork != null)
	{
		eval("HOLDER" + currentWork + "Height.toggle();");
	}
	else
	{
		HOLDERworkHeight.toggle();
	}
	
	eval("HOLDER" + id_work + "Height.toggle();");
	currentWork = id_work;
}
