// Rollover images
if (document.images) {
  sn_arrow_reg = new Image(1,1);
  sn_arrow_reg.src = "../../images/sn_arrow_reg.gif";
  sn_arrow_sel_gn = new Image(1,2);
  sn_arrow_sel_gn.src = "../../images/sn_arrow_sel_gn.gif";
  sn_arrow_sel_or = new Image(1,3);
  sn_arrow_sel_or.src = "../../images/sn_arrow_sel_or.gif";
  sn_arrow_sel_pu = new Image(1,4);
  sn_arrow_sel_pu.src = "../../images/sn_arrow_sel_pu.gif";
  sn_arrowup_reg = new Image(1,5);
  sn_arrowup_reg.src = "../../images/sn_arrowup_reg.gif";
  sn_arrowup_sel_gn = new Image(1,6);
  sn_arrowup_sel_gn.src = "../../images/sn_arrowup_sel_gn.gif";
  sn_arrowup_sel_or = new Image(1,7);
  sn_arrowup_sel_or.src = "../../images/sn_arrowup_sel_or.gif";
  sn_arrowup_sel_pu = new Image(1,8);
  sn_arrowup_sel_pu.src = "../../images/sn_arrowup_sel_pu.gif";
  
  
  ssn_arrow_reg = new Image(2,1);
  ssn_arrow_reg.src = "../../images/ssn_arrow_reg.gif";
  ssn_arrow_sel_gn = new Image(2,2);
  ssn_arrow_sel_gn.src = "../../images/ssn_arrow_sel_gn.gif"; 
  ssn_arrow_sel_or = new Image(2,3);
  ssn_arrow_sel_or.src = "../../images/ssn_arrow_sel_or.gif";
  ssn_arrow_sel_pu = new Image(2,4);
  ssn_arrow_sel_pu.src = "../../images/ssn_arrow_sel_pu.gif";
 
  
 
  botframe_menushow = new Image(3,1);
  botframe_menushow.src = "../images/botframe_menushow.gif";
  botframe_menuhide = new Image(3,2);
  botframe_menuhide.src = "../images/botframe_menuhide.gif"; 
}

// Preload new image function
function newImage(imageLocation) {
  if (document.images) {
    imageResult = new Image();
    imageResult.src = imageLocation;
    return imageResult;
  }
}

// Swap image function 
function ChangeImage (ImageName, FileName) {
  if (document.images) {
    document[ImageName].src = eval(FileName + ".src");
  }
}

// Swap two images function
function ChangeImages (ImageName,FileName,SecImageName,SecFileName) {
  if (document.images) {
    document[ImageName].src = eval(FileName + ".src");
    document[SecImageName].src = eval(SecFileName + ".src");
  }
}

// Popup window function
function openWindow(url, name, size, scroll) {
  popupWin=window.open(url, name, '"toolbar=no,' + size +',left=100,top=100,status=no,' + scroll +',resize=no,menubar=no"');
}

// Array function
function makeArray(len) {
  for (var i = 0 ; i < len; i++) this[i] = null;
  this.length = len;
}

    function GetDate(CtrlName)
    {
   /****************************************************
   
   Use Javascript method (window.open) to PopUp a new window 
   which contain a Calendar Control. In the meantime, we'll 
   pass the Parent Form Name and Request Control Name in the QueryString!
   
   *****************************************************/
        ChildWindow = window.open('../../Controls/Calendar1.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName + '&CtrlValue=' + document.forms[0].elements[CtrlName].value  , "PopUpCalendar", "width=306,height=350,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
        ChildWindow.focus();
    }
    
    function PopUpTree(CtrlName)
    {
    //alert (document.forms[0].elements(CtrlName).value);
        ChildWindow = window.open('../../Controls/TreeViewPopUp.aspx?FormName=' + document.forms[0].name + '&CtrlName=' + CtrlName + '&CtrlValue=' + document.forms[0].elements[CtrlName].value + '&Location_ID=' + document.forms[0].elements[CtrlName].value  , "OUTree", "width=320,height=360,top=100,left=100,toolbars=no,scrollbars=yes,status=no,menubar=no,resizable=no");
        ChildWindow.focus();
    }
/*    function PopUpCurriculum(CtrlName)
    {
//        ChildWindow = window.open('popCurriculumAdd.aspx'  , "About",      "width=600,height=400,top=200,left=200,toolbars=no,scrollbars=no,status=no,resizable=no");
//        ChildWindow = window.open('popCurriculumAdd.aspx?CtrlName=' + CtrlName + '&CtrlValue=' + document.forms[0].elements(CtrlName).value , "AddCurriculum", "width=620,height=300,top=200,left=200,toolbars=no,scrollbars=yes,status=no,resizable=no");
        ChildWindow = window.open('popCurriculumAdd.aspx?CtrlName=' + CtrlName , "AddCurriculum", "width=620,height=300,top=200,left=200,toolbars=no,scrollbars=yes,status=no,resizable=no");
        ChildWindow.focus();
    }*/
    function ShowAbout()
    {
        ChildWindow = window.open('popabout.aspx'  , "About", "width=550,height=375,top=100,left=100,toolbars=no,scrollbars=yes,status=no,resizable=no");
        ChildWindow.focus();
    }

    function ShowHelp(Helpid)
    {
    
    if ( Helpid == 2 ) //student
		{
		
		HelpWindow=window.open('../StudentHelp/popStudentHelp.aspx', "Help", "width=750,height=580,top=10,left=10,toolbars=no,scrollbars=yes,status=no,resizable=yes");
        //HelpWindow = window.open('../../Controls/popHelp.aspx?helpid='+Helpid  , "Help", "width=600,height=400,top=100,left=100,toolbars=no,scrollbars=yes,status=no,resizable=yes");
        HelpWindow.focus();
        }
        
      else 
    if ( Helpid == 3 ) //instructor
		{
		
		HelpWindow=window.open('../../student/StudentHelp/popStudentHelp.aspx', "Help", "width=750,height=580,top=10,left=10,toolbars=no,scrollbars=yes,status=no,resizable=yes");
        //HelpWindow = window.open('../../Controls/popHelp.aspx?helpid='+Helpid  , "Help", "width=600,height=400,top=100,left=100,toolbars=no,scrollbars=yes,status=no,resizable=yes");
        HelpWindow.focus();
        }
        
      else //admin
        {
		HelpWindow=window.open('../Help/index.htm', "Help", "width=750,height=580,top=10,left=10,toolbars=no,scrollbars=yes,status=no,resizable=yes");
        //HelpWindow = window.open('../../Controls/popHelp.aspx?helpid='+Helpid  , "Help", "width=600,height=400,top=100,left=100,toolbars=no,scrollbars=yes,status=no,resizable=yes");
        HelpWindow.focus();
        }
    }
    function ShowForums()
    {
        ChildWindow = window.open('http://c2demo/aspnetforums/', "Forums", "width=700,height=575,top=10,left=10,toolbars=no,scrollbars=yes,status=yes,resizable=yes");
        //alert(ChildWindow.document.Form1.username.value);
        //ChildWindow.document.Form1.PostView1__ctl0_username.value='admin';
        //ChildWindow.document.Form1.PostView1__ctl0_password.value='admin';
        //ChildWindow.document.Form1.submit();
        ChildWindow.focus();
    }
   
    function ShowHP()
    {
        ChildWindow = window.open('../../controls/popHP.aspx', "Forums", "width=700,height=575,top=10,left=10,toolbars=no,scrollbars=yes,status=yes,resizable=yes");
        //alert(ChildWindow.document.Form1.username.value);
        //ChildWindow.document.Form1.PostView1__ctl0_username.value='admin';
        //ChildWindow.document.Form1.PostView1__ctl0_password.value='admin';
        //ChildWindow.document.Form1.submit();
        ChildWindow.focus();
    }
    function ShowArticulate()
    {
        ChildWindow = window.open('../../controls/popArticulate.aspx', "Forums", "width=700,height=575,top=10,left=10,toolbars=no,scrollbars=yes,status=yes,resizable=yes");
        //alert(ChildWindow.document.Form1.username.value);
        //ChildWindow.document.Form1.PostView1__ctl0_username.value='admin';
        //ChildWindow.document.Form1.PostView1__ctl0_password.value='admin';
        //ChildWindow.document.Form1.submit();
        ChildWindow.focus();
    }
   function CheckWindow()
   {
      ChildWindow.close();
   }

 function popMyForum()
    {
    fullWindow('../../Controls/Forums/Forums.aspx');
    }

function popEvaluationEngine(GUID, UserID) { 
			var str = "left=0,screenX=0,top=0,screenY=0,resizable,status=yes,scrollbars=yes";
			if (window.screen) {
				var ah = screen.availHeight - 30;
				var aw = screen.availWidth - 10
				str += ",height=" + ah;
				str += ",innerHeight=" + ah;
				str += ",width=" + aw;
				str += ",innerWidth=" + aw;
				}
			win=window.open("popEvaluationEngine.aspx?GUID=" + GUID +'&UserID='+UserID, "w", str);
			win.focus;
			} 

function fullWindow(url) { 
    var str = "left=0,screenX=0,top=0,screenY=0,resizable,scrollbars=yes,status=yes";
    if (window.screen) {
      var ah = screen.availHeight - 30;
      var aw = screen.availWidth - 10
      str += ",height=" + ah;
      str += ",innerHeight=" + ah;
      str += ",width=" + aw;
      str += ",innerWidth=" + aw;
    }
    win=window.open(url, "w", str);
    win.focus;
}

function openFullWindow(url, height, width) { 
    var str = "left=0,screenX=0,top=0,screenY=0,scrollbars=yes,status=yes";
    var statusBarHeight = 30;
    var scrollbarWidth = 10;
    var ah = height;
    var aw = width;

    if (height > screen.availHeight)
        height = -100;

    if (width > screen.availWidth)
        width = -100;

    if ((width < 0) || (height < 0))
        str += ",resizable";

    if (width < 0) // percentage of screen width
        aw = screen.availWidth * (width / -100);
        
    if (height < 0) // percentage of screen height
        ah = screen.availHeight * (height / -100);

    if (window.screen) {
        ah = ah - statusBarHeight;
        aw = aw - scrollbarWidth;

        str += ",height=" + ah;
        str += ",innerHeight=" + ah;
        str += ",width=" + aw;
        str += ",innerWidth=" + aw;
    }
    
    win=window.open(url, "w", str);
    win.focus;
} 

// Array of day names
var dayNames=new makeArray(7);
dayNames[0] = "Sunday";
dayNames[1] = "Monday";
dayNames[2] = "Tuesday";
dayNames[3] = "Wednesday";
dayNames[4] = "Thursday";
dayNames[5] = "Friday";
dayNames[6] = "Saturday";

// Array of month names
var monthNames = new makeArray(12);
monthNames[0] = "January";
monthNames[1] = "February";
monthNames[2] = "March";
monthNames[3] = "April";
monthNames[4] = "May";
monthNames[5] = "June";
monthNames[6] = "July";
monthNames[7] = "August";
monthNames[8] = "September";
monthNames[9] = "October";
monthNames[10] = "November";
monthNames[11] = "December";

// Elements of Date object assigned to variables
var now = new Date();
var day = now.getDay();
var date = now.getDate();
var month = now.getMonth();
var year = now.getYear();
if (year == 99)
  year = 1999;
else if (year > 99 && year < 2000)
  year = 1900 + year;
var date = now.getDate();

function padDigits(n, totalDigits)
{
	n = n.toString();
	var pd = '';
	if (totalDigits > n.length)
	{
		for (i=0; i < (totalDigits-n.length); i++)
			pd += '0';
	}
	
	return pd + n.toString();
}

function popSurveyEngine(GUID, UserCourseID) { 
	var str = "left=0,screenX=0,top=0,screenY=0,resizable,status=yes,scrollbars=yes";
	if (window.screen) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10
		str += ",height=" + ah;
		str += ",innerHeight=" + ah;
		str += ",width=" + aw;
		str += ",innerWidth=" + aw;
		}
	win=window.open("../../student/StudentCourses/SurveyEngine1page.aspx?GUID=" + GUID + "&UserCourseID=" + UserCourseID, "w", str);
	win.focus;
	} 
			