function strip_tags(str) { str = str.toString(); return str.replace(/<\/?[^>]+>/gi, ''); } function decodeEntities(encodedString) { var textArea = document.createElement('textarea'); textArea.innerHTML = encodedString; return textArea.value; } function displayAlert( mss , parentID='' , type='success'){ if(parentID!=''){ if(type=='success'){ $('#'+parentID).html(''); } window.setTimeout(function() { $(".alert").fadeTo(500, 0).slideUp(500, function(){ $(this).remove(); }); }, 5000); } } function strstr(haystack, needle, bool) { // Finds first occurrence of a string within another // // version: 1103.1210 // discuss at: http://phpjs.org/functions/strstr // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Onno Marsman // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // * example 1: strstr(‘Kevin van Zonneveld’, ‘van’); // * returns 1: ‘van Zonneveld’ // * example 2: strstr(‘Kevin van Zonneveld’, ‘van’, true); // * returns 2: ‘Kevin ‘ // * example 3: strstr(‘name@example.com’, ‘@’); // * returns 3: ‘@example.com’ // * example 4: strstr(‘name@example.com’, ‘@’, true); // * returns 4: ‘name’ var pos = 0; haystack += ""; pos = haystack.indexOf(needle); if (pos == -1) { return false; } else { if (bool) { return haystack.substr(0, pos); } else { return haystack.slice(pos); } } } function stristr(haystack, needle, bool) { haystack = haystack.toLowerCase(); needle = needle.toLowerCase(); return strstr(haystack, needle, bool); } function confirmAction(message,url){ if(confirm(message)){ location.href= url; } } String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); } function xmlObject(){ try{ // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); }catch (e){ // Internet Explorer try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch (e){ try{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch (e){ alert("Your browser does not support AJAX!"); return false; } } } return xmlHttp; } function doXmlRequest(xmlUrl, functionByValue) { xmlObj = new xmlObject(); xmlObj.onreadystatechange = function(){ if (xmlObj.readyState == 4) { globalXmlData = xmlObj.responseText; functionByValue(xmlObj.responseText); } } xmlObj.open('GET', xmlUrl , true); xmlObj.send(null); } function doXmlPOSTRequest(xmlUrl, params, functionByValue) { xmlObj = new xmlObject(); xmlObj.open("POST", xmlUrl, true); //Send the proper header information along with the request xmlObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlObj.setRequestHeader("Content-length", params.length); xmlObj.setRequestHeader("Connection", "close"); xmlObj.onreadystatechange = function() {//Call a function when the state changes. if (xmlObj.readyState == 4) { globalXmlData = xmlObj.responseText; functionByValue(xmlObj.responseText); } } xmlObj.send(params); } function showTR(trid){ if (document.all) document.all[trid].style.display = ''; else if (document.getElementById) document.getElementById(trid).style.display = ''; } function hideTR(trid){ if (document.all) document.all[trid].style.display = 'none'; else if (document.getElementById) document.getElementById(trid).style.display = 'none'; } function toggleTR(trid) { if (document.all) document.all[trid].style.display = (document.all[trid].style.display == 'none') ? 'block' : 'none'; else if (document.getElementById) document.getElementById(trid).style.display = (document.getElementById(trid).style.display == 'none') ? 'block' : 'none'; } // // END BASIC FUNCTIONS //