function openPdfWnd( url) 
{
    width = 600;
    height = 530;
    features = "scrollbars,resizable,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
    var win = window.open(url,"TechConnect",features, false);
}


function openLessonPlanWnd( url) 
{
    width = 600;
    height = 530;
    features = "scrollbars,resizable,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
    var win = window.open(url,"TechConnect",features, false);
}

function openAboutWnd( url) 
{
    width = 600;
    height = 530;
    features = "scrollbars,resizable,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
    var win = window.open(url,"TechConnect",features, false);
}



function openContactUsWindow(url)
{
    width = getWidth(500);
    height = 300;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open(url,"ContactUs",features, false);
    win.focus();
}


function ImgSwap(image, newName) {
	image.src = newName;
}


function loadImgs(imgNames) {	
	for(i = 0; i < imgNames.length; i++) {
		var img = new Image();
		img.src = imgNames[i];
	}
	
	
	return img;
}


function openClassEditWindow(url)
{
    width = getWidth(700);
    height = 265;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open(url,"EditClass",features, false);
    win.focus();
}

function openConfirmDeleteStudentsWindow(url)
{
    width = getWidth(500);
    height = 265;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open(url,"Delete",features, false);
    win.focus();
}


function openStudentEditWindow(form, url)
{
    width = getWidth(700);
    height = 265;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open("about:blank","EditStudents",features, false);
    win.focus();
    
    var tmpTarget = form.target;
    var tmpAction = form.action;
    
    
    form.target = "EditStudents";
    form.action = url;
    form.submit();
    
    form.target = tmpTarget;
    form.action = tmpAction;
    
    
    
}

function openStudentInfoWindow(url) 
{
    width = getWidth(500);
    height = 400;
    features = "toolbar=yes,scrollbars,width=" + width + ",height=" + height;
    var win = window.open(url,"StudentInfo",features, false);
    win.focus();
}

function openAddActivityFolderWindow(frm, nCount, tar) 
{
   var bChecked = false;
   if(nCount==1){
   		bChecked = frm.ACTIVITYCHECK.checked;
   }
   else{
	   for(i = 0; i < frm.ACTIVITYCHECK.length; i++) {
	   	if(frm.ACTIVITYCHECK[i].checked) {
	   		bChecked = true;
	   	}
	   }
   }
   if(!bChecked) {
   	alert("You must select at least one activity.");
   	return false;
   }


    width = getWidth(500);
    height = 300;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open("about:blank", "StudentInfo", features, false);
    frm.target = "StudentInfo";
    //tar.name = "newTarget";
    //win.targetwin = tar.name;
    
    //frm.action = url;
    frm.submit();
    
    win.focus();
    
    //win.document.forms[0].target = "newTarget";
    
}


function openEditActivityFolderWindow(frm, tar) 
{
    width = getWidth(500);
    height = 300;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open("about:blank", "StudentInfo", features, false);
    frm.target = "StudentInfo";
    //tar.name = "newTarget";
    //win.targetwin = tar.name;
    
    //frm.action = url;
    frm.submit();
    
    win.focus();
    
    //win.document.forms[0].target = "newTarget";
    
}


function deleteAcFolder(frm)
{
	if(confirm("Are you sure you want to delete this folder?"))
		frm.submit();
}


function openAboutContentKeysWindow(url)
{
    width = getWidth(500);
    height = 265;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open(url,"AboutContentKeys",features, false);
    win.focus();
}

function openAboutTTDefaultsWindow(url)
{
    width = getWidth(500);
    height = 361;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open(url,"AboutContentKeys",features, false);
    win.focus();
}

function openAboutAccessCodesWindow(url)
{
    width = getWidth(500);
    height = 400;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open(url,"AboutAccessCodes",features, false);
    win.focus();
}

function openAboutLevelsWindow(url)
{
    width = getWidth(500);
    height = 361;
    features = "scrollbars,width=" + width + ",height=" + height;
    var win = window.open(url,"AboutLevels",features, false);
    win.focus();
}



function getWidth( width ) {
    /* compensate for IE scollbar width */
    if ( !document.layers ) {
        width += 28;
    }
    return width;
}

function selectAllCheck(frm, bCheck) {

	for(var i = 0; i < frm.elements.length; i++) 
		frm.elements[i].checked = bCheck;


}

function reloadForm(frm)
{
	frm.action = "";
	frm.submit();
}

function checkActivityFolderSubmit(frm)
{
	if(frm.FOLDERID.selectedIndex == 0)
		alert ("You must select a folder.");
	else
		frm.submit();
	
}


// browser checker - currently checks for ie5, net4, net6 and mac.  can add aol or opera as well.
ie5 = 0; nn4 = 0; nn6 = 0; isMac = 0;

if(document.images){
    if(navigator.userAgent.indexOf("Opera") != -1){
        op = 1;
    } else {
        if(navigator.userAgent.indexOf("AOL") != -1){
            aol = 1;
        } else {
            ie4 = (document.all && !document.getElementById);
            nn4 = (document.layers);
            ie5 = (document.all && document.getElementById);
            nn6 = (document.addEventListener);
        }
    }
} else {
    v3 = 1;	
}

if(navigator.userAgent.indexOf("Mac") != -1){
    isMac = 1;
}

var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}




function openReportPRWindow(frm, url) 
{

    var b = false;
    for(i = 0; i < frm.elements.length; i++) {
    	if(frm.elements[i].checked)
    		b = true;
    }
    
    if(!b)  {
    	alert("No students are selected.");
    	return;
    }

    width = getWidth(700);
    height = 530;
    features = "scrollbars,screenx=0,screeny=0,left=0,top=0,toolbar,width=" + width + ",height=" + height;
    var win = window.open("about:blank","Report",features, false);
    frm.target = "Report";
    frm.action = url;
    frm.submit();
    
}


function openGlossaryWndL(leter) 
{
    var url = "/tc/TCController?ACTION=23";

    var width = getWidth(500);
    var height = 350;
    var features = "scrollbars,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
    var win = window.open(url, "Glossary", features, true);
}
function openHelpWnd(help)
{
    var url = "/tc/TCController?ACTION=24&help=" + help;
    var width = getWidth(500);
    var height = 350;
    var features = "scrollbars,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
    var win = window.open(url, "Help", features, true);
}


function validateDeleteStudentCheck(frm) 
{

   var bChecked = frm.TODELETE.checked;
   for(i = 0; i < frm.TODELETE.length; i++) {
   	if(frm.TODELETE[i].checked) {
   		bChecked = true;
   	}
   }
   if(!bChecked) {
   	alert("You must select at least one student.");
   	return false;
   }
   return confirm("Each selected student will be removed from this class, and his or her work will be removed permanently from the class portfolio. The seat of each selected student will be restored to the content key, provided that the student has been removed from all Glencoe TechCONNECT classes in which he or she is enrolled (including subject teacher classes and TechCONNECT coordinator classes). Are you sure you want to remove the selected student(s) from this class?");
}	

function validateClassKey(strClass)
{

	if(strClass.length == 0 || parseInt(strClass, 36) == NaN || hasSpecialCharacters(strClass)) {
		alert("In order to add a class you must enter a class key");
		return false;
	}	
	return true;

}


function OpenPreviewActivity(url) 
{
    url = url + '&PREVIEW=true';
    width = getWidth(765);
    height = 530;
    features = "scrollbars,toolbar,menubar,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
    var win = window.open(url,"Preview",features, false);
}




function openBBSWindow( url) 
{
    width = 614;
    height = 654;
    features = "scrollbars,resizable,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
    var win = window.open(url,"TechConnect",features, false);
}
function comment(url)
{
  window.location=url;
}

// Added below functions on 8th July 04 by Sharon
function openPrepareImportFunction()
{
	setupcomplete.submit();
}

function openTemplate(url)
{
    width = 614;
    height = 654;
    features = "scrollbars,resizable,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
	var win = window.open(url,"TechConnect",features, false);
}

function openPage(url)
{
	importpage.action = url;
	importpage.submit();
}
function openIT(url) {
   var width = 1024;
   var height = 768;
 // var width = screen.availHeight;
  //var height = screen.availWidth;
  //if(width > 1024) width = 1024;
  //if(height > 768) height = 768;
   //width = 758;
    //height = 600;
    features = "scrollbars,resizable,screenx=0,screeny=0,left=0,top=0,width=" + width + ",height=" + height;
    var win = window.open(url,"Tutor",features, false);
}
