var Generics=function(){var g=function(a){return!isNaN(parseFloat(a))&&isFinite(a)},h=function(){var a;return{init:function(){a=this},emailRegex:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,validateEmail:function(c){return a.emailRegex.test(c)},validateEmailOrEmpty:function(c){return c==""||a.validateEmail(c)},urlRegex:/^(http|https|ftp)\:\/\/([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|travel|[a-zA-Z]{2,4}))(\:[0-9]+)*(\/($|[a-zA-Z0-9\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*$/i,
validateURL:function(c){return a.urlRegex.test(c)},validateURLOrEmpty:function(c){return c==""||a.validateURL(c)},ipAddressRegex:/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/,validateIPAddress:function(c){return a.ipAddressRegex.test(c)},validateIPAddressOrEmpty:function(c){return c==""||a.validateIPAddress(c)},validateZipCode:function(c){if(c.length==10){if(c.charAt(5)!="-")return false;c=c.substring(0,5)+
c.substring(6)}else if(c.length!=5)return false;return a.validateNaturalNumber(c)},validateZipCodeOrEmpty:function(c){return c==""||a.validateZipCode(c)},naturalNumberRegex:/^[0-9]+$/,validateNaturalNumber:function(c){return a.naturalNumberRegex.test(c)},validateNaturalNumberOrEmpty:function(c){return c==""||a.validateNaturalNumber(c)},validateNonEmpty:function(c){return c!=""}}}();h.init();return{isNumber:g,searchAndReplace:function(a,c,d){return a.split(c).join(d)},addEvent:function(a,c,d,b){b||
(b=false);if(a.addEventListener){a.addEventListener(c,d,b);return true}else if(a.attachEvent){a["e"+c+d]=d;a[c+d]=function(){a["e"+c+d](window.event)};return a.attachEvent("on"+c,a[c+d])}else{if(!a.myEvents)a.myEvents={};a.myEvents[c]||(a.myEvents[c]=[]);b=a.myEvents[c];b[b.length]=d;a["on"+c]=function(){if(!(!a||!a.myEvents||!a.myEvents[c]))for(var e=a.myEvents[c],f=0,i=e.length;f<i;f++)e[f]()};return true}},removeEvent:function(a,c,d,b){b||(b=false);if(a.removeEventListener)a.removeEventListener(c,
d,b);else if(a.detachEvent){a.detachEvent("on"+c,a[c+d]);a[c+d]=null;a["e"+c+d]=null}},addClass:function(a,c){if(c&&typeof c==="string"){var d=(c||"").split(/\s+/);if(a.nodeType===1)if(a.className)for(var b=" "+a.className+" ",e=0,f=d.length;e<f;e++){if(b.indexOf(" "+d[e]+" ")<0)a.className+=" "+d[e]}else a.className=c}},removeClass:function(a,c){if(c&&typeof c==="string"||c===undefined){var d=(c||"").split(/\s+/);if(a.nodeType===1&&a.className)if(c){for(var b=(" "+a.className+" ").replace(/[\n\t]/g,
" "),e=0,f=d.length;e<f;e++)b=b.replace(" "+d[e]+" "," ");a.className=b.substring(1,b.length-1)}else a.className=""}},hasClass:function(a,c){var d=" "+c+" ";if((" "+a.className+" ").replace(/[\n\t]/g," ").indexOf(d)>-1)return true;return false},validation:h,get_query_parameter:function(a){for(var c=window.location.search.substring(1).split("&"),d=0;d<c.length;d++){var b=c[d].split("=");if(b[0]==a)return b[1]}return null},transferOptions:function(a){if(typeof a!="object"||a==null)throw"Input must be a JavaScript object !";
if(typeof a.from=="undefined")throw'Must specify "from" !';if(typeof a.to=="undefined")throw'Must specify "to" !';if(typeof a.onlyMoveSelected!="undefined"&&a.onlyMoveSelected)for(var c=a.from.options.length-1;c>=0;c--){if(a.from.options[c].selected){a.to.options[a.to.options.length]=new Option(a.from.options[c].text,a.from.options[c].value);a.from.remove(c)}}else for(c=a.from.options.length-1;c>=0;c--){a.to.options[a.to.options.length]=new Option(a.from.options[c].text,a.from.options[c].value);a.from.remove(c)}},
serialize:function(a){if(typeof a!="object"||a==null)throw"Input must be a JavaScript object !";if(typeof a.data=="undefined")throw'Must specify "data" !';var c;if(typeof a.separator=="string")c=a.separator;else if(typeof a.separator!="undefined")throw'"separator" must be a string !';else c=",";var d="";switch(typeof a.method=="undefined"?0:a.method){case 1:if(typeof a.encodeFunction=="function")if(typeof a.ascendingOrder!="undefined"&&a.ascendingOrder)for(var b=0;b<a.data.length;b++)d+=a.encodeFunction(a.data[b])+
c;else for(b=a.data.length-1;b>=0;b--)d+=a.encodeFunction(a.data[b])+c;else if(typeof a.ascendingOrder!="undefined"&&a.ascendingOrder)for(b=0;b<a.data.length;b++)d+=a.data[b]+c;else for(b=a.data.length-1;b>=0;b--)d+=a.data[b]+c;if(d!="")d=d.substring(0,d.length-c.length);break;default:if(typeof a.encodeFunction=="function"){var e;if(typeof a.ascendingOrder!="undefined"&&a.ascendingOrder)for(b=0;b<a.data.length;b++){e=a.encodeFunction(a.data[b]);d+=e.length+c+e}else for(b=a.data.length-1;b>=0;b--){e=
a.encodeFunction(a.data[b]);d+=e.length+c+e}}else if(typeof a.ascendingOrder!="undefined"&&a.ascendingOrder)for(b=0;b<a.data.length;b++)d+=a.data[b].length+c+a.data[b];else for(b=a.data.length-1;b>=0;b--)d+=a.data[b].length+c+a.data[b]}return d},serializeOptions:function(a){if(typeof a!="object"||a==null)throw"Input must be a JavaScript object !";if(typeof a.element=="undefined")throw'Must specify "element" !';var c;if(typeof a.separator=="string")c=a.separator;else if(typeof a.separator!="undefined")throw'"separator" must be a string !';
else c=",";var d="";switch(typeof a.method=="undefined"?0:a.method){case 1:if(typeof a.encodeFunction=="function")if(typeof a.ascendingOrder!="undefined"&&a.ascendingOrder)if(typeof a.onlySerializeSelected!="undefined"&&a.onlySerializeSelected)for(var b=0;b<a.element.options.length;b++){if(a.element.options[b].selected)d+=a.encodeFunction(a.element.options[b].value)+c}else for(b=0;b<a.element.options.length;b++)d+=a.encodeFunction(a.element.options[b].value)+c;else if(typeof a.onlySerializeSelected!=
"undefined"&&a.onlySerializeSelected)for(b=a.element.options.length-1;b>=0;b--){if(a.element.options[b].selected)d+=a.encodeFunction(a.element.options[b].value)+c}else for(b=a.element.options.length-1;b>=0;b--)d+=a.encodeFunction(a.element.options[b].value)+c;else if(typeof a.ascendingOrder!="undefined"&&a.ascendingOrder)if(typeof a.onlySerializeSelected!="undefined"&&a.onlySerializeSelected)for(b=0;b<a.element.options.length;b++){if(a.element.options[b].selected)d+=a.element.options[b].value+c}else for(b=
0;b<a.element.options.length;b++)d+=a.element.options[b].value+c;else if(typeof a.onlySerializeSelected!="undefined"&&a.onlySerializeSelected)for(b=a.element.options.length-1;b>=0;b--){if(a.element.options[b].selected)d+=a.element.options[b].value+c}else for(b=a.element.options.length-1;b>=0;b--)d+=a.element.options[b].value+c;if(d!="")d=d.substring(0,d.length-c.length);break;default:if(typeof a.encodeFunction=="function"){var e;if(typeof a.ascendingOrder!="undefined"&&a.ascendingOrder)if(typeof a.onlySerializeSelected!=
"undefined"&&a.onlySerializeSelected)for(b=0;b<a.element.options.length;b++){if(a.element.options[b].selected){e=a.encodeFunction(a.element.options[b].value);d+=e.length+c+e}}else for(b=0;b<a.element.options.length;b++){e=a.encodeFunction(a.element.options[b].value);d+=e.length+c+e}else if(typeof a.onlySerializeSelected!="undefined"&&a.onlySerializeSelected)for(b=a.element.options.length-1;b>=0;b--){if(a.element.options[b].selected){e=a.encodeFunction(a.element.options[b].value);d+=e.length+c+e}}else for(b=
a.element.options.length-1;b>=0;b--){e=a.encodeFunction(a.element.options[b].value);d+=e.length+c+e}}else if(typeof a.ascendingOrder!="undefined"&&a.ascendingOrder)if(typeof a.onlySerializeSelected!="undefined"&&a.onlySerializeSelected)for(b=0;b<a.element.options.length;b++){if(a.element.options[b].selected)d+=a.element.options[b].value.length+c+a.element.options[b].value}else for(b=0;b<a.element.options.length;b++)d+=a.element.options[b].value.length+c+a.element.options[b].value;else if(typeof a.onlySerializeSelected!=
"undefined"&&a.onlySerializeSelected)for(b=a.element.options.length-1;b>=0;b--){if(a.element.options[b].selected)d+=a.element.options[b].value.length+c+a.element.options[b].value}else for(b=a.element.options.length-1;b>=0;b--)d+=a.element.options[b].value.length+c+a.element.options[b].value}return d},nl2br:function(a){return a=a.split("\r\n").join("<br />").split("\r\n").join("<br />").split("\\r\\n").join("<br />").split("\n").join("<br />").split("\n").join("<br />").split("\\n").join("<br />")},
br2nl:function(a){return a=a.split("<br />").join("\r\n")},fixNL:function(a){return this.br2nl(this.nl2br(a))},millisecondsToTimespan:function(a){var c=Math.floor(a/864E5);a%=864E5;var d=Math.floor(a/36E5);a%=36E5;var b=Math.floor(a/6E4);a%=6E4;return{days:c,hours:d,minutes:b,seconds:Math.floor(a/1E3)}},timespanToString:function(a){var c="",d="";if(typeof a.days!="undefined"&&g(a.days)&&a.days>0)d=a.days==1?"1 day":a.days+" days";if(typeof a.hours!="undefined"&&g(a.hours)&&a.hours>0){if(d!="")if(c==
"")c=d;else c+=", "+d;d=a.hours==1?"1 hour":a.hours+" hours"}if(typeof a.minutes!="undefined"&&g(a.minutes)&&a.minutes>0){if(d!="")if(c=="")c=d;else c+=", "+d;d=a.minutes==1?"1 minute":a.minutes+" minutes"}if(typeof a.seconds!="undefined"&&g(a.seconds)&&a.seconds>0){if(d!="")if(c=="")c=d;else c+=", "+d;d=a.seconds==1?"1 second":a.seconds+" seconds"}if(d!="")if(c=="")c=d;else c+=" and "+d;return c},pad:function(a,c){for(var d=""+a;d.length<c;)d="0"+d;return d},dateToISO8601:function(a,c,d,b,e){var f=
"";if(typeof b=="undefined")b="-";if(typeof e=="undefined")e=":";if(c!=false){f+=a.getFullYear()+b+this.pad(a.getMonth()+1,2)+b+this.pad(a.getDate(),2);if(d!=false)f+=" "}if(d!=false)f+=this.pad(a.getHours(),2)+e+this.pad(a.getSeconds(),2);return f},dateToMMDDYYYY:function(a,c,d,b,e){var f="";if(typeof b=="undefined")b="/";if(typeof e=="undefined")e=":";if(c!=false){f+=this.pad(a.getMonth()+1,2)+b+this.pad(a.getDate(),2)+b+a.getFullYear();if(d!=false)f+=" "}if(d!=false)f+=this.pad(a.getHours(),2)+
e+this.pad(a.getSeconds(),2);return f}}}();

