function clickFormButton(btnID){
	var objForm = document.Form1;
	if (objForm){
		var objButtonID = document.Form1.hidButtonID;
		if (objButtonID){
			objButtonID.value = btnID;
			objForm.submit();
		}
	}
}

function HandleKeyPress(combo, e){
	var characterCode //literal character code will be stored in this variable
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else {
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	if (characterCode == 13){
		var objBtn = document.getElementById("btSearch");
		if (objBtn){
			objBtn.click();
		}
	}
}

function checkEnter(e, action){ //e is event object passed from function invocation
	var characterCode //literal character code will be stored in this variable
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else {
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}

	var keychar = String.fromCharCode(characterCode);

	var objKeywordSearch = document.getElementById("txtSearchKeyword");
	var strKeyword = "";
	if (objKeywordSearch){
		strKeyword = objKeywordSearch.value;
	}

	if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
		if (action == 1){
		    if (ExactCourseName != '' && blnKeywordMoved){
                strKeyword = ExactCourseName;
                if (objKeywordSearch){
                    objKeywordSearch.value = strKeyword;
                    objKeywordSearch.focus();
                }
            }
			submitKeywordSearch(strKeyword);
		}
		else if (action == 2){
			clickFormButton(1);
		}		
		else if (action == 3){
			clickFormButton(2);
		}		
		else if (action == 10){
			search(document.Form1, self);
		}		
		blnDisableCloseDiv = false;
		closeDiv();
		return false 
	}
	else{
		return true 
	}
}

function submitKeywordSearch(keyword){
	var objBtn = document.getElementById("btSearch");
	if (objBtn){
	    objBtn.click();
	}
}

function submitSearch(){
    var objKeyword = document.getElementById("txtSearchKeyword");
    if (objKeyword){
        if (objKeyword == ""){
            return false;
        }
    }
    else {
        return false;
    }
}

function menu_on(menuid, base) {
    if (!base){
        base = '';
    }
    document.getElementById('menu' + menuid + 'left').src=base+'images/menu_left_on.gif';
    document.getElementById('menu' + menuid + 'bg').style.background='url("' + base+ 'images/menu_bg_on.gif")';
    document.getElementById('menu' + menuid + 'right').src=base+'images/menu_right_on.gif';
    document.getElementById('menu' + menuid + 'bg').style.color='#258827';
}


function menu_off(menuid, base) {
    document.getElementById('menu' + menuid + 'left').src=base+'images/menu_left_off.gif';
    document.getElementById('menu' + menuid + 'bg').style.background='url("' + base+ 'images/menu_bg_off.gif")';
    document.getElementById('menu' + menuid + 'right').src=base+'images/menu_right_off.gif';
    document.getElementById('menu' + menuid + 'bg').style.color='#258827';
}


function ddmenu_on(objTD, menuid) {
    if (objTD){
        objTD.className = "topNavBkgOn";
    }
    var objDDMenu = document.getElementById(menuid);
    var objDDMenuSub = document.getElementById(menuid + 'sub');
    var yPos = 0;
    var objBottomMenu = document.getElementById("BottomMenu"); 
    
    if (objDDMenuSub){
        objDDMenuSub.zIndex = 999;
        if (objBottomMenu) {
            yPos = findYPos(objBottomMenu)-5;
        }
        xPos = findXPos(objDDMenuSub)
		objDDMenuSub.style.top = yPos;
        objDDMenuSub.position = 'absolute';
        objDDMenuSub.style.display = 'block';
        positionIFrame(menuid + 'sub', 'theframe');
        objDDMenuSub.style.display = 'block';
    }
    
}

function ddmenu_off(objTD, menuid) {
    if (objTD){
        objTD.className = "topNavBkg";
    }

    var objDDMenu = document.getElementById(menuid);
    var objDDMenuSub = document.getElementById(menuid + 'sub');
    if (objDDMenuSub){
        objDDMenuSub.style.display = 'none';
        var objFrame = document.getElementById("theframe");
        if (objFrame){
            objFrame.style.display = 'none';
        }
    }
}


var origRowClass = 'ddMenuOff';
var origLinkClass = 'ddMenuOffLink';
function ddmenuitem_on(objRow, menuid) {
    origRowClass = objRow.className;
    objRow.className = 'ddMenuOn';
    var objLink = document.getElementById(menuid);
    if (objLink){
        objLink.className = 'ddMenuOnLink';
    }
}

function ddmenuitem_off(objRow, menuid) {


    objRow.className = origRowClass;
    var objLink = document.getElementById(menuid);
    if (objLink){
        objLink.className = origLinkClass;
    }
}

function changePrice(CourseID, LocationID){
    eval("var objSchedule = document.Form1.ddScheduleID_" + CourseID + "_" + LocationID + ";");
    if (objSchedule){
        var index = objSchedule.selectedIndex;
        var objPrice = document.getElementById("divPrice_" + CourseID + "_" + LocationID);
        if (objPrice){
            var objNewPrice = document.getElementById("divPrice_" + CourseID + "_" + LocationID + "_" + index);
            if (objNewPrice){
                // objPrice.innerText = objNewPrice.innerText;
                objPrice.innerHTML = objNewPrice.innerHTML;
            }
        }
    }
}

function changePrice2(CourseID, LocationID, DropDownID, TotalDropDowns){
    var objSchedule;
    var i = 0;
    var index = 0;
    for (i=0; i < TotalDropDowns; i++){
        eval("objSchedule = document.Form1.ddScheduleID_" + CourseID + "_" + i + ";");
        if (objSchedule){
            if (i == DropDownID){
                index = objSchedule.selectedIndex;
                var objPrice = document.getElementById("divPrice_" + CourseID + "_" + i);
                eval("var objScheduleIDs = document.frmAdd.scheduleids;");
                if (index == 0){
                    var objNewPrice = document.getElementById("divPrice_" + CourseID + "_" + LocationID + "_1");
                    if (objNewPrice){
                        var strNewPrice = objNewPrice.innerHTML;
                        objPrice.innerHTML = strNewPrice;
                    }
                    if (objScheduleIDs){
                        objScheduleIDs.value = "";
                    }
                }
                else {
                    var ScheduleID = objSchedule[index].value;
                    if (objScheduleIDs){
                        objScheduleIDs.value = ScheduleID;
                    }
                    
                    if (objPrice){
                        var divPriceID = "divPrice_" + CourseID + "_" + LocationID + "_" + index;
                        var objNewPrice = document.getElementById(divPriceID);
                        if (objNewPrice){
                            var strNewPrice = objNewPrice.innerHTML;
                            objPrice.innerHTML = strNewPrice;
                        }
                    }
                }
            }
            else {
                objSchedule.selectedIndex = 0;
                var objPrice = document.getElementById("divPrice_" + CourseID + "_" + i);
                var objNewPrice = document.getElementById("divPrice_" + CourseID + "_" + i + "_default");
                if (objNewPrice){
                    var strNewPrice = objNewPrice.innerHTML;
                    if (objPrice){
                        objPrice.innerHTML = strNewPrice;
                    }
                }
            }
        }
    }
}

function bookNow(CourseID, LocationID, Price){
    var ScheduleID = 0;
    var blnError = false;
    var objForm = document.frmBookNow;
    eval("var objSchedule = document.Form1.ddScheduleID_" + CourseID + "_" + LocationID + ";");
    eval("var objPriceOptions = document.Form1.radPriceOption_" + CourseID + ";");
    var strPriceOption = "0";
    
    if (objForm){
        if (objSchedule){
            ScheduleID = objSchedule[objSchedule.selectedIndex].value;
        }
        else {
            if (objPriceOptions){
                var j = objPriceOptions.length;
                if (j){
                    for (x=0; x < j; x++){
                        if (objPriceOptions[x].checked){
                            strPriceOption = objPriceOptions[x].value;
                            break;
                        }
                    }
                }
                else {
                    if (objPriceOptions.checked)
                        strPriceOption = objPriceOptions.value;
                }
                
                if (strPriceOption == "0"){
                    blnError = true;
                    alert("Please select one of the available payment options!");
                }
            }
        }
        
        if (!blnError){
            objForm.scheduleids.value = ScheduleID;
            objForm.courseid.value = CourseID;
            objForm.priceoption.value = strPriceOption;
            objForm.submit();
        }
    }
}

function addToCart(CourseID){
    var blnError = false;
    var strScheduleIDs = "";
    eval("var objSchedule = document.Form1.ddScheduleID_" + CourseID + "_0;");
    
    var objPriceOptions  = document.Form1.radPriceOption;
    var strPriceOption = "0";
    
    if (objSchedule){
        if (document.frmAdd.scheduleids.value == ""){
            blnError = true;
        }
    }

    if (objPriceOptions){
        var j = objPriceOptions.length;
        var intCount = 0;
        if (j){
            for (x=0; x < j; x++){
                if (objPriceOptions[x].checked){
                    intCount++;
                    strPriceOption = objPriceOptions[x].value;
                    break;
                }
            }
        }
        else {
            if (objPriceOptions.checked){
                intCount++;
                strPriceOption = objPriceOptions.value;
            }
        }
        
        if (intCount == 0)
            blnError = true;
    }


    if (blnError){
        if (objSchedule){
            if (document.frmAdd.scheduleids.value == ""){
                alert("Please select one of the available dates!");
            }
        }
            
        if (objPriceOptions)
            alert("Please select one of the available payment options!");
    }
    else {
        document.frmAdd.courseid.value = CourseID;
        document.frmAdd.priceoption.value = strPriceOption;
        document.frmAdd.submit();
    }
}

function findXPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return curleft;
}

function findYPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return curtop;
}



//------------------------------------------------------------------------------------------
// Cal
//------------------------------------------------------------------------------------------


var yn = new Array(1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030);
var na = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,'01','02','03','04','05','06','07','08','09');
var ml = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

var sday;
var smonth;
var syear;
var sc;
var txtname;
var dn=0;

// Date Format:  1. dd/MM/yyyy  2. MM/dd/yyyy  3. yyyy-MM-dd
var dateformat=1;

var mDivMOver=false;document.onclick=function() {if(document.getElementById("caldiv") != null){ if (mDivMOver == false) {dn++;if (dn > 1){document.getElementById("caldiv").style.visibility='hidden';document.getElementById('calshim').style.visibility='hidden';}}}}

function isdate(day, month, year)
{
var nastr=na.join(",")+',';
var ynstr=yn.join(",")+',';

if (nastr.indexOf(day + ',') == -1)
return false;

if (nastr.indexOf(month + ',') == -1)
return false;

if (ynstr.indexOf(year + ',') == -1)
return false;

if (month < 1 || month > 12)
return false;

if (year/4 == parseInt(year/4))
{
ml[1] = 29;
}
else
{
ml[1] = 28;
}

if (day < 1 || day > ml[month-1])
return false;

return true;
}


function calgo(name,thedate,format)
{
txtname=name;

if (format==1 || format==2 || format==3)
{
dateformat=format;
}

if (navigator.appName == 'Microsoft Internet Explorer')
{
document.getElementById("caldiv").setAttribute('onmouseover',function anonymous(){mDivMOver=true});
document.getElementById("caldiv").setAttribute('onmouseout',function anonymous(){mDivMOver=false});
}
else
{
document.getElementById("caldiv").setAttribute('onMouseOver','mDivMOver=true');
document.getElementById("caldiv").setAttribute('onMouseout','mDivMOver=false');
}

var calleft=0;
var caltop=0;
 objParent = document.getElementById(txtname).offsetParent;
         
        while(objParent && objParent.tagName.toUpperCase() != "BODY")
        {
        calleft+=objParent.offsetLeft;
            caltop+=objParent.offsetTop;
objParent = objParent.offsetParent;
}

calleft+=document.getElementById(txtname).offsetLeft
caltop+=document.getElementById(txtname).offsetTop + document.getElementById(txtname).offsetHeight + 2;

var leftpos = (calleft+11) + 'px';
var toppos = (caltop+35) + 'px';

document.getElementById("caldiv").style.left = (findXPos(document.getElementById('div_'+txtname))) + 'px';
document.getElementById("caldiv").style.top = (findYPos(document.getElementById('div_'+txtname))) + 'px';

/*
alert("leftpos = " + leftpos);
alert("toppos = " + toppos);
*/

var correctdate=false;

sc='-';

if (thedate.indexOf("/") != -1)
{
sc='/';
}




var checkdate=thedate.split(sc);

if (checkdate.length == 3)
{

var cdday;
var cdmonth;
var cdyear;

if (dateformat == 1)
{
cdday=checkdate[0];
cdmonth=checkdate[1];
cdyear=checkdate[2];
}
else if (dateformat == 2)
{
cdday=checkdate[1];
cdmonth=checkdate[0];
cdyear=checkdate[2];
}
else if (dateformat == 3)
{
cdday=checkdate[2];
cdmonth=checkdate[1];
cdyear=checkdate[0];
}

if (isdate(cdday,cdmonth,cdyear) == true)
{
correctdate=true;
}
}


if (correctdate == true)
{
sday=cdday;
smonth=cdmonth;
syear=cdyear;

calendar(sday,smonth,syear);
}
else
{
var d=new Date()
sday=d.getDate();
smonth=d.getMonth()+1;
syear=d.getFullYear();
calendar(sday,smonth,syear);
}

if (format==3)
{
sc='-'
}
else
{
sc='-'
}

}

function caldown(day, month, year)
{
month=month-1;

if (month == 0)
{
month=12;
year=year-1;
}

if (year < yn[0])
{
month=1;
year=yn[0];
}

calendar(day, month, year);
}

function calup(day, month, year)
{
month=month+1;

if (month == 13)
{
month=1;
year=year+1;
}

if (year > yn[yn.length-1])
{
month=12;
year=yn[yn.length-1];
}

calendar(day, month, year);
}


function calmonth(day, month, year)
{
calendar(day, month, year);

}

function calyear(day, month, year)
{
calendar(day, month, year);

}

function calout(day, month, year)
{

    var months = new Array(13);
    months[0]  = "January";
    months[1]  = "February";
    months[2]  = "March";
    months[3]  = "April";
    months[4]  = "May";
    months[5]  = "June";
    months[6]  = "July";
    months[7]  = "August";
    months[8]  = "September";
    months[9]  = "October";
    months[10] = "November";
    months[11] = "December";

    var weekdays = new Array(7);
    weekdays[0] = "Sunday";
    weekdays[1] = "Monday";
    weekdays[2] = "Tuesday";
    weekdays[3] = "Wednesday";
    weekdays[4] = "Thursday";
    weekdays[5] = "Friday";
    weekdays[6] = "Saturday";

var thedate;

if (day.toString().length==1)
{
day='0'+day;
}

if (month.toString().length==1)
{
month='0'+month;
}

if (dateformat == 1)
{
thedate=day + sc + month + sc + year;
}
else if (dateformat == 2)
{
thedate=month + sc + day + sc + year;
}
else if (dateformat == 3)
{
thedate=year + sc + month + sc + day;
}
else if (dateformat == 4)
{
thedate=year + sc + month + sc + day;
}

//document.getElementById(txtname).value=thedate;
if (document.getElementById(txtname + '_Display')){
    var dtmDate = new Date(year, month-1, day)
    document.getElementById(txtname+'_Display').value = day + '/' + month + '/' + year;
}
if (document.getElementById(txtname)){
    document.getElementById(txtname).value = year + '-' + month + '-' + day;
}

document.getElementById("caldiv").style.visibility='hidden';document.getElementById('calshim').style.visibility='hidden';
}




function calendar(day, month, year)
{
dn=0;
var monthnumber = new Array(1,2,3,4,5,6,7,8,9,10,11,12);
var monthname = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
var h;
var DayLoop=0;
var WeekLoop=0;
var font='Arial';
var pday='';
var pmonth;
var pyear;
var ShadeColor='#edf5fe';
var DayBackColor='#ffffff';
var DayBorderColor='#eaeaea';
var BorderColor='#294985';
var DayHeadingBackColor='#294985';
var DayBackColor='#ffffff';
var SelectDayBackColor='#e1e1e1';
var HoverDayBackColor='#9abce7';
var DayStyle='style="font-family:' + font + ';font-size:8pt;font-weight:bold;color:#ffffff"';
var LinkStyle='style="font-family:' + font + ';font-size:8pt;font-weight:normal;color:#294985"';
var AlternateMonth='style="font-family:' + font + ';font-size:8pt;font-weight:normal;color:#666666"';
var ArrowStyle='style="font-family:' + font + ';font-size:8pt;font-weight:bold;color:#294985"';
var HeadingCellAttributes='width="14%" style="border-right-width:0px;border-left-width:0px;color:#FFFFFF;"'

h='<table border=1 cellpadding=0 cellspacing=0 bordercolor=' + BorderColor +' style="border-collapse:collapse"><tr><td>'
h+='<table border=1 width=180 cellspacing=0 bordercolor=' + DayBorderColor +' style="border-collapse:collapse">';
h+='<tr bgcolor=' + ShadeColor + '><td colspan="7"><table border=0 cellpadding=1 cellspacing=1 width="100%"><tr>';
h+='<td width="10%" onclick="caldown(1,' + month + ',' + year + ')" style="cursor:hand" ' + ArrowStyle + '>&lt;&lt;</a></td>';
h+='<td align=center width="80%">';
h+='<table border=0 cellpadding=0 cellspacing=0>';
h+='<tr>';

h+='<td><select name=ddlmonth style="font-size:8pt;" onchange="calmonth(' + day + ',this.options[this.selectedIndex].value, ' + year + ');">'

for (var a = 0; a < monthnumber.length; a++)
{
 h+='<option value=' + monthnumber[a]

if (month == monthnumber[a])
{
h+=' selected=selected';
}

h+='>' + monthname[a] + '</option>';
}

h+='</select></td>'
h+='<td>&nbsp;</td>';
h+='<td><select name=ddlyear style="font-size:8pt;" onchange="calyear(' + day + ',' + month + ',this.options[this.selectedIndex].value);">'

for (var a = 0; a < yn.length; a++)
{
 h+='<option value=' + yn[a]

if (year == yn[a])
{
h+=' selected=selected';
}

h+='>' + yn[a] + '</option>';
}

h+='</select></td>'

h+='</tr>';
h+='</table>';
h+='</td>';
h+='<td align=right width="10%" onclick="calup(1,' + month + ',' + year + ')" style="cursor:hand" ' + ArrowStyle + '>&gt;&gt;</a></td>';
h+='</tr></table></td></tr>'
h+='<tr align=center bgcolor=' + DayHeadingBackColor + ' ' + DayStyle + '>';
h+='<td ' + HeadingCellAttributes + '>Sun</td>';
h+='<td ' + HeadingCellAttributes + '>Mon</td>';
h+='<td ' + HeadingCellAttributes + '>Tue</td>';
h+='<td ' + HeadingCellAttributes + '>Wed</td>';
h+='<td ' + HeadingCellAttributes + '>Thu</td>';
h+='<td ' + HeadingCellAttributes + '>Fri</td>';
h+='<td ' + HeadingCellAttributes + '>Sat</td>';
h+='</tr>';

for(CellLoop=0; ;CellLoop++)
{
DayLoop++;
WeekLoop++;

if (isdate(DayLoop, month, year) == false)
{
break;
}

var TheDate=new Date(year, month-1, DayLoop);

if (WeekLoop == 1)
{
h+='<tr>'
}

if (CellLoop < TheDate.getDay())
{
if (pday=='')
{
pmonth=month-1;
pyear=year;

if (pmonth == 0)
{
pmonth=12;
pyear=year-1;
}

if (pyear/4 == parseInt(pyear/4))
{
ml[1] = 29;
}
else
{
ml[1] = 28;
}

pday=ml[pmonth-1]-TheDate.getDay()-CellLoop+1;

}
else
{
pday++;
}

h+='<td onclick="calout(' + pday + ',' + pmonth + ',' + pyear + ')" style="cursor:hand" width="14%" bgcolor=' + ShadeColor + ' onmouseover="this.style.background=\'' + HoverDayBackColor + '\'" onmouseout="this.style.background=\'' + ShadeColor + '\'"><table border=0 cellpadding=1 cellspacing=0 width="100%"><tr><td align=right ' + AlternateMonth + '>' + pday + '</td></tr></table></td>';
DayLoop=0;
}
else
{
h+='<td onclick="calout(' + DayLoop + ',' + month + ',' + year + ')" width="14%" style="cursor:hand" valign=top'

if (sday==DayLoop && smonth==month && syear==year)
{
h+=' bgcolor="' + SelectDayBackColor + '" onmouseover="this.style.background=\'' + HoverDayBackColor + '\'" onmouseout="this.style.background=\'' + SelectDayBackColor + '\'">';
}
else
{
h+=' bgcolor="' + DayBackColor + '" onmouseover="this.style.background=\'' + HoverDayBackColor + '\'" onmouseout="this.style.background=\'' + DayBackColor + '\'">';
}

h+='<table border=0 cellpadding=1 cellspacing=0 width="100%"><tr><td align=right ' + LinkStyle + '>' + DayLoop + '</td></tr></table></td>';
}

if (WeekLoop == 7)
{
h+='</tr>';
WeekLoop=0;
}
}

var CellFill=TheDate.getDay()

if (CellFill != 7)
{
var nmd=0;

month++;

if (month == 13)
{
month=1;
year++;
}

for (i = CellFill+2; i <= 7; i++)
{
nmd++;
h+='<td onclick="calout(' + nmd + ',' + month + ',' + year + ')" style="cursor:hand" width="14%" bgcolor=' + ShadeColor + ' onmouseover="this.style.background=\'' + HoverDayBackColor + '\'" onmouseout="this.style.background=\'' + ShadeColor + '\'"><table border=0 cellpadding=1 cellspacing=0 width="100%"><tr><td align=right ' + AlternateMonth + '>' + nmd + '</td></tr></table></td>';
}

h+='</tr>';
}

h+='</table>';
h+='</td></tr></table>';

document.getElementById("caldiv").innerHTML=h;
document.getElementById("caldiv").style.visibility='visible';



	var IfrRef = document.getElementById('calshim');



	IfrRef.style.width = document.getElementById("caldiv").offsetWidth;

    	IfrRef.style.height = document.getElementById("caldiv").offsetHeight;

    	IfrRef.style.top = document.getElementById("caldiv").style.top;

    	IfrRef.style.left = document.getElementById("caldiv").style.left;

    	IfrRef.style.zIndex = document.getElementById("caldiv").style.zIndex - 1;

    	IfrRef.style.display = "block";

	IfrRef.style.visibility='visible';



}



function calmultiple()

{

	if (document.getElementById("datediv").style.visibility == 'visible')

	{

		document.getElementById("datediv").style.visibility = 'hidden';

		document.getElementById("txtDate2").value = '';

		document.getElementById("dateimage").src='images/datetype_multiple.gif';

		document.getElementById("datediv").style.width='1px';

	}

	else

	{

		document.getElementById("datediv").style.visibility = 'visible';

		document.getElementById("txtDate2").value = document.getElementById("dd").value;

		document.getElementById("dateimage").src='images/datetype_single.gif';

		document.getElementById("datediv").style.width=130;

	}

}


function rollOver(strImg, strID){
	var strEval = "document.getElementById('" + strID + "');";
	var objImg = eval(strEval);
	if (objImg){
	    //alert(strImg);
		objImg.src = strImg;
	}
}


function clearDates(){
    var objFromDate1 = document.getElementById('txtFromDate');
    var objFromDate2 = document.getElementById('txtFromDate_Display');
    var objToDate1 = document.getElementById('txtToDate');
    var objToDate2 = document.getElementById('txtToDate_Display');
    
    if (objFromDate1){
        objFromDate1.value = "";
    }

    if (objFromDate2){
        objFromDate2.value = "";
    }

    if (objToDate1){
        objToDate1.value = "";
    }

    if (objToDate2){
        objToDate2.value = "";
    }
}

function popUp(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
	var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
	var int_windowTop = (screen.height - a_int_windowHeight) / 2;
	var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable;
	var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
	if (parseInt(navigator.appVersion) >= 4) {
		obj_window.window.focus();
	}
}

function setFilter(fieldName, fieldValue){
    var objField = document.getElementById(fieldName)
    if (objField){
        objField.value = fieldValue;
        //alert("objField.value = " + objField.value)
        document.Form1.submit();
    }
}

function showCCFields(){
	var objPaymentMethod = document.Form1.ddPaymentMethod;
	var objCCFields = document.getElementById("divCCFields");
	if (objCCFields){
		if (objPaymentMethod){
			var strPaymentMethod = objPaymentMethod[objPaymentMethod.selectedIndex].value;
			if (strPaymentMethod == "02A"){
				objCCFields.style.display = "inline";
			}
			else {
				objCCFields.style.display = "none";
			}
		}
	}
}


function positionIFrame(divid, frmid)
{
	var div = document.getElementById(divid);
	var frm = document.getElementById(frmid);
    if (div) {
        yPos = findYPos(div);
    }
    xPos = findXPos(div)
	frm.style.left = xPos + 'px';
	frm.style.top = yPos + 'px';
	frm.style.height = div.offsetHeight + 'px';
	frm.style.width = div.offsetWidth + 'px';
	frm.style.display = "block";
}

function showStudentList(){
    var objDiv = document.getElementById("divStudentList");
    //alert("start");
    if (objDiv){
        //alert("div exists");
        var objMCAttending = document.getElementById("ddMCAttending");
        var objOtherStudents = document.Form1.ddOtherStudents;

        var strMCAttending = "";
        var strOtherStudents = "";

        if (objMCAttending){
            strMCAttending = objMCAttending[objMCAttending.selectedIndex].value;
        }
        
        if (objOtherStudents){
            strOtherStudents = objOtherStudents[objOtherStudents.selectedIndex].value
        }

        //alert("strOtherStudents = " + strOtherStudents);
        if (strMCAttending == "0" || strOtherStudents == "1"){
            objDiv.style.display = "inline";
            if (objOtherStudents){
                objOtherStudents.selectedIndex = 1;
            }
        }
        else {
            objDiv.style.display = "none";
        }
    }
}

function showStudentList2(){
    var objDiv = document.getElementById("divStudentList");
    //alert("start");
    if (objDiv){
        //alert("div exists");
        var objMCAttending = document.getElementById("ddMCAttending");
        var objTotalStudents = document.getElementById("ddTotalStudents");

        var strMCAttending = "";
        var strTotalStudents = "";

        if (objMCAttending){
            strMCAttending = objMCAttending[objMCAttending.selectedIndex].value;
        }
        
        if (objTotalStudents){
            strTotalStudents = objTotalStudents[objTotalStudents.selectedIndex].value
        }
        
        if (strMCAttending != "" && strTotalStudents != "")
            objDiv.style.display = "inline";
        else
            objDiv.style.display = "none";
    }
}


function showOffsiteAddress(){
    var objDiv = document.getElementById("divOffsiteAddress");
    if (objDiv){
        var strCourseLocation = "";
        var objCourseLocation = document.getElementById("ddCourseLocation");

        if (objCourseLocation){
            strCourseLocation = objCourseLocation[objCourseLocation.selectedIndex].value;
        }
        
        if (strCourseLocation == "Off-site")
            objDiv.style.display = "inline";
        else
            objDiv.style.display = "none";
    }
    
}


function DisplayOtherPreference(){
    var objDiv = document.getElementById("OtherPreferred");
    if (objDiv){
        var objSchedule = document.Form1.ddSchedule;
        var strScheduleLocation = "";
        var intSelectedIndex = 0;
        if (objSchedule){
            intSelectedIndex = objSchedule.selectedIndex;
            strScheduleLocation = objSchedule[intSelectedIndex].value;
        }
        if ((strScheduleLocation == "0|0" || strScheduleLocation == "-1|-1")&& intSelectedIndex > 0)
            objDiv.style.display = "inline";
        else
            objDiv.style.display = "none";
    }
}

var req = createXMLHttpRequest();
function createXMLHttpRequest() {
	var ua;
	if(window.XMLHttpRequest){
		try {
			ua = new XMLHttpRequest();
			//ua.overrideMimeType('text/xml');
			if (ua.overrideMimeType) {
				ua.overrideMimeType('text/xml');
			}
		} 
		catch(e) {
			ua = false;
		}
	} 
	else if(window.ActiveXObject) {
		try {
			ua = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(e) {
			ua = false;
		}
	}
	return ua;
}

function sendRequest(intPageID, intLvl) {
	var objDivPage = document.getElementById("divPage" + intPageID + "_Subs");
	var url = "Page_AJAX.aspx";
	url = url + "?pid=" + intPageID + "&lvl=" + intLvl;
	req.open("GET", url, true);
	req.onreadystatechange = handleResponse;
	req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	req.send(null);
}

function handleResponse() {
	if(req.readyState == 4){
	    var objIFrame = document.getElementById("ifrmPage");
		var response = req.responseText;
		//alert("response = " + response);
		var update = new Array();
		if(response.indexOf('||' != -1)) {
			update = response.split('||');
			var objDivPage = document.getElementById(update[1]);
			if (objDivPage){
				objDivPage.innerHTML = update[2];
			}
		}
	}
}


function expandCollapse(objImg, pageID){
    if (objImg){
        var strSrc = objImg.src;
        var blnShow = false;
        if (strSrc.toLowerCase().indexOf("show") >= 0)
            blnShow = true
        
        var objDiv = document.getElementById("rp" + pageID);
        var objDivSub = document.getElementById("divPage" + pageID + "_Subs");
        
        if (objDiv){
            if (blnShow)
                objDiv.className = "rootPageOn";
            else
                objDiv.className = "rootPage";
        }
        
        if (objDivSub){
            // alert(objDivSub.style.display);
            if (blnShow)
                objDivSub.style.display = "inline";
            else
                objDivSub.style.display = "none";
        }

        if (blnShow)
            objImg.src = "images/lk_hide.gif";
        else
            objImg.src = "images/lk_show.gif";
    }
}

function selectPref1(PageID){
    var objDivOld = document.getElementById("divSub" + pref1);
    var objDiv = document.getElementById("divSub" + PageID);

    var objChkOld = document.getElementById("chkPref1_" + pref1);
    var objChk = document.getElementById("chkPref1_" + PageID);
    
    if (objChk){
        var strDisplay = "";
        var blnChecked = objChk.checked;
        if (blnChecked){
            strDisplay = "inline";
        }
        else {
            strDisplay = "none";
        }
        
        if (objDiv){
            objDiv.style.display = strDisplay;
        }
        
        if (objDivOld){
            if (PageID != pref1){
                if (strDisplay == "inline"){
                    objDivOld.style.display = "none";
                    if (objChkOld){
                        objChkOld.checked = false;
                    }
                }
                else {
                    objDivOld.style.display = "inline";
                }
            }
        }
        
        pref1 = PageID;
        
        var objChk2Old = document.getElementById("chkPref2_" + pref2);
        pref2 = 0;
        if (objChk2Old){
            objChk2Old.checked = false;
        }
    }
}

function selectPref2(PageID){
    var objChkOld = document.getElementById("chkPref2_" + pref2);
    var objChk = document.getElementById("chkPref2_" + PageID);

    if (PageID != pref2){
        if (objChkOld){
            objChkOld.checked = false;
        }
    }

    pref2 = PageID;
}

var pref1 = 0;
var pref2 = 0;

function applySurcharge(){
    var objCardType = document.Form1.ddCardType;
    var objTotalAmount = document.Form1.hidTotalAmount;
    var objTotalAmountAmex = document.Form1.hidTotalAmountAmex;
    var objLBTotalAmount = document.getElementById("lblTotalAmount");
    // alert("objCardType = " + objCardType);
    if (objCardType){
        var cardType = objCardType[objCardType.selectedIndex].value;
        if (objLBTotalAmount) {
            if (cardType == 'AMEX'){
                objLBTotalAmount.innerText = objTotalAmountAmex.value;
            }
            else {
                objLBTotalAmount.innerText = objTotalAmount.value;
            }            
        }
    }
}


function showImage()
{                        
   	xGetElementById('image').style.display = "block";                                                
    xGetElementById('data').style.display = "none";  
	xGetElementById('locationSelectedIndex').innerHTML = xGetElementById('location').selectedIndex;      
	xHide('location');                   
}


function hideImage()
{
    xGetElementById('image').style.display = "none";
    xGetElementById('data').style.display = "block"; 
	xGetElementById('location').selectedIndex = xGetElementById('locationSelectedIndex').innerHTML;
	xShow('location');
}

function clickgo(a,b) {
 document.getElementById("subStatus").value=1;
 document.getElementById("subName").value=a;
 document.getElementById("subID").value=b;
 document.getElementById("Form1").submit();
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		map_01_ImageMap_02_over = newImage("images/map_01-ImageMap_02_over.gif");
		map_01_ImageMap_03_over = newImage("images/map_01-ImageMap_03_over.gif");
		map_01_ImageMap_04_over = newImage("images/map_01-ImageMap_04_over.gif");
		map_01_ImageMap_05_over = newImage("images/map_01-ImageMap_05_over.gif");
		map_01_ImageMap_06_over = newImage("images/map_01-ImageMap_06_over.gif");
		map_01_ImageMap_07_over = newImage("images/map_01-ImageMap_07_over.gif");
		map_01_ImageMap_01_over = newImage("images/map_01-ImageMap_01_over.gif");
		preloadFlag = true;
	}
}

function showCity() {
	var objCity1 = document.getElementById('Cities');
	var objCity2 = document.getElementById('Cities2');
	var objImg = document.getElementById('imgMap');
	
	if (objCity1){
		objCity1.style.display = "inline";
		objCity2.style.display = "none";
		if (objImg){
			objCity1.style.top = (findYPos(objImg)+60) + 'px';
			objCity1.style.left = (findXPos(objImg)+90) + 'px';
		}
	}	
	changeImages('map_01', 'images/map_01-ImageMap_05_over.gif')
/*	
    document.getElementById("Cities").style.top = '10px';
	document.getElementById("Cities").style.display = 'inline';
	document.getElementById("Cities2").style.display = 'none';
*/	
	
}
function hideCity() {
	document.getElementById("Cities").style.display = 'none';
	changeImages('map_01', 'images/map_01.gif'); 
	return true;
}

function showCity2() {
	var objCity1 = document.getElementById('Cities');
	var objCity2 = document.getElementById('Cities2');
	var objImg = document.getElementById('imgMap');
	
	if (objCity2){
		objCity2.style.display = "inline";
		objCity1.style.display = "none";
		if (objImg){
			objCity2.style.top = (findYPos(objImg)+30) + 'px';
			objCity2.style.left = (findXPos(objImg)+140) + 'px';
		}
	}	
/*
	document.getElementById("Cities2").style.display = 'inline';
	document.getElementById("Cities").style.display = 'none';
*/
	changeImages('map_01', 'images/map_01-ImageMap_04_over.gif')
}
function hideCity2() {
	document.getElementById("Cities2").style.display = 'none';
	changeImages('map_01', 'images/map_01.gif'); 
	return true;
}


function ShowContextMenu(e)
{                
}


function showSearchField(){
	var objDiv1 = document.getElementById('divSF');
	var objDiv2 = document.getElementById('imgSF');
	if (objDiv1){
		objDiv1.style.display = "inline";
		if (objDiv2){
			objDiv1.style.top = (findYPos(objDiv2)-9) + 'px';
			objDiv1.style.left = (findXPos(objDiv2)) + 'px';
		}
	}
	var objButtonID = document.Form1.hidButtonID;
	if (objButtonID){
	    objButtonID.value = "";
	}
}

function submitLPForm(){
    var objForm = document.LPLoginForm;
    if (objForm){
        objForm.username.value = document.Form1.txtLPEmail.value;
        objForm.password.value = document.Form1.txtLPPwd.value;
        objForm.submit();
    }
}



function search(whichform, whichframe) {

    //  TEST FOR IE5 FOR MAC (NO DOCUMENTATION)
    if (is_ie4up && is_mac) return;
    //  TEST FOR NAV 6 (NO DOCUMENTATION)
    if (is_gecko && (is_rev <1)) return;
    //  TEST FOR Opera (NO DOCUMENTATION)
    if (is_opera) return;
    //  INITIALIZATIONS FOR FIND-IN-PAGE SEARCHES

    if(whichform.findthis.value!=null && whichform.findthis.value!='') {
        str = whichform.findthis.value;
        win = whichframe;
        var frameval=false;
        if(win!=self){
           frameval=true;  // this will enable Nav7 to search child frame
           win = parent.frames[whichframe];
        }
    }
    else return;  //  i.e., no search string was entered

    var strFound;
    //  NAVIGATOR 4 SPECIFIC CODE
    if(is_nav4 && (is_minor < 5)) {
        strFound=win.find(str); // case insensitive, forward search by default
        //  There are 3 arguments available:
        //  searchString: type string and it's the item to be searched
        //  caseSensitive: boolean -- is search case sensitive?
        //  backwards: boolean --should we also search backwards?
        //  strFound=win.find(str, false, false) is the explicit
        //  version of the above
        //  The Mac version of Nav4 has wrapAround, but
        //  cannot be specified in JS
    }
    //  NAVIGATOR 7 and Mozilla rev 1+ SPECIFIC CODE (WILL NOT WORK WITH NAVIGATOR 6)

    if (is_gecko && (is_rev >= 1)) {
        if(frameval!=false) win.focus(); // force search in specified child frame
        strFound=win.find(str, false, false, true, false, frameval, false);

        //  The following statement enables reversion of focus 
        //  back to the search box after each search event 
        //  allowing the user to press the ENTER key instead
        //  of clicking the search button to continue search.
        //  Note: tends to be buggy in Mozilla as of 1.3.1
        //  (see www.mozilla.org) so is excluded from users 
        //  of that browser.

        if (is_not_moz)  whichform.findthis.focus();
        //  There are 7 arguments available:
        //  searchString: type string and it's the item to be searched
        //  caseSensitive: boolean -- is search case sensitive?
        //  backwards: boolean --should we also search backwards?
        //  wrapAround: boolean -- should we wrap the search?
        //  wholeWord: boolean: should we search only for whole words
        //  searchInFrames: boolean -- should we search in frames?
        //  showDialog: boolean -- should we show the Find Dialog?
    }

    if (is_ie4up) {
        // EXPLORER-SPECIFIC CODE revised 5/21/03
        if (TRange!=null) {
            TestRange=win.document.body.createTextRange();
            if (dupeRange.inRange(TestRange)) {
                TRange.collapse(false);
                strFound=TRange.findText(str);
                if (strFound) {
                    //the following line added by Mike and Susan Keenan, 7 June 2003
                    win.document.body.scrollTop = win.document.body.scrollTop + TRange.offsetTop;
                    TRange.select();
                }
            }
            else {
                TRange=win.document.body.createTextRange();
                TRange.collapse(false);
                strFound=TRange.findText(str);
                if (strFound){
                    //the following line added by Mike and Susan Keenan, 7 June 2003
                    win.document.body.scrollTop = TRange.offsetTop;
                    TRange.select();
                }
            }
        }

        if (TRange==null || strFound==0) {
            TRange=win.document.body.createTextRange();
            dupeRange = TRange.duplicate();
            strFound=TRange.findText(str);
            if (strFound) {
                //the following line added by Mike and Susan Keenan, 7 June 2003
                win.document.body.scrollTop = TRange.offsetTop;
                TRange.select();
            }
        }
    }
    if (!strFound) alert ("String '"+str+"' not found!") // string not found
}

var strSearchKeyword = "";
function checkKeyword(BaseURL, e){
    var intTempListItemID = intListItemID;
    //alert("intTempListItemID = " + intTempListItemID);

	var characterCode //literal character code will be stored in this variable
	if(e && e.which){ //if which property of event object is supported (NN4)
		e = e
		characterCode = e.which //character code is contained in NN4's which property
	}
	else {
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	
	var intCharCode = parseInt(characterCode);
	if (intCharCode >= 96 && intCharCode <= 105){
	    characterCode = intCharCode - 48;
	}
	var blnDoSearch = true;
	var strKeyword = "";
    var objKeyword = document.getElementById("txtSearchKeyword");
	if (objKeyword){
	    strKeyword = objKeyword.value;
	}
    //alert("characterCode = " + characterCode);
	//alert("character = " + String.fromCharCode(characterCode))

	var objDiv = document.getElementById("divKeywordList");
    if (objDiv && strSearchKeyword.length > 0){
        objDiv.style.left = (findXPos(objKeyword)-5) + 'px';
        objDiv.style.top = (findYPos(objKeyword)+22) + 'px';
    }
	
	var strChar = "";
	if (characterCode == 8) {
	    strKeyword = strKeyword.substring(0, strKeyword.length-1);
	}
	else if (characterCode == 13) {
	    blnDoSearch = false;
	    objDiv.style.display = "none";
	}
	else {
	    if ((characterCode >= 48 && characterCode <= 57) || (characterCode >= 65 && characterCode <= 90)){
    	    strKeyword += String.fromCharCode(characterCode);
	    }
	}
	strSearchKeyword = strKeyword.toLowerCase();
	//alert("strSearchKeyword = " + strSearchKeyword);
	
    if (blnDoSearch && characterCode != 38 && characterCode != 40){
        intListItemID = 0;
        if (!BaseURL)
            BaseURL = "/"
            
        req = null;
        req = createXMLHttpRequest();            
        if (objKeyword){
            objDiv.innerHTML = "";
            //alert("objDiv.innerHTML = " + objDiv.innerHTML);
	        var url = BaseURL + "ajax-check-keyword.aspx";
	        url +=  "?kw=" + encodeURIComponent(strKeyword) + "&guid=" + encodeURIComponent(guid());
	        //alert("url = " + url);
	        req.open("GET", url, true);
	        req.onreadystatechange = handleResponse2;
	        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	        req.send(null);
	    }
    }
    
    if (characterCode == 38){
        --intTempListItemID;
        blnKeywordMoved = true;
    }
    else if (characterCode == 40) {
        ++intTempListItemID;
        blnKeywordMoved = true;
    }
    else {
        if (characterCode != 13){ 
            // If not the enter key then set to false
            blnKeywordMoved = false;
        }
    }
    
    var objItemDivCurrent = document.getElementById("divItem_" + intListItemID);
    var objItemLinkCurrent = document.getElementById("linkItem_" + intListItemID);
    
    var objItemDiv = document.getElementById("divItem_" + intTempListItemID);
    var objItemLink = document.getElementById("linkItem_" + intTempListItemID);
    
    if (objItemDiv && objItemLink){
        intListItemID = intTempListItemID;
        if (objItemDivCurrent && objItemLinkCurrent){
            objItemDivCurrent.style.backgroundColor='#FFFFFF'
            objItemLinkCurrent.style.color='#555555';
        }
        objItemDiv.style.backgroundColor='#555555';
        objItemLink.style.color='#FFFFFF';
        if (objDiv){
            if (objDiv.style.display != "none"){
                objItemLink.focus();
            }
        }
        
        if (objItemDiv.innerText){
            ExactCourseName = objItemDiv.innerText;
        }
        else {
            if (objItemDiv.innerHTML){
                ExactCourseName = objItemDiv.innerHTML;
            }
            else {
                ExactCourseName = "";
            }
        }

        var objKeyword = document.getElementById("txtSearchKeyword");
        if (objKeyword){
            objKeyword.focus();
        }
    }

}

function handleResponse2() {
	var objDiv = document.getElementById("divKeywordList");
    var objKeyword = document.getElementById("txtSearchKeyword");

	if (objDiv){
	    if(req.readyState == 4){
	        if (req.status==200){
		        var response = req.responseText;
	            //alert(response);
	            intListItemID = 0;
	            if (response.indexOf('NO RESULTS') >= 0){
                    objDiv.style.display = "none";
	            }
	            else {
	                objDiv.innerHTML = response;
	                if (objKeyword){
                        objDiv.style.left = (findXPos(objKeyword)-5) + 'px';
                        objDiv.style.top = (findYPos(objKeyword)+22) + 'px';
                    }
	                objDiv.style.display = "inline";
                }
		    }
		    else {
                objDiv.style.display = "none";
		    }
		    var objSearchStatusIcon = document.getElementById("divSearchStatusIcon");
		    if (objSearchStatusIcon){
		        setTimeout('hideSearchIcon();', 1500);
                //objSearchStatusIcon.style.display = "none";
		    }
		    blnSearching = false;
		}
		else {
		    blnSearching = true;
		    var objSearchStatusIcon = document.getElementById("divSearchStatusIcon");
		    if (strSearchKeyword.length > 0){
		        if (objSearchStatusIcon){
                    objSearchStatusIcon.style.left = (findXPos(document.getElementById('divSerachKeywordTextbox')))+265 + 'px';
                    objSearchStatusIcon.style.top = (findYPos(document.getElementById('divSerachKeywordTextbox')))+2 + 'px';
		            objSearchStatusIcon.style.display = "inline";
		        }
		    }
		    else {
		        if (objSearchStatusIcon){
		            setTimeout('hideSearchIcon();', 1500);
		        }
		    }
		}
    }
}

function hideSearchIcon(){
    var objSearchStatusIcon = document.getElementById("divSearchStatusIcon");
	if (objSearchStatusIcon){
	    objSearchStatusIcon.style.display = "none";
	}
}

function closeDiv(DivName){
    //alert("blnDisableCloseDiv = " + blnDisableCloseDiv);
    var objDiv = document.getElementById(DivName);
    if (!blnDisableCloseDiv){
        if (objDiv){
            objDiv.innerHTML = "";
            objDiv.style.display = "none";
        }
        intListItemID = 0;
	    var objSearchStatusIcon = document.getElementById("divSearchStatusIcon");
	    if (objSearchStatusIcon){
            setTimeout('hideSearchIcon();', 1500);
	    }
        
    }
    else {
        if (objDiv){
            objDiv.style.display = "inline";
        }
    }
    
}

function openDiv(DivName){
    var objDiv = document.getElementById(DivName);
    var objKeyword = document.getElementById("txtSearchKeyword");
    if (objDiv && objKeyword){
        var strKeyword = objKeyword.value;
        if (strKeyword == ""){
            objDiv.style.display = "none";
        }
        else {
            if (objDiv.style.display != "inline"){
                objDiv.style.left = (findXPos(objKeyword)-5) + 'px';
                objDiv.style.top = (findYPos(objKeyword)+22) + 'px';
                intListItemID = 0;
            }
            objDiv.style.display = "inline";
        }
    }
}

function returnKeyword(kw){
    var objKeyword = document.getElementById("txtSearchKeyword");
    //alert("kw = " + kw);
    if (objKeyword){
        objKeyword.value = kw;
        objKeyword.focus();
        if (kw != ""){
            submitKeywordSearch(kw);
        }
    }
    closeDiv("divKeywordList");
}

function submitKeyword(){
    var objKeyword = document.getElementById("txtSearchKeyword");
    if (objKeyword){
        submitKeywordSearch(objKeyword.value);
    }
}

function S4() {
    return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

function guid() {
    return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}

function clearHighlightedKeyword(){
    var objItemDivCurrent = document.getElementById("divItem_" + intListItemID);
    var objItemLinkCurrent = document.getElementById("linkItem_" + intListItemID);
    
    if (objItemDivCurrent && objItemDivCurrent){
        objItemDivCurrent.style.backgroundColor='#FFFFFF'
        objItemLinkCurrent.style.color='#555555';
    }
    
    var objKeyword = document.getElementById("txtSearchKeyword");
    if (objKeyword){
        objKeyword.focus();
    }
}


var intListItemID = 0;
var blnDisableCloseDiv = false;
var blnKeywordMoved = false;
var ExactCourseName = "";
var blnSearching = false;


function initScripts(){
    var browser = navigator.appName;
    var b_version = navigator.appVersion;
    var version = parseFloat(b_version);
    
    //alert(browser + "|" + b_version + "|" + version);
    if (b_version.indexOf("MSIE") >= 0){    
        var objDivKeywordList = document.getElementById("divKeywordList");
        if (objDivKeywordList){
            objDivKeywordList.style.width = "295";
        }
    }

    var objKeyword = document.getElementById("txtSearchKeyword");
    if (objKeyword){
        //objKeyword.style.color = "#000000";
        objKeyword.value = "Search for a Course"
    }
}






function sc_displayattendee(item) {

 if (document.getElementById('ds:'+item).value=='1') {
  document.getElementById('divAtt:'+item).style.display='none';
  document.getElementById('ds:'+item).value='';
  document.getElementById('AttLink:'+item).innerHTML='<a href="#" onclick="sc_displayattendee('+item+');return false;" style="font-size:10px;">Add&nbsp;Attendees</a>';
 } else {
  document.getElementById('divAtt:'+item).style.display='inline';
  document.getElementById('ds:'+item).value='1';
  document.getElementById('AttLink:'+item).innerHTML='<a href="#" onclick="sc_displayattendee('+item+');return false;" style="font-size:10px;">Hide&nbsp;Attendees</a>';
 }

}





function sc_deletecourse(item) {


 if (confirm('Are you sure you want to delete the course?')) {
  clickgo('CourseRemove',item);
 }

}


function sc_qtychange(item,l) {

 var q=document.getElementById('qty:'+item).value;
 var pre=document.getElementById('preqty:'+item).value;

 var status=true;

 if (Number(q) < Number(pre)) {

  var messagecount='';

  if ((Number(pre)-Number(q))==1) {messagecount='attendee';} else {messagecount=(Number(pre)-Number(q)) + ' attendees';}

  if (confirm('Reducing the number of attendees will result in the last ' + messagecount + ' being deleted.\nPress OK to confirm.')) {
	status=true;
  } else {
	status=false;
  }

 }

 if (status==true) {
	document.getElementById('preqty:'+item).value=q;
	sc_attendeeform(item,l);

 } else {
	document.getElementById('qty:'+item).value=pre;
 }

}




function sc_attendeeform(item,l) {

 var q=document.getElementById('qty:'+item).value;
 var h=new Array();
 var price=0;

 var FirstNameId='';
 var FirstNameValue='';
 var LastNameId='';
 var LastNameValue='';
 var EmailId='';
 var EmailValue='';
 var ErrorId='';

 if (document.getElementById('pr:'+item) != null) {
  price=formatCurrency(q * Number(document.getElementById('pr:'+item).value));
  document.getElementById('divpr:'+item).innerHTML=price+document.getElementById('prtext:'+item).value;
 }


 h.push('<table border="0" cellpadding="10" cellspacing="0" width="100%"><tr><td bgcolor="#AADFFF"><table border="0" cellpadding="1" cellspacing="0" style="font-size:10px;">');

 h.push('<tr><td colspan="6">');


 ErrorId='error:' + item;

 if (document.getElementById(ErrorId) != null) {
  if (document.getElementById(ErrorId).value != '') {
   h.push('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td style="padding-bottom:6px;font-size:11px;color:#ff0000;" align="center">' + document.getElementById(ErrorId).value + '</td></tr></table>');
  }
 }

 h.push('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top" style="padding-bottom:6px;font-size:11px;">Please enter the attendee details below and click the Save button on the right.<br />More attendees can be added by using the \'Qty\' drop down above.</td><td align="right" style="padding-bottom:6px;"><a href="#" onclick="getattendeedata();clickgo(\'AttendeeDataSave\',\'0\');return false;"><img src="/images/but_Save.gif" border="0" width="51px" height="21px" alt="Save" /></a></td></tr></table>');

 h.push('</td></tr>');


 for (i = 1; i <= q; i++) {

	FirstNameId='firstname:' + item + ':' + i;
	if (document.getElementById(FirstNameId) != null) {FirstNameValue=document.getElementById(FirstNameId).value;} else {FirstNameValue='';}
	LastNameId='lastname:' + item + ':' + i;
	if (document.getElementById(LastNameId) != null) {LastNameValue=document.getElementById(LastNameId).value;} else {LastNameValue='';}
	EmailId='email:' + item + ':' + i;
	if (document.getElementById(EmailId) != null) {EmailValue=document.getElementById(EmailId).value;} else {EmailValue='';}
		
	h.push('<tr>');
	h.push('<td>First&nbsp;Name:</td>');
	h.push('<td><input type="text" id="'+ FirstNameId + '" name="'+ FirstNameId + '" value="' + FirstNameValue + '" maxlength="64" style="height:14px;font-size:8pt;width:130px;" /></td>');
	h.push('<td>&nbsp;Last&nbsp;Name:</td>');
	h.push('<td><input type="text" id="'+ LastNameId + '" name="'+ LastNameId + '" value="' + LastNameValue + '" maxlength="64" style="height:14px;font-size:8pt;width:130px;" /></td>');
	h.push('<td>&nbsp;Email:</td>');
	h.push('<td><input type="text" id="'+ EmailId + '" name="'+ EmailId + '" value="' + EmailValue + '" maxlength="128" style="height:14px;font-size:8pt;width:270px;" /></td>');
	h.push('</tr>');

 }

 h.push('</table></td></tr>')

 if (l==0) {
  	h.push('<tr><td style="padding:0px;">&nbsp;</td></tr>');
 }

 h.push('</table>');

 document.getElementById('divAtt:'+item).innerHTML=h.join('');

}



function getattendeedata() {
	
	var itemArray=document.getElementById('itemlist').value.split(',');
	var ad=new Array();
	
	for ( j = 0; j < itemArray.length; j++ ) {
	
		theitem=itemArray[j];
		
		if (theitem != '') {
			
			var q=document.getElementById('qty:'+theitem).value;
			
			ad.push('Start__Attendee__Item__' + theitem);
			
			for (i = 1; i <= q; i++) {

				FirstNameId='firstname:' + theitem + ':' + i;
				if (document.getElementById(FirstNameId) != null) {FirstNameValue=document.getElementById(FirstNameId).value;} else {FirstNameValue='';}
				LastNameId='lastname:' + theitem + ':' + i;
				if (document.getElementById(LastNameId) != null) {LastNameValue=document.getElementById(LastNameId).value;} else {LastNameValue='';}
				EmailId='email:' + theitem + ':' + i;
				if (document.getElementById(EmailId) != null) {EmailValue=document.getElementById(EmailId).value;} else {EmailValue='';}
					
						
				ad.push(FirstNameValue + '~|~|~|~|~|~' + LastNameValue + '~|~|~|~|~|~' + EmailValue + '~~||~~||~~||~~');

			}
			 
			 ad.push('End__Attendee__Item__' + theitem);

			document.getElementById('TotalAttendeeData').value=ad.join('');
		}
	
	}
}

function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num + '.' + cents);
}


var lastImgSrc = "";

//  IMPORTANT NOTICE!
//  Preloading images in script.js file no longer allowed. Referencing images with invalid/broken urls causes entire website to slow down.



function loadFlashMovies() {
    //alert("start");
    var objIFrame1 = document.getElementById("ifrmMovie1");
    if (objIFrame1) {
        //alert("reload frame 1");
        objIFrame1.src = "/UserImages/FlashMovies/Awards_Movie/slideshow.html";
    }
    var objIFrame2 = document.getElementById("ifrmMovie2");
    if (objIFrame2) {
        //alert("reload frame 2");
        objIFrame2.src = "/UserImages/FlashMovies/Special_Offers_Movie/slideshow.html";
    }
    var objIFrame3 = document.getElementById("ifrmMovie3");
    if (objIFrame3) {
        //alert("reload frame 3");
        objIFrame3.src = "/Flash/MS-SpecialOffers/slideshow.html";
    }
    //alert("end");
}
