<!--
if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=mtrack;
var mousex, mousey;
function mtrack(e)  {
   
   if (document.layers)
   {
    mouesex = e.pageX;
    mousey = e.pageY;
   }
   else 
   {
   mousex = event.x;
   mousey = event.y;
   }
}



function createQString(s)
{
    var result="";

    for(var i=0;i<s.length;++i)
    {
        if(s.charAt(i)==' ')
        {
            result+="+";
        }
        else
        {
            result+=s.charAt(i);
        }
    }

    return result;
}

function showtip(current, e, text)
{
        
        thetitle=text.split('<br>');
        if (thetitle.length > 1)
        {
            thetitles="";
            for (i=0; i<thetitle.length; i++)
            {
                thetitles += thetitle[i] + "\r\n";
            }
            current.title = thetitles;
        }
        else
        {
            current.title = text;
        }

}

function hidetip()
{
    if (document.layers)
        document.tooltip.visibility="hidden"
}

function updateFilter(fieldName, value, jspName, extraParams)
{
    value = createQString(value);

    if (parent.frames[1] == null)
    {
        location=jspName + "?" + fieldName + "=" + value + "&" + extraParams;
    }
    else
    {
        parent.frames[1].location=jspName + "?" + fieldName + "=" + value + "&" + extraParams;
    }
}

function updateGenericFilter(fieldName, value, jspName)
{
    document.inputForm.action = jspName;
    document.inputForm.filterField.value = fieldName;
    document.inputForm.filter.value = value;

    document.inputForm.submit();
}

function updateGenericRoomsFilter(fieldName, value, jspName, extraParams)
{
    value = createQString(value);

    if (parent.frames[2] == null)
    {
        location=jspName + "?filterField=" + fieldName + "&filter=" + value + "&" + extraParams;
    }
    else
    {
        parent.frames[2].location=jspName + "?filterField=" + fieldName + "&filter=" + value + "&" + extraParams;
    }
}

function displayCalendar(dateFieldInst, eventInst)
{
   
    window.dateField = dateFieldInst;
   
 

    var Xpos, Ypos, sOptions, calWidth, calHeight;
 

    calWidth = 220;

    calHeight = 225;
   

    Xpos = eventInst.screenX - (calWidth / 2);

    Ypos = eventInst.screenY + 20;

    
    if (navigator.appName.indexOf("Netscape") >= 0)
    {
   
        if(parseInt(navigator.appVersion.charAt(0)) < 5)
        {
       
            calWidth = 370;
           
            calHeight = 280;
            
        }
        else
        {
       
            calWidth = 220;
     
            calHeight = 225;
        }


        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight + ',resizable=yes';
    
        calendar = window.open('calendar.jsp?dateField=' + dateFieldInst.value ,'cal','SCREENY=' + Ypos + ',SCREENX=' + Xpos  + sOptions);
    
    }
    else
    {
    
        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight + ',resizable=yes';
        
         
        
        calendar = window.open('calendar.jsp?dateField=' + dateFieldInst.value ,'cal','LEFT=' + Xpos + ', TOP=' + Ypos + sOptions);
      
    }
    

    return false;
}
function displayTimeTool(startTime, endTime, eventInst)
{

    window.startTime = startTime;
    window.endTime = endTime;

    var Xpos, Ypos, sOptions, calWidth, calHeight;

    calWidth = 280;
    calHeight = 275;

    Xpos = eventInst.screenX - (calWidth / 2);
    Ypos = eventInst.screenY + 20;

    if (navigator.appName.indexOf("Netscape") >= 0)
    {

        calWidth = 280;
        calHeight = 350;

        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight + ',resizable=yes';

        timetool = window.open('timetool.jsp','cal','SCREENY=' + Ypos + ',SCREENX=' + Xpos  + sOptions);
    }
    else
    {
        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;
        timetool = window.open('timetool.jsp','cal','LEFT=' + Xpos + ', TOP=' + Ypos + sOptions);
    }

    return false;
}

function displayGridTimeTool(startTime, endTime, eventInst)
{

    window.startTime = startTime;
    window.endTime = endTime;

    var Xpos, Ypos, sOptions, calWidth, calHeight;

    calWidth = 280;
    calHeight = 225;

    Xpos = eventInst.screenX - (calWidth / 2);
    Ypos = eventInst.screenY + 20;

    if (navigator.appName.indexOf("Netscape") >= 0)
    {

        calWidth = 280;
        calHeight = 350;

        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;

        timetool = window.open('gridtimetool.jsp','cal','SCREENY=' + Ypos + ',SCREENX=' + Xpos  + sOptions);
    }
    else
    {
        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;
        timetool = window.open('gridtimetool.jsp','cal','LEFT=' + Xpos + ', TOP=' + Ypos + sOptions);
    }

    return false;
}

function displayGridLegend(eventInst)
{


    var Xpos, Ypos, sOptions, calWidth, calHeight;

    calWidth = 240;
    calHeight = 325;

    Xpos = eventInst.screenX - (calWidth / 2);
    Ypos = eventInst.screenY + 20;

    if (navigator.appName.indexOf("Netscape") >= 0)
    {

        calWidth = 320;
        calHeight = 380;

        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;

        timetool = window.open('gridLegend.jsp','cal','SCREENY=' + Ypos + ',SCREENX=' + Xpos  + sOptions);
    }
    else
    {
        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;
        timetool = window.open('gridLegend.jsp','cal','LEFT=' + Xpos + ', TOP=' + Ypos + sOptions);
    }

    return false;
}

function eventPopup(subject, course, sectionNum, title, building,
                    room, daysMet, instructorCustomer, startTime,
                    endTime, startDate, endDate, eventType, campus,
                    id, isEvent)
{

    var sURL = 'class_popup.jsp';

    if (isEvent == 'true')
    {
        sURL = 'event_popup.jsp';
    }

    popupWin = window.open(sURL + '?'+
        'subject=' + subject + '&' +
        'course=' + course + '&' +
        'sectionNum=' + sectionNum + '&' +
        'title=' + title + '&' +
        'building=' + building + '&' +
        'room=' + room + '&' +
        'daysMet=' + daysMet + '&' +
        'instructorCustomer=' + instructorCustomer + '&' +
        'startTime=' + startTime + '&' +
        'endTime=' + endTime + '&' +
        'startDate=' + startDate + '&' +
        'endDate=' + endDate + '&' +
        'campus=' + campus + '&' +
        'id=' + id + '&' +
        'eventType=' + eventType
    , 'POPUP', 'alwaysRaised=yes,menubar,status,scrollbars,resizable,dependent,width=800,height=400');

    popupWin.focus();
}


function updatePage(pageName, startDate, endDate)
{
    //
    // update display by reloading this page
    //

    location = pageName+'?startDate=' + startDate + '&endDate=' + endDate;
}

function emailCheck (emailStr) {

  var emailPat=/^(.+)@(.+)$/
  
  //List illegal charatcters
  var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
  
  //characters not allowed in a name or domain
  var validChars="\[^\\s" + specialChars + "\]"
  
  //quoted string
  var quotedUser="(\"[^\"]*\")"
  
  //IP Domains
  var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
  
  
  /* The following string represents an atom (basically a series of
     non-special characters.) */
  var atom=validChars + '+'
  
  
  /* The following string represents one word in the typical username.
     For example, in john.doe@somewhere.com, john and doe are words.
     Basically, a word is either an atom or quoted string. */
  var word="(" + atom + "|" + quotedUser + ")"
  
  
  // The following pattern describes the structure of the user
  var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
  
  /* The following pattern describes the structure of a normal symbolic
     domain, as opposed to ipDomainPat, shown above. */
  var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
  
  
  var matchArray=emailStr.match(emailPat)
  if (matchArray==null) 
  {
  	return false
  }
  var user=matchArray[1]
  var domain=matchArray[2]
  
  if (user.match(userPat)==null) 
  {
      return false
  }
  
  
  var IPArray=domain.match(ipDomainPat)
  if (IPArray!=null) 
  {
  	  for (var i=1;i<=4;i++) 
      {
  	    if (IPArray[i]>255) 
        {
  		      return false
  	    }
      }
      return true
  }
  
  var domainArray=domain.match(domainPat)
  if (domainArray==null) 
  {
      return false
  }
  
  
  var atomPat=new RegExp(atom,"g")
  var domArr=domain.match(atomPat)
  var len=domArr.length
  if (domArr[domArr.length-1].length<2 || 
      domArr[domArr.length-1].length>3) 
  {
     return false
  }
  
  if (len<2) 
  {  
     return false
  }


  return true;
}

function multiPopUp(timeSpanId)
{

    var sURL = 'multi_popup.jsp';

    popupWin = window.open(sURL + '?'+
        'timeSpanId=' + timeSpanId
    , 'POPUP', 'alwaysRaised=yes,menubar,status,scrollbars,resizable,dependent,width=800,height=400');
    popupWin.focus();
}

function displayBuildingRoomSelect(building, room, includeAll, eventInst)
{

    window.BUILDING = building;
    window.ROOM = room;
    window.INCLUDEALL = includeAll;
    

    var Xpos, Ypos, sOptions, calWidth, calHeight,includeAllString;
    if (includeAll)
    {
        includeAllString = "True";
    }
    else
    {
        includeAllString = "False";
    }
    

    calWidth = 280;
    calHeight = 225;

    Xpos = eventInst.screenX - (calWidth / 2);
    Ypos = eventInst.screenY + 20;

    if (navigator.appName.indexOf("Netscape") >= 0)
    {

        calWidth = 280;
        calHeight = 350;

        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;

        timetool = window.open('selectBuildingRoom.jsp?building=' +building.value + '&room=' + room.value + '&includeAll=' + includeAllString,'cal','SCREENY=' + Ypos + ',SCREENX=' + Xpos  + sOptions);
       // timetool.close();
        timetool = window.open('selectBuildingRoom.jsp?building=' +building.value + '&room=' + room.value + '&includeAll=' + includeAllString,'cal','SCREENY=' + Ypos + ',SCREENX=' + Xpos  + sOptions);
    }
    else
    {
        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;
        timetool = window.open('selectBuildingRoom.jsp?building=' +building.value + '&room=' + room.value + '&includeAll=' + includeAllString,'cal','LEFT=' + Xpos + ', TOP=' + Ypos + sOptions);
        //timetool.close();
        timetool = window.open('selectBuildingRoom.jsp?building=' +building.value + '&room=' + room.value + '&includeAll=' + includeAllString,'cal','LEFT=' + Xpos + ', TOP=' + Ypos + sOptions);
    }

    return false;
}
function displaySubjectCourseSelect(subject, course, includeAll, eventInst)
{

    window.SUBJECT = subject;
    window.COURSE = course;
    window.INCLUDEALL = includeAll;
    

    var Xpos, Ypos, sOptions, calWidth, calHeight,includeAllString;
    if (includeAll)
    {
        includeAllString = "True";
    }
    else
    {
        includeAllString = "False";
    }
    

    calWidth = 280;
    calHeight = 225;

    Xpos = eventInst.screenX - (calWidth / 2);
    Ypos = eventInst.screenY + 20;

    if (navigator.appName.indexOf("Netscape") >= 0)
    {

        calWidth = 280;
        calHeight = 350;

        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;

        timetool = window.open('selectSubjectCourse.jsp?subject=' +subject.value + '&course=' + course.value + '&includeAll=' + includeAllString,'cal','SCREENY=' + Ypos + ',SCREENX=' + Xpos  + sOptions);
       // timetool.close();
        timetool = window.open('selectSubjectCourse.jsp?subject=' +subject.value + '&course=' + course.value + '&includeAll=' + includeAllString,'cal','SCREENY=' + Ypos + ',SCREENX=' + Xpos  + sOptions);
    }
    else
    {
        sOptions = ',WIDTH=' + calWidth + ',HEIGHT=' + calHeight;
        timetool = window.open('selectSubjectCourse.jsp?subject=' +subject.value + '&course=' + course.value + '&includeAll=' + includeAllString,'cal','LEFT=' + Xpos + ', TOP=' + Ypos + sOptions);
       // timetool.close();
        timetool = window.open('selectSubjectCourse.jsp?subject=' +subject.value + '&course=' + course.value + '&includeAll=' + includeAllString,'cal','LEFT=' + Xpos + ', TOP=' + Ypos + sOptions);
    }

    return false;
}



//-->