function CreateURLFromSelect(sUrl,oSelect,bID)
{	
	if (bID) {
		//alert(sUrl + escape(oSelect.options[oSelect.selectedIndex].value));
		self.location.replace(sUrl + escape(oSelect.options[oSelect.selectedIndex].value));
	}
	else {
		//alert(sUrl + escape(oSelect.options[oSelect.selectedIndex].text));
		self.location.replace(sUrl + escape(oSelect.options[oSelect.selectedIndex].text));
	}
}

function CreateURLFromSelectWithTargetFrame(sUrl,sTargetFrame,oSelect,bID)
{	
	if (bID) {
		//alert(sUrl + escape(oSelect.options[oSelect.selectedIndex].value));
		top.frames[sTargetFrame].location.replace(sUrl + escape(oSelect.options[oSelect.selectedIndex].value));
	}
	else {
		//alert(sUrl + escape(oSelect.options[oSelect.selectedIndex].text));
		top.frames[sTargetFrame].location.replace(sUrl + escape(oSelect.options[oSelect.selectedIndex].text));
	}
}

function CreateURLFromItem(sUrl,oItem)
{
	//alert(sUrl + escape(oItem.value));
	self.location.replace(sUrl + escape(oItem.value));
}

function popupCentreWindow(winURL, winX, winY) {
	//  default window size
	var windowWidth  = winX;
	var windowHeight = winY;
	//  get the size of the screen if we can
	if (window.screen) {
        if (window.screen.availWidth) {
	    //  browser has the appropriate properties we need to centre the window
            var screenWidth  = window.screen.availWidth;
            var screenHeight = window.screen.availHeight;
        }
	}
	//  location of the window
	var left = (screenWidth - windowWidth) / 2;
	var top  = (screenHeight - windowHeight) / 2;
	//  open the window
	window.open(winURL,'masterwindow','left='+left+',top='+top+',screenX='+left+',screenY='+top+',width='+windowWidth+',height='+windowHeight+',scrollbars=1,resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=0');
}

var focusWindow;
function popupWindowWithFocus(winURL) {

	if (!focusWindow || focusWindow.closed) {
		focusWindow = window.open(winURL,'winFocus','');
		if (!focusWindow.opener) {
			focusWindow.opener = window;
		}
	}
	else {
		// window is already open; bring to front
		setTimeout('focusWindow.focus();',250);
		focusWindow.location = winURL;
	}

}

function confirmDeactivateAction(sMessage)
{
	if (confirm(sMessage)) {
		document.forms[0].cmd.value='DEACTIVATE';
		document.forms[0].submit();		
		return true;
	}
	else {
		return false;
	}
}

function navToPage(nPage)
{
	document.forms[0].pageid.value = nPage;
	document.forms[0].cmd.value = 'NAV';
	document.forms[0].submit();
}

// JavaScript Document
// Rollover function
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+"'");
  }
}

var last_hidden_element = "menu1";
var last_visible_highlight = "menu1_highlight";
//var last_hidden_element_top = "learn_button";
//var last_visible_highlight_top = "learn_highlight";


//show last hidden menu and hide last visible highlight
function showLast(last_hidden_element,last_visible_highlight) {
	document.getElementById(last_hidden_element).style.visibility = "visible";
	document.getElementById(last_visible_highlight).style.visibility = "hidden";
}
//highlight function for left menu
function markActive(activeID,activeID_highlight,url) {
	
	if (last_hidden_element == "undefined") {
		last_hidden_element_top = "learn_button";
		last_visible_highlight_top = "learn_highlight";
	} else if (last_visible_highlight == "undefined") {
		//do nothing
	} else {
		showLast(last_hidden_element,last_visible_highlight);
	}
	
	
	
	document.getElementById(activeID_highlight).style.visibility = "visible"; 
	document.getElementById(activeID).style.visibility = "hidden";
	last_hidden_element = activeID;
	last_visible_highlight = activeID_highlight;
	parent.mainbodyframe.location.href = url;
}
//highlight function for top menu
function markActiveTop(activeID,activeID_highlight,url) {
	//if (last_hidden_element_top == "undefined") {
		//do nothing
	//} else if (last_visible_highlight_top == "undefined") {
		//do nothing
	//} else {

	//	showLast(last_hidden_element_top,last_visible_highlight_top);
	//}
	//document.getElementById(activeID_highlight).style.visibility = "visible"; 
	//last_hidden_element_top = activeID;
	//last_visible_highlight_top = activeID_highlight;
	//parent.headerframe.location.href = url;
}

function JavascriptRefreshWithCategoryChangedValue() {
    document.forms[0].cmd.value= 'category_changed';
    document.forms[0].submit();
}

function setValuesForCategoryExpandedPostback(nCurrentCategoryID, sCategoryExpandedRecord) {
    document.frmCourses.cmd.value= nCurrentCategoryID ;
    document.frmCourses.cmd2.value= sCategoryExpandedRecord;
    document.frmCourses.submit();
}


