
function addToSetPopup(group_id, resource_id) {
    //open up the add_resource_to_a_set window called "Add resource to a set"
    url = "/tech/popup/retrieveClassGroupByTeacher.do?group_id=" + group_id + "&resource_id=" + resource_id;
    addToSetPopupWindow = window.open(url, "Add_To_Set", "scrollbars,resizable,width=400, height=400");

    // if this window isn't the opener, set it (just in case)
    if (addToSetPopupWindow.opener == null) addToSetPopupWindow.opener = window;
}

function communityPopup(forum) {
    //open up the word in a window called "Community"
    url = "/tech/html/email/email_project_main.jsp";
    communityWindow = window.open(url, "Community", "scrollbars,resizable,width=750,height=160");

    // if this window isn't the opener, set it (just in case)
    if (communityWindow.opener == null) communityWindow.opener = window;
}

function closeIt() {
	// set to close the active window after 10 ms.
	timer = setTimeout('window.close();', 10);
}

function createSetPopup(group_id, session_id) {
    url = "/tech/set/create/unassigned/load.do" + ";jsessionid=" + session_id + "?group_id=" + group_id;
    createSetPopupWindow = window.open(url, "Create_Set", "scrollbars,resizable,width=416, height=330");

    // if this window isn't the opener, set it (just in case)
    if (createSetPopupWindow.opener == null) createSetPopupWindow.opener = window;
}

function generalPopup(url, winName) {
    generalWindow = window.open(url, winName, "toolbar,menubar,scrollbars,resizable,width=720");
    if (window.focus) {generalWindow.focus()}
    if (generalWindow.opener == null) generalWindow.opener = window;
}

function generalPopupSameOptions(url, winName) {
    generalWindow = window.open(url, winName);
    if (window.focus) {generalWindow.focus()}
    if (generalWindow.opener == null) generalWindow.opener = window;
}

function gWord(ID) {
    //open up the word in a window called "glossary"
    url = "/tech/html/resource/glossary/glossary_redirect.jsp?resource_id=" + ID;
    glossaryWindow = window.open(url, "glossary", "scrollbars,resizable,width=320,height=300");

    // if this window isn't the opener, set it (just in case)
    if (glossaryWindow.opener == null) glossaryWindow.opener = window;
}

function openBasicWindow(url, name, width, height)
{
    if(url && name && width && height)
    {
        openWindow(url, name, 'resizable', width, height);
    }
}

function openComingSoonPopup(url){
    if (url) {
        winpops=window.open(url,"comingsoon","resizable, width=500, height=300");
    }
}

function openGenericWindow(url, name, width, height)
{
    if(url && name && width && height)
    {
        openWindow(url, name, 'status,resizable,scrollbars,', width, height);
    }
}
function openPopupWindow(url, name) {
    if(url) {
        var newWin = window.open(url, name);
        newWin.focus();
    }
}

function openStudentViewWindow(url)
{
    if(url)
    {
        openWindow(url, 'student_preview', 'status,scrollbars', '625', '500');
    }
}

function openStudentWindow(url)
{
    if(url)
    {
        // names current window as "main".
		self.name = "main";

		var winNewWindow = window.open(url, "student", "scrollbars,resizable,width=450,height=530");
        winNewWindow.focus();
    }
}



function openWindow(url, name, options, width, height)
{
    if(url && name && options && width && height)
    {
        var winNewWindow = window.open(url, name, options + ',width=' + width + ',height=' + height + ',resizable=no');
        if (winNewWindow.opener == null) winNewWindow.opener = window;
        winNewWindow.focus();
    }
}

function renameWindow() {
   window.name = "tap";
}

function refreashWindow() {
   window.focus();
}

function rmPopup(ID) {
    //open up the word in a window called "Helpful Tip Popup"
    var arr;
    arr = ID.split(",");
    url = "/tech/student/resource/resolveVersion.do?resource_id=";

    for(i=0;i<arr.length;i++)
    {
         url = url + arr[i];
         if (i != arr.length -1 ) {
            url = url + "&resource_id=";
         }
    }
    var w_height = screen.height - 100 - 48;
    var w_width = 560;
    var xpos = screen.width - 25 - w_width;
    var ypos = 25;
    rmPopupWindow = window.open(url, "Reference_Material_Popup", "status,scrollbars,resizable,width=" + w_width + ",height=" + w_height + ", left=" + xpos + ",top=" + ypos);

    // if this window isn't the opener, set it (just in case)
    if (rmPopupWindow.opener == null) rmPopupWindow.opener = window;

    rmPopupWindow.focus();
}

function rmLanguagePopup(language, ID) {
    //open up the word in a window called "Helpful Tip Popup"
    var arr;
    arr = ID.split(",");
    url = "/tech/student/resource/resolveVersion.do?resource_id=";

    for(i=0;i<arr.length;i++)
    {
         url = url + arr[i];
         if (i != arr.length -1 ) {
            url = url + "&resource_id=";
         }
    }
    url = url + "&language=" + language;
    var w_height = screen.height - 100 - 48;
    var w_width = 560;
    var xpos = screen.width - 25 - w_width;
    var ypos = 25;
    rmPopupWindow = window.open(url, "Reference_Material_Popup", "status,scrollbars,resizable,width=" + w_width + ",height=" + w_height + ", left=" + xpos + ",top=" + ypos);

    // if this window isn't the opener, set it (just in case)
    if (rmPopupWindow.opener == null) rmPopupWindow.opener = window;

    rmPopupWindow.focus();
}

function resourceWindow(url, name) {
    if (url && name) {
        var winNewWindow = window.open(url, name, 'status,resizable,scrollbars');
        if (winNewWindow.opener == null) winNewWindow.opener = window;
        winNewWindow.focus();
    }
}

function standardsPopup(resource_id, resource_type, show_title, title) {
    url = "/tech/achieve/teks/display.do?resource_id="+resource_id+"&resource_type="+resource_type+"&show_title="+show_title+"&title="+title;
    standardsPopupWindow = window.open(url, "Standards", "scrollbars,width=510,height=530");
    standardsPopupWindow.focus();
    // if this window isn't the opener, set it (just in case)
    if (standardsPopupWindow.opener == null) standardsPopupWindow.opener = window;

}

function studentWebLibraryPopup()
{
    url = "/tech/webLibrary/student/overview.do";
    webLibraryWindow = window.open(url, "student", "scrollbars,resizable,width=450,height=530");

    // if this window isn't the opener, set it (just in case)
    if (webLibraryWindow.opener == null) webLibraryWindow.opener = window;

    webLibraryWindow.focus();
}

function teacherPrintPopup(linkType, ID) {
    var url;
    if (linkType == 'lesson' || linkType == 'project') {
        url = "/tech/teacher/" + linkType + "/print/wait.do?resource_type=" + linkType + "&resource_id=" + ID;
    } else {
        url = "/tech/teacher/" + linkType + "/print/load.do?resource_type=" + linkType + "&resource_id=" + ID;
    }
    printPopupWindow = window.open(url, "Print_Popup", "toolbar,menubar,scrollbars,resizable,status");
    if (window.focus) {printPopupWindow.focus()}
    if (printPopupWindow.opener == null) printPopupWindow.opener = window;
}


function tutorialChooser(ID) {
    //open up the word in a window called "glossary"
    url = "/tech/software/platform/tutorial/load.do?resource_id=" + ID;
    glossaryWindow = window.open(url, "glossary", "scrollbars,resizable,width=550");

    // if this window isn't the opener, set it (just in case)
    if (glossaryWindow.opener == null) glossaryWindow.opener = window;

}