var header   = '<div align="center" id="outerPage">\n	<div id="page">\n	<a id="logo" href="/"><img src="/img/logo.gif" width="953" height="95" alt="5CARDproductions" border="0" /></a>',
	footer	= '\n<div class="footer">&copy 2007 5 Card Productions. All rights reserved. design: <a href="mailto:tmcbod@aol.com" target="_new">theresa castro design</a> | coding: <a href="http://samrod.com/portfolio" target="_new">samrod shenassa</a></div></div></div>',


	skeleton = '\n<img class="grid" src="/img/casper.gif" width="720" height="480" alt="" />',
	halfRamp = [ .999999, .9575, .8306, .6656, .5406, .5 ],

	currentPath = window.location.pathname + '',

	reelLinks = [
		new page( "feature",	"/feature.html" ),
		new page( "commercial",	"/commercial.html" ),
		new page( "documentary","/documentary.html" )
],
	pressLinks = [
		new page( "Los Angeles Times",			"/lat.html" ),
		new page( "Los Angeles Times Review",	"/latreview.html" ),
		new page( "New York Times",				"/nyt.html" ),
		new page( "Philippine Daily Inquirer",	"/pdi.html" ),
		new page( "San Francisco Chronicle",	"/sfc.html" )
],
	mainLinks = [
		new page( "biography",	"/bio.html" ),
		new page( "reel",		"/reel",	reelLinks ),
		new page( "press",		"/press",	pressLinks ),
		new page( "contact",	"/contact.html" )
],
	scrollPage_X = 670,
	scrollPage_Y = 478;


function page( name, href, sublinks )
{
	thisLink = new Object();
	thisLink.name = name;
	thisLink.href = href;
	thisLink.active = ( currentPath.indexOf( href ) > -1 );
	thisLink.sublinks = ( sublinks ) ? sublinks : false;
	return thisLink;
}

function init()
{
	var out = header + '\n	<div id="nav">',
		thisLink, thisSublink, x, y;
	for ( x=0; x < mainLinks.length; x++ )
	{
		thisLink = mainLinks[x];
		if ( thisLink.sublinks && thisLink.active )
		{
			out += '<div class="subLinks">';
			for ( y=0; y < thisLink.sublinks.length; y++ )
			{
				thisSublink = thisLink.sublinks[y];
				out += '\n				<a href="' + thisLink.href + thisSublink.href + '"' + ( ( thisSublink.active ) ? ' class="active"' : '' ) + '>' + thisSublink.name + '</a>';
			}
			out += '\n		</div>';
		}
		out += '\n	<a class="mainLinks' + ( ( thisLink.active ) ? ' active' : '' ) + '" href="' + thisLink.href + '">' + thisLink.name + '</a>';
	}
	out += '\n</div>' + ( ( currentPath.indexOf('reel') == -1 ) ? skeleton : '' ) + document.body.innerHTML + footer;
//	Debug( out );
	document.body.innerHTML = out;
}


// REEL FUNCTIONS
function initThumb( id )
{
	new FadeObj( d( id ), halfRamp );
	bindEvent( d( id ), 'mouseover',	function() { over( id ) } );
	bindEvent( d( id ), 'mouseout',		function() { over( id ) } );
	bindEvent( d( id ), 'click',		function() { lockFade( id ) } );
}

function over( id )
{
	if ( thumbCache != id )
		fadeObj[ id ].fade();
}

function lockFade( id )
{
	fadeObj[ thumbCache ].fadeUp();
	Swap( thumbCache + "_caption", id + "_caption" )
	thumbCache = id;
	d("playall").className = "";
}

function makeActive()
{
	d("playall").className = "active";
	Swap( thumbCache + "_caption", "junk_caption" );
	thumbCache = 'junk';
}

