//Top level functions

function updateDivHeight(whichHeight) {
	//trace("whichHeight: "+whichHeight);
	$('topNavFlash').setStyle({height: whichHeight + "px"});
}

function loadDetailPage (projId) {
	
	//use pageId to load appropriate work details page.
	if (projId != "" && projId != undefined) {
		var theURL = "work_detail.php?i=" + projId;//"http://www.savouryprojects.com/work_detail.html?i="+projId;
		//trace("theURL: "+theURL);
		if (theURL != location.href) {
			location.href = theURL;
		}
		else {
			return;
		}
	} else {
		return;
	}
}

function homeSlideChange(currentIndex,targetIndex){
	// identify elements to be moved using passed parameters
	var curSlide = $('slide0'+currentIndex);
	var tgtSlide = $('slide0'+targetIndex);
	if (tgtSlide.style.left != "-700px"){
		tgtSlide.setStyle("left:-700px");
	}

	// "outgoingX" x coordinate to move outgoing slide to 
	var outgoingX = -700;
	// "incomingX" - x coordinate to move incoming slide to
	var incomingX = 0;

	//var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	if (isIE) {
		//trace("no animation 'cause of transparent SWF issues");
		curSlide.style.left = outgoingX + "px";
		tgtSlide.style.left = incomingX + "px";
	} else {
		//move current slide out of view
		JSTweener.addTween(curSlide.style, {
						time: 0.5,
						transition: 'easeOutSine',
						left: outgoingX,
						suffix: {
							left: 'px'
						}
					});
	
		//bring in new slide			
		JSTweener.addTween(tgtSlide.style, {
						time: 0.5,
						transition: 'easeOutSine',
						left: incomingX,
						delay: 0.75,
						suffix: {
							left: 'px'
						}
					});
	}
}

