function detailsWin(iFile,x,y) {
	var imagewindow=window.open(""+iFile+"","Details","width="+x+",height="+y+",menubar=no,toolbar=no,scrollbars=yes,resizable");
	imagewindow.resizeTo(x,y);
	imagewindow.focus();
}
function roll(state,imagename){ 
	document.images[imagename].src="/images/"+imagename+"_"+state+".gif"; 
}
function roll2(at,state,imagename){ 
	document.images[at].src="/images/"+imagename+"_"+state+".gif"; 
}
var isDHTML=0;
var isLayers=0;
var isAll=0;
var isID=0;
var currentPage = "";
var contactActive = false;
if(document.getElementById){
	isID=1;isDHTML=1;
}else{
	if(document.all){isAll=1;isDHTML=1;
	}else{
		browserVersion = parseInt(navigator.appVersion);
		if((navigator.appName.indexOf('Netscape')!=-1)&&(browserVersion==4)){isLayers=1;isDHTML=1;}
	}
}
function findDOM(objectID,withStyle){
	//alert('findDOM');
	if(withStyle==1){
		if(isID){return(document.getElementById(objectID).style);}
		else{if(isAll){return(document.all[objectID].style);}
		else{if(isLayers){return(document.layers[objectID]);}
		};}
	}else{
		if(isID){return(document.getElementById(objectID));}
		else{if(isAll){return(document.all[objectID]);}
		else{if(isLayers){return(document.layers[objectID]);}
		};}
	}
}

function checkContactOpenClose(){
	//alert('checkContactOpenClose ; ' + contactActive)
	if(contactActive){
		slideUpDown('contact','contactform','300','0');
		changeColor();
	}
}
function clearAllActiveNavs(p_currentNavItem){
	//alert('clearAllActiveNavs');
	//changeStyle(objectID,styleName,newValue)
	changeStyle('navHome','backgroundPosition','top');
	changeStyle('navAbout','backgroundPosition','top');
	changeStyle('navNews','backgroundPosition','top');
	changeStyle('navWork','backgroundPosition','top');
	changeStyle('navTechnology','backgroundPosition','top');
	changeStyle('navServices','backgroundPosition','top');
	changeStyle('navContact','backgroundPosition','top');
	
	setActiveNav(p_currentPage);
}

function setActiveNavItem(p_currentPage){
	changeStyle(p_currentPage,'backgroundPosition','bottom');	
}


function changeColor(p_currentPage){
	//alert('p_currentPage : ' + p_currentPage)
	if(!contactActive && p_currentPage != "undefined"){
	//	alert('currentPage : ' + currentPage)
		currentPage = p_currentPage;
		contactActive = true;
		document.getElementById("navContact").style.backgroundPosition = '0px -86px';
		document.getElementById("navHome").style.backgroundPosition = '0px 0px';
		document.getElementById("navAbout").style.backgroundPosition = '0px 0px';
		document.getElementById("navNews").style.backgroundPosition = '0px 0px';
		document.getElementById("navWork").style.backgroundPosition = '0px 0px';
		document.getElementById("navTechnology").style.backgroundPosition = '0px 0px';
		document.getElementById("navServices").style.backgroundPosition = '0px 0px';
	}else{
	//	alert('currentPage : ' + currentPage)
		document.getElementById("navContact").style.backgroundPosition = '0px 0px';
		if(currentPage == "Home"){
			document.getElementById("navHome").style.backgroundPosition = '0px -86px';
		}
		if(currentPage == "About"){
			document.getElementById("navAbout").style.backgroundPosition = '0px -86px';
		}
		if(currentPage == "News"){
			document.getElementById("navNews").style.backgroundPosition = '0px -86px';
		}
		if(currentPage == "Work"){
			document.getElementById("navWork").style.backgroundPosition = '0px -86px';
		}
		if(currentPage == "Technology"){
			document.getElementById("navTechnology").style.backgroundPosition = '0px -86px';
		}
		if(currentPage == "Services"){
			document.getElementById("navServices").style.backgroundPosition = '0px -86px';
		}
		currentPage = "";
		contactActive = false;
	}
	
}


function changeColor2(p_currentPage){
	//alert('p_currentPage : ' + p_currentPage)
	if(!contactActive && p_currentPage != "undefined"){
	//	alert('currentPage : ' + currentPage)
		currentPage = p_currentPage;
		contactActive = true;
		document.getElementById("navContact").style.backgroundPosition = 'bottom';
		document.getElementById("navHome").style.backgroundPosition = 'top';
		document.getElementById("navAbout").style.backgroundPosition = 'top';
		document.getElementById("navNews").style.backgroundPosition = 'top';
		document.getElementById("navWork").style.backgroundPosition = 'top';
		document.getElementById("navTechnology").style.backgroundPosition = 'top';
		document.getElementById("navServices").style.backgroundPosition = 'top';
	}else{
	//	alert('currentPage : ' + currentPage)
		document.getElementById("navContact").style.backgroundPosition = 'top';
		if(currentPage == "Home"){
			document.getElementById("navHome").style.backgroundPosition = 'bottom';
		}
		if(currentPage == "About"){
			document.getElementById("navAbout").style.backgroundPosition = 'bottom';
		}
		if(currentPage == "News"){
			document.getElementById("navNews").style.backgroundPosition = 'bottom';
		}
		if(currentPage == "Work"){
			document.getElementById("navWork").style.backgroundPosition = 'bottom';
		}
		if(currentPage == "Technology"){
			document.getElementById("navTechnology").style.backgroundPosition = 'bottom';
		}
		if(currentPage == "Services"){
			document.getElementById("navServices").style.backgroundPosition = 'bottom';
		}
		currentPage = "";
		contactActive = false;
	}
	
}

// function adjustFlashSize(p_currentPage){
// 	currentPage = p_currentPage;
// 	if(currentPage == "Home" || currentPage == "Work"){
// 		changeStyle('flashbox','height','100%');
// 		changeStyle('flashbox','height','auto !important');
// 		changeStyle('flashbox','min-height','700px');
// 	}	
// }

function adjustFooterDiv(w,h){
	
    screen_height = window.screen.availHeight;
    screen_width = window.screen.availWidth; 
//	alert('screen_width : ' + screen_width);
//	alert('screen_height : ' + screen_height);
	 if(screen_height >= 800){
	//	alert('screen_height : ' + screen_height);
		// changeStyle('footer2','bottom', screen_height-'60px');
		// changeStyle('footer2','bottom', '-120px');
		// 		changeStyle('footer2', 'margin-top', '10px');
		// 		changeStyle('footer2', 'margin-right', '0.01em');
		// 		changeStyle('footer2', 'overflow', 'hidden');
		// 		changeStyle('footer2', 'text-align', 'center');
		// 		changeStyle('footer2', 'width', '100%');
		// 		changeStyle('footer2', 'clear', 'both');
		// 		changeStyle('footer2', 'position', 'absolute');
	//	changeStyle('footer2','height','700px');
	}
	// //reset positions 
	// 	changeStyle('flashMovie','width', screen_width+'px');
	// 	changeStyle('flashMovie','left', '0px');
	// 	changeStyle('flashMovie','height', screen_height+'px');
	// 	if(position == 'top'){
	// 		changeStyle('flashMovie','top', '0px');
	// 	}else{
	// 		changeStyle('flashMovie','bottom', '-90px');
	// 	}
	// 	
	// 	//updating the divSize reference
	// 	divSize='big';
}


function changeStyle(objectID,styleName,newValue){
	//alert('changeStyle');
	var dom=findDOM(objectID,1);
	if(dom){dom[styleName]=newValue;}
}
function setClass(objectID,newClass){
	var dom=findDOM(objectID,0);
	if(dom){dom.className=newClass;}
}
function slideUpDown(objectID,nestedObjectID,clipHeight,currentHeight){
	var dom=findDOM(objectID,1);
	if(dom['height']==clipHeight+'px'){
		direction='close';
	}else{
		direction='open';
	}
	setClipBottom(objectID,nestedObjectID,clipHeight,currentHeight,direction);
}

function setClipBottom(objectID,nestedObjectID,clipHeight,currentHeight,direction){
	if(direction=='close'){
		var clipHeight=eval(clipHeight)-10;
		changeStyle(objectID,'height',clipHeight+'px');
		changeStyle(nestedObjectID,'clip','rect(auto auto '+clipHeight+'px auto)');
		if(currentHeight!=clipHeight){
			setTimeout('setClipBottom("'+objectID+'","'+nestedObjectID+'","'+clipHeight+'","'+currentHeight+'","'+direction+'")',10);
		}
	}else{
		var currentHeight=eval(currentHeight)+10;
		changeStyle(objectID,'height',currentHeight+'px');
		changeStyle(nestedObjectID,'clip','rect(auto auto '+currentHeight+'px auto)');
		if(currentHeight<clipHeight){
			setTimeout('setClipBottom("'+objectID+'","'+nestedObjectID+'","'+clipHeight+'","'+currentHeight+'","'+direction+'")',10);
		}
	}
}
function pageQuickSlide(objectID,clipHeight,currentHeight,currentAlpha,techID,techTitle){
	var currentHeight=eval(currentHeight)-2;
	changeStyle(objectID,'height',currentHeight+'px');
	 if(currentAlpha > 0){
	 	var currentAlpha = eval(currentAlpha) - .2;
	 	changeStyle('content', 'opacity', currentAlpha);
	 }
	
	if(currentHeight> -2){
		setTimeout('pageQuickSlide("'+objectID+'","'+clipHeight+'","'+currentHeight+'","'+currentAlpha+'","'+techID+'","'+techTitle+'")',15);
	}else if(currentHeight <= 0 && techID != null && techTitle != null){
		
		//changeStyle('flashbar','height','700px');
		changeStyle('flashbar','background','#fff');
		changeStyle('content','display','none');
		changeStyle('content','opacity',1);
		changeStyle('flashbox','height','700px');
		changeStyle('flashbox','min-height','700px');
		// //var flashWindowHeight = window.screen.availHeight - 200;
		// //changeStyle('flashbox','height',''+flashWindowHeight+'px');
		if(techTitle != 'PROJECT_TYPE'){
			var techData = 'technologyID=' + techID + ',technologyType=' + techTitle;
		  	//thisMovie("fasv5").externalInterfaceCallback('WORK_ASSOCIATED_TECHNOLOGY', techData);
			window.location = '/work_technology_'+techTitle;
		}else{
			var projectTypeData = 'projectTypeID=' + techID + ',projectType=' + techTitle;
			//alert('WORK_PROJECT_TYPE'+techID);
		  	//thisMovie("fasv5").externalInterfaceCallback('WORK_PROJECT_TYPE', projectTypeData);
			window.location = '/work_service_'+techID;
		}
	  	
	}else{
		//changeStyle('flashbar','height','700px');
		changeStyle('flashbar','background','#fff');
		changeStyle('content','display','none');
		changeStyle('content','opacity',1);
		changeStyle('flashbox','height','700px');
		changeStyle('flashbox','min-height','700px');
		// //var flashWindowHeight = window.screen.availHeight - 200;
		// //changeStyle('flashbox','height',''+flashWindowHeight+'px');
	  	var techData = 'technologyID=' + techID + ',technologyType=' + techTitle;
	  	thisMovie("fasv5").externalInterfaceCallback('WORK');
	}
	
}
function hideWorkContent(objectID,clipHeight,currentHeight,currentAlpha,projectID,projectTitle,featuredSWF,projectColor)
{
	var currentHeight=eval(currentHeight)-2;
	changeStyle(objectID,'height',currentHeight+'px');
	 if(currentAlpha > 0){
	 	var currentAlpha = eval(currentAlpha) - .2;
	 	changeStyle('content', 'opacity', currentAlpha);
	 }
	if(currentHeight> -2){
		setTimeout('hideWorkContent("'+objectID+'","'+clipHeight+'","'+currentHeight+'","'+currentAlpha+'","'+projectID+'","'+projectTitle+'","'+featuredSWF+'","'+projectColor+'")',15);
	}else{
		changeStyle('flashbar','background','#fff');
		changeStyle('content','display','none');
		changeStyle('content','opacity',1);
		changeStyle('flashbox','height','700px');		
		var projectData = 'projectID=' + projectID + ',projectTitle=' + projectTitle + ',featuredSWF=' + featuredSWF + ',projectColor=' + projectColor;
		thisMovie("fasv5").externalInterfaceCallback('WORK_FEATURED_PROJECT', projectData);
	}
}

function returnToBrowingContentSlider(objectID,clipHeight,currentHeight,currentAlpha){
	var currentHeight=eval(currentHeight)-2;
	changeStyle(objectID,'height',currentHeight+'px');
	 if(currentAlpha > 0){
	 		var currentAlpha = eval(currentAlpha) - .2;
	 		changeStyle('content', 'opacity', currentAlpha);
	 	}
	
	if(currentHeight> -2){
		setTimeout('returnToBrowingContentSlider("'+objectID+'","'+clipHeight+'","'+currentHeight+'","'+currentAlpha+'")',15);
	}else {
		window.location = '/work';
	}
}

// alternative form functionality
function submit_form(inURL)
{
	if(check_values())
	{	
		document.contact.formSubmitReal.value = "true";
		document.contact.submit();
		return true;
	}
}

function check_values()
{
	var errBlankFound = false;
	var errBlankText = "";
	errBlankText = "You must complete the following fields before you can submit this form:\n\n"; 
	// test blank fields

	if (document.contact.userName.value == "")
	{
		errBlankFound = true;
		errBlankText += "    Name\n";
	}
	if (document.contact.userEmail.value == "")
	{
		errBlankFound = true;
		errBlankText += "    E-mail\n";
	}
	if (errBlankFound == true)
	{
		alert(errBlankText);
		return false;
	}
	return true;
}

// function contactSubmit(){
// 	//alert('contactSubmit')
// 	if(document.contact.name.value=='') { 
// 		alert('Some required information was missing from the form.\n\nPlease include your Name.');
// 	//	document.contact.name.focus();
// 		return false;
// 	}
// 	if(document.contact.email.value=='') { 
// 		alert('Some required information was missing from the form.\n\nPlease include your Email Address.');
// 		document.contact.email.focus();
// 		return false;
// 	}
// 	AtPos=document.contact.email.value.indexOf("@");
// 	StopPos=document.contact.email.value.lastIndexOf(".");
// 	if (AtPos==-1 || StopPos==-1){
// 		alert('Some required information was incorectly entered into the form.\n\nPlease verify your Email Address.');
// 		document.contact.email.focus();
// 		return false;
// 	}
// 	if(StopPos<AtPos){
// 		alert('Some required information was incorectly entered into the form.\n\nPlease verify your Email Address.');
// 		document.contact.email.focus();
// 		return false;
// 	}
// 	if(StopPos-AtPos==2){
// 		alert('Some required information was incorectly entered into the form.\n\nPlease verify your Email Address.');
// 		document.contact.email.focus();
// 		return false;
// 	}
// 	if(AtPos==0 || StopPos==0){
// 		alert('Some required information was incorectly entered into the form.\n\nPlease verify your Email Address.');
// 		document.contact.email.focus();
// 		return false;
// 	}
// 	if(StopPos==document.contact.email.value.length-1){
// 		alert('Some required information was incorectly entered into the form.\n\nPlease verify your Email Address.');
// 		document.contact.email.focus();
// 		return false;
// 	}
// 	if(document.contact.image.value=='') { 
// 		alert('Some required information was missing from the form.\n\nPlease type in the Image Verification.');
// 		document.contact.image.focus();
// 		return false;
// 	}else{
// 		alert('sending..')
// 		document.contact.submit();
// 		return true;
// 	}
// 	
// }
// Sneaky Email Function
function sef(domain,name){
	parent.location='m'+'ai'+'lto:'+name+'@'+domain;
}
function delay(r,g,b,element) {
	setTimeout("fadetext("+r+","+g+","+b+",'"+element+"'),2000");
}
function fadetext(r,g,b,element){
var rdone=false;
var bdone=false;
var gdone=false;
if(g<198){g+=2;}else{g=198;gdone=true;
	if(b>63){b-=2}else{b=63;bdone=true;
		if(r<141){r+=2;}else{r=141;rdone=true;}
	}
}
	document.getElementById(element).style.borderColor="rgb("+r+","+g+","+b+")";
	document.getElementById(element).style.color="rgb("+r+","+g+","+b+")";
	if(rdone==true && bdone==true && gdone==true){
		return;
	}else{
		setTimeout("fadetext("+r+","+g+","+b+",'"+element+"'),500");
	}
}
function createCookie(name,value,days){
	if(days){
		var date=new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires="; expires="+date.toGMTString();
	}
	else var expires="";
	document.cookie=name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ=name + "=";
	var ca=document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c=ca[i];
		while(c.charAt(0)==' ') c=c.substring(1,c.length);
		if(c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name) {
	createCookie(name,"",-1);
}

// FUNCTIONS FOR FLASH INTERACTIVITY


function thisMovie(movieName){
	if(navigator.appName.indexOf("Microsoft")!=-1){
		return window[movieName];
	}else{
		return document[movieName];
	}
}

// I LIKE MY FIND DOM BETTER
function thisMovie2(movieName){
	return findDOM(movieName,0);
}
function showFeaturedProject(projectID,projectTitle,featuredSWF,projectColor){
	if(!isIE){
		checkContactOpenClose();
		hideWorkContent('flashbox',0,35,1,projectID,projectTitle,featuredSWF,projectColor);
	}else{
		changeStyle('flashbar','background','#fff');
		changeStyle('flashbar','height','700px');
		changeStyle('content','display','none');
	 	changeStyle('flashbox','height','700px');
	 	changeStyle('flashbox','display','block');
		var projectData = 'projectID=' + projectID + ',projectTitle=' + projectTitle + ',featuredSWF=' + featuredSWF + ',projectColor=' + projectColor;
		thisMovie("fasv5").externalInterfaceCallback('WORK_FEATURED_PROJECT', projectData);
	}
	//
	// slideUpDown('contact','contactform','300','0');
	 //changeColor();
	 
//	hideWorkContent('flashbox',0,35,1,projectID,projectTitle,featuredSWF,projectColor);
	
}
function showFeaturedProject2(projectID,projectTitle,featuredSWF,projectColor){
	checkContactOpenClose();
	// slideUpDown('contact','contactform','300','0');
	 //changeColor();
	 //changeStyle('flashbar','background','#fff');
	// 	changeStyle('content','display','none');
	// 	changeStyle('flashbox','height','700px');
	hideWorkContent('flashbox',0,35,1,projectID,projectTitle,featuredSWF,projectColor);
	//var projectData = 'projectID=' + projectID + ',projectTitle=' + projectTitle + ',featuredSWF=' + featuredSWF + ',projectColor=' + projectColor;
	//thisMovie("fasv5").externalInterfaceCallback('WORK_FEATURED_PROJECT', projectData);
}
function hideFeaturedProject(flashbarColor){
	changeStyle('flashbar','background','#'+flashbarColor);
	if(isIE){
		changeStyle('flashbar','height','35px');
	}
	changeStyle('content','display','block');
	changeStyle('flashbox','height','35px');
}
function showTechnologies(techID,techTitle){
	//alert(isIE);
	if(!isIE){
		checkContactOpenClose();
		pageQuickSlide('flashbox',0,35,1,techID,techTitle);
	 }else{
	 		//changeStyle('flashbar','background','#fff');
	 		//changeStyle('content','display','none');
	 		//changeStyle('flashbox','height','700px');
			window.location = '/work_technology_'+techTitle;
	 	}
	
	// changeStyle('flashbar','background','#fff');
	// changeStyle('content','display','none');
	// changeStyle('flashbox','height','700px');
	//	// //var flashWindowHeight = window.screen.availHeight - 200; 
	//	// //changeStyle('flashbox','height',''+flashWindowHeight+'px');
	// var techData = 'technologyID=' + techID + ',technologyType=' + techTitle;
	// thisMovie("fasv5").externalInterfaceCallback('WORK_ASSOCIATED_TECHNOLOGY', techData);
}
function hideTechnologies(flashbarColor){
	changeStyle('flashbar','background','#'+flashbarColor);
	changeStyle('content','display','block');
	changeStyle('flashbox','height','35px');
}

function showProjectType(projectTypeTitle){
	if(!isIE){
		checkContactOpenClose();
		pageQuickSlide('flashbox',0,35,1,projectTypeTitle,'PROJECT_TYPE');
	 }else{
	 		//changeStyle('flashbar','background','#fff');
	 		//changeStyle('content','display','none');
	 		//changeStyle('flashbox','height','700px');
			window.location = '/work_service_'+projectTypeTitle;
	 	}
   //checkContactOpenClose();
   ////alert(projectTypeID);
   //pageQuickSlide('flashbox',0,35,1,projectTypeTitle,'PROJECT_TYPE');
	// changeStyle('flashbar','background','#fff');
	// changeStyle('content','display','none');
	// changeStyle('flashbox','height','700px');
	//	// //var flashWindowHeight = window.screen.availHeight - 200; 
	//	// //changeStyle('flashbox','height',''+flashWindowHeight+'px');
	// var techData = 'technologyID=' + techID + ',technologyType=' + techTitle;
	// thisMovie("fasv5").externalInterfaceCallback('WORK_ASSOCIATED_TECHNOLOGY', techData);
}

function showHome(){
	//alert("showHome");
	//changeStyle('flashbar','background','#000');
	//changeStyle('flashbar','background','#231F20');
	//changeStyle('flashbar','background','#141213');
	changeStyle('flashbar','background','#ffffff');
	changeStyle('flashbar','height','700px');
	changeStyle('content','display','none');
	changeStyle('flashbox','height','700px');
	changeStyle('flashbox','display','block');
}

function showWork(){
	//changeStyle('flashbar','background','#000');
	//changeStyle('flashbar','background','#231F20');
	changeStyle('flashbar','background','#141213');
	changeStyle('content','display','none');
	changeStyle('flashbox','height','700px');
	
	pageQuickSlide('flashbox',0,35,1,null,null);
}
function returnToBrowsing(){
	if(!isIE){
		returnToBrowingContentSlider('flashbox',0,35,1,null,null);
	}else{
		window.location = '/work';
	}
	
}

function adjustContentHeight(p_newHeight){
	//alert(p_newHeight);
	// if(isIE){
	// 	alert(isIE);
	// }
	//changeStyle('content','display','block');
	changeStyle('flashbox','height',''+p_newHeight+'px');
	changeStyle('flashbox','display','block');
}