// JavaScript Document

//First row table images
function myoverviewbar()
	{
		document.write("<img src='http://www.greeneconsults.com/topclass/custom/gca/images/programOverview.gif' align='left'>");
	}
function skillmarktitle()
	{
		document.write("<TITLE>Greene Consulting - The E-Learning Solution for Financial Services Professionals</TITLE>");
	}

function row1headerimages() 
	{
		document.write("<IMG SRC='http://www.greeneconsults.com/topclass/custom/gca/images/logo.gif' align='left'>");
		document.write("<IMG SRC='http://www.greeneconsults.com/topclass/custom/gca/images/headerLine.gif' align='right' height='64' width='60%'>");
	} 

function mycourseworkbar()
	{
		document.write("<img src='http://www.greeneconsults.com/topclass/custom/gca/images/mycoursework.gif' >");
	}
function myadvisorbar()
	{
		document.write("<img src='http://www.greeneconsults.com/topclass/custom/gca/images/advisortools.gif' align='left'>");
	}
function myhistorybar()
	{
		document.write("<img src='http://www.greeneconsults.com/topclass/custom/gca/images/myhistory.gif' align='left'>");
	}
function mymanagerbar()
	{
		document.write("<img src='http://www.greeneconsults.com/topclass/custom/gca/images/manager.gif' align='left'>");
	}	
function headernavbar(isAdmin)
	{
		document.write("<a href='"+TCPathToTopClass+"Learning' class='navrow'>Home</a>");
		document.write("&nbsp; |");
		document.write("&nbsp;<a href='http://www.greeneconsults.com/faq.asp' target='_blank' class='navrow'>Help</a>");
		document.write("&nbsp; |");		
		document.write("&nbsp;<a href='"+TCPathToTopClass+"Logout' class='navrow'>Logout</a>");
		document.write("&nbsp; |");
		if(isAdmin==1)
		{
		  document.write("&nbsp;<a href='"+TCPathToTopClass+"Expand-Administrator' class='navrow'>Admin</a>");
		  document.write("&nbsp; |");
		}
	
	}

function certificatelogo()
	{
		document.write("<IMG SRC='http://www.greeneconsults.com/topclass/custom/gca/images/logo.gif' align='left'>");
		document.write("<IMG SRC='http://www.greeneconsults.com/topclass/custom/gca/images/headerLine.gif' align='right' height='64' width='60%'>");
	} 

function certificatesignature()
	{
		document.write("<img src='images/cindy_sign.jpg' align='middle'>");
	}

//Copyright

function copyrightDate()
	{
		wriYr = new Date
		var doYr = wriYr.getFullYear()
		document.write("&copy " + doYr + " Greene Consulting Associates, LLC. All Rights Reserved.")
	}
function listSubmissions()
{
   document.write("<div class='myhistorylink'><a href='"+TCPathToTopClass+"retrieve-list-submissions-mine'>View All Exercise Submissions</a></div>");
   //document.write("View All");
   
}

function getValidstartend(validPeriod)
{
	var validArray = validPeriod.split('-');
	
	var validBegin = validArray[0];
	var validBeginSplit = validBegin.split(' ');
	var validBeginDate = validBeginSplit[0];
	
	var validEnd = validArray[1];
	var validEndSplit = validEnd.split(' ');
	var validEndDate = validEndSplit[1];
	
	if(validBeginDate==undefined)
	{
	  validBeginDate="";
	  }	
	if(validEndDate==undefined)
	{
	  validEndDate="";
	  }
	
	document.write("<td class='myhistorytitle3'>"+validBeginDate+"</td><td class='myhistorytitle3'>"+validEndDate+"</td>");
}

function getDisplayScore(score, marks)
{
   var score = parseInt(score);
   var marks = parseInt(marks);
   var pctScore=(Math.round(score/marks*100));
   var isScoreNumber = isNaN(pctScore);
   if(isScoreNumber==false && score <= marks)
   {
   	document.write(score+" of "+marks+" ("+pctScore+"%)");
   }
   else
   {
   	document.write(score+" of "+marks);
   }
}
//Begin TOC Row Color

function indexFrameHighlight(obj)
	{
     		if (obj == presentPosition)
     		{
       			//obj.className="pmHoverSelect";
       			obj.style.background="#EEEEEE";
     		}
     	else
     		{
		       //obj.className="pmHover";
		       obj.style.background="#DFDFDF";
		}
   	}

function markHere(obj,useParent,evt)
	{
  	if (presentPosition != null)
  		{
    			presentPosition.style.background="none";
  		}
  	if (useParent==true)
  		{
    			here = obj.parentNode;
 		}
 	 else
  		{
			here = obj;
			//Nicholas Murphy 03-Apr-2003  unsure that the _contents div containing this is open
			// we shouldn't have to recurse up the tree to ensure that all displays are open, as they have to be
			// to get to this point.
			here.parentNode.parentNode.style.display="";
  		}
			here.style.background="#EEEEEE";
			//debugAlert("setting presentPosition to " + here.id);
			presentPosition=here;
	if (window.navigator.appName == "Microsoft Internet Explorer")
		{
	if (window.event)
   		 {
     			window.event.cancelBubble=true;
   		 }
  		}
  	else
  		{
    	if (evt)
    		 {
     			evt.cancelBubble=true;
     		 }
  		}
	}

//END TOC Row Color
function pretestMessage()
{
	return false;
}
function submissionMessage(aScore, aTotal, aTitle)
{
  if(aTitle.indexOf("Diagnostic")>0)
  {
    document.write("<P><B><font color='#000066'>You scored ");
    document.write(aPercent);
    document.write("%");
    document.write(" ("+aScore+" out of "+aTotal+" total points)</B></FONT> on the test you submitted.</P>");  
    document.write("<P>If you scored below 80% on the Diagnostic Test, please proceed to the Training to review the material.</p>");
    document.write("<P>If you scored 80% or higher please click on the 'Home' link above and click the 'View Certificate' link to view and print your Certificate of Completion.</p>");
  }
  else
  {
    document.write("<P><B><font color='#000066'>You scored ");
    document.write(aPercent);
    document.write("%");
    document.write(" ("+aScore+" out of "+aTotal+" total points)</B></FONT> on the test you submitted.</P>");  
    document.write("<P>If you scored 80% or higher please click on the 'Home' link above and click the 'View Certificate' link to view and print your Certificate of Completion.</p>");
    document.write("<P>If you did not pass the test, please scroll to the bottom of this Review Test and click the Resubmit button to take the test again.</p>");
  
  }
}

//DO NOT CHANGE ANYTHING BELOW THIS LINE
//--------------------------------------

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

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];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function welcome(username)
{
  now = new Date
  if (now.getHours() < 12) {
    document.write(" Good Morning, " +username)
  }
  else if (now.getHours() < 17) {
    document.write(" Good Afternoon, " +username)
  }
  else {
    document.write(" Good Evening, " +username)
                }
}

function submitCertificate(classname)
{
  document.certificateform.courseid.value = classname;
  document.certificateform.submit();
}

function welcomedate()
{
  now = new Date;
  dayofweekint = now.getDay();

  if(dayofweekint==0)
  {
    dayofweek = "Sunday";
  }
  
  else if(dayofweekint==1)
  {
    dayofweek="Monday";
  }

  else if(dayofweekint==2)
  {
    dayofweek="Tuesday";
  }

  else if(dayofweekint==3)
  {
    dayofweek="Wednesday";
  }

  else if(dayofweekint==4)
  {
    dayofweek="Thursday";
  }
    
  else if(dayofweekint==5)
  {
    dayofweek="Friday";
  }

  else if(dayofweekint==6)
  {
    dayofweek="Saturday";
  }

  monthint = now.getMonth();

  if(monthint==0)
  {
    monthstring = "January";
  }
  
  else if(monthint==1)
  {
    monthstring = "February";
  }
  
  else if(monthint==2)
  {
    monthstring = "March";
  }
  
  else if(monthint==3)
  {
    monthstring = "April";
  }

  else if(monthint==4)
  {
    monthstring = "May";
  }

  else if(monthint==5)
  {
    monthstring = "June";
  }

  else if(monthint==6)
  {
    monthstring = "July";
  }
  
  else if(monthint==7)
  {
    monthstring = "August";
  }

  else if(monthint==8)
  {
    monthstring = "September";
  }

  else if(monthint==9)
  {
    monthstring = "October";
  }

  else if(monthint==10)
  {
    monthstring = "November";
  }

  else if(monthint==11)
  {
    monthstring = "December";
  }

  yearstring = now.getFullYear();
  datestring = now.getDate();

  daystring = dayofweek+", "+monthstring+" "+datestring+", "+yearstring;

  document.write(daystring);
}

function folderTitle(longFolder, folderId, folderstudentId, classname)
{
if(longFolder.indexOf("Training") > -1)
{
       
        linkText="<a href='"+TCPathToTopClass+"CnTxT-"+folderstudentId+"-Retrieve-Page-"+folderId+"'>Training</a>";
        
        return linkText;
}
else if(longFolder.indexOf("Diagnostic") > -1)
{
       
        linkText="<a href='"+TCPathToTopClass+"CnTxT-"+folderstudentId+"-Retrieve-Page-"+folderId+"'>Diagnostic</a>";
        return linkText;
}
else if(longFolder.indexOf("Certificate") > -1)
{
       
        linkText="<a href='javascript:submitCertificate(\""+classname+"\")'>View Certificate</a>";
        return linkText;
}
else
{
        linkText="<a href='"+TCPathToTopClass+"CnTxT-"+folderstudentId+"-Retrieve-Page-"+folderId+"'>"+longFolder+"</a>";
        return linkText;
}

}

function emailInstructor(pagetitle, pageid, realname, username, email)
{
  urlopen = "http://www.greeneconsults.com/topclass/greene/cfp/email.asp?pagetitle="+pagetitle+"&pageid="+pageid+"&wholename="+realname+"&username="+username+"&usermail="+email;
  window.open(urlopen,'mailform','width=560,height=365,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes,left=0,top=0,screenX=0,screenY=0');
}

function loginpage()
	{
		document.write("<H3>Please enter your Username and Password to enter Greene Consulting's Online training platform.</H3>");
	}

function logoutpage()
	{
		document.write("<H3>You have been Logged Out of Greene Consulting's Online training platform.<br><br>Please enter your Username and Password to re-enter.</H3>");
	}
	
function loadFlashHeader(userCompany, parentFolder)
{
	var queryStr="?userCompany="+userCompany+"&parentFolder="+parentFolder;
	var flashCode = '<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="650" height="50">\n';
	flashCode += '\t<param name="allowScriptAccess" value="always" /> \n';
	flashCode += '\t<param name="movie" value="custom/'+userCompany+'/flash/header.swf'+queryStr+'" /> \n';
	flashCode += '\t<param name="quality" value="high" /> \n';
	flashCode += '\t<param name="bgcolor" value="#ffffff" /> \n';
	flashCode += '\t<param name="wmode" value="transparent" /> \n';
	flashCode += '\t<embed src="custom/'+userCompany+'/flash/header.swf'+queryStr+'" quality="high" bgcolor="#ffffff" width="650" height="50" name="test" align="middle" type="application/x-shockwave-flash" myinput="Hello World" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" /> \n';
	flashCode += '</object> \n';
	//alert(flashCode);
	document.write(flashCode);
}

function loadFlashButton2(userCompany, parentFolder, username, realname)
{
	var queryStr="?userCompany="+userCompany+"&parentFolder="+parentFolder+"&username="+username+"&realname="+realname;
	var flashCode = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="120" height="30">\n';
	flashCode += '\t<param name="allowScriptAccess" value="always" /> \n';
	flashCode += '\t<param name="movie" value="greene/flash/flashButton2.swf'+queryStr+'" /> \n';
	flashCode += '\t<param name="quality" value="high" /> \n';
	flashCode += '\t<param name="bgcolor" value="#ffffff" /> \n';
	flashCode += '\t<param name="wmode" value="transparent" /> \n';
	flashCode += '\t<embed src="greene/flash/flashButton2.swf'+queryStr+'" quality="high" bgcolor="#ffffff" width="120" height="30" name="test" align="middle" type="application/x-shockwave-flash" myinput="Hello World" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" /> \n';
	flashCode += '</object> \n';
	
	document.write(flashCode);
}

function continuingeducationbar()
	{
		document.write("<img src='http://www.greeneconsults.com/topclass/custom/gca/images/continuingEducationBar.gif' align='left'>");
	}
function loadWealthTool(userCompany, parentFolder, userName, firstName, lastName)
{
	var queryStr="?userCompany="+userCompany+"&parentFolder="+parentFolder+"&userName="+userName+"&firstName="+firstName+"&lastName="+lastName;
	var flashCode = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="850" height="1300">\n';
	flashCode += '\t<param name="allowScriptAccess" value="always" /> \n';
	flashCode += '\t<param name="movie" value="greene/relationshipNavigator_00/main.swf'+queryStr+'" /> \n';
	flashCode += '\t<param name="quality" value="high" /> \n';
	flashCode += '\t<param name="bgcolor" value="#ffffff" /> \n';
	flashCode += '\t<param name="wmode" value="transparent" /> \n';
	flashCode += '\t<embed src="greene/relationshipNavigator_00/main.swf'+queryStr+'" quality="high" bgcolor="#ffffff" width="850" height="1300" name="test" align="middle" type="application/x-shockwave-flash" myinput="Hello World" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" /> \n';
	flashCode += '</object> \n';
	
	document.write(flashCode);
}


function loadCourseVideo(myVid, courseName)
{
	//alert("video: "+myVid+" course: "+courseName);
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="330" height="250"><param name="movie" value="http://www.greeneconsults.com/topclass/video/retirement/flash/courseVideoPlayer.swf"><param name="quality" value="high"><param name="wmode" value="transparent" /><param NAME=FlashVars VALUE="myVideo='+myVid+'&myCourseName='+courseName+'"><embed src="http://www.greeneconsults.com/topclass/video/retirement/flash/courseVideoPlayer.swf" quality="high" wmode="transparent" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="330" height="250" FlashVars="myVideo='+myVid+'&myCourseName='+courseName+'"></embed></object> ');	
}


function loadWealthTool2(userCompany, parentFolder, userName, firstName, lastName)
{
	alert("kp");
	var queryStr="?userCompany="+userCompany+"&parentFolder="+parentFolder+"&userName="+userName+"&firstName="+firstName+"&lastName="+lastName;
	var flashCode = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="850" height="1300">\n';
	flashCode += '\t<param name="allowScriptAccess" value="always" /> \n';
	flashCode += '\t<param name="movie" value="greene/relationshipNavigator_01/main.swf'+queryStr+'" /> \n';
	flashCode += '\t<param name="quality" value="high" /> \n';
	flashCode += '\t<param name="bgcolor" value="#ffffff" /> \n';
	flashCode += '\t<param name="wmode" value="transparent" /> \n';
	flashCode += '\t<embed src="greene/relationshipNavigator_01/main.swf'+queryStr+'" quality="high" bgcolor="#ffffff" width="850" height="1300" name="test" align="middle" type="application/x-shockwave-flash" myinput="Hello World" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" /> \n';
	flashCode += '</object> \n';
	
	document.write(flashCode);
}
function loadWealthTool3(userCompany, parentFolder, userName, firstName, lastName)
{
	var queryStr="?userCompany="+userCompany+"&parentFolder="+parentFolder+"&userName="+userName+"&firstName="+firstName+"&lastName="+lastName;
	var flashCode = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="850" height="1300">\n';
	flashCode += '\t<param name="allowScriptAccess" value="always" /> \n';
	flashCode += '\t<param name="movie" value="http://www.greeneconsults.com/relnav/relationshipnavigator/main.swf'+queryStr+'" /> \n';
	flashCode += '\t<param name="quality" value="high" /> \n';
	flashCode += '\t<param name="bgcolor" value="#ffffff" /> \n';
	flashCode += '\t<param name="wmode" value="transparent" /> \n';
	flashCode += '\t<embed src="http://www.greeneconsults.com/relnav/relationshipnavigator/main.swf'+queryStr+'" quality="high" bgcolor="#ffffff" width="850" height="1300" name="test" align="middle" type="application/x-shockwave-flash" myinput="Hello World" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" /> \n';
	flashCode += '</object> \n';
	
	document.write(flashCode);
}
