// JavaScript Document	
function isWrongLength(strng,checkWhich) {
	var error = "";
	if (strng.length < 6) {
		error = "The password must at least 6 characters.\n"
	}
	if (strng.length > 12) {
		error = "The password must be no longer than 12 characters.\n"
	}
	return error;	  
}
function isInvalidEmail(str,checkWhich) {
	var error = "";
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		error = "Please enter a valid "+checkWhich+".\n"
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		error = "Please enter a valid "+checkWhich+".\n"
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		error = "Please enter a valid "+checkWhich+".\n"
	}
	 if (str.indexOf(at,(lat+1))!=-1){
		error = "Please enter a valid "+checkWhich+".\n"
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		error = "Please enter a valid "+checkWhich+".\n"
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
		error = "Please enter a valid "+checkWhich+".\n"
	 }	
	 if (str.indexOf(" ")!=-1){
		error = "Please enter a valid "+checkWhich+".\n"
	 }
	return error;	  
}	
function checkWholeForm(theForm) {
	//syedit
	currentFormBeingUsed=theForm.name;
	//
	var why = "";
	why += isInvalidEmail(theForm.userNameValue.value, "email address");
	why += isWrongLength(theForm.passwordValue.value, "'Password'");
	if (why != "") {
	   alert(why);
	   return false;
	}
return true;
}
function OpenObject(type,value){
	var features="status=1,scrollbars=1";
  	var windowName="objectViewer"; 
	var width=666;
	var height=509;
	_popup = window.open(type+".htm?objectValue="+value+"|access="+access, windowName,"width=" + width + ",height=" + height+","+features);
        if (window.focus){
                popupTimer=setTimeout("_popup.focus()",250);
                _popup.resizeTo(width,height);      
        }	
  	return _popup
}

function OpenObjectPhp(page,value){
	var features="status=1,scrollbars=1";
  	var windowName="leadership_log"; 
	var width=666;
	var height=509;
	_popup = window.open(page+"&objectValue="+value+"|access="+access, windowName,"width=" + width + ",height=" + height+","+features);
        if (window.focus){
                popupTimer=setTimeout("_popup.focus()",250);
                _popup.resizeTo(width,height);      
        }	
  	return _popup
}

function CreateComponentList() {
	pageComponentsArray=pageInfoArray[page-1].split("|");
	componentListArray=new Array();
	for (var i=1;i<pageComponentsArray.length;i++) {
		var componentMatchFlag=0;
		for (var j=0;j<componentListArray.length;j++) {
			if (pageComponentsArray[i]==componentListArray[j]) {
				componentMatchFlag=1;
			}
		}
		if (componentMatchFlag==0) {
			componentListArray[componentListArray.length]=pageComponentsArray[i];
		}
	}
	for (var i=0;i<componentListArray.length;i++) {
		componentType=componentListArray[i];
		this[componentType+"Index"]=0;
		document.write('<script src="generic/tmplts/'+componentListArray[i]+'.js" language="JavaScript"><\/script>');
	}
}
function CosmoQuizGotoCasestudy(){
	//document.location="casestudy.htm?casestudy=" + casestudy + "|page=" +(parseInt(page)+1)+ "|access="+access;
}
function SendToLog(source,score){
	// cosmo quiz sends source="cosmo" & score;
}

function RenderComponentTable() {
	document.write('<table width="548" border="0" cellspacing="0" cellpadding="0">');
	componentInstanceIndex=0;
	for (var i=1;i<pageComponentsArray.length;i++) {
		document.write('<tr><td>');
		componentType=pageComponentsArray[i];
		previousComponentType=pageComponentsArray[i-1];
		componentInstanceIndex=this[componentType+"Index"];
		if(debug){
			document.write('RenderComponentTable:<br>');
			document.write('...componentType: '+componentType+'<br>');
			document.write('...componentInstanceIndex: '+componentInstanceIndex+'<br>');
			document.write('...i: '+i+'<br>');
			document.write('...pageComponentsArray[i]: '+pageComponentsArray[i]+'<br>');
			document.write('...Function call: '+pageComponentsArray[i]+'('+i+','+componentInstanceIndex+')<br>');
		}
		eval(pageComponentsArray[i])(i,componentInstanceIndex);
		this[componentType+"Index"]+=1;
		document.write('</td></tr>');
		//var listOfFlashInteractions="fruit mcpix slider mctxt clicksel";
		//if(listOfFlashInteractions.indexOf(previousComponentType)==-1){
			document.write('<tr height="20"><td>&nbsp;</td></tr>');
		//} else {
			//document.write('<tr height="20"><td>************</td></tr>');
		//}
	}
	document.write('</table>');
}
function EmbedFlash(movieName,movieID,XMLfile,xSize,ySize,col1,col2,col3) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+xSize+'" height="'+ySize+'" id="'+movieName+'">');
	document.write('<param name="movie" value="generic/tmplts/'+movieName+'.swf">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="swliveconnect" value="true">');
	document.write('<param name="FlashVars" value="XMLfile='+XMLfile+'&col1='+col1+'&col2='+col2+'&col3='+col3+'&caseStudy='+casestudy+'&thePageNumber='+page+'&documentLocation='+document.location+'"/>');
	document.write('<embed src="generic/tmplts/'+movieName+'.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+xSize+'" height="'+ySize+'" FlashVars="XMLfile='+XMLfile+'&col1='+col1+'&col2='+col2+'&col3='+col3+'&caseStudy='+casestudy+'&thePageNumber='+page+'&documentLocation='+document.location+'" swLiveConnect="true"');
	document.write('</embed>');
	document.write('</object>');
}

function RenderTopNav() {
	document.write('  <table width="800" border="0" cellpadding="0" cellspacing="0">');
	document.write('    <tr align="center" valign="middle">');
	document.write('      <td width="90" height="32"><a href="index2.htm?access='+access+'" class="topnavlink">Home</a></td>');
	document.write('      <td width="90"><a href="javascript:OpenObject(\'glossary\',\'\');void 0;" class="topnavlink">Glossary</a>');
	document.write('      <td width="90"><a href="javascript:OpenObject(\'timeline\');void 0;" class="topnavlink">Timeline</a>');
	document.write('      <td width="90"><a href="teachers.htm?casestudy=5|page=1|access='+access+'" class="topnavlink">Teachers</a></td>');
	document.write('      <td width="90"><a href="javascript:OpenObject(\'links\');void 0;" class="topnavlink">Links</a></td>');
	document.write('      <td><a href="javascript:ToggleAccessibility();void 0;" class="topnavlink">'+accessibleToggleText+'</a></td>');
	
	document.write('      <td><a href="javascript:OpenObjectPhp(\'log_page.php?note=tips&id=CS'+casestudy+'&num='+page+'\');void 0;" class="topnavlink">Leadership log</a></td>');
																 
	document.write('      <td><a href="javascript:OpenObject(\'help\',\'\');void 0;" class="topnavlink">Help &amp; legal</a></td>');
	document.write('    </tr>');
	document.write('  </table>');
}
function RenderTopBar() {
	if (casestudy==1) {
		document.write('<table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#F50103">');
		document.write('  <tr><td height="15" colspan="4">&nbsp;</td></tr>');
		document.write('  <tr align="left" valign="top">');
		document.write('  	<td height="123" width="41" rowspan="2">&nbsp;</td>');
		document.write('    <td width="526" rowspan="2" valign="bottom"><img src="generic/images/nmm_title_cs1.gif" alt="Case Study 1: Building and managing a team" width="526" height="123"></td>');		
		document.write('    <td width="190" height="82" align="right" valign="top">');		
		document.write('    <a href="http://www.nmm.ac.uk/" target="_blank">');		
		document.write('	<img src="generic/images/nmm_cs1.gif" alt="National Maritime Museum logo" width="135" height="59" border="0"></a>');
		document.write('	<br><a href="http://www.rog.nmm.ac.uk/" target="_blank">');
		document.write('	<img src="generic/images/observatory_cs1.gif" alt="Royal Observatory, Greenwich logo" width="135" height="13" border="0"></a></td>');					   
		document.write('    <td width="36" rowspan="2">&nbsp;</td> ');   
		document.write('  </tr>');
		document.write('  <tr align="left" valign="top">');
		document.write('    <td height="41" align="right" class="whitetext"><img src="generic/images/cs1.gif" alt="Case study 1" width="27" height="27"></td>');
		document.write('  </tr>');
		document.write('</table>');
	} else if (casestudy==2) {
		document.write('<table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#00AEEF">');
		document.write('  <tr height="15"><td colspan="4">&nbsp;</td></tr>');
		document.write('  <tr align="left" valign="top">');
		document.write('  	<td height="123" width="41" rowspan="2">&nbsp;</td>');
		document.write('    <td width="526" rowspan="2" valign="bottom"><img src="generic/images/nmm_title_cs2.gif" alt="Case Study 2: Battle plans and breifings" width="526" height="123"></td>');
		document.write('    <td width="190" height="82" align="right" valign="top">');
		document.write('    <a href="http://www.nmm.ac.uk/" target="_blank">');
		document.write('	<img src="generic/images/nmm_cs2.gif" alt="National Maritime Museum logo" width="135" height="59" border="0"></a>');
		document.write('	<br><a href="http://www.rog.nmm.ac.uk/" target="_blank">');
		document.write('	<img src="generic/images/observatory_cs2.gif" alt="Royal Observatory, Greenwich logo" width="135" height="13" border="0"></a></td>');
		document.write('    <td width="36" rowspan="2">&nbsp;</td> ');   
		document.write('  </tr>');
		document.write('  <tr align="left" valign="top">');
		document.write('    <td height="41"align="right" class="whitetext"><img src="generic/images/cs2.gif" alt="Case study 2" width="27" height="27"></td>');
		document.write('  </tr>');
		document.write('</table>');
	} else if (casestudy==3) {
		document.write('<table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFC61E">');
		document.write('  <tr><td height="15" colspan="4">&nbsp;</td></tr>');
		document.write('  <tr align="left" valign="top">');
		document.write('  	<td height="123" width="41" rowspan="2">&nbsp;</td>');
		document.write('    <td width="526" rowspan="2" valign="bottom"><img src="generic/images/nmm_title_cs3.gif" alt="Case Study 3: Morale building and leading through crisis" width="526" height="123"></td>');
		document.write('    <td width="190" height="82" align="right" valign="top">');
		document.write('    <a href="http://www.nmm.ac.uk/" target="_blank">');
		document.write('	<img src="generic/images/nmm_cs3.gif" alt="National Maritime Museum logo" width="135" height="59" border="0"></a>');
		document.write('	<br><a href="http://www.rog.nmm.ac.uk/" target="_blank">');
		document.write('	<img src="generic/images/observatory_cs3.gif" alt="Royal Observatory, Greenwich logo" width="135" height="13" border="0"></a></td>');
		document.write('    <td width="36" rowspan="2">&nbsp;</td> ');   
		document.write('  </tr>');
		document.write('  <tr align="left" valign="top">');
		document.write('    <td height="41" align="right" class="whitetext"><img src="generic/images/cs3.gif" alt="Case study 3" width="27" height="27"></td>');
		document.write('  </tr>');
		document.write('</table>');
	} else if (casestudy==4) {
		document.write('<table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#14213D">');
		document.write('  <tr><td height="15" colspan="4">&nbsp;</td></tr>');
		document.write('  <tr align="left" valign="top">');
		document.write('  	<td height="123" width="41" rowspan="2">&nbsp;</td>');
		document.write('    <td width="526" rowspan="2" valign="bottom"><img src="generic/images/nmm_title_cs4.gif" alt="Case Study 4: Immortal memory" width="526" height="123"></td>');
		document.write('    <td width="190" height="82" align="right" valign="top">');
		document.write('    <a href="http://www.nmm.ac.uk/" target="_blank">');
		document.write('	<img src="generic/images/nmm_cs4.gif" alt="National Maritime Museum logo" width="135" height="59" border="0"></a>');
		document.write('	<br><a href="http://www.rog.nmm.ac.uk/" target="_blank">');
		document.write('	<img src="generic/images/observatory_cs4.gif" alt="Royal Observatory, Greenwich logo" width="135" height="13" border="0"></a></td>');
		document.write('    <td width="36" rowspan="2">&nbsp;</td> ');   
		document.write('  </tr>');
		document.write('  <tr align="left" valign="top">');
		document.write('    <td height="41" align="right" class="whitetext"><img src="generic/images/cs4.gif" alt="Case study 4" width="27" height="27"></td>');
		document.write('  </tr>');
		document.write('</table>');
	}
}
function RenderSideNav() {
	if (casestudy!=5) {
	document.write('  <table width="178" height="70%" border="0" cellpadding="0" cellspacing="0">');
	document.write('    <tr align="center" valign="top">');
	document.write('      <td height="28" colspan="2" class="topsidenav">&nbsp;</td></tr>');
	document.write('    <tr align="center" valign="top" bgcolor="#BDBDBD">');
	document.write('      <td height="100%">');
	document.write('  <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#BDBDBD">');
	document.write('    <tr align="center" valign="top">');
	document.write('      <td height="100%">&nbsp;</td>');
	document.write('      <td>');
	document.write('	  <table width="130" border="0" cellspacing="0" cellpadding="0" bgcolor="#BDBDBD">');
	document.write('        <tr align="left" valign="top">');
	document.write('          <td height="30"><a href="index2.htm?access='+access+'" class="casestudysectionlink">Home</a></td>');
	document.write('        </tr>');
	document.write('        <tr align="left" valign="top">');
	document.write('          <td height="30"><a href="overview.htm?access='+access+'" class="casestudysectionlink">Overview</a></td>');
	document.write('        </tr>');
	for (j=1;j<=4;j++) {
		document.write('		<tr align="left" valign="top">');
		document.write('          <td height="30"><a href="casestudy.htm?casestudy='+j+'|page=1|access='+access+'" class="casestudysectionlink">Case study '+j+'</a></td>');
		document.write('        </tr>');
		if (j==casestudy) {
			//
			document.write('        <tr>');	
			document.write('          <td align="right" valign="top">');
			document.write('		  	<table width="110" cellspacing="0" cellpadding="5" border="0">');
				for (i=0;i<pageInfoArray.length;i++) {
					pageItemArray=pageInfoArray[i].split("|");
					document.write('        		<tr align="left" valign="top">');
					if ((i+1)==page) {
						document.write('					<td height="22" align="left" valign="top"><div class="casestudysectionlinkvisited">'+pageItemArray[0]+'</div></td>');
					} else {
						document.write('					<td height="22" align="left" valign="top"><a href="casestudy.htm?casestudy='+j+'|page='+(i+1)+'|access='+access+'" class="casestudysectionlink">'+pageItemArray[0]+'</a></td>');
					}			
					document.write('				</tr>');
				}
			document.write('				<tr>');
			document.write('				  <td height="8" align="left" valign="top">');
			document.write('				</td></tr>');
			document.write('			</table>');
			document.write('			</td>');
			document.write('		</tr>');		
		}
	}
	document.write('		</table>');  
	document.write('      </td>');
	document.write('    </tr>')
	document.write('  </table>');
	document.write('</td></tr>');
	document.write('    <tr align="left" valign="bottom">');
	document.write('      <td height="28" colspan="2" class="bottsidenav">&nbsp;</td>');
	document.write('    </tr></table>');
	} else {
	document.write('  <table width="178" height="70%" border="0" cellpadding="0" cellspacing="0">');
	document.write('    <tr align="center" valign="top">');
	document.write('      <td height="28" colspan="2" class="topsidenav">&nbsp;</td></tr>');
	document.write('    <tr align="center" valign="top" bgcolor="#BDBDBD">');
	document.write('      <td height="100%">');
	document.write('  <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#BDBDBD">');
	document.write('    <tr align="center" valign="top">');
	document.write('      <td height="100%">&nbsp;</td>');
	document.write('      <td>');
	
	document.write('	  <table width="140" border="0" cellspacing="0" cellpadding="0" bgcolor="#BDBDBD">');	
	document.write('		<tr align="left" valign="top">');				
	document.write('          <td height="30"><a href="index2.htm?access='+access+'" class="casestudysectionlink">Home</a></td>');
	document.write('				</tr>');	
	document.write('		<tr align="left" valign="top">');				
	document.write('          <td height="30"><a href="teachers.htm?casestudy=5|page=1|access='+access+'" class="casestudysectionlink">Introduction</a></td>');
	document.write('				</tr>');	
	document.write('		<tr align="left" valign="top">');
	document.write('          <td height="30"><a href="teachers.htm?casestudy=5|page=2|access='+access+'" class="casestudysectionlink">How to use the site</a></td>');
	document.write('        </tr>');
	document.write('		<tr align="left" valign="top">');
	document.write('          <td height="30"><a href="teachers.htm?casestudy=5|page=3|access='+access+'" class="casestudysectionlink">Lesson plans</a></td>');
	document.write('        </tr>');
	document.write('		<tr align="left" valign="top">');
	document.write('          <td height="30"><a href="teachers.htm?casestudy=5|page=4|access='+access+'" class="casestudysectionlink">Image bank</a></td>');
	document.write('        </tr>');
	document.write('		</table>');  
	document.write('      </td>');
	document.write('    </tr>')
	document.write('  </table>');
	document.write('</td></tr>');
	document.write('    <tr align="left" valign="bottom">');
	document.write('      <td height="28" colspan="2" class="bottsidenav">&nbsp;</td>');
	document.write('    </tr></table>');
	}
}

function RenderBottomNav() {
	document.write('  <table width="750" height="45" border="0" cellpadding="0" cellspacing="0">');
	/*
	document.write('    <tr>');
	document.write('      <td width="200">&nbsp;</td>');	
	if (page<pageInfoArray.length) {
		document.write('      <td width="550" align="right" valign="top"><a href="casestudy.htm?casestudy='+casestudy+'|page='+(parseInt(page)+1)+'|access='+access+'">');
		document.write('      <img src="generic/images/next_button.gif" alt="Next button" width="93" height="37" border="0">');
		document.write('	  </a></td>');
	} 	
	document.write('    </tr>');
	*/
	if (page!=2) {
	document.write('    <tr>');
	document.write('      <td width="200">&nbsp;</td>');
	var myCurrentLocation=document.location.toString();
	document.write('      <td width="550" align="center" valign="top"><a href="'+myCurrentLocation+'" class="topnavlink">Return to the top</a></td>');
	document.write('    </tr>');	
	} else {
	document.write('    <tr>');
	document.write('      <td width="200">&nbsp;</td>');
	document.write('      <td width="550" align="center" valign="top">&nbsp;</td>');
	document.write('    </tr>');
	}
	document.write('  </table>');
	document.write('<br>');
	/*
	document.write('  <table width="780" height="32"  border="0" cellpadding="0" cellspacing="0">');
	document.write('    <tr align="center" valign="middle">');
	document.write('      <td width="95">');
	document.write('      <a href="javascript:OpenObject(\'glossary\',\'\');void 0;" class="topnavlink">Glossary</a></td>');
	document.write('      <td><a href="#" class="topnavlink">Teachers’ resources</a></td>');
	document.write('      <td><a href="javascript:OpenObject(\'links\');void 0;" class="topnavlink">Useful links</a></td>');
	document.write('      <td><a href="javascript:ToggleAccessibility();void 0;" class="topnavlink">'+accessibleToggleText+'</a></td>');
	document.write('      <td><a href="javascript:OpenObject(\'leadershiplog\',\'quiz\');void 0;" class="topnavlink">Leadership log</a></td>');
	document.write('      <td width="95"><a href="javascript:OpenObject(\'help\',\'\');void 0;" class="topnavlink">Help</a></td>');
	document.write('    </tr>');
	document.write('  </table>');
	*/
}

function RenderTeachersBottomNav() {
	document.write('  <table width="750" height="45" border="0" cellpadding="0" cellspacing="0">');
	if (page!=1) {
	document.write('    <tr>');
	document.write('      <td width="200">&nbsp;</td>');
	var myCurrentLocation=document.location.toString();
	document.write('      <td width="550" align="center" valign="top"><a href="'+myCurrentLocation+'" class="topnavlink">Return to the top</a></td>');
	document.write('    </tr>');	
	} else {
	document.write('    <tr>');
	document.write('      <td width="200">&nbsp;</td>');
	document.write('      <td width="550" align="center" valign="top">&nbsp;</td>');
	document.write('    </tr>');
	}
	document.write('  </table>');
	document.write('<br>');
}

function RenderIndexBottomNav() {
	document.write('  <table width="760" border="0" cellpadding="0" cellspacing="0">');
	document.write('    <tr align="center" valign="top">');
	document.write('     <td width="90" height="32"><a href="javascript:OpenObject(\'glossary\',\'\');void 0;" class="topnavlink">Glossary</a></td>');
	document.write('      <td width="90"><a href="javascript:OpenObject(\'timeline\');void 0;" class="topnavlink">Timeline</a>');
	document.write('     <td width="90"><a href="teachers.htm?casestudy=5|page=1|access=\'+access+\'" class="topnavlink">Teachers</a></td>');
	document.write('     <td width="90"><a href="javascript:OpenObject(\'links\');void 0;" class="topnavlink">Links</a></td>');
	document.write('     <td><a href="javascript:ToggleAccessibility();void 0;" class="topnavlink">'+accessibleToggleText+'</a></td>');
	document.write('     <td><a href="javascript:OpenObjectPhp(\'log_page.php?note=tips&id=CS'+casestudy+'&num='+page+'\');void 0;" class="topnavlink">Leadership log</a></td>');
	document.write('     <td><a href="javascript:OpenObject(\'help\',\'\');void 0;" class="topnavlink">Help &amp; legal</a></td>');
	document.write('    </tr>');
	document.write('  </table>');
}
function ToggleAccessibility() {
	if (access==0) {
		access=1;
	} else {
		access=0;
	}
	var currentLocation=document.location.toString();
	var temp=currentLocation.split("?");
	if(temp.length>1){
		// has a querystring.  process accordingly
		var currentAddress=temp[0];
		var temp2=temp[1].toString().split("|");
		var newQueryString="?";
		for(var i=0;i<temp2.length;i++){
			if(temp2[i].indexOf("access")==-1){
				// no action
				newQueryString+=temp2[i]+"|";
			} else {
				// 
				newQueryString+="access="+access;
			}
		}
		document.location=currentAddress+newQueryString;
	} else {
		// first time visit.  No query string- apend.
		document.location=currentLocation+"?access="+access;
	}
}
// **************** LEADERSHIP LOG **************** //
function RenderLeadershipTabs() {
	document.write('		<td background="generic/images/leadership_quiz_tab.gif" style="background-repeat:no-repeat;" width="202" height="32" align="center" valign="middle">');
	document.write('		<a href="quiz_page.php?note=quiz&id=CS'+casestudy+'&num='+page+'" class="whiteboldtext">Quiz results</a></td>');	
	document.write('		<td background="generic/images/leadership_tip_tab.gif" style="background-repeat:no-repeat;" width="202" align="center" valign="middle">');
	document.write('		<a href="tips_page.php?note=tips&id=CS'+casestudy+'&num='+page+'" class="whiteboldtext">Leadership tips</a></td>');
	document.write('		<td background="generic/images/leadership_notes_tab.gif" style="background-repeat:no-repeat;" width="202" align="center" valign="middle">');
	document.write('		<a href="log_page.php?note=log&id=CS'+casestudy+'&num='+page+'" class="whiteboldtext">Your notes</a></td>');
	document.write('		<td width="34">&nbsp;</td>');
	document.write('	</tr>');
	/*
	if (objectValue=="quiz") {
		document.write('	<tr height="10" bgcolor="#6E9715">');
		document.write('		<td colspan="4"></td>');
		document.write('	</tr>');
	} else if (objectValue=="tips") {
		document.write('	<tr height="10" bgcolor="#DE961D">');
		document.write('		<td colspan="4"></td>');
		document.write('	</tr>');
	} else {
		document.write('	<tr height="10" bgcolor="#614C2D">');
		document.write('		<td colspan="4"></td>');
		document.write('	</tr>');
	}
	*/
}


function ConfirmSave() {
	var answer = confirm ("Do you want to save the contents to the leadership log?");
	if (answer) {
		document.log_Entry.submit();
	}
}	
function ConfirmReset() {
	var answer = confirm ("Are you sure you want to delete the contents of the leadership log?");
	if (answer) {
		document.location="reset.php";
	}
}
function ConfirmLogout() {
//if a log entry exists, submit to the server in order to save changes.
		if (document.log_Entry) {
			document.log_Entry.submit();
//Need to pause the page in order to process the form data.
//If you delete the next line, user data is lost when they log out.
			alert('Your notes have been saved');
		}
		document.location="login.php?act=out";
}
function ConfirmClose() {
	var answer = confirm ("Are you sure you want to close the Leadership Log?");
	if (answer) {
//if a log entry exists, submit to the server in order to save changes.
		if (document.log_Entry) {
			document.log_Entry.submit();
		}
		window.close();
	}
}


function RenderLeadershipbuttons() {
	if (loggedIn==0) {
		// if login page the render only two buttons
		document.write('<table width="110" border="0" cellspacing="0" cellpadding="0">');
		document.write('<tr align="center" valign="top">');
		document.write('	<td height="72"><a href="http://www.nmm.ac.uk/" target="_blank">');
		document.write('	<img src="generic/images/nmm_leader_log.gif" alt="National Maritime Museum" width="96" height="52" border="0"></a>');
		document.write('	</td>');
		document.write('</tr>');		
		document.write('<tr align="center" valign="top">');
		document.write('	<td height="52">');
		document.write('	<a href="javascript:ConfirmClose();void 0;">');
		document.write('		<img src="generic/images/leadership_close.gif" alt="Close button" width="90" height="41" border="0"></a>');
		document.write('	</td>');
		document.write('</tr>');
		document.write('</table>');
	} else {
		// user is logged in, render all buttons...
		document.write('<table width="110" border="0" cellspacing="0" cellpadding="0">');
		document.write('	<tr align="center" valign="top">');
		document.write('		<td height="72"><a href="http://www.nmm.ac.uk/" target="_blank">');
		document.write('		<img src="generic/images/nmm_leader_log.gif" alt="National Maritime Museum" width="96" height="52" border="0">');
		document.write('	</a></td></tr>');
		//********* SAVE *********
		document.write('	<tr align="center" valign="top">');
		document.write('		<td height="52">');
		document.write('		<a href="javascript:ConfirmSave();void 0;">');
		document.write('		<img src="generic/images/leadership_save.gif" alt="Save text entered into the text fields in the Your notes section" width="90" height="41" border="0">');
		document.write('	</a></td></tr>');	
		//******** PRINT *********
		document.write('	<tr align="center" valign="top">');
		document.write('		<td height="52"><a href="javascript:window.print();void 0;">');
		document.write('		<img src="generic/images/leadership_print.gif" alt="Print quiz results, tips and notes out on separate pages" width="90" height="41" border="0">');
		document.write('	</a></td></tr>');
		//********* START AGAIN *********
		document.write('	<tr align="center" valign="top">');
		document.write('		<td height="52">');	
		document.write('		<a href="javascript:ConfirmReset();void 0;">');
		document.write('		<img src="generic/images/leadership_startagain.gif" alt="Start again button" width="90" height="41" border="0">');				   
		document.write('	</a>');
		document.write('	</td></tr>');
		//*********** LOG OUT **********
		document.write('	<tr align="center" valign="top">');
		document.write('		<td height="52">');
		document.write('		<a href="javascript:ConfirmLogout();void 0;">');
		document.write('		<img src="generic/images/leadership_logout.gif" alt="Remember to save content before logging out" width="90" height="41" border="0">');
		document.write('	</a></td></tr>');
		//*********** CLOSE ***********
		document.write('	<tr align="center" valign="top">');
		document.write('		<td height="52">');
		document.write('		<a href="javascript:ConfirmClose();void 0;">');
		document.write('		<img src="generic/images/leadership_close.gif" alt="Close this window without logging out" width="90" height="41" border="0">');
		document.write('	</a></td></tr>');	
		document.write('</table>');
	}
}

