var storeExpandedDivId =''
var storeOuterDivId =''
			
  function expander(nameOfDivToExpand, expanOuter, expdivdimension, dimensionsOuter) {
	  if (nameOfDivToExpand == storeExpandedDivId) {
	    // close it and move on
	    
      jQuery("#" + storeExpandedDivId).animate({ height: "1"}, 500 );
      jQuery("#" + storeOuterDivId).animate({ height: "44"}, 500 );
      storeExpandedDivId = '';
      storeOuterDivId = '';

	  } else {
	    // expand it
	  //if statement to go here 
	    if (storeExpandedDivId !='' && storeOuterDivId !='') {
	      jQuery("#" + storeExpandedDivId).animate({ height: "1"}, 500 );
	      jQuery("#" + storeOuterDivId).animate({ height: "44"}, 500 );
	    }

    //$('div').animate({height : '500px', top : '+=500px'}, 2000);
    //jQuery("#" + nameOfDivToExpand).animate({ height : '500px', top : '500px'}, 1000 );
	  //  jQuery("#" + expanOuter).animate({ height : '530px', top : '530px'}, 1000 );
	    jQuery("#" + nameOfDivToExpand).animate({ height: expdivdimension}, 1000 );
	    jQuery("#" + expanOuter).animate({ height: dimensionsOuter}, 1000 );
   	
	    storeExpandedDivId = nameOfDivToExpand;
	    storeOuterDivId = expanOuter;
	  }

  }

  function closer() {
	  jQuery("#" + storeExpandedDivId).animate({ height: "1"}, 500 );
	  jQuery("#" + storeOuterDivId).animate({ height: "44"}, 500 );
	  storeExpandedDivId =''
	  storeOuterDivId =''
  }

	function question_show(theText) {
		document.getElementById('tooltip').innerHTML = theText;
		document.getElementById('tooltip').style.display = '';
	}
	
	function popupAppear(id) {
		document.getElementById(id + '_wrapper').style.display = '';
		if(document.getElementById(id + '_screen')) new Effect.Appear(document.getElementById(id + '_screen'), { duration: 0.3, to:0.6 });
		new Effect.BlindDown(document.getElementById(id), { duration: 0.6, delay: 0.3 });
	}
	
	function showWalkthrough_teams() {
		document.getElementById('see_how_it_works').innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="470" height="355" id="walkthrough_swf" align="middle">\
			<param name=\"allowScriptAccess\" value="sameDomain\" />\
			<param name=\"movie\" value=\"/includes/walkthrough_team.swf\" />\
			<param name=\"quality" value="high" />\
			<embed src=\"/includes/walkthrough_team.swf\" quality=\"high\" width=\"470\" height=\"355\" name=\"walkthrough_swf\" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\
			</object>\
			<div style=\"text-align:center; padding-top:10px\"><a href=\"#\" onClick=\"showWalkthrough_teams();\"><img src=\"/images/restart_button.gif\" width=\"70\" height=\"20\" border=\"0\"></a>&nbsp;&nbsp;&nbsp;<a href=\"#\" onClick=\"popupHide(\'see_how_it_works\');\"><img src=\"/images/close_button.gif\" width=\"70\" height=\"20\" border=\"0\"></a></div>';
	}
	
	function showWalkthrough_individuals() {
		document.getElementById('see_how_it_works').innerHTML = '<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"470\" height=\"355\" id="walkthrough_swf\" align=\"middle\">\
			<param name=\"allowScriptAccess\" value=\"sameDomain\" />\
			<param name=\"movie\" value=\"/includes/walkthrough_ind.swf\" />\
			<param name=\"quality" value="high" />\
			<embed src=\"/includes/walkthrough_ind.swf\" quality=\"high\" width=\"470\" height=\"355\" name=\"walkthrough_swf\" align=\"middle\" allowScriptAccess=\"sameDomain\" type="application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\
			</object>\
			<div style=\"text-align:center; padding-top:10px\"><a href=\"#\" onClick=\"showWalkthrough_individuals();\"><img src=\"/images/restart_button.gif" width="70" height="20" border="0"></a>&nbsp;&nbsp;&nbsp;<a href=\"#\" onClick="popupHide(\'see_how_it_works\');\"><img src="/images/close_button.gif\" width="70" height=\"20\" border=\"0\"></a></div>';
	}
	
//--- HIDE THE POPUP BY FADING IN THE BLACK SCREEN AND DROPPING THE BOX INTO VIEW
	function popupHide(id) {
		if(document.getElementById(id + '_screen')) new Effect.Fade(document.getElementById(id + '_screen'), { duration: 0.1, to:0 });
		document.getElementById(id).style.display = 'none';
		document.getElementById(id + '_wrapper').style.display = 'none';
	}

	var newImage, imageList, preloadCount;
	var preloadCount = 0;
	imageList = new Array();
	
	function addPreloadImage(url) {
		imageList[imageList.length] = url;
	}
	
	function startPreloading() { 
		newImage = new Image;
		newImage.src = imageList[0]
		setInterval('preloadCheck()', 1000);
	}
	
	function preloadCheck() {
		if (newImage.complete) {
			preloadCount += 1;
			if (!preloadCount >= imageList.length) {
				newImage.src = imageList[preloadCount];
				setInterval('preloadCheck()', 1000);
			}
		}
	}
	
	function imageSwap(key, url) {
		eval('document.' + key + '.src = \'' + url + '\'');
	}

	function swapSky(key, mouseOn) {
		if (!mouseOn) eval('document.' + key + '.src = \'/images/services/' + key + '.gif\'');
		else eval('document.' + key + '.src = \'/images/services/' + key + 'Light.gif\'');
	}

	function mailto(recipient) {
		document.location.href = 'mailto:' + recipient + '@exceptionalachievement.com?subject=Website Enquiry';
	}
	
	function goTo(url) {
		document.location.href = url;
	}

	function openWindow(url, width, height, sizeable) {
		if (sizeable==null) sizeable=true;
		if (sizeable) sizeable = ',resizable,scrollbars'
		else sizeable = '';
		if (!width) width=screen.availWidth*.8;
		if (!height) height=screen.availHeight*.8;

		var openWin = window.open(url,'_blank','width=' + width + ',height=' + height + ',screenX=' + ((screen.availWidth-width)/2) + ',left=' + ((screen.availWidth-width)/2) + ',screenY=' + ((screen.availHeight-height)/2) + ',top=' + ((screen.availHeight-height)/2) + sizeable);
//alert('url = ' + url);
		openWin.focus();
	}
	
//#-- VARIABLE TO TRACK IF CURRENT FORM FIELD IS A TEXT AREA - IF SO, microsoftKeyPress SHOULDN'T RUN
var textArea = false;
//#-- FUNCTION TO HANDLE KEYPRESSES IN IE BROWSERS
	function microsoftKeyPress()  {	
		if (!textArea) {
	  	  if (window.event.keyCode == 13) {
				submitForm();
				window.event.returnValue = false;
			}
		}
	}
	