
/* ATOMIC JS FUNCTIONS  */

/******************* Easing Equations **********************/

function Delegate() {}
Delegate.create = function (o, f) {
	var a = new Array() ;
	var l = arguments.length ;
	for(var i = 2 ; i < l ; i++) a[i - 2] = arguments[i] ;
	return function() {
		var aP = [].concat(arguments, a) ;
		f.apply(o, aP);
	}
}

Tween = function(obj, prop, func, begin, finish, duration, suffixe){
	this.init(obj, prop, func, begin, finish, duration, suffixe)
}
var t = Tween.prototype;

t.obj = new Object();
t.prop='';
t.func = function (t, b, c, d) { return c*t/d + b; };
t.begin = 0;
t.change = 0;
t.prevTime = 0;
t.prevPos = 0;
t.looping = false;
t._duration = 0;
t._time = 0;
t._pos = 0;
t._position = 0;
t._startTime = 0;
t._finish = 0;
t.name = '';
t.suffixe = '';
t._listeners = new Array();	
t.setTime = function(t){
	this.prevTime = this._time;
	if (t > this.getDuration()) {
		if (this.looping) {
			this.rewind (t - this._duration);
			this.update();
			this.broadcastMessage('onMotionLooped',{target:this,type:'onMotionLooped'});
		} else {
			this._time = this._duration;
			this.update();
			this.stop();
			this.broadcastMessage('onMotionFinished',{target:this,type:'onMotionFinished'});
		}
	} else if (t < 0) {
		this.rewind();
		this.update();
	} else {
		this._time = t;
		this.update();
	}
}
t.getTime = function(){
	return this._time;
}
t.setDuration = function(d){
	this._duration = (d == null || d <= 0) ? 100000 : d;
}
t.getDuration = function(){
	return this._duration;
}
t.setPosition = function(p){
	this.prevPos = this._pos;
	var a = this.suffixe != '' ? this.suffixe : '';
	this.obj[this.prop] = Math.round(p) + a;
	this._pos = p;
	this.broadcastMessage('onMotionChanged',{target:this,type:'onMotionChanged'});
}
t.getPosition = function(t){
	if (t == undefined) t = this._time;
	return this.func(t, this.begin, this.change, this._duration);
};
t.setFinish = function(f){
	this.change = f - this.begin;
};
t.getFinish = function(){
	return this.begin + this.change;
};
t.init = function(obj, prop, func, begin, finish, duration, suffixe){
	if (!arguments.length) return;
	this._listeners = new Array();
	this.addListener(this);
	if(suffixe) this.suffixe = suffixe;
	this.obj = obj;
	this.prop = prop;
	this.begin = begin;
	this._pos = begin;
	this.setDuration(duration);
	if (func!=null && func!='') {
		this.func = func;
	}
	this.setFinish(finish);
}
t.start = function(){
	this.rewind();
	this.startEnterFrame();
	this.broadcastMessage('onMotionStarted',{target:this,type:'onMotionStarted'});
	//alert('in');
}
t.rewind = function(t){
	this.stop();
	this._time = (t == undefined) ? 0 : t;
	this.fixTime();
	this.update();
}
t.fforward = function(){
	this._time = this._duration;
	this.fixTime();
	this.update();
}
t.update = function(){
	this.setPosition(this.getPosition(this._time));
	}
t.startEnterFrame = function(){
	this.stopEnterFrame();
	this.isPlaying = true;
	this.onEnterFrame();
}
t.onEnterFrame = function(){
	if(this.isPlaying) {
		this.nextFrame();
		setTimeout(Delegate.create(this, this.onEnterFrame), 0);
	}
}
t.nextFrame = function(){
	this.setTime((this.getTimer() - this._startTime) / 1000);
	}
t.stop = function(){
	this.stopEnterFrame();
	this.broadcastMessage('onMotionStopped',{target:this,type:'onMotionStopped'});
}
t.stopEnterFrame = function(){
	this.isPlaying = false;
}

t.continueTo = function(finish, duration){
	this.begin = this._pos;
	this.setFinish(finish);
	if (this._duration != undefined)
		this.setDuration(duration);
	this.start();
}
t.resume = function(){
	this.fixTime();
	this.startEnterFrame();
	this.broadcastMessage('onMotionResumed',{target:this,type:'onMotionResumed'});
}
t.yoyo = function (){
	this.continueTo(this.begin,this._time);
}

t.addListener = function(o){
	this.removeListener (o);
	return this._listeners.push(o);
}
t.removeListener = function(o){
	var a = this._listeners;	
	var i = a.length;
	while (i--) {
		if (a[i] == o) {
			a.splice (i, 1);
			return true;
		}
	}
	return false;
}
t.broadcastMessage = function(){
	var arr = new Array();
	for(var i = 0; i < arguments.length; i++){
		arr.push(arguments[i])
	}
	var e = arr.shift();
	var a = this._listeners;
	var l = a.length;
	for (var i=0; i<l; i++){
		if(a[i][e])
		a[i][e].apply(a[i], arr);
	}
}
t.fixTime = function(){
	this._startTime = this.getTimer() - this._time * 1000;
}
t.getTimer = function(){
	return new Date().getTime() - this._time;
}

Tween.backEaseIn = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158;
	return c*(t/=d)*t*((s+1)*t - s) + b;
}
Tween.backEaseOut = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158;
	return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
}
Tween.backEaseInOut = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158; 
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}
Tween.elasticEaseIn = function(t,b,c,d,a,p){
		if (t==0) return b;  
		if ((t/=d)==1) return b+c;  
		if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) {
			a=c; var s=p/4;
		}
		else 
			var s = p/(2*Math.PI) * Math.asin (c/a);
		
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	
}
Tween.elasticEaseOut = function (t,b,c,d,a,p){
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b);
	}
Tween.elasticEaseInOut = function (t,b,c,d,a,p){
	if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) var p=d*(.3*1.5);
	if (!a || a < Math.abs(c)) {var a=c; var s=p/4; }
	else var s = p/(2*Math.PI) * Math.asin (c/a);
	if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
}

Tween.bounceEaseOut = function(t,b,c,d){
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
}

Tween.bounceEaseIn = function(t,b,c,d){
	return c - Tween.bounceEaseOut (d-t, 0, c, d) + b;
	}
Tween.bounceEaseInOut = function(t,b,c,d){
	if (t < d/2) return Tween.bounceEaseIn (t*2, 0, c, d) * .5 + b;
	else return Tween.bounceEaseOut (t*2-d, 0, c, d) * .5 + c*.5 + b;
	}

Tween.strongEaseInOut = function(t,b,c,d){
	return c*(t/=d)*t*t*t*t + b;
	}

Tween.regularEaseIn = function(t,b,c,d){
	return c*(t/=d)*t + b;
	}
Tween.regularEaseOut = function(t,b,c,d){
	return -c *(t/=d)*(t-2) + b;
	}

Tween.regularEaseInOut = function(t,b,c,d){
	if ((t/=d/2) < 1) return c/2*t*t + b;
	return -c/2 * ((--t)*(t-2) - 1) + b;
	}
Tween.strongEaseIn = function(t,b,c,d){
	return c*(t/=d)*t*t*t*t + b;
	}
Tween.strongEaseOut = function(t,b,c,d){
	return c*((t=t/d-1)*t*t*t*t + 1) + b;
	}

Tween.strongEaseInOut = function(t,b,c,d){
	if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
	return c/2*((t-=2)*t*t*t*t + 2) + b;
	}
	
/********* Return a section title string from an object id  *********/

function getTitle(id){
id = id.charAt(0);
var t = "";
switch (id) {
	case "m": t = "method"; break;
	case "r": t = "results"; break;
	case "a": t ="about"; break;
	case "s": t ="services"; break;
	case "n": t ="news"; break;
	}
return t;
}

/********* Return a section array reference from an object id  *********/

function getTitleRef(id){
id = id.charAt(0);
var r = 0;
switch (id) {
	case "r": r = 1; break;
	case "a": r = 2; break;
	case "s": r = 3; break;
	case "n": r = 4; break;
	}
return r;
}

/*************   Opacity code for timed-transitions   *************/

OpacityTween.prototype = new Tween();
OpacityTween.prototype.constructor = Tween;
OpacityTween.superclass = Tween.prototype;

function OpacityTween(obj,func,fromOpacity,toOpacity,duration){
	this.targetObject = obj;
	this.init(new Object(),'x',func,fromOpacity,toOpacity,duration);
}
var o = OpacityTween.prototype;
o.targetObject = {};
o.onMotionChanged = function(evt){
	var v = evt.target._pos;
	var t = this.targetObject;
	t.style['opacity'] = v / 100;
	t.style['-moz-opacity'] = v / 100;
//	if(t.filters) t.filters.alpha['opacity'] = v;    Mod for IE6-7
	if(t.filters) t.style['filter']='alpha(opacity = '+v+')';
}

/**************** Backbutton & bookmarking Functions and Variables *****************/

function viewChange(newLocation, historyData) {
		if(newLocation){
			if(newLocation != 'home'){	// if not home, then load a new view into a panel via ajax 
				var t = getTitle(newLocation.charAt(8));

				var tref = getTitleRef(newLocation.charAt(8));
				if(active_panel != none){						 		// is a panel open? 
					if(active_panel == tref){					 		// does hash target the currently opened panel?
						ajaxpage2(newLocation, t + '_panel_content');	// ajax update the panel 
					}
				}
				else{	
					column_mouseover(t + "_column_container");
					column_mousedown(t + "_column_container");			// all panels closed, so open targeted panel using hash info
					ajaxpage2(newLocation, t + '_panel_content');		// ajax update the panel
				}
				lastView = newLocation;
			}

			/* The hash = home */
			else{
				if(lastView != 'home'){

					panel_close();									 	// so just close panel 
					lastView = newLocation;								// then assign 'home' to lastView
				}
			}
		}
}


/**************** AJAX Functions and Variables *****************/

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url,containerid){
	dhtmlHistory.add(url,'link');
	lastView = url;
	clientListCount = 0;
	ajaxpage2(url, containerid);
}

function ajaxpage2(url, containerid){
	var page_request = false;
	var theContainer = document.getElementById(containerid);
	var loadLeft = (parseInt(theContainer.parentNode.style.width)-94)/2;
	

/*	replace container content with loading panel and animated gif  */
	if(containerid != 'results_column_content'){
		theContainer.innerHTML='<div style="position:absolute; width:66px; top:40px; left:' + loadLeft + 'px"><img src="images/loader.gif"></div>';
	}
/*	add code to quickly fade in loading gif panel */

	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
		else if (window.ActiveXObject){ // if IE
			try {
				page_request = new ActiveXObject("Msxml2.XMLHTTP")
			} 
			catch (e){
				try{
					page_request = new ActiveXObject("Microsoft.XMLHTTP")
				}
					catch (e){}
				}
		}
	else return false
	
	if(containerid != 'results_column_content'){
		page_request.onreadystatechange=function(){	loadpage(page_request, containerid)	}
	}
	else{
		page_request.onreadystatechange=function(){	loadpage2(page_request, containerid)	}
	}
	page_request.open('GET', url, true)
	page_request.send(null)

}
function loadpage(page_request, containerid){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){ 
		loadingOpacity[active_panel].continueTo(0,.5);
		loadingOpacity[active_panel].onMotionFinished = function(){loadpage2(page_request, containerid)};
	}
}  

function loadpage2(page_request, containerid){
 	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){ 
		document.getElementById(containerid).innerHTML=page_request.responseText;
		if(containerid != 'results_column_content'){
			loadingOpacity[active_panel].continueTo(100,.5);
			loadingOpacity[active_panel].onMotionFinished = null;
		}
	}
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}     /*  end AJAX loader code  */





/**************** Atomic Functions and Variables *****************/

var method=0; var results=1; var about=2; var services=3; var news=4; var none=5; var closing=6;
var section_title 			= new Array();
var motion					= new Array();
var opacity					= new Array();
var loadingOpacity			= new Array();
var panel  					= new Array();
var panel_container 		= new Array();
var panel_close_button		= new Array();	/* all close buttons */
var active_panel 			= none;			/* The currently opened panel. none = all panels closed */
var last_panel				= "";			/* the panel just closed after close button clicked */
var panel_init_content		= "";			/* stores panel content initially loaded at page load */
var panel_origin 			= 0;			/* stores initial horiz position of closed panel */
var last_mousedown_id		= "";			/* stores id of column last clicked */

/*  vars for client image rotator  */

var ImageIdx 				= 1;			/* next image to load into rotator */
var ImageFrame 				= 0;			/* display switch for two divs inside the cliet_anim div */
var TotalImages				= 24;			/* total number of client rotator images */
var animTween1				= null;
var animTween2				= null;
var clientAnimTimer 		= null;			/* timer for rotating client banners on homepage */

/*  vars for client list nimation  */

var clientListTimer			= null;			/* timer for client banner list in About panel */
var clientListMotionTween	= new Array();	/* motiontween object for second column of client banner list */
var clientListOpacityTween	= new Array();	/* motion/opacity tween object for second column of client banner list */
var testClientOPtween		= null;

var clientListCount			= 0;			/* loop counter for timing of client list events */

/* vars for Results cases  */

var totalResultsCases	= 13;

/*  vars for anchor hash management (bookmarking, back button, forward button)  */

var lastView = '';

/**************** End of Atomic Functions and Variables *****************/





/* Directly set object opacity  */

function set_opacity(obj, opacity) {
        obj.style.opacity = ( opacity / 100 );
        obj.style.MozOpacity = ( opacity / 100 );
        obj.style.KhtmlOpacity = ( opacity / 100 );
        obj.style.filter = 'alpha(opacity=' + opacity + ')';
}

function logo_mouseover(id){
	document.getElementById(id).style.cursor = "pointer";
}
function logo_mouseout(id){
	document.getElementById(id).style.cursor = "default";
}



function column_mouseover(id){
	if (active_panel == none){
		if(id != 'event_edge' ){		/* Note:  "event_edge" is the class name of the event edge divs and is passed as an id  */
			for(i=0; i<5; i++){ 
				set_opacity(document.getElementById(section_title[i] + '_column_container'), 20); 
			}
			var t = getTitle(id);
			document.getElementById(t + '_subtitle').style.color = "#9ecf1e";
			document.getElementById(t + '_title').style.color = "#006666";
			set_opacity(document.getElementById(id), 100);
	}
		else{
			for(i=0; i<5; i++){ 
				set_opacity(document.getElementById(section_title[i] + '_column_container'), 100); 
				document.getElementById(section_title[i] + '_subtitle').style.color = "#006666";
				document.getElementById(section_title[i] + '_title').style.color = "#000000";
			}
		} 
	}
}

function column_mouseout(id){
	if(active_panel==none){
		var t = getTitle(id);
		set_opacity(document.getElementById(id), 20);
		document.getElementById(t + '_subtitle').style.color = "#006666";
		document.getElementById(t + '_title').style.color = "#000000";
	}
}

function contact_click(){
	if(active_panel != none && active_panel != about){
		panel_close();
  		contactTimer = window.setTimeout('viewChange("content/about-contact.php", "link");', 800);
	}
	else{
		viewChange('content/about-contact.php', 'link');
	}
}




function results_mousedown(){
last_mousedown_id = 'results_column_container';
if (active_panel == none){
	
			viewChange(document.getElementById('case').className, 'link');

	}
else{ panel_close(); }	
}




function column_mousedown(id){
last_mousedown_id = id;
if (active_panel == none){
	if(id != "news_column_container"){
		var m_time = 1;
		var m_func = Tween.strongEaseOut;
		var o_time = 1;
		active_panel = getTitleRef(id);
		last_panel = getTitle(id);
		
		switch (last_panel) {
			case "method":	    dhtmlHistory.add('content/method-different-approach.php','link'); break;
			case "about": 	    dhtmlHistory.add('content/about-alternative-pr.php','link'); break;
			case "services":	dhtmlHistory.add('content/services-engaging-the-continuum.php','link'); break;
			case "results":		dhtmlHistory.add('content/results-panel.php','link'); break;
			}
	
		panel_init_content = document.getElementById(last_panel + '_panel_content').innerHTML;
		panel_close_button[active_panel].style.visibility = 'visible';
		panel_container[active_panel].style.visibility = 'visible';
		panel_origin = panel[active_panel].style.left;
		motion[active_panel].func = m_func;
		motion[active_panel].continueTo(0,m_time);
		opacity[active_panel].continueTo(100,o_time);
		}
	}
else{ 
	panel_close();}
}





function panel_close(){
	if(active_panel < 5){
		var m_time = .3;
		var o_time = .3;
		var m_func = Tween.strongEaseIn;
		motion[active_panel].func = m_func;
		motion[active_panel].continueTo(parseInt(panel_origin),m_time);
		opacity[active_panel].continueTo(0,o_time);
		panel_close_button[active_panel].style.visibility = 'hidden';
		active_panel=closing;
	}
}

function panel_closed(){
	if(active_panel == closing){
		active_panel=none;
		document.getElementById(last_panel + '_panel_content').innerHTML = panel_init_content;
		for(i=0; i<5; i++){ 
			panel_container[i].style.visibility = 'hidden';
			}
			
		var	casenum = Math.floor(Math.random()* totalResultsCases);
		casenum += '';
		ajaxpage2('content/case-' + casenum + '.php', 'results_column_content');	

		clientAnimation();
		column_mouseover(last_mousedown_id);
		dhtmlHistory.add('home','link');
		clientListCount = 0;
	}
}




/*  Client rotator animation  */

function clientAnimation(){
if(active_panel == none){
	window.clearTimeout(clientAnimTimer);
	if(ImageIdx > TotalImages){ImageIdx=1;}
  	if(ImageFrame > 1){ImageFrame=0;}
	/* create internal frame divs for images if it doesn't exist */
	if (!document.getElementById('animation_frame1')){
		document.getElementById('client_animation').innerHTML='<div id="animation_frame1" style="left:0px; width:173px; height:130px; position:absolute; backgroundImage="images/client-animation/1.jpg"; opacity: 1; filter: alpha(opacity=100);	-moz-opacity: 1;"></div><div id="animation_frame2" style="left:0px; width:173px; height:130px; position:absolute; backgroundImage="images/client-animation/2.jpg"; opacity: 1; filter: alpha(opacity=100);	-moz-opacity: 1;"></div>';
	}
	var imgUrl = 'images/client-animation/' + ImageIdx + '.jpg';
	preloadImageObj = new Image();
	if(ImageIdx < TotalImages){preloadImageObj.src = 'images/client-animation/' + (ImageIdx+1) + '.jpg';}

	switch (ImageFrame) {
		case 0:
				document.getElementById('animation_frame2').style.backgroundImage = 'url(' + imgUrl + ')';
				animTween1 = new OpacityTween(document.getElementById('animation_frame1'),Tween.easeIn, 100, 0, 1);
				animTween1.start();
				animTween2 = new OpacityTween(document.getElementById('animation_frame2'),Tween.easeIn, 0, 100, 1);
				animTween2.start();
		break;

		case 1:
				document.getElementById('animation_frame1').style.backgroundImage = 'url(' + imgUrl + ')';
				animTween1 = new OpacityTween(document.getElementById('animation_frame2'),Tween.easeIn, 100, 0, 1);
				animTween1.start();
				animTween2 = new OpacityTween(document.getElementById('animation_frame1'),Tween.easeIn, 0, 100, 1);
				animTween2.start();
		break;
	}
	ImageIdx++;
	ImageFrame++;
  	clientAnimTimer = window.setTimeout('clientAnimation();', 5000);
	}
}

/*   CLIENT LIST ANIMATION   */

function clientListOpacity(img1, img2, img3, img4, listIndex){    
			clientListOpacityTween[0] = new OpacityTween(document.getElementById('client_image_' + img1),Tween.easeIn,100,0,1);
			clientListOpacityTween[1] = new OpacityTween(document.getElementById('client_image_' + img2),Tween.easeIn,100,0,1);
			clientListOpacityTween[2] = new OpacityTween(document.getElementById('client_image_' + img3),Tween.easeIn,100,0,1);
			clientListOpacityTween[3] = new OpacityTween(document.getElementById('client_image_' + img4),Tween.easeIn,100,0,1);
			clientListOpacityTween[4] = new OpacityTween(document.getElementById('client_list_index' + listIndex),Tween.easeIn,100,0,1);
			clientListOpacityTween[0].start();
			clientListOpacityTween[1].start();
			clientListOpacityTween[2].start();
			clientListOpacityTween[3].start();
			clientListOpacityTween[4].start();
}

function clientList(){
	window.clearTimeout(clientListTimer);
	if (document.getElementById("client_image_1")){
		clientListCount++;
		// pass number of image to opacity function 
		switch (clientListCount){
			case 6:	 clientListOpacity(1, 2, 3, 4, 1);		break;
			case 12: clientListOpacity(5, 6, 7, 8, 2);		break;
			case 18: clientListOpacity(9, 10, 11, 12, 3);	break;
			case 20:	for(i=0; i<4; i++){ 
						clientListOpacityTween[i] = new OpacityTween(document.getElementById('client_image_' + (i+1)),Tween.easeIn,0,100,1);
						clientListOpacityTween[i].start();
						}
						clientListOpacityTween[4] = new OpacityTween(document.getElementById('client_list_index1'),Tween.easeIn,0,100,1);
						clientListOpacityTween[4].start();
			break;
			case 21: 	for(i=4; i<12; i++){ 			
						clientListOpacityTween[i] = new OpacityTween(document.getElementById('client_image_' + (i+1)),Tween.easeIn,0,100,.1);
						clientListOpacityTween[i].start();
						} 
						clientListOpacityTween[12] = new OpacityTween(document.getElementById('client_list_index2'),Tween.easeIn,0,100,.1);
						clientListOpacityTween[12].start();
						clientListOpacityTween[13] = new OpacityTween(document.getElementById('client_list_index3'),Tween.easeIn,0,100,.1);
						clientListOpacityTween[13].start();
						clientListCount = 0;
			break;
		}
	} 
	clientListTimer = window.setTimeout('clientList();', 1000);
} 


/*  General init function called by onload event ****************************************************/

window.onload = function(){

/* Load title strings into array for loop usage */

section_title[0] = 'method';
section_title[1] = 'results';
section_title[2] = 'about';
section_title[3] = 'services';
section_title[4] = 'news';

/* initialize motion and opacity arrrays, and any objects that will be affected by them  */

for(i=0; i<5; i++){ 
		panel[i] 					= document.getElementById(section_title[i] + '_panel');
		panel_container[i] 			= document.getElementById(section_title[i] + '_panel_container');
		panel_close_button[i] 		= document.getElementById(section_title[i] + '_close');
		motion[i] 					= new Tween(panel[i].style,'left','',parseInt(panel[i].style.left),0,0,'px');
		opacity[i] 					= new OpacityTween(panel[i],Tween.easeIn, 0, 100, 1);
		loadingOpacity[i] 			= new OpacityTween(panel[i],Tween.easeIn, 100, 0, .5);
		motion[i].onMotionFinished 	= function(){panel_closed()};
		}

/* init the history management framework */

dhtmlHistory.initialize();
dhtmlHistory.addListener(viewChange);

/* set home as the current page in the history  */

if(document.location.hash){
	h = document.location.hash.slice(1);
	dhtmlHistory.add(h,'link');
	viewChange(h, 'link');
	}
else{
	dhtmlHistory.add('home','link');
	}

/*
for(i=0; i<5; i++){ 
				set_opacity(document.getElementById(section_title[i] + '_column_container'), 100); 
				document.getElementById(section_title[i] + '_subtitle').style.color = "#006666";
				document.getElementById(section_title[i] + '_title').style.color="000000";
			}
*/			
var browserName = navigator.appName; 
if(browserName == "Microsoft Internet Explorer"){
	document.getElementById('method_subtitle').style.letterSpacing = -1;
	document.getElementById('results_subtitle').style.letterSpacing = -1;
	document.getElementById('about_subtitle').style.letterSpacing = -1;
	document.getElementById('services_subtitle').style.letterSpacing = -1;
	document.getElementById('news_subtitle').style.letterSpacing = -1;
}
/* first random case load to results column */

var	casenum = Math.floor(Math.random()* totalResultsCases);
casenum += '';

ajaxpage2('content/case-' + casenum + '.php', 'results_column_content');

/* start the client image rotator and client list anim. */

clientAnimation();
clientList();

}