/*----TEXT AND FADE SHIFT Script----*/
/*----Copyright 2010. Jeremy Sosnick----*/

function preloadImages(urls){
 var img = new Array();
 for (var i=0; i<urls.length; i++) {
 img[img.length] = new Image();
 img[img.length - 1].src = urls[i]; 
 }
}

function StartSequencesAbout(){
var img = new Array("button_images/about_button_hover.png", "button_images/home_button_hover.png", "button_images/projects_button_hover.png", "button_images/events_button_hover.png", "button_images/shop_button_hover.png", "button_images/contact_button_hover.png");
preloadImages(img);
window.scrollTo(95, 0);
}

var action = false;
var companyCursor = 1;
var membersCursor = 0;
var mf = 4;
var cf = 10;
var tf = 10;
var companyText = "<p class='big_title'>Timestop Productions</p><p class='about_us'>Founded in 2009, Timestop Productions was formed by a group of artists with the sole purpose of bringing new and innovative ideas to the entertainment industry. Timestop represents the new era of creativity through animation, photography, film, and other multimedia services.</p><p class='about_us'>In its infancy, the Burlingame, California-based company has participated in a wide range of productions from music videos for local artists to large scale animations for the San Francisco Giants. Timestop strives to expand their repertoire and continues to provide the skill and talent for many projects.</p>";
var membersText = "<ul><li class='mem'><b>Justin Tatsuo Chan</b> - Director/Producer</li><li class='mem' style='font-size:12pt;'><b>Unnikrishnan Ravendranathan</b> - Photography</li><li class='mem'><b>Heather Hyo Han</b> - Visual Effects</li><li class='mem'><b>Jay Lee</b> - Storyboards/Layouts</li><li class='mem'><b>Brian Sydnor</b> - Character Design</li><li class='mem'><b>Jeremy Sosnick</b> - Web Design</li><li class='mem'><b>Eric Rissler</b> - Modeling/Games</li></ul>";
var currentText = companyText;

function setOpacity(item,value) {
	document.getElementById(item).style.opacity = value/10;
	document.getElementById(item).style.filter = 'alpha(opacity=' + value*10 + ')';
}

function FadeOutMembers(){
action = true;
mf = mf - .3;
setOpacity("members",mf);
if (mf < 4)
{membersCursor = 0;
clearInterval(id2);}
}

function FadeOutCompany(){
action = true;
cf = cf - .3;
setOpacity("company",cf);
if (cf < 4)
{companyCursor = 0;
clearInterval(id4);}
}

function FadeOutText(){
action = true;
tf = tf - .3;
setOpacity("bottom_aboutbox",tf);
if (tf < 0)
{clearInterval(id5);
ChangeAboutText();
setupFadeInText();}
}

function FadeInText(){
action = true;
tf = tf + .3;
setOpacity("bottom_aboutbox",tf);
if (tf > 10)
{clearInterval(id6);
action = false;}
}

function ChangeAboutText(){
if (currentText == companyText)
	{document.getElementById("bottom_aboutbox").innerHTML = membersText;
	return currentText = membersText;}
if (currentText == membersText)
	{document.getElementById("bottom_aboutbox").innerHTML = companyText;
	return currentText = companyText;}
}

function FadeInMembers(){
action = true;
mf = mf + .3;
setOpacity("members",mf);
membersCursor = 1;
if(mf > 10)
{membersCursor = 1;
clearInterval(id1);
setupFadeOutText();
setupFadeOutCompany();}
}

function FadeInCompany(){
action = true;
cf = cf + .3;
setOpacity("company",cf);
companyCursor = 1;
if(cf > 10)
{companyCursor = 1;
clearInterval(id3);
setupFadeOutText();
setupFadeOutMembers();}
}

function setupFadeOutMembers(){
id2 = setInterval("FadeOutMembers()",10);
}

function setupFadeInMembers(){
id1 = setInterval("FadeInMembers()",10);
}

function setupFadeOutCompany(){
id4 = setInterval("FadeOutCompany()",10);
}

function setupFadeInCompany(){
id3 = setInterval("FadeInCompany()",10);
}

function setupFadeOutText(){
id5 = setInterval("FadeOutText()",10);
}

function setupFadeInText(){
id6 = setInterval("FadeInText()",10);
}

function FadeMembers(){
	if (action == false)
	{setupFadeInMembers();}
}

function FadeCompany(){
	if (action == false)
	{setupFadeInCompany();}
}

function MembersCursorChange(){
	if (membersCursor == 0)
	{document.getElementById("members").style.cursor = "pointer";}
	if (membersCursor == 1)
	{document.getElementById("members").style.cursor = "default";}
}

function CompanyCursorChange(){
	if (companyCursor == 0)
	{document.getElementById("company").style.cursor = "pointer";}
	if (companyCursor == 1)
	{document.getElementById("company").style.cursor = "default";}
}
