function randomString(length, type) { var chars; switch(type) { case 'mixed_nocase': chars = '0123456789abcdefghiklmnopqrstuvwxyz'.split(''); break; default: chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split(''); break; } var str = ''; for (var i = 0; i < length; i++) { str += chars[Math.floor(Math.random() * chars.length)]; } return str; } function bookmark () { title = "Harvest Ministries"; url = "http://www.harvestministriesindia.com"; var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; if (window.sidebar && !is_chrome) { // Mozilla Firefox Bookmark window.sidebar.addPanel(title, url,""); } else if( window.external && !is_chrome) { // IE Favorite window.external.AddFavorite( url, title); } else if(window.opera && window.print) { // Opera Hotlist var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } } function urlencode (str) { return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A'); } function getXmlHttpRequestObject() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else { return false; //document.getElementById('output').innerHTML = 'Status: Cound not create XmlHttpRequest Object. Consider upgrading your browser.'; } } String.prototype.repeat = function(l){ return new Array(l+1).join(this); } String.prototype.toURL = function() { var str = this.replace(/\s+/g, '-').match(/[a-zA-Z-]/g); return (str == null) ? '' : str.join('').toLowerCase(); } function getObject(whichLayer) { if(document.getElementById) elem=document.getElementById(whichLayer); else if (document.all) elem=document.all[whichLayer]; else if (document.layers) elem=document.layers[whichLayer]; return elem; } function getSelectBoxValue(ob) { if(typeof(ob) != "object") ob = getObject(ob); return ob.options[ob.selectedIndex].value; } function setSelectBoxValue(ob, val) { var inpSel = document.getElementById(ob); for(i=0; i= 2) doAlert = arguments[1]; if(reg.test(val)) { if(doAlert) alert("Please use only alphanumeric characters or the following special characters:\n _ (underscore)\n - (dash)\n . (period)\n / (forward slash)"); ob.value=ob.value.substring(0, ob.value.length-1); return false; } else { return true; } } function settimeinput(name, hours, minutes) { // Set values using 24-hour time if(arguments.length > 1) { var ampm = "am"; if(hours > 11) { ampm = "pm"; hours = hours - 12; } if(hours == 0) hours = 12; setSelectBoxValue(name + "_h", hours); setSelectBoxValue(name + "_m", minutes); setSelectBoxValue(name + "_a", ampm); } h = getSelectBoxValue(name + "_h"); m = getSelectBoxValue(name + "_m"); a = getSelectBoxValue(name + "_a"); getObject(name).value = h + ":" + m + " " + a; } /** * Function : dump() * Arguments: The data - array,hash(associative array),object * The level - OPTIONAL * Returns : The textual representation of the array. * This function was inspired by the print_r function of PHP. * This will accept some data as the argument and return a * text that will be a more readable version of the * array/hash/object that is given. * Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php */ function dump(arr,level) { var dumped_text = ""; if(!level) level = 0; //The padding given at the beginning of the line. var level_padding = ""; for(var j=0;j \"" + value + "\"\n"; } } } else { //Stings/Chars/Numbers etc. dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; } return dumped_text; } function cloneObject(ob) { var newObj = (ob instanceof Array) ? [] : {}; for (i in ob) { if (i == 'clone') continue; if (ob[i] && typeof ob[i] == "object") { newObj[i] = cloneObject(ob[i]); } else newObj[i] = ob[i] } return newObj; };