<!--
//var webbase = "/craft/"
var pathname =  location.pathname.substring(1, location.pathname.length)
var webbase = "/" + pathname.substring(0,pathname.indexOf("/")) + "/"



function openmain(url,id) {
		if (is_ie)
			{
			tgt = "_main"
			}		
		else
			{
			tgt = "_content"
			}
		window.open(url,tgt)
}

function openpopup(url,id) {
var w = screen.width-250;
var h = screen.height*0.66;
var t = screen.height-142-h;
var l = screen.width-w-12;
winprops = 'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars=yes,resizable=yes,status=yes,toolbar=no,location=yes';
win = window.open(url,id,winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
if (win.opener == null) {win.opener = self; window.name = "opener";}
}

function formsubmit() {
document.dropdownform.submit()
}

function radioformsubmit() {
document.radioform.submit()
}

function prefswindow(url,winname) {
//function prefswindow(url) {
var w = screen.width*0.65;
var h = screen.height*0.65;
var t = screen.height*0.17;
var l = screen.width*0.17;
winprops = 'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars,resizable';
win = window.open(url,winname,winprops)
//win = window.open(url,'prefswindow',winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function maxlength(formitem){
	if (formitem.value.length > 255){
		alert("You have entered more than the maximum allowed number of " +
		 			"characters. Only the first 255 characters will be saved. ")
	}
}


function URLEncode(URL) {
//& = %26
//return escape(URL.replace('&','%26'))
return escape(URL)
}

function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

function reloadOpener() {
		opener.window.location.reload();
/*		
		//Get craft cookie
		alert(Get_Cookie("CRAFT"));
		var CRAFTcookie = (Get_Cookie("CRAFT")).split("&")
		var i
		//Loop through cookie until you find the formsubmit cookie
		for (i=0;i<CRAFTcookie.length;i++){
//			alert(CRAFTcookie[i]);
			if (CRAFTcookie[i].substring(0,10).toLowerCase() == "formsubmit") {
				 var formsubmit = CRAFTcookie[i].substring(11).toLowerCase();
				 break; }
		}
//		alert(formsubmit);
		if (formsubmit == "y") {
			opener.window.location.href = opener.window.location.href 
		} else {
		opener.window.location.reload();
		}*/
} //end function reloadOpener

//---------------------------------------------------------
// DELETE NOTE SECTION
//---------------------------------------------------------
function deleteNote(theform) {
	if (confirm("Are you sure you want to delete this note? \nYou will NOT be able to undo this action."))
	{
	location.href=webbase + "scripts/manage_process_add.asp?type=text&tabtype=" + 
		theform.tabtype.value + "&tabID=" + theform.tabID.value + "&id=" + theform.ID.value + 
		"&parent=" + theform.parent.value + "&courseid=" + theform.courseid.value + 
		"&action=delete"
	}
}


//---------------------------------------------------------
// CRAFT TOOLS SECTION
// assumes var currenc and currform_method have already been set
//---------------------------------------------------------
function changePage(selterm, charenc, form_method) {	
	if (
		(currenc != charenc) ||
		(currform_method != form_method) ||
		(form_method == 'POST')
	)
	{
		frames['searchoptions'].window.location.href = webbase + "content/tool.asp?method=" + form_method + "&id=" + selterm + "&charset=" + charenc
		currenc=charenc
		currform_method=form_method		
	}
}

function sendVals(formname,searchname) {
	parent.document.checkvalues.fmname.value = formname
	parent.document.checkvalues.boxname.value = searchname
}


function submitform(formobj) {
			var randomnumber = Math.floor(Math.random()*1000)
			var w = screen.width-250;
			var h = screen.height*0.75;
			var t = screen.height-h-65;
			var l = screen.width-w-12;
			winprops = 'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars,resizable,toolbar,location';
			window.open(webbase + 'content/tool_blank.asp',randomnumber,winprops)
			frames['searchoptions'].window.document.forms[0].elements[0].value = formobj.searchbox.value
			frames['searchoptions'].window.document.forms[0].charsetsel.value = formobj.charsetsel.value
			frames['searchoptions'].window.document.forms[0].target = randomnumber
			for (var i=0;i<formobj.charsetsel.length;i++) {
				if (formobj.charsetsel[i].checked) {
				frames['searchoptions'].window.document.forms[0].charsetsel.value = formobj.charsetsel[i].value
				} 
			}
			frames['searchoptions'].window.document.forms[0].submit()
}

function opensearchwin(winname) {
document.forms[0].elements[0].value = document.forms[0].elements[0].value  
var w = screen.width-250;
var h = screen.height*0.75;
var t = screen.height-h-57;
var l = screen.width-w-12;
winprops = 'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars,resizable,toolbar,location';
win = window.open(webbase + 'content/tool_blank.asp',winname,winprops)
win.window.focus();
}

//---------------------------------------------------------
// END OF CRAFT TOOLS SECTION
//---------------------------------------------------------

//-->
