
function openFile(theFile){
    var winProperties = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,";
	var w = 520;
	var h  = 300;
	var winl = 0;
	var wint = 15;
	var settings  ='height=' + h + ',';
        	      settings +='width='+w+',';
        	      settings +='top='+wint+',';
        	      settings +='left='+ winl + ',' + winProperties;

	var popItWin = window.open(theFile,"subWin",settings);
	if( navigator.appName.substring(0,8) == "Netscape" ) 
		popup.location = popItWin;
	else
		popItWin.location.reload();
	popItWin.focus();
}

function openInfo(theFile){
    var winProperties = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,";
	var w = 499;
	var h  = 350;
	var winl = 0;   //(screen.width-w)/2;
	var wint = 16;   //(screen.height-h)/2;
	if (theFile.indexOf("4") > 0) {
	    h = 330
	}
	var settings  ='height='+h+',';
        	      settings +='width='+w+',';
        	      settings +='top='+wint+',';
        	      settings +='left='+ winl + ',' + winProperties;

	var popItWin = window.open(theFile,"subWin",settings);
	if( navigator.appName.substring(0,8) == "Netscape" ) 
		popup.location = popItWin;
	else
		popItWin.location.reload();
	popItWin.focus();
}

function openPrintable(theFile){
    var winProperties = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,";
	var w = 720;    var h  = 630;
	var winl = 0;   var wint = 15;
	var settings  ='height=' + h + ',';
        	      settings +='width='+w+',';
        	      settings +='top='+wint+',';
        	      settings +='left='+ winl + ',' + winProperties;

	var popItWin = window.open(theFile,"subWin",settings);
	if( navigator.appName.substring(0,8) == "Netscape" ) 
		popup.location = popItWin;
	else
		popItWin.location.reload();
	popItWin.focus();
}

function openPrintableReport(theView, theVal, rptType, theFile){
    var winProperties = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,";
	var w = 700;    var h  = 600;
	var winl = 0;   var wint = 15;
	var settings  ='height=' + h + ',';
        	      settings +='width='+w+',';
        	      settings +='top='+wint+',';
        	      settings +='left='+ winl + ',' + winProperties;
    var theFile = theFile + "?view=" + theView + "&sVal=" + theVal + "&rType=" + rptType
    //alert(theFile)
	var popItWin = window.open(theFile,"subWin",settings);
	if( navigator.appName.substring(0,8) == "Netscape" ) 
		popup.location = popItWin;
	else
		popItWin.location.reload();
	popItWin.focus();
}
function toNextPage(theUrl) {
    window.location.href = theUrl
}

function selectUniversity(theCntrl, thePage) {
//    alert("page " + thePage)
    var theName = theCntrl.name
    var selectNum = theName.substring(theName.length - 1, theName.length)
    thePage = thePage 
    //+ "?uni=" + theCntrl.value + "&fcipID=0" + "&selectNum=" + selectNum
    document.frmFCIP.action = thePage
    document.frmFCIP.submit()
//    window.location.replace(thePage)
}

function selectCourse(cntrlIn, theNum) {
    var courseCntrl = eval("document.frmFCIP.txtCourseID" + theNum)
    /*
    alert(cntrlIn.value)
    if (cntrlIn.value.length < 2 || cntrlIn.value.indexOf("Select") >= 0) {
        courseCntrl.value = ""
        document.frmFCIP.totCourses.value = document.frmFCIP.totCourses.value - 1
        return false
    }
    */
    var coursesAndID = document.frmFCIP.hidUniCourseAndID.value
    var str = coursesAndID.substring(coursesAndID.indexOf(cntrlIn.value+'='), coursesAndID.length)
    var pos = str.indexOf("=") + 1;
    var end = str.indexOf(',');
    str = str.substring(pos, end)
    var isSame = 0;
    var totCourses = 0
    for (var i = 1; i < 7; i ++) {
        var theCntrl = eval("document.frmFCIP.txtCourseID" + i)
        //if (theCntrl.value.length > 0)
            //totCourses = totCourses + 1
        if (str == theCntrl.value && !(theNum == i)) {
            alert("You cannot select more than one course with the same FCIP Code. ")
            cntrlIn.value = ""
            isSame = 1
        }
    }
    if (!(isSame == 1)) {
        courseCntrl.value = str
        //document.frmFCIP.totCourses.value = totCourses + 1
    } 
    //alert("FINAL: " + courseCntrl.value)
}

function selectCompany(theCntrl, thePage) {
    var theName = theCntrl.name
    var selectNum = theName.substring(theName.length - 1, theName.length)
    thePage = thePage + "?comID=" + theCntrl.value + "&pg=" + document.dataForm.thePg.value
    document.dataForm.action = thePage
    document.dataForm.submit()
}
