<!-- all heavy image loads goes here -->
var Website_Images = new Array('../images/button.gif','../images/button_on.gif','../images/bg_slice.jpg','../images/logo.gif');
var UrlParameters = "";
var MessageId = "";
var AjaxSection = "InnerBody";
var AjaxMessageSection = "LoadingMessage";

var Alerts = {
    CHECKBOXOTHER:"You are missing information for the following field: ",
    CHECKBOX:"You are missing a selection for the following field: ",
    CONFIRM:"You have filled out the fields correctly, once you submit the form the changes will be final.\n\nAre you sure you want to submit the form now?",
    DSI:" Was not found! \n\nEnter the DSI # again and make sure you include a\n\nD before the numbers.",
    MISSINGDATA:"You have to enter data for \"",
    MISSINGINSTRUCTOR:"Please select an intructor to continue!",
    RADIO:"You have to select a \"",
    SERVERSTATUS:"There seems to be a problem with the server. Please\n try again."+ 
                 "If this problem persists, refresh the page\nand contact the Webmaster with the below information:"+
                 "\n\nThere was an Internal Error. Status:"
}
function onMouseOverEvent(Obj){
	Obj.style.cursor='pointer';
	if(onMouseOverEvent.arguments[1]){
		Obj.className=onMouseOverEvent.arguments[1];
	}
}
function onMouseOutEvent(Obj){
	Obj.style.cursor='';
	if(onMouseOutEvent.arguments[1]){
		Obj.className=onMouseOutEvent.arguments[1];
	}
}
function onMouseOverMenuEvent(Obj){
	Obj.style.cursor='pointer';
	if(onMouseOverMenuEvent.arguments[1]){
		Obj.style.backgroundPosition=onMouseOverMenuEvent.arguments[1];
	}
}
function onMouseOutMenuEvent(Obj){
	Obj.style.cursor='';
	if(onMouseOutMenuEvent.arguments[1]){
		Obj.style.backgroundPosition=onMouseOutMenuEvent.arguments[1];
	}
}
function onClickEvent(Obj){
	return location.href = Obj;
}
function onAjaxClickEvent(Obj){
	d=document;
	if(d.getElementById(onAjaxClickEvent.arguments[1]) != null)
		AjaxSection = onAjaxClickEvent.arguments[1];
	if(d.getElementById(onAjaxClickEvent.arguments[2]) != null)
		AjaxMessageSection = onAjaxClickEvent.arguments[2];
	ExecuteAjax = new AjaxEvent(AjaxMessageSection, AjaxSection, Obj);
	return true;
}

function preloader(){
	for(i=0; i < Website_Images.length; i++){
		var Temp_Image = new Image();
		Temp_Image.src = Website_Images[i];
	}
}
function changeElementValue(){
    d=document;
	for(i = 0; i < changeElementValue.arguments.length; i++){
	    paramArray = changeElementValue.arguments[i].split(":");
	    id=paramArray[0];
	    newVal=paramArray[1];
		d.getElementById(id).value=newVal;
	}
}
function nodisplay(){
	var d=document;
	
	for(i = 0; i < nodisplay.arguments.length; i++){
			if(d.getElementById(nodisplay.arguments[i])){	
				d.getElementById(nodisplay.arguments[i]).style.display="none";
			}
	}
}
function display(){
	var d=document;
	for(i=0; i < display.arguments.length; i++){
			if(d.getElementById(display.arguments[i]))
				d.getElementById(display.arguments[i]).style.display="";
	}
}
function popUpWindow(url,name){
	if(popUpWindow.arguments[2]){
		window.open(url,name,"height=" + popUpWindow.arguments[2] + ",width=" + popUpWindow.arguments[3] +",resizable=yes,scrollbars=yes,menubar=no,top=0,left=0")
	}
	else{
		window.open(url,name,"height=350,width=500,resizable=yes,scrollbars=yes,menubar=yes,top=0,left=0")
	}
}
function ShowMessage(){
	if(document.getElementById("message_confirmation")){
		display("message_confirmation");
		if(!ShowMessage.arguments[0]) MessageId = window.setTimeout("HideMessage()", "6500");
	}
}
function HideMessage(){
	if(document.getElementById("message_confirmation")){
		nodisplay("message_confirmation");
		window.clearTimeout(MessageId);
	}
}
var SearhParameters = "Phrase,FilterOption,PackageFilter,PageLength,OrderBy,OrderByDirection,Action,Refer_To,profile," +
					  "st,po,sp,g,ht,wt,gpa,sat,act,fn,ln,d,scname,un,toa,tos,ImageID,VideoID";

function skipPageTo(url, Form, skipTo){
	URL=url;
	d=document.getElementById(Form).elements;
	
	URL+="?run_until="+skipTo;
	URL+="&KeepState=True";
	
    var sSearch = SearhParameters.split(",");
    for(i=0;i<sSearch.length;i++){
	    if(d[sSearch[i]])
	        if(d[sSearch[i]].value!="")
		        URL+="&"+sSearch[i]+"="+d[sSearch[i]].value;    
    }
    if(skipPageTo.arguments[3]){	
	    ExecuteAjax = new AjaxEvent(AjaxMessageSection, AjaxSection, URL);
	}
	else{
	    location.href = URL;
	}
}
function nextPage(url, Form){
	URL=url;
	d=document.getElementById(Form).elements;
	
	URL+="?run_until="+d["run_until"].value;
	URL+="&KeepState=True";
	
    var sSearch = SearhParameters.split(",");
    for(i=0;i<sSearch.length;i++){
	    if(d[sSearch[i]])
	        if(d[sSearch[i]].value!="")
		        URL+="&"+sSearch[i]+"="+d[sSearch[i]].value;    
    }
	
    if(nextPage.arguments[2]){	
	    ExecuteAjax = new AjaxEvent(AjaxMessageSection, AjaxSection, URL);
	}
	else{
	    location.href = URL;
	}
}
function prevPage(PAGELENGTH,url,Form){
	URL=url;
	d=document.getElementById(Form).elements;
				
	d["run_until"].value-=PAGELENGTH*2;
	URL+="?run_until="+d["run_until"].value;
	URL+="&KeepState=True";

    var sSearch = SearhParameters.split(",");
    for(i=0;i<sSearch.length;i++){
	    if(d[sSearch[i]])
	        if(d[sSearch[i]].value!="")
		        URL+="&"+sSearch[i]+"="+d[sSearch[i]].value;    
    }
	
    if(prevPage.arguments[3]){	
	    ExecuteAjax = new AjaxEvent(AjaxMessageSection, AjaxSection, URL);
	}
	else{
	    location.href = URL;
	}
}