var xmlHttp; var lid; //Added 10-8-09...having trouble with the onclick changing in IE. Workaround: use a lobby with a global toggle var. function ajaxSaveLessonOrNoteEditLobby( ) { if( isNoteEdit == false ) lessonSaveOrNoteEdit(); else { var href = '/profile/notes.php?type=add&lid=346'; var title = 'Add a note'; openMediaBox(href, title, 560, 390); } } function lessonSaveOrNoteEdit() { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { return; } xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET","/profile/ajaxProfileSave.php?lid=346",true); xmlHttp.send(null); } function stateChanged() { var status; if (xmlHttp.readyState==4) { status = xmlHttp.responseText; if(status == true) { var href = '/profile/notes.php?type=add&lid=346'; var title = 'Add a note'; var onclick = "openMediaBox('" + href + "', '" + title + "', 560, 390);"; document.getElementById('save_lesson_link').alt = title; document.getElementById('save_lesson_link').title = title; document.getElementById('save_lesson_link').innerHTML = ""; //document.getElementById('save_lesson_link').setAttribute("onclick", '' ); //document.getElementById('save_lesson_link').setAttribute("onClick", openMediaBox(href, title, 560, 390) ); isNoteEdit = true; } else document.getElementById('saveOrEdit').innerHTML = status; } } function getNewestNote(lesson_id) { lid = lesson_id; xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { return; } xmlHttp.onreadystatechange=stateChanged2; xmlHttp.open("GET","/profile/ajaxProfileShow.php?lid=" + lid,true); xmlHttp.send(null); } function stateChanged2() { var html; var canSet; if (xmlHttp.readyState==4) { var anchor = ""; html = xmlHttp.responseText; if( document.getElementById('note_display_note_' + lid) && document.getElementById('note_view_notes_' + lid) ) canSet = true; else canSet = false; if( canSet == true ) { document.getElementById('note_display_note_' + lid).innerHTML= html; if(html.length > 0) { document.getElementById('note_view_notes_' + lid).innerHTML= anchor; document.getElementById('note_view_notes_' + lid).className = 'note_images' } else document.getElementById('note_view_notes_' + lid).innerHTML= ""; } } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }