var http_request = false; function makePOSTRequest(url, parameters) { http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { // set type accordingly to anticipated content type //http_request.overrideMimeType('text/xml'); http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open('POST', url, true); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Connection", "close"); http_request.send(parameters); } function alertContents() { if (http_request.readyState == 4) { if (http_request.status == 200) { //alert(http_request.responseText); result = http_request.responseText; document.getElementById('shoutbox').innerHTML = result; } else { alert('There was a problem with the request.'); } } } function getCursorPos(input) { if ("selectionStart" in input && document.activeElement == input) { return { start: input.selectionStart, end: input.selectionEnd }; } else if (input.createTextRange) { var sel = document.selection.createRange(); if (sel.parentElement() === input) { var rng = input.createTextRange(); rng.moveToBookmark(sel.getBookmark()); for (var len = 0; rng.compareEndPoints("EndToStart", rng) > 0; rng.moveEnd("character", -1)) { len++; } rng.setEndPoint("StartToStart", input.createTextRange()); for (var pos = { start: 0, end: len }; rng.compareEndPoints("EndToStart", rng) > 0; rng.moveEnd("character", -1)) { pos.start++; pos.end++; } return pos; } } return -1; } function insertSmiley(smiley) { var currentText = document.getElementById("sbcontent"); var smileyWithPadding = " " + smiley + " "; currentText.value += smileyWithPadding; currentText.focus(); } function TogSmileyOFF() { document.getElementById('smileycont').style.display = "none"; } function TogSmileyON() { document.getElementById('smileycont').style.display = ""; } function TogSmiley() { if (document.getElementById('smileycont').style.display == "") { document.getElementById('smileycont').style.display = "none"; } else { document.getElementById('smileycont').style.display = ""; } } function InsSmiley(id) { var obj = document.getElementById('sbcontent'); if(typeof(document.selection)!='undefined') { obj.focus(); var range = document.selection.createRange(); if(range.parentElement() != obj) { return false; } var orig = obj.value.replace(/rn/g, "n"); range.text = id; var actual = tmp = obj.value.replace(/rn/g, "n"); for(var diff = 0; diff < orig.length; diff++) { if(orig.charAt(diff) != actual.charAt(diff)) break; } for(var index = 0, start = 0; (tmp = tmp.replace(id, "")) && (index <= diff); index = start + id.length) { start = actual.indexOf(id, index); } } else { var startPos = obj.selectionStart; var endPos = obj.selectionEnd; obj.value = obj.value.substr(0, startPos) + id + obj.value.substr(endPos, obj.value.length); } } function c() { var strtxt = document.getElementById("sbcontent").value; if (strtxt == 'Leave Message ...') document.getElementById("sbcontent").value=''; } function co() { var strtxt = document.getElementById("sbcontent").value; if (strtxt == '') document.getElementById("sbcontent").value='Leave Message ...'; } function get() { var poststr = "sbcontent=" + encodeURI( document.getElementById("sbcontent").value ) + "&commpages=" + encodeURI( document.getElementById("commpages").value ) + "&commmember=" + encodeURI( document.getElementById("commmember").value ) + "&commid=" + encodeURI( document.getElementById("commid").value ) + "&method=add"; if (poststr.length > ) { alert('Max. comments character'); } else { makePOSTRequest('co/viewsb.php', poststr); } } function view(obj) { var poststr = "pg=" + encodeURI( obj ); makePOSTRequest('co/viewsb.php', poststr); } function vco(obj) { var poststr = "s=" + encodeURI( obj ); makePOSTRequest('co/viewsb.php', poststr); } function getdel(obj) { var poststr = "commid=" + encodeURI( obj ) + "&method=del"; makePOSTRequest('co/viewsb.php', poststr); } function getdela(obj) { var poststr = "commid=" + encodeURI( obj ) + "&method=del"; makePOSTRequest('co/viewacomm.php', poststr); }