/*
 * Copyright 2006 twentyeight development limited (info@twentyeight-uk.com) http://www.twentyeight-uk.com.
 * This project contains libraries licensed under a Creative Commons licence.
 * Licensed work is clearly marked by being within a 'com.johncowen' namespace.
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/2.0/ or send a letter to 
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
 *
 */

_import("com.johncowen.timeline.Wait");
_import("com.johncowen.lang.MovieClip#tweenTo");
_import("com.johncowen.timeline.easing.Normal#easeOut");
_import("com.johncowen.timeline.easing.Quint#easeOut");
_import("com.johncowen.lang.Object#registerSymbol");

var o = this;
o.init = function()
{
	try {
		// quick _blank
		var links = document.getElementsByTagName("a");
		for(var i = 0;i < links.length;i ++) {
			if(links[i].rel == "external") {
				links[i].target = "_blank";
			}
		}
		this.bar_mc = document.getElementById('tagline');
		Object.registerSymbol(this.bar_mc, MovieClip);
		this.bar_mc.display_txt = this.bar_mc.firstChild;
		this.bar_mc.style.overflow = "hidden";
		this.bar_mc.style.whiteSpace = "nowrap";
		this.bar_mc.style.width = "180px";
		
		//
		this.taglines = new Array();
		this.taglines.push("High-end Web Development");
		this.taglines.push("Development Limited");
		this.taglines.push("HTML Development");
		this.taglines.push("Web Development");
		this.taglines.push("High-end Back-end");
		this.taglines.push("High-end Web Creation");
		this.taglines.push("Flash Development");
		this.taglines.push("Web Creation");
		this.taglines.push("High-end Front-end");
		this.pause();
	} catch (e) {
		
	}
};
o.pause = function()
{
	var w = new Wait(200);
	var o = this;
	w.onComplete = function()
	{
		o.changeTagline();
	};
	w.play();
};
o.changeTagline = function()
{
	var tw = this.bar_mc.tweenTo(Normal.easeOut, {width: -180}, 31);	
	var o = this;
	tw.onComplete = function()
	{
		o.showTagline();
	};
};
o.showTagline = function()
{
	var line = this.taglines.pop();
	this.taglines.unshift(line);
	this.bar_mc.display_txt.data = line;
	var tw = this.bar_mc.tweenTo(Quint.easeOut, {width: 180}, 72);
	var o = this;
	tw.onComplete = function()
	{
		o.pause();
	};
};
o.onload = o.init;
//o.init();