// JavaScript Document

function init(section) {
	MM_preloadImages('images/header_hover.png', 'images/home_hover.png', 'images/services_hover.png', 'images/portfolio_hover.png', 'images/contact_hover.png')
	MM_preloadImages('images/cg_hover.png','images/marlena_hover.png','images/millward_hover.png','images/franciscan_hover.png','images/proactideas_hover.png','images/cca_hover.png');  <!-- Do this here, instead of on body onload, so that it is only done when the services section is loaded -->
	changeBackground('short');
}

/* Dreamweaver functions */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


/* Generic hide/show functions */

function show(id) { 
	document.getElementById(id).style.display = "block";
} 

function hide(id) { 
	document.getElementById(id).style.display = "none";
} 

function hideAndShowMap(){
	document.getElementById("nav_map").style.display = "none";
	document.getElementById("nav_map").style.display = "block";
	
	}

/*****************************************************************
* Show a lifted version of the puzzle piece, when the mouse is 
* hovered over that puzzle piece.  Hide the lifted version when
* the mouse moves off of it.
*****************************************************************/

function showPiece(selected){
	//show the selected piece when the user hovers over that area of the imagemap
	//If the user is on the Home page, the header should not lift up when the
	//user mouses over it, since the header is used to take them home.
//	if (!(currentSection=='home' && selected=='header')){
		show(selected+'_hover');
//		}
	}

function hideAllPieces(){
	//hide all pieces when the mouse moves off the selected piece
	hide('home_hover');
	hide('services_hover');
	hide('portfolio_hover');
	hide('contact_hover');
	hide('header_hover');
	}

/*****************************************************************
* Change the section when the user clicks on a lifted puzzle piece.
* Show the dimmed version of the puzzle piece that goes with that
* section (this part happens on first load, as well, based on 
* whichever section is selected due to the URL).
*****************************************************************/

function changeSection(section){
	parent.location='index.php?file='+section;
	}

function showCurrentSectionPiece(section){
	show(section+'_selected');
	}
	
function changePageTitle(title){
	separator = ' ... '
	if ((title == null)||(title=='')){
		separator='';
	}
	document.title=title+separator+'Transformative Design ... Web Development';
	}
	
/*****************************************************************
* Show the description associated with a thumbnail.  Show the 
* unshadowed verion of the thumbnail when the user hovers over it.
*****************************************************************/

function showHover(selected){
	//show the description and the hoverimage when the user mouses over
	show(selected+'_hover');
	show(selected+'_description');
	hide(selected+'_normal');
}
	
function hideHover(selected){
	//hide the description and the hoverimage when the user mouses away
	show(selected+'_normal');
	hide(selected+'_hover');
	hide(selected+'_description');
	}


/*****************************************************************
* Change the background of the page, to accomodate longer text. 
*****************************************************************/

function changeBackground(length) { 
	if (length=="long"){
		document.getElementById('wrapper').style.height="850px";
	}
} 
