//Create a boolean variable to check for a valid IE instance. var xmlhttp = false; //Check if we are using IE. try { //If the javascript version is greater than 5. xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { //If not, then use the older active x object. try { //If we are using IE. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { //Else we must be using a non-IE browser. xmlhttp = false; } } //If we are using a non-IE browser, create a JavaScript instance of the object. if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { xmlhttp = new XMLHttpRequest(); } $(document).ready(function(){ $('#dialogMap').dialog({ autoOpen: false, modal: true, height: 450, width: 450 }); $('.dialogMapButton').click(function() { $('#dialogMap').dialog('open'); eUrl = $(this).attr('url'); // alert(eUrl); $("#modalIframeId").attr("src",eUrl); }); $('#addCommentSend').click(function() { commentText = escape($('#addCommentText').val()); theurl = 'bin/addComment.php?number='+number+'&id='+commentId+'&commentText='+commentText; $.getScript(theurl); loadComments(); $("#addCommentText").val(""); }); $('.commentDeleteButton').livequery('click', function(event) { tmp = $(this).attr('id').split('_'); theid = tmp[1]; theurl = 'bin/delComment.php?number='+number+'&id='+theid; // alert('URL: '+theurl); $.getScript(theurl); commentCount--; $('#commentDiv_'+theid).empty(); }); }) function look4Comments() { loadComments(); updateTimerId = setTimeout('look4Comments();', 5000); } function loadComments() { theurl = 'bin/loadNextComment.php?id='+commentId+'&commentCount='+commentCount; $.getScript(theurl); } function getUser() { var number = document.getElementById("number").value; var passcode = document.getElementById("passcode").value; var alias = document.getElementById("alias").value; var objID = "showUser"; var serverPage = "setAlias.php?number="+encode(number)+"&passcode="+encode(passcode)+"&alias="+encode(alias); var obj = document.getElementById(objID); xmlhttp.open("GET", serverPage); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { obj.innerHTML = xmlhttp.responseText; } } xmlhttp.send(null); } function encode(str) { var result = ""; for (i = 0; i < str.length; i++) { if (str.charAt(i) == " ") { result += "+"; } else { result += str.charAt(i); } } return escape(result); } function textCounter(field, countfield) { countfield.value = field.value.length; } function textCounterLimit(field, countfield, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! { field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter } else { countfield.value = maxlimit - field.value.length; } }