// JavaScript Document// Project: LMS6.0// Date:   07/01/2005/* * Get Brower Type (IE or FireFox/Netscape 8.0). * Global variable  ***/	 var agt = navigator.userAgent.toLowerCase();   var is_ie = (agt.indexOf("msie")!=-1 && document.all); var is_firefox = (agt.indexOf("firefox")!=-1);  var is_netscape = (agt.indexOf("netscape")!=-1);  var is_opera = (agt.indexOf("opera")!=-1);function GetAbsolute(element,attribute) {    if ( arguments.length != 2 || element == null )     {         return null;     }     var elmt = element;     var offsetTop = elmt.offsetTop; 	var offsetLeft = elmt.offsetLeft;		    while( elmt.offsetParent )  { 		elmt = elmt.offsetParent        offsetTop += elmt.offsetTop; 		offsetLeft += elmt.offsetLeft;    } 	if( attribute == 'top') return offsetTop;	else if( attribute == 'left') return offsetLeft;	else return 0;} /* Moving option(s) from one select box to another select box. * 3 functions move(fbox,tbox),BumpUp(box),SortD(box),notSelect(box),notSelect(box) *  */ function move(fbox,tbox){	var selectFlag = 0;	    for(var i = 0; i < fbox.options.length; i++)		if(fbox.options[i].selected)	       selectFlag = 1;      if(selectFlag == 0) return ;    	for(var i = 0; i < fbox.options.length; i++)	{		if(fbox.options[i].selected && fbox.options[i].value != "")		{			// Add Item			var no = new Option();			no.value = fbox.options[i].value;			no.text = fbox.options[i].text;			tbox.options[tbox.options.length] = no;			// Delete Item			fbox.options[i].value = "";			fbox.options[i].text = "";		}	}	//	SortD(tbox);	SortD(fbox);	notSelect(tbox);	notSelect(fbox);	BumpUp(fbox);}function BumpUp(box){	for(var i = 0; i < box.options.length; i++)	{		if(box.options[i].value == "")		{			for(var j = i; j<box.options.length - 1; j++)			{				box.options[j].value = box.options[j + 1].value;				box.options[j].text = box.options[j + 1].text;			}			var ln = i;			break;		}	}	if(ln < box.options.length)	{		box.options.length -= 1;		BumpUp(box);	}}	function SortD(box){	var temp_optsText = new Array();	var temp_optsValue = new Array();	var temp = new Object();	for(var i = 0; i < box.options.length; i++)	{		temp_optsText[i] = box.options[i].text;		temp_optsValue[i] = box.options[i].value;	}	for(var x = 0; x < temp_optsText.length-1; x++)	{		for(var y = (x + 1); y < temp_optsText.length; y++)		{			if(temp_optsText[x] > temp_optsText[y])			{							temp = temp_optsText[x];				val = temp_optsValue[x];				temp_optsText[x] = temp_optsText[y];				temp_optsValue[x]= temp_optsValue[y];				temp_optsText[y] = temp;				temp_optsValue[y]=val;			}			}	}	for(var i = 0; i < box.options.length; i++)	{		box.options[i].value = temp_optsValue[i];		box.options[i].text = temp_optsText[i];	}}function notSelect(box){	for(var i=0;i<box.options.length;i++)		box.options[i].selected=false;}function Select(box){	for(var i = 0; i < box.options.length; i++)	{		box.options[i].selected = true;	}}/* Moving option(s) from one select box to another select box. * Ending - */  /* Form validate  * AtTrim(),jsCheckInt(),jsCheckMail(),jsCheckDate()  */function AtTrim(s){	var r1, r2, s1, s2, s3;    r1 = new RegExp("^ *");    r2 = new RegExp(" *$");    s1 = ""+s+"";    s2 = s1.replace(r1, "");    s3 = s2.replace(r2, "");        r1 = null;    r2 = null;    return(s3);}		function jsCheckInt(s)	{	var rd =/^\d{1,20}$/;		if(!rd.test(s)) {		alert("Please input a valid integer for field");		return false;	}	return true;}function jsCheckMail(str){	var filter=/^[\.\-_0-9a-zA-Z]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]+$/	tempstr = str.split(";");	for(i = 0;i < tempstr.length;i ++)	{		if(!filter.test(tempstr[i]))			return false;	}	return true;}function MM_openBrWindow(theURL,winName,features){ //v2.0	window.open(theURL,winName,features);} function MM_goToURL() { //v3.0  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");}function MM_preloadImages() { //v3.0  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}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_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}function showTimeZone(){   //alert('timezone');    	//document.getElementById("timezoneList").style.visibility = "visible";	//if (document.getElementById('timeList').options[4]){alert('ddd')}	//document.getElementById('timeList').options[4].selected=true;	showWindow("timezoneList", "timezoneLink", 250, 100, 'left');}/* Function Name ---- showWindow * frame         -> frame name or frame id * link2         -> link name or link id * Frw           -> frame width * Frh           -> frame heigth * position      -> positon that relate to link2 * elementWidth  -> is only for firefox when the iframe will show on the right of link2 **/function showWindow(frame,link2,Frw,Frh,position,elementWidth)  //elementWidth is for firefox{	var Frl,Frt,Winw,Winh,left;	Winw = document.body.offsetWidth; 	Winh = document.body.offsetHeight;	link = eval(document.getElementById(link2));		if(is_ie)	{		if(position == 'left')		{			Frl=link.getBoundingClientRect().left;		}		else if(position == 'right')		{			Frl=link.getBoundingClientRect().right;		}		else		{			Frl = (Winw - Frw) / 2;		}		Frt=link.getBoundingClientRect().top +document.body.scrollTop;	}	else if( is_firefox || is_netscape || is_opera)	{		var top = GetAbsolute(link,'top') + 2;		var left = GetAbsolute(link,'left') + 2;				if(position == 'left')		{			Frl = left;		}		else if(position == 'right')		{			Frl = left + elementWidth;		}		else		{			Frl = (Winw - Frw) / 2;		}		Frt = top;	}	if (((Frl+Frw)>Winw)&&(Frw<Winw))	{		Frl=Frl-Frw;	}	if ((Frt+Frh>Winh)&&(Frh<Winh))	{		Frt=Frt-Frh;	}		eval("document.getElementById(frame).style.visibility = 'visible'");	eval("document.getElementById(frame).style.left=Frl-4+'px'");	eval("document.getElementById(frame).style.top=Frt+12+'px'");}function hiddenWindow(actionFlag,selectedIdx,locFlag){   document.getElementById("timezoneList").style.visibility = "hidden";  //if (actionFlag=='1'){     selectTimeZone(actionFlag,selectedIdx,locFlag);  //}}function selectTimeZone(actionFlag,selectedIdx,locFlag){    //var obj=document.fmtimezone;    with(document.getElementById('timeList'))    {  if (actionFlag=='1'){         if (document.getElementById('timeList')){            var jstimeZoneID=options[selectedIndex].value;            //alert('selectedindex='+options[selectedIndex].value)            //var jstimeZoneID=obj.elements["timezoneList"].selectedIndex;            //alert("jstimeZoneID="+jstimeZoneID);            if (locFlag=='1'){                 window.location.href="courseListings.do?timeZoneID="+jstimeZoneID+"&orderByStr="+currentOrder;            }             }       }       if (actionFlag=='2'){          if (document.getElementById('timeList')){             document.getElementById('timeList').selectedIndex=-1;             document.getElementById('timeList').options[selectedIdx].selected=true;          }       }    }}