<!--

function switchMenu(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}


function toggleMenu(objID, imgID) {
if (!document.getElementById) return;
var ob = document.getElementById(objID).style;
ob.display = (ob.display == 'block')?'none' : 'block';

var ob2 = document.getElementById(imgID);
if(ob2.src == 'http://www.visionlearning.com/images/cat_x.jpg'){
    ob2.src='http://www.visionlearning.com/images/cat_-.jpg';
}else{
    ob2.src='http://www.visionlearning.com/images/cat_x.jpg';
}
}

function WinOpen(url,name,w,h){
	winOpts = "toolbar=no,scrollbars=yes,status=yes,resizable=yes,menubar=yes,width="+w+",height="+h+"";
        var win1 = window.open(url,name,winOpts);
	win1.focus();
}


function confirmation($warning,$url){
	if(confirm($warning)){
		location=$url;
	}
}

function confirmationTop($warning,$url){
        if(confirm($warning)){
                parent.location=$url;
        }
}

function andBoom(url) {
	window.open(url,"Viewer",'scrollbars=yes,width='+screen.width+',height='+screen.height+',top=0,left=0');
}

function viewer_loader(url,target,l){

	parent.VLmain.location.href = url;
	parent.VLnav.location.href = "/library/viewer/viewer_nav.php?targ="+target+"&l="+l+"#"+target+"";

}

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) 
field.value = field.value.substring(0, maxlimit);
else
cntfield.value = maxlimit - field.value.length;
}


function closeAndRefresh(url){
        pop = opener.location.href=url;
       	} 
      

function GlossaryChemistry(page,anchor) {
	page = escape(page);
	var url=("http://antoine.frostburg.edu/chem/senese/101/glossary/"+page+".shtml#"+anchor+"");
	msg=open(url,"GlossaryWindow","width=610,height=150,toolbar=no,scrollbars=yes,directories=no,menubar=no,status=no,screenX=50,screenY=50,top=50,left=50");
}

function GlossaryVisionlearning(anchor){
	var url=("http://www.visionlearning.com/library/glossary.htm#"+anchor+"");
	msg=open(url,"GlossaryWindow","width=610,height=150,toolbar=no,scrollbars=yes,directories=no,menubar=no,status=no,resizable=yes,screenX=50,screenY=50,top=50,left=50");
}

function GlossaryChemistry2(let,term){
	term = escape(term); 
	url = "/library/pop_glossary_term.php?term="+term;
	WinOpen(url,'Glossary',500,300);
}

function Glossary(oid){
	url = "/library/pop_glossary_term.php?oid="+oid;
	WinOpen(url,'Glossary',500,300);
}

function addDeGloss(){
        txt = document.forms[0].elements[8].value;
        txt += "^~";
        document.forms[0].elements[8].value = txt;
        document.forms[0].elements[9].checked = true;
        return;
}

function addTable1x2(){
	txt = document.forms[0].elements[8].value;
	txt += "<table>\n<tr>\n <td>\n  <!-- Top Left Cell Content Below -->\n\n </td><td>\n  <!-- Top Right Cell Content below -->\n\n </td>\n</tr>\n</table>\n\n";
	document.forms[0].elements[8].value = txt;
	document.forms[0].elements[9].checked = true;
	return;
}

function addTable2x2(){
        txt = document.forms[0].elements[8].value;
        txt += "<table>\n<tr>\n <td>\n  <!-- Top Left Cell Content Below -->\n\n </td><td>\n  <!-- Top Right Cell Content Below -->\n\n </td>\n</tr>\n<tr>\n <td>\n  <!-- Bottom Left Cell Content Below -->\n\n </td><td>\n  <!-- Bottom Right Cell Content Below -->\n\n </td>\n</tr>\n</table>\n\n";

        document.forms[0].elements[8].value = txt;
        document.forms[0].elements[9].checked = true;

        return;
}

function addTable2x1(){
        txt = document.forms[0].elements[8].value;
        txt += "<table>\n<tr>\n <td>\n  <!-- Top Cell Content Below -->\n\n </td>\n</tr>\n<tr>\n <td>\n  <!-- Bottom Cell Content Below -->\n\n  </td>\n</tr>\n</table>\n\n";

        document.forms[0].elements[8].value = txt;
        document.forms[0].elements[9].checked = true;

        return;
}

function addObjectCode(link){
        txt = document.forms[0].elements[8].value;
        txt += link;
        document.forms[0].elements[8].value = txt;
        document.forms[0].elements[9].checked = true;

        return;
}

function addGlossaryTerm(gtid,term){
        txt = opener.document.forms[0].elements[8].value;
        txt += "<a class=\"gloss\" onMouseover=\"window.status='"+term+"'; return true\" onMouseOut=\"window.status=''; return true;\"  href=\"JavaScript:Glossary("+gtid+");\">"+term+"</a>";

        opener.document.forms[0].elements[8].value = txt;
        self.close();
        return;
}

function addGlossaryTerm2(gtid,term){
        txt = opener.document.forms[0].elements[2].value;
        txt += "<a class=\"gloss\" onMouseover=\"window.status='"+term+"'; return true\" onMouseOut=\"window.status=''; return true;\"  href=\"/library/pop_glossary_term.php?oid="+gtid+"\">"+term+"</a>";

        opener.document.forms[0].elements[2].value = txt;
        self.close();
        return;
}

function addRef(){
        txt = document.forms[0].elements[8].value;
        txt += "<a href=\"#refs\" onClick=\"open_refs();\">#</a>";
        document.forms[0].elements[8].value = txt;
        document.forms[0].elements[9].checked = true;

        return;
}

function addModuleLink(modid,modtitle){
        txt = opener.document.forms[0].elements[8].value;
        txt += "<a href=\"/library/module_viewer.php?mid="+modid+"\">"+modtitle+"</a>";

        opener.document.forms[0].elements[8].value = txt;
        self.close();
        return;
}

function ahah(url, target) {
  document.getElementById(target).innerHTML = ' Fetching data...';
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function load(name, div) {
    ahah(name,div);
    return false;
}

function unload(div){
     document.getElementById(div).innerHTML = '';
}

function open_refs(){

         var item = document.getElementById('refers');
        var txt = document.getElementById('refvis');
         if(item.style.display =='none'){
                item.style.display = 'block';
                txt.innerHTML = '<img src="/images/minus.gif" border="0"> hide'; 
        }
}

function toggle_display(ids){
    var idees = ids.split(",");
    for( var i=0; i < idees.length; i++){
        var divID = idees[i];
        var item = document.getElementById(divID);
        if(divID == "refers"){
                var txt = document.getElementById('refvis');
        }else{
                var txt = document.getElementById('objvis');
        }
        if(item){
            if(item.style.display =='none'){
                item.style.display = 'block';
                txt.innerHTML = '<img src="/images/minus.gif" border="0"> hide';  
   
            }else{
                item.style.display = 'none';
                txt.innerHTML = '<img src="/images/plus.gif" border="0"> view';   
    
            }
        }
    }
}


//-->
