function implode( glue, pieces ) { return ( ( pieces instanceof Array ) ? pieces.join ( glue ) : pieces ); } function explode( delimiter, string ) { var emptyArray = { 0: '' }; if (arguments.length != 2 || typeof arguments[0] == 'undefined' || typeof arguments[1] == 'undefined' ) { return null; } if (delimiter === '' || delimiter === false || delimiter === null ) { return false; } if (typeof delimiter == 'function' || typeof delimiter == 'object' || typeof string == 'function' || typeof string == 'object' ) { return emptyArray; } if ( delimiter === true ) { delimiter = '1'; } return string.toString().split (delimiter.toString()); } function array_unique( array ) { var p, i, j; for (i = array.length; i;) { for (p = --i; p > 0;) { if (array[i] === array[--p]) { for (j = p; --p && array[i] === array[p];); i -= array.splice(p + 1, j - p).length; } } } return true; } function trim( value ) { var re = /\s*((\S+\s*)*)/; value = value.replace(re, "$1"); var re = /((\s*\S+)*)\s*/; value = value.replace(re, "$1"); return value; } function ltrim ( str, charlist ) { charlist = !charlist ? ' \\s\u00A0' : (charlist+'').replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1'); var re = new RegExp('^[' + charlist + ']+', 'g'); return (str+'').replace(re, ''); } function rtrim ( str, charlist ) { charlist = !charlist ? ' \\s\u00A0' : (charlist+'').replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\\$1'); var re = new RegExp('[' + charlist + ']+$', 'g'); return (str+'').replace(re, ''); } function getCookie (c_name) { if (document.cookie.length>0) { c_start = document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function setCookie (name, value, expires, path, domain, secure) { document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + "Mon, 01-Jan-2020 00:00:00 GMT" : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT"; } } function ucwords (str) { return (str + '').replace(/^([a-z])|\s+([a-z])/g, function ($1) { return $1.toUpperCase(); }); } function strip_tags (input, allowed) { allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase () var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi, commentsAndPhpTags = /|<\?(?:php)?[\s\S]*?\?>/gi; return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''; }); } function sha1 ( str ) { var rotate_left = function(n,s) { var t4 = ( n<>>(32-s)); return t4; }; var lsb_hex = function(val) { var str=""; var i; var vh; var vl; for( i=0; i<=6; i+=2 ) { vh = (val>>>(i*4+4))&0x0f; vl = (val>>>(i*4))&0x0f; str += vh.toString(16) + vl.toString(16); } return str; }; var cvt_hex = function(val) { var str=""; var i; var v; for( i=7; i>=0; i-- ) { v = (val>>>(i*4))&0x0f; str += v.toString(16); } return str; }; var blockstart; var i, j; var W = new Array(80); var H0 = 0x67452301; var H1 = 0xEFCDAB89; var H2 = 0x98BADCFE; var H3 = 0x10325476; var H4 = 0xC3D2E1F0; var A, B, C, D, E; var temp; str = this.utf8_encode(str); var str_len = str.length; var word_array = new Array(); for( i=0; i>>29 ); word_array.push( (str_len<<3)&0x0ffffffff ); for ( blockstart=0; blockstart 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; } function utf8_decode(utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } function md5 ( str ) { var RotateLeft = function(lValue, iShiftBits) { return (lValue<>>(32-iShiftBits)); }; var AddUnsigned = function(lX,lY) { var lX4,lY4,lX8,lY8,lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF); if (lX4 & lY4) { return (lResult ^ 0x80000000 ^ lX8 ^ lY8); } if (lX4 | lY4) { if (lResult & 0x40000000) { return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); } else { return (lResult ^ 0x40000000 ^ lX8 ^ lY8); } } else { return (lResult ^ lX8 ^ lY8); } }; var F = function(x,y,z) { return (x & y) | ((~x) & z); }; var G = function(x,y,z) { return (x & z) | (y & (~z)); }; var H = function(x,y,z) { return (x ^ y ^ z); }; var I = function(x,y,z) { return (y ^ (x | (~z))); }; var FF = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var GG = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var HH = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var II = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var ConvertToWordArray = function(str) { var lWordCount; var lMessageLength = str.length; var lNumberOfWords_temp1=lMessageLength + 8; var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64; var lNumberOfWords = (lNumberOfWords_temp2+1)*16; var lWordArray=Array(lNumberOfWords-1); var lBytePosition = 0; var lByteCount = 0; while ( lByteCount < lMessageLength ) { lWordCount = (lByteCount-(lByteCount % 4))/4; lBytePosition = (lByteCount % 4)*8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (str.charCodeAt(lByteCount)<>>29; return lWordArray; }; var WordToHex = function(lValue) { var WordToHexValue="",WordToHexValue_temp="",lByte,lCount; for (lCount = 0;lCount<=3;lCount++) { lByte = (lValue>>>(lCount*8)) & 255; WordToHexValue_temp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2); } return WordToHexValue; }; var x=Array(); var k,AA,BB,CC,DD,a,b,c,d; var S11=7, S12=12, S13=17, S14=22; var S21=5, S22=9 , S23=14, S24=20; var S31=4, S32=11, S33=16, S34=23; var S41=6, S42=10, S43=15, S44=21; str = this.utf8_encode(str); x = ConvertToWordArray(str); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; for (k=0;k> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); } return output; } function base64_decode(input) { var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = keyStr.indexOf(input.charAt(i++)); enc2 = keyStr.indexOf(input.charAt(i++)); enc3 = keyStr.indexOf(input.charAt(i++)); enc4 = keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = utf8_decode(output); return output; } function strpos( haystack, needle, offset ) { var i = haystack.indexOf( needle, offset ); // returns -1 return i >= 0 ? i : false; } function str_replace ( search, replace, subject ) { if(!(replace instanceof Array)){ replace=new Array(replace); if(search instanceof Array){ while(search.length>replace.length){ replace[replace.length]=replace[0]; } } } if(!(search instanceof Array))search=new Array(search); while(search.length>replace.length){ replace[replace.length]=''; } if(subject instanceof Array){ for(k in subject){ subject[k]=str_replace(search,replace,subject[k]); } return subject; } for(var k=0; k-1){ subject = subject.replace(search[k], replace[k]); i = subject.indexOf(search[k],i); } } return subject; } function substr_count (haystack, needle, offset, length) { var pos = 0, cnt = 0; haystack += ''; needle += ''; if (isNaN(offset)) { offset = 0; } if (isNaN(length)) { length = 0; } offset--; while ((offset = haystack.indexOf(needle, offset + 1)) != -1) { if (length > 0 && (offset + needle.length) > length) { return false; } else { cnt++; } } return cnt; } function htmlentities(s) { var div = document.createElement('div'); var text = document.createTextNode(s); div.appendChild(text); return div.innerHTML; } function decodeHtmlentities(s) { var y = document.createElement('textarea'); y.innerHTML = s; return y.value; } function version_compare(a, b) { if (a === b) { return 0; } var a_components = a.split("."); var b_components = b.split("."); var len = Math.min(a_components.length, b_components.length); // loop while the components are equal for (var i = 0; i < len; i++) { // A bigger than B if (parseInt(a_components[i]) > parseInt(b_components[i])) { return 1; } // B bigger than A if (parseInt(a_components[i]) < parseInt(b_components[i])) { return -1; } } // If one's a prefix of the other, the longer one is greater. if (a_components.length > b_components.length) { return 1; } if (a_components.length < b_components.length) { return -1; } // Otherwise they are the same. return 0; } function array_intersect (arr1) { var retArr = [], argl = arguments.length, arglm1 = argl - 1, k1 = '', arr = {}, i = 0, k = ''; arr1keys: for (k1 in arr1) { arrs: for (i = 1; i < argl; i++) { arr = arguments[i]; for (k in arr) { if (arr[k] === arr1[k1]) { if (i === arglm1) { retArr[k1] = arr1[k1]; } // If the innermost loop always leads at least once to an equal value, continue the loop until done continue arrs; } } // If it reaches here, it wasn't found in at least one array, so try next value continue arr1keys; } } return retArr; }