
//////////////////////////////////////////////////////////////////////////////////////
/////////////////////// ACCORDIAN FUNCTIONS /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////


var _glbAccord = "";
var _glbAccordActive = 0;

function accordControl(num){
	document.getElementById('accordLinkDetail'+num).innerHTML = "";
		if (_glbAccordActive == 0){
			if(_glbAccord != ""){
				closeContent(num);
			}
			showContent(num);
		}
}

function closeContent(num){

/*	document.getElementById('accordExpandTitle'+_glbAccord).style.display = "none";
	document.getElementById('accordLinks'+_glbAccord).style.display = "none";
	document.getElementById('accordLinkDetail'+_glbAccord).style.display = "none";*/
	currentNum=_glbAccord;
	


	closeDetails = new Tween(document.getElementById('accordContent'+currentNum).style,'height',Tween.regularEaseInOut,185,0,.5,'px');
		
		closeDetails.onMotionFinished = function(){	
		
			document.getElementById('accordHead'+currentNum).className = "accordHead";
			document.getElementById('titleText'+currentNum).className = "orngText";
			//opacityTween = new OpacityTween(document.getElementById('accordHead'+_glbAccord),Tween.regularEaseOut, 0, 100, 1);
			//opacityTween.start();
			//document.getElementById('accordContent'+currentNum).style.display = "none";
			//contentTween = new OpacityTween(document.getElementById('accordContent'+_glbAccord),Tween.regularEaseOut, 100, 0, .5);
			//contentTween.start();
/*			document.getElementById('accordExpandTitle'+currentNum).style.display = "none";
			document.getElementById('accordLinks'+currentNum).style.display = "none";
			document.getElementById('accordLinkDetail'+currentNum).style.display = "none";*/
		}
		
	closeDetails.start();
		
	_glbAccord = num;
}

function showContent(num){
	if(_glbAccordActive == 0){
	
		//document.getElementById('accordHead'+num).style.display = "none";
		
		document.getElementById('accordHead'+num).className = "accordHeadClear";
		document.getElementById('titleText'+num).className = "accordTitleGrey";
		showDetails = new Tween(document.getElementById('accordContent'+num).style,'height',Tween.regularEaseInOut,0,185,.5,'px');
	
		showDetails.onMotionStarted = function(){
			_glbAccordActive = 1;
			//contentTween = new OpacityTween(document.getElementById('accordContent'+num),Tween.regularEaseOut, 0, 100, .3);
			//contentTween.onMotionStarted =  function(){
				document.getElementById('accordContent'+num).style.display = "block";
			//}
			//contentTween.start();
			
		}
		
		showDetails.onMotionFinished = function(){
			//document.getElementById('accordExpandTitle'+num).style.display = "block";
			//titleTween = new OpacityTween(document.getElementById('accordExpandTitle'+num),Tween.regularEaseOut, 0, 100, .1);
			//titleTween.start();
			
			//document.getElementById('accordLinks'+num).style.display = "block";
			//linksTween = new OpacityTween(document.getElementById('accordLinks'+num),Tween.regularEaseOut, 0, 100,.1);
			//linksTween.start();
			
			//document.getElementById('accordLinkDetail'+num).style.display = "block";
			//linksDetailTween = new OpacityTween(document.getElementById('accordLinkDetail'+num),Tween.regularEaseOut, 0, 100,.1);
			//linksDetailTween.start();
			_glbAccordActive = 0;
		 }
			
		showDetails.start();
		
		_glbAccord = num;
	}
}
/////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////
///////////     SUB NAV FUNCTIONS     ///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////

var _gblSubNavName = "";
var _glbMenuActive = 0;

function subNavControl(subNavName){

	if(_glbMenuActive == 0){
		if(_gblSubNavName != ""){
			closeSubNav(_gblSubNavName);
		}
		
		if(subNavName != 'subnavblank'){
			openSubNav(subNavName);
		}
	}
}

function openSubNav(subNavName){

	if(document.getElementById('subNav').style.height == '' && _glbMenuActive == 0){
		subNavTween = new Tween(document.getElementById('subNav').style,'height',Tween.regularEaseInOut,0,32,.5,'px');
		
		subNavTween.onMotionStarted = function(){
			_glbMenuActive = 1;
		}
		subNavTween.onMotionFinished = function(){
			document.getElementById(subNavName).style.display = "block";
			_glbMenuActive = 0;
		}

		subNavTween.start();
		
		
	}else{
		document.getElementById(subNavName).style.display = "block";
	}
	

	_gblSubNavName = subNavName;

}

function closeSubNav(subNavName){

	document.getElementById(subNavName).style.display = "none";
	
	_gblSubNavName = subNavName;
}

/////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////
/////////////////  JUST LAUNCHED IMAGES /////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////

var imgCount = 0;

var launchImages = new Array();

	
	launchImages[0] = new Array();
	launchImages[0].image = "launchBGImage9.jpg";
	launchImages[0].Title = "TOURISM SUNSHINE COAST <br>WEBSITE REDEVELOPMENT";
	launchImages[0].Text = "www.tsc.com.au is the culmination of engaging user generated content from the Local Stories Microsite, a social networking strategy and a highly engaging user experience to showcase the destinations broad range of offerings. This website was recently awarded the Outstanding Tourism Website award at the International WebAwards 2009. <br><br><table border=0 cellpadding=0 cellspacing=0 style='margin-left: -6px;' align=right><tr valign=middle><td><div class='folderImage'></div></td><td><a href='/portfolio.cfm?portfolio_category=web' class='orngLink' style='font-size: 11px; color: #ffffff; font-weight: bold;'> View Our Portfolio</a></td></tr></table>";
	
	launchImages[1] = new Array();
	launchImages[1].image = "launchBGImage10.jpg";
	launchImages[1].Title = "EB GAMES <br>WEBSITE REDEVELOPMENT";
	launchImages[1].Text = "EMU recently worked closely with EB Games to redevelop and relaunch their website to include a highly customised e-commerce solution. The new website allows customers to purchase new, pre-owned and pre-order games online for the first time. This project was a clear indication of EMU’s ability to deliver large and complex projects for clients. <br><br><table border=0 cellpadding=0 cellspacing=0 style='margin-left: -6px;' align=right><tr valign=middle><td><div class='folderImage'></div></td><td><a href='/portfolio.cfm?portfolio_category=web' class='orngLink' style='font-size: 11px; color: #ffffff; font-weight: bold;'> View Our Portfolio</a></td></tr></table>";
	
	launchImages[2] = new Array();
	launchImages[2].image = "launchBGImage7.jpg";
	launchImages[2].Title = "SUPERCHEAP AUTO <br>REDEVELOPMENT";
	launchImages[2].Text = "Supercheap Auto is one of Australasia's leading retailers of automotive spare parts, hand tools, power tools, car care, electrical, outdoor products, and more. Emu worked closely with Supercheap to provide a comprehensive upgrade to their existing site, creating a more effective and powerful shopping experience for customers.<br><br><table border=0 cellpadding=0 cellspacing=0 style='margin-left: -6px;' align=right><tr valign=middle><td><div class='folderImage'></div></td><td><a href='/portfolio.cfm?portfolio_category=web' class='orngLink' style='font-size: 11px; color: #ffffff; font-weight: bold;'> View Our Portfolio</a></td></tr></table>";

	launchImages[3] = new Array();
	launchImages[3].image = "launchBGImage8.jpg";
	launchImages[3].Title = "GRIFFITH UNIVERSITY <br>PLAY YOUR PART CAMPAIGN";
	launchImages[3].Text = "Emu recently recently developed the 'play your part' microsite for Griffith University. Emu delivered a website providing an effective introduction for new students to the university, helping them decide what they would like to study and which campus they would like to attend. <br><br><table border=0 cellpadding=0 cellspacing=0 style='margin-left: -6px;' align=right><tr valign=middle><td><div class='folderImage'></div></td><td><a href='/portfolio.cfm?portfolio_category=web' class='orngLink' style='font-size: 11px; color: #ffffff; font-weight: bold;'> View Our Portfolio</a></td></tr></table>";
	
	
function swapLaunchInfo(){
	
	if(imgCount <= launchImages.length - 1){
		setTimeout('swapLaunchInfo()', 10000);
	}

	contentTween = new OpacityTween(document.getElementById('launchImage'),Tween.regularEaseOut, 0, 100, 1);
	
	contentTween.onMotionStarted = function(){
		document.getElementById('launchImage').style.background = "url(\/images\/layout\/launchImages\/"+launchImages[imgCount].image+")";
		document.getElementById('launchTitle').innerHTML = launchImages[imgCount].Title;
		document.getElementById('launchShortText').innerHTML = launchImages[imgCount].Text;
	}
	
	contentTween.start();

	if(imgCount == launchImages.length - 1){
		imgCount = 0;
	}else{
		imgCount++;
	}
	
}

/////////////////////////////////////////////////////////////////////////////////////


function swapOverlay(id,numOverlays){
	
	for(var i = 1; i <= numOverlays; i++){
		if(id == i){
			document.getElementById('overlay'+i).style.display = "none";
		}else{
			document.getElementById('overlay'+i).style.display = "block";
		}
	}

}

////////////////////////////////////////////////////////////////////////////////////


function importXML(docName,section,subSection,contentID)
{
	if (document.implementation && document.implementation.createDocument){
	   xmlDoc= document.implementation.createDocument("","root",null);
		xmlDoc.onload = function () {
			getXMLData(section,subSection,contentID);
		}
		
	}
	else if (window.ActiveXObject){
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function () {
			if (xmlDoc.readyState == 4) {
				getXMLData(section,subSection,contentID);
			}
		}
 	}
	else{
		alert('Your browser can\'t handle this script');
		return;
	}
	xmlDoc.load("/xml/"+docName+".xml");

}

function getXMLData(section,subSection,contentID){
	var rootLevel = xmlDoc.getElementsByTagName('data');

	var topLevel = rootLevel[0].getElementsByTagName(section);
	var subLevel = topLevel[0].getElementsByTagName(subSection)[0];

	for (j=0;j<subLevel.childNodes.length;j++)
	{

		if (subLevel.childNodes[j].nodeType != 1) continue;

		var theData = subLevel.childNodes[j].firstChild.nodeValue;
	}
	document.getElementById(contentID).innerHTML = theData;
}


function topNavState(elemID){
	
	if(document.getElementById(elemID).className == "mainLinks"){
		document.getElementById(elemID).className = "mainLinksState";
	}else{
		document.getElementById(elemID).className = "mainLinks"
	}
}

function subNavState(elemID){
		
	if(document.getElementById(elemID).className == elemID){
		document.getElementById(elemID).className = document.getElementById(elemID).id+"State";
	}else{
		document.getElementById(elemID).className = elemID;
	}

}