var strEmailString = "_r=1";

function Public()
{
	location.href="/ReqCourse.aspx?&rt=Public&cc=" + sCode + "&cn=" + sName;
}

function OnSite()
{
	location.href="/ReqCourse.aspx?&rt=On-site&cc=" + sCode + "&cn=" + sName;
}

function GetContentWnd()
{
	return parent; 
}		

function OnPrintPage()
{
	var oWnd = GetContentWnd();	
	oWnd.print();
//	return false;
}

function OnEmail()
{
	var oWnd = 	GetContentWnd();
	var oDoc = oWnd.document;
	
	var oDescription = oDoc.getElementById("Description");
/*
	var strDescription = ( (oDescription == null) || (oDescription.content == "") ) ? oDoc.title : oDescription.content;	
*/

//	var strDescription = oDoc.title;	
	var strDescription = sName;

	if( oDoc.title == "" )
		oWnd.location.href = "mailto:?body="+BuildEmailDescription(strDescription, AddParamToURL(oWnd.location.href, strEmailString));
	else
		oWnd.location.href = "mailto:?subject="+escape(strDescription)+"&body="+BuildEmailDescription(strDescription, AddParamToURL(oWnd.location.href, strEmailString));
//	return false;
}

function BuildEmailDescriptionCourse(strDescription,hRef)
{
	return escape("Here's something from VRDS, Inc. that you might be interested in:\n\n" + strDescription + "\nURL: " + hRef);
}

function BuildEmailDescriptionCurriculum(strDescription,hRef)
{
	return escape("Here's something from VRDS, Inc. that you might be interested in:\n\n" + strDescription + "\nURL: " + hRef);
}

function BuildEmailDescription(strDescription,hRef)
{
	if (bCurriculum)
		return BuildEmailDescriptionCurriculum(strDescription,hRef);
	else
		return BuildEmailDescriptionCourse(strDescription,hRef);
}

function AddParamToURL(strLoc,strParam)
{
	// HACK
	return strLoc;
	// END HACK

	var i = strLoc.lastIndexOf("?");
	if(strLoc.indexOf(strParam, i) >= 0)
		return strLoc;
	
	strLoc += ((i >= 0) && (i > strLoc.lastIndexOf("/"))) ? "&" : "?";
	return strLoc + strParam;
}

//function bookmark(url, description) {
function bookmark() 
{
	if (navigator.appName=='Microsoft Internet Explorer') 
	{
		window.external.AddFavorite(location.href, document.title);
	}
	else if (navigator.appName=='Netscape') 
	{
		alert('Netscape cannot automatically bookmark pages. Please press OK to dismiss this dialog then Ctrl+D to bookmark this page.');
	}
	else 
	{
		alert('We cannot insert the bookmark automatically for this browser. Please insert it manually.');
	}
}

function ShowBelts(BeltType)
{
	var url = "/popups/belts.htm";
	
	
	if (BeltType != "")
	{
		url += "#";
		url += BeltType
	}
	
	window.open(url, "Tracks", "width=400, height=250, location=no, menubar=no, status=no, toolbar=no, scrollbars=yes, resizable=yes");
}	
