0||Math.floor(d)>0):e=!0,a.internal.mouse={x:b.pageX,y:b.pageY},e&&a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId),a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),delete this.internal.mouse,this.element.unbind(c),this.css.jq.gui.unbind(c),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullWindow&&this.options.autohide.full||!this.options.fullWindow&&this.options.autohide.restored?(this.element.bind(d,e),this.css.jq.gui.bind(d,e),this.css.jq.gui.hide()):this.css.jq.gui.show())},fullScreen:function(a){var b="object"==typeof a;b&&this.options.useStateClassSkin&&this.options.fullScreen?this._setOption("fullScreen",!1):this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_fullscreenAddEventListeners:function(){var b=this,c=a.jPlayer.nativeFeatures.fullscreen;c.api.fullscreenEnabled&&c.event.fullscreenchange&&("function"!=typeof this.internal.fullscreenchangeHandler&&(this.internal.fullscreenchangeHandler=function(){b._fullscreenchange()}),document.addEventListener(c.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1))},_fullscreenRemoveEventListeners:function(){var b=a.jPlayer.nativeFeatures.fullscreen;this.internal.fullscreenchangeHandler&&document.removeEventListener(b.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1)},_fullscreenchange:function(){this.options.fullScreen&&!a.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()&&this._setOption("fullScreen",!1)},_requestFullscreen:function(){var b=this.ancestorJq.length?this.ancestorJq[0]:this.element[0],c=a.jPlayer.nativeFeatures.fullscreen;c.used.webkitVideo&&(b=this.htmlElement.video),c.api.fullscreenEnabled&&c.api.requestFullscreen(b)},_exitFullscreen:function(){var b,c=a.jPlayer.nativeFeatures.fullscreen;c.used.webkitVideo&&(b=this.htmlElement.video),c.api.fullscreenEnabled&&c.api.exitFullscreen(b)},_html_initMedia:function(b){var c=a(this.htmlElement.media).empty();a.each(b.track||[],function(a,b){var d=document.createElement("track");d.setAttribute("kind",b.kind?b.kind:""),d.setAttribute("src",b.src?b.src:""),d.setAttribute("srclang",b.srclang?b.srclang:""),d.setAttribute("label",b.label?b.label:""),b.def&&d.setAttribute("default",b.def),c.append(d)}),this.htmlElement.media.src=this.status.src,"none"!==this.options.preload&&this._html_load(),this._trigger(a.jPlayer.event.timeupdate)},_html_setFormat:function(b){var c=this;a.each(this.formats,function(a,d){return c.html.support[d]&&b[d]?(c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1):void 0})},_html_setAudio:function(a){this._html_setFormat(a),this.htmlElement.media=this.htmlElement.audio,this._html_initMedia(a)},_html_setVideo:function(a){this._html_setFormat(a),this.status.nativeVideoControls&&(this.htmlElement.video.poster=this._validString(a.poster)?a.poster:""),this.htmlElement.media=this.htmlElement.video,this._html_initMedia(a)},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id!==this.internal.video.id||this.status.nativeVideoControls||this.internal.video.jq.css({width:"0px",height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){this.htmlElement.media&&(this.htmlElement.media.src="about:blank",this.htmlElement.media.load())},_html_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.htmlElement.media.load()),clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this,c=this.htmlElement.media;if(this.androidFix.pause=!1,this._html_load(),this.androidFix.setMedia)this.androidFix.play=!0,this.androidFix.time=a;else if(isNaN(a))c.play();else{this.internal.cmdsIgnored&&c.play();try{if(c.seekable&&!("object"==typeof c.seekable&&c.seekable.length>0))throw 1;c.currentTime=a,c.play()}catch(d){return void(this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},250))}}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this,c=this.htmlElement.media;if(this.androidFix.play=!1,a>0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId),c.pause(),this.androidFix.setMedia)this.androidFix.pause=!0,this.androidFix.time=a;else if(!isNaN(a))try{if(c.seekable&&!("object"==typeof c.seekable&&c.seekable.length>0))throw 1;c.currentTime=a}catch(d){return void(this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},250))}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this,c=this.htmlElement.media;this._html_load();try{if("object"==typeof c.seekable&&c.seekable.length>0)c.currentTime=a*c.seekable.end(c.seekable.length-1)/100;else{if(!(c.duration>0)||isNaN(c.duration))throw"e";c.currentTime=a*c.duration/100}}catch(d){return void(this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},250))}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})))},_html_setProperty:function(a,b){this.html.audio.available&&(this.htmlElement.audio[a]=b),this.html.video.available&&(this.htmlElement.video[a]=b)},_aurora_setAudio:function(b){var c=this;a.each(this.formats,function(a,d){return c.aurora.support[d]&&b[d]?(c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1):void 0}),this.aurora.player=new AV.Player.fromURL(this.status.src),this._addAuroraEventListeners(this.aurora.player,this.aurora),"auto"===this.options.preload&&(this._aurora_load(),this.status.waitForLoad=!1)},_aurora_resetMedia:function(){this.aurora.player&&this.aurora.player.stop()},_aurora_clearMedia:function(){},_aurora_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.aurora.player.preload())},_aurora_play:function(b){this.status.waitForLoad||isNaN(b)||this.aurora.player.seek(b),this.aurora.player.playing||this.aurora.player.play(),this.status.waitForLoad=!1,this._aurora_checkWaitForPlay(),this._updateButtons(!0),this._trigger(a.jPlayer.event.play)},_aurora_pause:function(b){isNaN(b)||this.aurora.player.seek(1e3*b),this.aurora.player.pause(),b>0&&this._aurora_checkWaitForPlay(),this._updateButtons(!1),this._trigger(a.jPlayer.event.pause)},_aurora_playHead:function(a){this.aurora.player.duration>0&&this.aurora.player.seek(a*this.aurora.player.duration/100),this.status.waitForLoad||this._aurora_checkWaitForPlay()},_aurora_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1)},_aurora_volume:function(a){this.aurora.player.volume=100*a},_aurora_mute:function(a){a?(this.aurora.properties.lastvolume=this.aurora.player.volume,this.aurora.player.volume=0):this.aurora.player.volume=this.aurora.properties.lastvolume,this.aurora.properties.muted=a},_flash_setAudio:function(b){var c=this;try{a.each(this.formats,function(a,d){if(c.flash.support[d]&&b[d]){switch(d){case"m4a":case"fla":c._getMovie().fl_setAudio_m4a(b[d]);break;case"mp3":c._getMovie().fl_setAudio_mp3(b[d]);break;case"rtmpa":c._getMovie().fl_setAudio_rtmp(b[d])}return c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_setVideo:function(b){var c=this;try{a.each(this.formats,function(a,d){if(c.flash.support[d]&&b[d]){switch(d){case"m4v":case"flv":c._getMovie().fl_setVideo_m4v(b[d]);break;case"rtmpv":c._getMovie().fl_setVideo_rtmp(b[d])}return c.status.src=b[d],c.status.format[d]=!0,c.status.formatType=d,!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",height:"0px"}),this._flash_pause(0/0)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=!1,this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}a>0&&(this.status.waitForLoad=!1,this._flash_checkWaitForPlay())},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height})))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_getFlashPluginVersion:function(){var a,b=0;if(window.ActiveXObject)try{if(a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")){var c=a.GetVariable("$version");c&&(c=c.split(" ")[1].split(","),b=parseInt(c[0],10)+"."+parseInt(c[1],10))}}catch(d){}else navigator.plugins&&navigator.mimeTypes.length>0&&(a=navigator.plugins["Shockwave Flash"],a&&(b=navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")));return 1*b},_checkForFlash:function(a){var b=!1;return this._getFlashPluginVersion()>=a&&(b=!0),b},_validString:function(a){return a&&"string"==typeof a},_limitValue:function(a,b,c){return b>a?b:a>c?c:a},_urlNotSetError:function(b){this._error({type:a.jPlayer.error.URL_NOT_SET,context:b,message:a.jPlayer.errorMsg.URL_NOT_SET,hint:a.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(b){var c;c=this.internal.ready?"FLASH_DISABLED":"FLASH",this._error({type:a.jPlayer.error[c],context:this.internal.flash.swf,message:a.jPlayer.errorMsg[c]+b.message,hint:a.jPlayer.errorHint[c]}),this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(b){this._trigger(a.jPlayer.event.error,b),this.options.errorAlerts&&this._alert("Error!"+(b.message?"\n"+b.message:"")+(b.hint?"\n"+b.hint:"")+"\nContext: "+b.context)},_warning:function(c){this._trigger(a.jPlayer.event.warning,b,c),this.options.warningAlerts&&this._alert("Warning!"+(c.message?"\n"+c.message:"")+(c.hint?"\n"+c.hint:"")+"\nContext: "+c.context)},_alert:function(a){var b="jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a;this.options.consoleAlerts?window.console&&window.console.log&&window.console.log(b):alert(b)},_emulateHtmlBridge:function(){var b=this;a.each(a.jPlayer.emulateMethods.split(/\s+/g),function(a,c){b.internal.domNode[c]=function(a){b[c](a)}}),a.each(a.jPlayer.event,function(c,d){var e=!0;a.each(a.jPlayer.reservedEvent.split(/\s+/g),function(a,b){return b===c?(e=!1,!1):void 0}),e&&b.element.bind(d+".jPlayer.jPlayerHtml",function(){b._emulateHtmlUpdate();var a=document.createEvent("Event");a.initEvent(c,!1,!0),b.internal.domNode.dispatchEvent(a)})})},_emulateHtmlUpdate:function(){var b=this;a.each(a.jPlayer.emulateStatus.split(/\s+/g),function(a,c){b.internal.domNode[c]=b.status[c]}),a.each(a.jPlayer.emulateOptions.split(/\s+/g),function(a,c){b.internal.domNode[c]=b.options[c]})},_destroyHtmlBridge:function(){var b=this;this.element.unbind(".jPlayerHtml");var c=a.jPlayer.emulateMethods+" "+a.jPlayer.emulateStatus+" "+a.jPlayer.emulateOptions;a.each(c.split(/\s+/g),function(a,c){delete b.internal.domNode[c]})}},a.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"},a.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+a.jPlayer.prototype.version.script+" needs Jplayer.swf version "+a.jPlayer.prototype.version.needFlash+" but found "},a.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."},a.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"},a.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."},a.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});
/* JS - LIBRARY (04 May 2017 12:39:50 AM) */
/* ./__swift/javascript/__global/library/Base64/class.SWIFT_Base64.js */
SWIFT.Library.Base64 = SWIFT.Base.extend({
_keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
Encode: function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = this._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 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 +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
Decode: function (input) {
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 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._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 = this._utf8_decode(output);
return output;
},
_utf8_encode: function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 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;
},
_utf8_decode: function (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;
}
});
/* ./__swift/javascript/__global/library/Browser/class.SWIFT_Browser.js */
// Browser Detect v2.1.6
// documentation: http://www.dithered.com/javascript/browser_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)
SWIFT.Library.Browser = SWIFT.Base.extend({
constructor: function() {
var ua = navigator.userAgent.toLowerCase();
// browser engine name
this.isGecko = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);
// browser name
this.isKonqueror = (ua.indexOf('konqueror') != -1);
this.isSafari = (ua.indexOf('safari') != - 1);
this.isOmniweb = (ua.indexOf('omniweb') != - 1);
this.isOpera = (ua.indexOf('opera') != -1);
this.isIcab = (ua.indexOf('icab') != -1);
this.isAol = (ua.indexOf('aol') != -1);
this.isIE = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) );
this.isMozilla = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
this.isFirefox = (ua.indexOf('firefox/') != -1 || ua.indexOf('firebird/') != -1);
this.isNS = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
// Mobile
this.isAndroid = ua.match(/Android/i) ? true : false;
this.isBB = ua.match(/BlackBerry/i) ? true : false;
this.isiOS = ua.match(/iPhone|iPad|iPod/i) ? true : false;
// spoofing and compatible browsers
this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
// rendering engine versions
this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
this.equivalentMozilla = ( (this.isGecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
this.appleWebKitVersion = ( (this.isAppleWebKit) ? parseFloat( ua.substring( ua.indexOf('applewebkit/') + 12) ) : -1 );
// browser version
this.versionMinor = parseFloat(navigator.appVersion);
// correct version number
if (this.isGecko && !this.isMozilla) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
}
else if (this.isMozilla) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
}
else if (this.isIE && this.versionMinor >= 4) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
}
else if (this.isKonqueror) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
}
else if (this.isSafari) {
this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
}
else if (this.isOmniweb) {
this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('omniweb/') + 8 ) );
}
else if (this.isOpera) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera') + 6 ) );
}
else if (this.isIcab) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab') + 5 ) );
}
this.versionMajor = parseInt(this.versionMinor);
// dom support
this.isDOM1 = (document.getElementById);
this.isDOM2Event = (document.addEventListener && document.removeEventListener);
// css compatibility mode
this.mode = document.compatMode ? document.compatMode : 'BackCompat';
// platform
this.isWin = (ua.indexOf('win') != -1);
this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
this.isMac = (ua.indexOf('mac') != -1);
this.isUnix = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
this.isLinux = (ua.indexOf('linux') != -1);
// specific browser shortcuts
this.isNS4x = (this.isNS && this.versionMajor == 4);
this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
this.isNS4up = (this.isNS && this.versionMinor >= 4);
this.isNS6x = (this.isNS && this.versionMajor == 6);
this.isNS6up = (this.isNS && this.versionMajor >= 6);
this.isNS7x = (this.isNS && this.versionMajor == 7);
this.isNS7up = (this.isNS && this.versionMajor >= 7);
this.isIE4x = (this.isIE && this.versionMajor == 4);
this.isIE4up = (this.isIE && this.versionMajor >= 4);
this.isIE5x = (this.isIE && this.versionMajor == 5);
this.isIE55 = (this.isIE && this.versionMinor == 5.5);
this.isIE5up = (this.isIE && this.versionMajor >= 5);
this.isIE6x = (this.isIE && this.versionMajor == 6);
this.isIE6up = (this.isIE && this.versionMajor >= 6);
this.isIE7x = (this.isIE && this.versionMajor == 7);
this.isIE7up = (this.isIE && this.versionMajor >= 7);
this.isIE8x = (this.isIE && this.versionMajor == 8);
this.isIE8up = (this.isIE && this.versionMajor >= 8);
this.isIE9x = (this.isIE && this.versionMajor == 9);
this.isIE9up = (this.isIE && this.versionMajor >= 9);
this.isIE10x = (this.isIE && this.versionMajor == 10);
this.isIE10up = (this.isIE && this.versionMajor >= 10);
this.isIE4xMac = (this.isIE4x && this.isMac);
}
});
/* ./__swift/javascript/__global/library/Language/class.SWIFT_Language.js */
SWIFT.Library.Language = SWIFT.Base.extend({
});
/* ./__swift/javascript/__global/library/MVC/class.SWIFT_Collection.js */
SWIFT.Library.Collection = Backbone.Collection.extend({
sync: function(method, model, options) {
if (model.methodUrl && model.methodUrl(method.toLowerCase())) {
options = options || {};
options.url = model.methodUrl(method.toLowerCase());
}
Backbone.sync(method, model, options);
}
});
/* ./__swift/javascript/__global/library/MVC/class.SWIFT_Controller.js */
SWIFT.Library.Controller = SWIFT.Base.extend({
});
/* ./__swift/javascript/__global/library/MVC/class.SWIFT_Model.js */
SWIFT.Library.Model = Backbone.Model.extend({
methodUrl: function(method) {
if (typeof this.path !== 'undefined') {
if (typeof this.attributes.id !== 'undefined') {
return SWIFT.get('basename') + this.path + this.attributes.id;
} else {
return SWIFT.get('basename') + this.path;
}
}
return false;
},
sync: function(method, model, options) {
if (model.methodUrl && model.methodUrl(method.toLowerCase())) {
options = options || {};
options.url = model.methodUrl(method.toLowerCase());
}
Backbone.sync(method, model, options);
}
});
/* ./__swift/javascript/__global/library/MVC/class.SWIFT_View.js */
SWIFT.Library.View = Backbone.View.extend({
});
/* ./__swift/javascript/__global/library/Router/class.SWIFT_Router.js */
SWIFT.Library.Router = SWIFT.Base.extend({
'routerPath': '',
'logPrefix': '(ROUTER)',
'routerArguments': [],
Navigate: function() {
},
PreNavigation: function(routerPath) {
},
PostNavigation: function(routerURL) {
var swiftBaseName = SWIFT.get('basename');
var baseNameStrip = routerURL.substr(0, swiftBaseName.length);
var parsedURL = false;
if (routerURL.substr(0, 1) == '/')
{
parsedURL = routerURL;
} else {
// Is basename same?
if (baseNameStrip.toLowerCase() == swiftBaseName.toLowerCase()) {
parsedURL = routerURL.substr(swiftBaseName.length);
}
}
if (parsedURL !== false) {
this.ExecuteControllers(parsedURL);
}
},
ExecuteControllers: function(routerPath) {
var routerChunks = routerPath.split('/');
if (routerChunks.length < 3) {
return false;
}
this.routerPath = routerPath;
var routerArguments = [];
var chunkIndex = 0;
_.each(routerChunks, function(chunkName) {
if (chunkName != '') {
if (chunkIndex == 0) {
appName = chunkName.toLowerCase();
} else if (chunkIndex == 1) {
controllerName = chunkName.toLowerCase();
} else if (chunkIndex == 2) {
actionName = chunkName;
} else {
routerArguments[routerArguments.length] = chunkName;
}
chunkIndex++;
}
});
this.routerArguments = routerArguments;
if (typeof SWIFT.Controllers[appName] === 'undefined') {
return false;
}
if (typeof SWIFT.Controllers[appName][controllerName] === 'undefined') {
return false;
}
for (i = 0; i < SWIFT.Controllers[appName][controllerName].length; i++) {
if (typeof SWIFT.Controllers[appName][controllerName][i][actionName] === 'function') {
SWIFT.Controllers[appName][controllerName][i][actionName].apply(SWIFT.Controllers[appName][controllerName][i], routerArguments);
}
}
},
Setup: function() {
this.PostNavigation(this.routerPath);
}
});
/* ./__swift/javascript/__global/library/Template/class.SWIFT_Template.js */
SWIFT.Library.Template = SWIFT.Base.extend({
templateCache: {},
AddToCache: function(cacheContainer) {
_.each(cacheContainer, function(templateData, templateName) {
SWIFT.Template.AddTemplate(templateName, templateData);
});
},
AddTemplate: function(templateName, templateData) {
this.templateCache[templateName] = templateData;
},
Get: function(templateName) {
if (typeof this.templateCache[templateName] === 'undefined') {
return '';
}
return this.templateCache[templateName];
},
get: function(templateName) {
return this.Get(templateName);
}
});
/* JS - MODELS (04 May 2017 12:39:50 AM) */
/* JS - CONTROLLERS (04 May 2017 12:39:50 AM) */
/* JS - VIEWS (04 May 2017 12:39:50 AM) */
/* JS - TEMPLATES (04 May 2017 12:39:50 AM) */
SWIFT.LoadCoreLibraries(); SWIFT.Template.AddToCache([]);
/* JS - COLLECTIONS (04 May 2017 12:39:50 AM) */
/* JS - THIRDPARTY (04 May 2017 12:39:50 AM) */
/* ./__swift/apps/base/javascript/client/thirdparty/legacy/core.js */
var _irsContents = ' ';
function ToggleTicketSubDepartments(_departmentID) {
$("tr[class^='ticketsubdepartments_']").hide();
$('.ticketsubdepartments_' + _departmentID).show();
}
function StartIRS() {
var _ticketMessageContents = $('#ticketsubject').val() + ' ';
if (typeof(tinyMCE) != "undefined" && tinyMCE.activeEditor && !tinyMCE.activeEditor.isHidden()) {
_ticketMessageContents = _ticketMessageContents + tinyMCE.activeEditor.getContent();
}
if (_ticketMessageContents != _irsContents) {
$('#irscontainer').slideDown('medium');
$.post(_baseName + '/Knowledgebase/Article/IRS', {
'contents': _ticketMessageContents
}, function(_data){
$('#irscontainer').show().html(_data);
});
_irsContents = _ticketMessageContents;
}
setTimeout('StartIRS();', 2000);
}
function ArticleHelpful(_kbArticleID) {
$('#kbratingcontainer').load(_baseName + '/Knowledgebase/Article/Rate/' + _kbArticleID + '/1');
}
function ArticleNotHelpful(_kbArticleID) {
$('#kbratingcontainer').load(_baseName + '/Knowledgebase/Article/Rate/' + _kbArticleID + '/0');
}
function MoveCommentReply(_commentID) {
$('#commentsformcontainer').appendTo('#commentreplycontainer_' + _commentID);
$('#commentformparentcommentid').val(_commentID);
$('#postnewcomment').hide();
$('#replytocomment').show();
}
function ActivateLoginTab() {
$('#leftloginsubscribeboxsubscribetab').addClass('inactive');
$('#leftloginsubscribeboxlogintab').removeClass('inactive');
$('#leftsubscribebox').removeClass('active');
$('#leftloginbox').addClass('active');
$('#leftsubscribebox').hide();
$('#leftloginbox').show();
}
function ActivateSubscribeTab() {
$('#leftloginsubscribeboxlogintab').addClass('inactive');
$('#leftloginsubscribeboxsubscribetab').removeClass('inactive');
$('#leftloginbox').removeClass('active');
$('#leftsubscribebox').addClass('active');
$('#leftloginbox').hide();
$('#leftsubscribebox').show();
}
function LanguageSwitch(_isLiveChat) {
if (!$('#languageid').length) {
return false;
}
if (_isLiveChat == true) {
window.location.href = window.location.href + '/_languageID=' + $('#languageid').val();
} else {
window.location.href = _baseName + '/Base/Language/Change/' + $('#languageid').val();
}
};
function RenderCustomfields(_proactive) {
_appendURL = '';
if (window.location.href.indexOf('_filterDepartmentID') === -1) {
_appendURL = '/_filterDepartmentID=' + encodeURIComponent($('input[name=filterdepartmentid]').val());
} else if (window.location.href.indexOf('_proactive') === -1) {
_appendURL = _appendURL + '/_proactive=' + _proactive;
}
if (window.location.href.indexOf('Start') >= 0) {
window.location.href = _baseName + '/LiveChat/Chat/Start/_departmentID=' + $('select[name=departmentid]').val() + '/_languageID=' + $('#languageid').val() + '/_filterDepartmentID=' + encodeURIComponent($('input[name=filterdepartmentid]').val()) + '/_proactive=' + _proactive;
} else if (window.location.href.indexOf('_departmentID') >= 0) {
window.location.href = window.location.href.replace(/(_departmentID=)[^\&]+/, '$1' + $('select[name=departmentid]').val()) + _appendURL;
} else {
window.location.href = window.location.href + '/_departmentID=' + $('select[name=departmentid]').val() + _appendURL;
}
}
var RecaptchaOptions = {
theme : 'clean'
};
function ResetLabel(_inputObject, _labelText, _cssClass) {
if ($(_inputObject).val() == _labelText && _labelText != '')
{
$(_inputObject).val('');
}
if (_cssClass)
{
$(_inputObject).removeClass().addClass(_cssClass);
}
return true;
};
function Redirect(_newLocation) {
window.location.href = _newLocation;
};
function AddProfileEmail() {
$('#profileemailcontainer').append('');
};
function AddTicketFile() {
$('#ticketattachmentcontainer').append('');
};
function PopupSmallWindow(url) {
screen_width = screen.width;
screen_height = screen.height;
widthm = (screen_width-400)/2;
heightm = (screen_height-300)/2;
window.open(url,"infowindow"+GetRandom(), "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=300,left="+widthm+",top="+heightm);
};
function QuoteTicketPost(_ticketID, _ticketPostID) {
$.ajax({
type: 'POST',
url: _baseName + '/Tickets/Ticket/GetQuote/' + _ticketID + '/' + _ticketPostID,
data: '',
success: function(_data){
$('#postreplycontainer').show();
$('#addreplybutton').hide();
$('#replycontents').val(_data);
}
});
}
function GetRandom()
{
var num;
now=new Date();
num=(now.getSeconds());
num=num+1;
return num;
};
function LinkedSelectChanged(_selectObject, _fieldName) {
var _selectValue = $(_selectObject).val();
$('.linkedselectcontainer_' + _fieldName).hide();
$('.linkedselectcontainer_' + _fieldName + ' select').prop('disabled', true); // SWIFT-2506
if ($('#selectsuboptioncontainer_' + _selectValue).length) {
$('#selectsuboptioncontainer_' + _selectValue).show();
$('#selectsuboptioncontainer_' + _selectValue + ' select').prop('disabled', false); // SWIFT-2506
}
};
function ClearDateField(_fieldName) {
$('#' + _fieldName).val('');
$('#' + _fieldName + '_hour').val('12');
$('#' + _fieldName + '_minute').val('0');
$('#' + _fieldName + '_meridian').val('am');
};
function ClearFunctionQueue() {
for (var i=0;i<_uiOnParseCallbacks.length;i++)
{
window._uiOnParseCallbacks[i]();
}
window._uiOnParseCallbacks = new Array();
return true;
};
window._uiOnParseCallbacks = new Array();
function QueueFunction(_functionData) {
window._uiOnParseCallbacks[_uiOnParseCallbacks.length] = _functionData;
return true;
};
function TriggerRating(_ratingURL, _ratingID, _typeID, _ratingValue, _isReadOnly) {
$.post(_baseName + _ratingURL, {
'ratingvalue': _ratingValue
}, function(data){
});
if (_isReadOnly == true) {
$('input[name=rating_' + _ratingID + '_' + _typeID + ']').rating('readOnly', true);
}
}
function PreventClickJacking() {
try {
if (top.location.hostname != self.location.hostname) {
throw 1;
}
} catch (e) {
top.location.href = self.location.href;
}
}
function PreventDoubleClicking(Object) {
$(Object).attr('onclick','').unbind('click');
return false;
}
/**
* ###############################################
* BEGIN ON READY FUNCTIONS
* ###############################################
*/
$(function(){
$("[form[name='SubmitTicketForm'], form[name='TicketReplyForm'] input[type='submit']").click(function() {
var formTicket = $("input[name='ticketattachments[]']").closest('form');
if (formTicket.attr('submitted')) {
return true;
}
$.each($("input[name='ticketattachments[]']"), function(index, file) {
if (file.value != '') {
formTicket.attr('action', formTicket.attr('action') + '/1');
formTicket.attr('submitted', 'true');
return true;
}
});
});
if (typeof _baseName == 'string') {
$.get(_swiftPath + 'cron/index.php?/Base/CronManager/Execute');
}
// Show save ticket properties button on properties change
$('#ticketpropertiesform select, #ticketpropertiesform input, #ticketpropertiesform textarea').change(function() {
$('#saveticketpropertiesbutton').show();
});
// Show the custom field changed notice on custom field change
$('#ticketpropertiesform .viewticketcontentcontainer select, #ticketpropertiesform .viewticketcontentcontainer input, #ticketpropertiesform .viewticketcontentcontainer textarea').change(function() {
$('#customfieldchangednotice').show();
});
$('#trisback').val('0');
ClearFunctionQueue();
});
/**
* ###############################################
* END ON READY FUNCTIONS
* ###############################################
*/
/* ./__apps/livechat/javascript/visitor/thirdparty/legacy/livesupport.js */
var _chatStatus = 1; // CHAT_INCOMING
var _isFirstTime = 1;
var _chatInitiated = false;
var _timerThreadRunning = 0;
var _currentSeconds = 0;
var _currentMinutes = 0;
var _currentMiliseconds = 0;
var _currentHour = 0;
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var _activeIntervalID = 0;
var _refreshInterval = 3000;
var _dateObject = new Date();
var _timeHolder = _dateObject.getTime();
var _chatEndedNotificationDisplayed = false;
var _isSoundEnabled = true;
var _isSoundPluginLoaded = false;
var _userClosedWindow = false;
var _globalNoLoop = false;
var _messageGUIDList = new Array();
var _transfer = 0;
$(document).unbind('keydown');
if (typeof _swiftFieldRequiredMessage !== "undefined") {
$.validator.messages.required = _swiftFieldRequiredMessage;
}
$(document).keydown(function (e) {
var _elementName = $(e.target).get(0).tagName;
if ( _elementName.toUpperCase() != 'TEXTAREA' && _elementName.toUpperCase() != 'INPUT' ) {
var code = (e.keyCode ? e.keyCode : e.which);
if ( code == 8 ) {
if (e.stopPropagation) e.stopPropagation();
return false;
}
}
});
/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 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 +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
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 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._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 = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 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;
},
// private method for UTF-8 decoding
_utf8_decode : function (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 OnLoaded() {
$('#chatfullname').focus();
}
function OnChatLoaded() {
OnLoaded();
_timerThreadRunning = 1;
TimerLoopThread();
ExecuteChatLoopURL();
_activeIntervalID = setInterval("ExecuteChatLoopURL();", _refreshInterval);
window.onerror = function() {
return true;
}
}
function LiveChatBeforeUnload() {
_userClosedWindow = true;
if (_chatInitiated) {
var _oldChatStatus = _chatStatus;
_chatStatus = 3;
LoadXMLHTTPRequest(_swiftChatEndURL, '', true);
if (_oldChatStatus == 2)
{
return _swiftLanguage['chatendsurvey'];
}
}
return;
}
function ValidateSurveyForm() {
var _emailExpression = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,6}$/;
$('#surveyform').validate();
if (!$('#surveyform').valid()) {
return false;
}
if ($('#chatfullname').val() == "" || $('#chatemail').val() == "" || $('#chatsubject').val() == "") {
// Alert!
$('#chatemailerror').fadeOut('medium');
$('#chaterror').fadeIn('medium');
return false;
}
$('#chaterror').fadeOut('medium');
var _emailValue = $('#chatemail').val();
if (!_emailValue.match(_emailExpression))
{
// Alert
$('#chatemailerror').fadeIn('medium');
return false;
}
return true;
}
function ValidateChatForm(isMessage) {
var _emailExpression = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,256}$/;
var _formName = 'chatform';
if (isMessage) {
_formName = 'messageform';
}
$("form").bind("submit", function(e){$('#' + _formName).find("input:submit").removeAttr('disabled');});
$('#' + _formName).validate();
if (!$('#' + _formName).valid()) {
return false;
}
if (!isMessage && ($('#chatfullname').val() == "" || $('#chatemail').val() == "")) {
// Alert!
$('#chatemailerror').fadeOut('medium');
$('#chaterror').fadeIn('medium');
return false;
} else if (isMessage && ($('#chatfullname').val() == "" || $('#chatemail').val() == "" || $('#chatsubject').val() == "" || $('#chatmessage').val() == "")) {
// Alert!
$('#chatemailerror').fadeOut('medium');
$('#chaterror').fadeIn('medium');
return false;
}
$('#chaterror').fadeOut('medium');
var _emailValue = $('#chatemail').val();
if (!_emailValue.match(_emailExpression))
{
// Alert
$('#chatemailerror').fadeIn('medium');
return false;
}
$("form").bind("submit", function(e){$('#' + _formName).find("input:submit").attr("disabled", "disabled");});
return true;
}
function BackupThreadCheck() {
_dateObject = new Date();
_currentTime = _dateObject.getTime();
_timeDifference = _currentTime - _timeHolder;
// More than 8 seconds? probably the loop stopped somehow.. we push it out manually
if (_timeDifference > 8000)
{
// When we trigger the backup.. we want to make sure timer gets reset (just in case the server dies or something)
_dateObject = new Date();
_currentTime = _dateObject.getTime();
// alert('Current Time: ' + _currentTime + ', Time Holder: ' + _timeHolder + ', Time Difference: ' + _timeDifference);
ExecuteChatLoopURL();
}
}
function nl2br (str, is_xhtml) {
// Converts newlines to HTML line breaks
//
// version: 1006.1915
// discuss at: http://phpjs.org/functions/nl2br
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Philip Peterson
// + improved by: Onno Marsman
// + improved by: Atli Þór
// + bugfixed by: Onno Marsman
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Brett Zamir (http://brett-zamir.me)
// + improved by: Maximusya
// * example 1: nl2br('Kevin\nvan\nZonneveld');
// * returns 1: 'Kevin\nvan\nZonneveld'
// * example 2: nl2br("\nOne\nTwo\n\nThree\n", false);
// * returns 2: '
\nOne
\nTwo
\n
\nThree
\n'
// * example 3: nl2br("\nOne\nTwo\n\nThree\n", true);
// * returns 3: '\nOne\nTwo\n\nThree\n'
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '' : '
';
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
}
function TimerLoopThread() {
_currentMiliseconds += 1;
if (_currentMiliseconds == 10){
_currentMiliseconds = 0;
_currentSeconds += 1;
}
if (_currentSeconds == 60){
_currentSeconds = 0;
_currentMinutes += 1;
}
if (_currentMinutes == 60) {
_currentHour += 1;
_currentMinutes = 0;
_currentSeconds = 0;
}
_stringSeconds = "" + _currentSeconds;
_stringMinutes = "" + _currentMinutes;
_stringMiliseconds = "" + _currentMiliseconds;
if (_stringSeconds.length != 2){
_stringSeconds = "0" + _currentSeconds;
}
if (_stringMinutes.length != 2){
_stringMinutes = "0" + _currentMinutes;
}
var _finalValue = _currentHour + ":" + _stringMinutes + ":" + _stringSeconds;
if (_chatStatus != 3)
{
$('#chattoptoolbarrightclockticker').html(_finalValue);
}
// We implement a backup mechanism here
BackupThreadCheck();
if (_timerThreadRunning == 1 && !_globalNoLoop) {
setTimeout("TimerLoopThread();", 100);
}
}
function GenerateChatRandomNumber()
{
_numberOne = 1;
_numberTwo = 50000;
var _generator = Math.random()*(_numberTwo-_numberOne);
_generator = Math.round(_numberOne+_generator);
return _generator;
}
function Base64Decode(input) {
return Base64.decode(input);
}
function Base64Encode(input) {
return Base64.encode(input);
}
function FocusMessageBox() {
$('#chatpostmsg').focus();
return true;
}
function RetrieveTimestamp() {
_timeStampText = '';
if (_swiftDisplayTimestamps == '1')
{
var _currentTimeStamp = new Date();
var _currentMinutes = _currentTimeStamp.getMinutes();
var _currentHours = _currentTimeStamp.getHours();
if (_currentMinutes < 10) {
_currentMinutes = '0' + _currentMinutes;
}
if (_currentHours < 10) {
_currentHours = '0' + _currentHours;
}
_timeStampText = '' + _currentHours + ':' + _currentMinutes + '';
}
return _timeStampText;
}
function DisplayStaffMessage(_staffName, _message) {
if (!_staffName || !_message)
{
return false;
}
_timeStampText = RetrieveTimestamp();
$('#chatcontentcontainer').append('' + _timeStampText + '' + _staffName + ': ' + AutoLink(htmlspecialchars(Base64Decode(_message))) + '
');
ScrollDiv();
PlaySound();
return true;
}
function DisplayClientMessage(_clientName, _message) {
if (!_clientName || !_message)
{
return false;
}
_timeStampText = RetrieveTimestamp();
$('#chatcontentcontainer').append('' + _timeStampText + '' + htmlspecialchars(_clientName) + ': ' + nl2br(htmlspecialchars(_message), false) + '
');
ScrollDiv();
return true;
}
function DisplaySystemMessage(_message) {
$('#chatcontentcontainer').append('' + _message + '
');
ScrollDiv();
return true;
}
function PushURL(_url) {
if (!SWIFT.Library.Browser.isIE) { //I need to prevent popup functionality in IE as allow popup blocker requires page refresh which interrupts chat
var _openWindow = window.open(_url, 'pushed' + GenerateChatRandomNumber());
}
$('#chatcontentcontainer').append('');
ScrollDiv();
PlaySound();
return true;
}
function PushImage(_url) {
/*
* BUG FIX - Varun Shoor
*
* SWIFT-SWIFT-1783 If we send an image using push image from KD, link is showing incorrect path at client end.
*
* Comments: When sending image from KD it will not make it link if URL is invalid
*/
var _urlRegExp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
var _isValidURL = false;
if(_urlRegExp.test(_url)){
_isValidURL = true;
if (!SWIFT.Library.Browser.isIE) { //I need to prevent popup functionality in IE as allow popup blocker requires page refresh which interrupts chat
var _openWindow = window.open(_url, 'pushed' + GenerateChatRandomNumber());
}
}
if(_isValidURL)
$('#chatcontentcontainer').append('');
else
$('#chatcontentcontainer').append('' + htmlspecialchars(_url) + '
');
ScrollDiv();
PlaySound();
return true;
}
function PushUploadedImage(_originalImageURL, _thumbnailImageURL) {
$('#chatcontentcontainer').append('');
//
' + htmlspecialchars(_originalImageURL) + '
ScrollDiv();
PlaySound();
return true;
}
function PushFile(_fileName, _fileID, _fileHash) {
$('#chatcontentcontainer').append('');
ScrollDiv();
PlaySound();
return true;
}
function PushCode(_codeContents) {
$('#chatcontentcontainer').append('' + _codeContents + '
');
ScrollDiv();
PlaySound();
return true;
}
function ResetAvatar(_staffID) {
$('#topbanneravatar').attr('src', swiftpath + 'index.php?/Base/Staff/GetProfileImage/' + _staffID);
ScrollDiv();
return true;
}
function DisplayUserIsTyping(_name) {
if (!_name)
{
return false;
}
if (!_swiftLanguage['istyping'])
{
_isTypingContainer = '%s is typing...';
} else {
_isTypingContainer = _swiftLanguage['istyping'];
}
$('#chatstatusbar').removeClass('chatstatusbarhidden').addClass('chatstatusbar').html(_isTypingContainer.replace('%s', _name));
return true;
}
function DisplayResetUserIsTyping() {
$('#chatstatusbar').removeClass('chatstatusbar').addClass('chatstatusbarhidden').html('');
return true;
}
function ProcessChatStatus(_incomingChatStatus) {
if (!_incomingChatStatus)
{
return false;
}
_chatStatus = _incomingChatStatus;
return true;
}
var _clientIsTyping = false;
function HandlePostEnter(_keyID)
{
_keyCode = document.layers ? _keyID.which : _keyID.keyCode;
if (_keyCode != 13)
{
_clientIsTyping = true;
}
if (_chatStatus != 2 && _keyCode == 13 && document.chatpostform && document.chatpostform.msg)
{
// Staff has not accepted chat yet
if (_swiftLanguage['staffnotacceptedchat'])
{
alert(_swiftLanguage['staffnotacceptedchat']);
}
document.chatpostform.msg.value = '';
FocusMessageBox();
return false;
} else if (_chatStatus == 2 && _keyCode == 13 && document.chatpostform && document.chatpostform.msg && document.chatpostform.msg.value.replace(/^\s+|\s+$/g,'') != '') {
ProcessMessage();
document.chatpostform.msg.value = '';
return false;
}
return true;
}
function HandlePostKeyUp(_keyID)
{
_keyCode = document.layers ? _keyID.which : _keyID.keyCode;
if (_keyCode != 13)
{
_clientIsTyping = true;
}
if (_chatStatus == 2 && _keyCode == 13 && _clientIsTyping == false && document.chatpostform && document.chatpostform.msg && document.chatpostform.msg.value.replace(/^\s+|\s+$/g,"") != "") {
ProcessMessage();
document.chatpostform.msg.value = '';
return false;
}
return true;
}
function ScrollDiv() {
var objDiv = document.getElementById("chatcontentcontainer");
if (!objDiv)
{
return false;
}
objDiv.scrollTop = objDiv.scrollHeight;
return true;
}
function ProcessMessage() {
if (!document.chatpostform || !document.chatpostform.msg || document.chatpostform.msg.value == '') {
return false;
}
_message = document.chatpostform.msg.value;
/*
* BUG FIX - Varun Shoor
*
* SWIFT-166 Displaying of Polish characters in Kayako Desktop.
*
* Comments: None
*/
LoadXMLHTTPRequest(_swiftMessageURL, 'message=' + encodeURIComponent((_message.replace(/%/g,'%25')).replace(/\+/g,'%2b')), true);
DisplayClientMessage(_userFullName, _message);
return true
}
function ProcessLiveChatSubmit() {
ProcessMessage();
document.chatpostform.msg.value = '';
FocusMessageBox();
return false;
}
var _xmlHTTPObject;
var xmlaction = "";
var xmlsubset = "";
function AjaxErrorAlert(_noAjaxSupport) {
if (!_noAjaxSupport) {
alert("XMLHttpRequest::open failed! This usually occurs due to the URL of your Kayako installation being different from the one specified under Admin CP >> Settings >> General. Due to limitations inherent in AJAX, the product URL needs to be exactly the same as the one specified in the settings; this includes \"www.\" and trailing slashes.");
} else {
alert("Your browser does not have the JavaScript support required to use this application. Please make sure that full JavaScript support is enabled in your browser and that your browser is recent and up to date.");
}
}
function LoadXMLHTTPRequest(url, _parameterContainer, _dontProcessStatusChange) {
if (window.XMLHttpRequest) {
// Not Internet Explorer
try {
_xmlHTTPObject = new XMLHttpRequest();
} catch (e) {
// Appears as if Ajax is not even supported.
AjaxErrorAlert(true);
}
if (_xmlHTTPObject) {
if (!_dontProcessStatusChange)
{
_xmlHTTPObject.onreadystatechange = ProcessStatusChange;
}
try {
_xmlHTTPObject.open("POST", url, true);
_xmlHTTPObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
_xmlHTTPObject.send(_parameterContainer);
} catch (e) {
AjaxErrorAlert(false);
}
}
} else if (window.ActiveXObject) {
// Internet Explorer
try {
_xmlHTTPObject = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
_xmlHTTPObject = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
// Appears as if Ajax is not even supported.
AjaxErrorAlert(true);
}
}
if (_xmlHTTPObject) {
if (!_dontProcessStatusChange)
{
_xmlHTTPObject.onreadystatechange = ProcessStatusChange;
}
try {
_xmlHTTPObject.open("POST", url, true);
_xmlHTTPObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
_xmlHTTPObject.send(_parameterContainer);
} catch (e) {
AjaxErrorAlert(false);
}
}
}
}
var _doClientLoop = true;
function ProcessStatusChange() {
if (!_swiftRefreshInterval) {
_refreshInterval = 3000;
} else {
_refreshInterval = _swiftRefreshInterval;
}
// If the ajax object is in the "completed" state
if (_xmlHTTPObject.readyState == 4) {
// Try, because .status can throw an exception
try {
// Try to read the status response.
// Note that this can throw an exception when the connection has been dropped.
if (_xmlHTTPObject.status == 200) {
var _xmlResult;
_xmlResult = _xmlHTTPObject.responseXML;
if (_xmlHTTPObject.responseText == '1') {
// Do nothing
} else if (!_xmlResult) {
alert("Invalid response received from server: " + _xmlHTTPObject.responseText);
} else {
var _chunks = _xmlResult.getElementsByTagName('chunk');
_isUserTyping = false;
if (_chunks.length) {
for (var i = 0; i < _chunks.length; i++) {
var _chunk = _chunks[i];
var _chunktype = _chunk.getElementsByTagName('type')[0].firstChild.nodeValue;
var _chunkGUID = _chunk.attributes.getNamedItem('guid').value;
if (typeof _chunkGUID != 'undefined' && _chunkGUID != '' && _chunkGUID != '0') {
_messageGUIDList.push('guid[]=' + escape(_chunkGUID));
}
if (_chunktype == 'usertyping') {
_isUserTyping = true;
}
ProcessChatChunk(_chunk);
}
}
if (!_isUserTyping) {
DisplayResetUserIsTyping();
}
}
} else if (_xmlHTTPObject.status == 12029) {
// 12029 is unable to establish connection.
// Reset the timer and bail.
//setTimeout("ExecuteChatLoopURL();", _refreshInterval);
}
} catch (e) {
// If .status throws, just reset the timer and bail.
//setTimeout("ExecuteChatLoopURL();", _refreshInterval);
}
}
}
function ExecuteChatLoopURL() {
if (!_swiftChatURL) {
return false;
}
var _guidParameters = _messageGUIDList.join('&');
_messageGUIDList = new Array();
_timeHolder = _dateObject.getTime();
LoadXMLHTTPRequest(_swiftChatURL + "/_chatStatus=" + _chatStatus + "/_isFirstTime=" + _isFirstTime + "/_RandomNumber=" + GenerateChatRandomNumber() + '/_isTyping=' + _clientIsTyping + '/_transfer=' + _transfer , _guidParameters, false);
_clientIsTyping = false;
_isFirstTime = 0;
}
var _isUserTyping = false;
function ProcessChatChunk(_chunk) {
_dateObject = new Date();
_timeHolder = _dateObject.getTime();
_chunkType = _chunk.getElementsByTagName('type')[0].firstChild.nodeValue;
var _shouldResetTyping = false;
if (_chunkType == 'message')
{
_chunkMessage = _chunk.getElementsByTagName('message')[0].firstChild.nodeValue;
if (_chunkMessage)
{
DisplaySystemMessage(_chunkMessage);
}
} else if (_chunkType == 'staffmessage') {
_chunkMessage = _chunk.getElementsByTagName('message')[0].firstChild.nodeValue;
_chunkName = _chunk.getElementsByTagName('staffname')[0].firstChild.nodeValue;
if (_chunkMessage && _chunkName)
{
DisplayStaffMessage(_chunkName, _chunkMessage);
_shouldResetTyping = _isUserTyping;
}
} else if (_chunkType == 'pushurl') {
_chunkURL = _chunk.getElementsByTagName('url')[0].firstChild.nodeValue;
if (_chunkURL)
{
PushURL(_chunkURL);
_shouldResetTyping = _isUserTyping;
}
} else if (_chunkType == 'pushimage') {
_chunkURL = _chunk.getElementsByTagName('url')[0].firstChild.nodeValue;
if (_chunkURL)
{
PushImage(_chunkURL);
_shouldResetTyping = isUserTyping;
}
} else if (_chunkType == 'pushfile') {
_chunkFileName = _chunk.getElementsByTagName('filename')[0].firstChild.nodeValue;
_chunkFileID = _chunk.getElementsByTagName('fileid')[0].firstChild.nodeValue;
_chunkFileHash = _chunk.getElementsByTagName('filehash')[0].firstChild.nodeValue;
if (_chunkFileName && _chunkFileID && _chunkFileHash)
{
PushFile(_chunkFileName, _chunkFileID, _chunkFileHash);
_shouldResetTyping = isUserTyping;
}
} else if (_chunkType == 'uploadedimage' && _chunk.getElementsByTagName('original') && _chunk.getElementsByTagName('thumbnail')) {
_chunkOriginalImage = _chunk.getElementsByTagName('original')[0].firstChild.nodeValue;
_chunkThumbnailImage = _chunk.getElementsByTagName('thumbnail')[0].firstChild.nodeValue;
if (_chunkOriginalImage && _chunkThumbnailImage)
{
PushUploadedImage(_chunkOriginalImage, _chunkThumbnailImage);
_shouldResetTyping = isUserTyping;
}
} else if (_chunkType == 'pushcode') {
_chunkCode = _chunk.getElementsByTagName('code')[0].firstChild.nodeValue;
if (_chunkCode)
{
PushCode(_chunkCode);
_shouldResetTyping = _isUserTyping;
}
} else if (_chunkType == 'usertyping') {
_chunkName = _chunk.getElementsByTagName('name')[0].firstChild.nodeValue;
if (_chunkName)
{
_isUserTyping = true;
DisplayUserIsTyping(_chunkName);
}
} else if (_chunkType == 'staffaccept') {
_chunkStaffID = _chunk.getElementsByTagName('staffid')[0].firstChild.nodeValue;
if (_chunkStaffID)
{
ResetAvatar(_chunkStaffID);
}
} else if (_chunkType == 'transfer') {
_transfer = _chunk.getElementsByTagName('status')[0].firstChild.nodeValue;
if (_transfer == '2') { // Staff has accepted the transfered chat. Let's reset avatar.
_transferStaffID = _chunk.getElementsByTagName('staffid')[0].firstChild.nodeValue;
ResetAvatar(_transferStaffID);
}
} else if (_chunkType == 'redirect') {
_chunkURL = _chunk.getElementsByTagName('url')[0].firstChild.nodeValue;
if (_chunkURL)
{
window.location.href = _chunkURL;
}
} else if (_chunkType == 'chatstatus') {
_chunkStatus = _chunk.getElementsByTagName('status')[0].firstChild.nodeValue;
if (_chunkStatus)
{
_chatInitiated = true;
// If set to Incoming and new status is In chat
if (_chatStatus == '1' && _chunkStatus == '2')
{
$('#chatpostmsg').removeAttr('disabled').focus().val(' ').val('');
$('#chattoptoolbarprint').show();
$('#chattoptoolbaremail').show();
$('#chattoptoolbarsoundon').show();
// Chat just ended
} else if (_chunkStatus == '3') {
_chatStatus = 3;
$('#chatpostmsg').attr('disabled', true);
if (_userClosedWindow)
{
window.location.href = _swiftChatSurvey;
}
clearInterval(_activeIntervalID);
_doClientLoop = false;
// Display chat ended notification
if (!_chatEndedNotificationDisplayed)
{
DisplaySystemMessage(_swiftLanguage['chatendednotification'] + '
' + _swiftLanguage['chatendednotificationsub'] + '');
_chatEndedNotificationDisplayed = true;
}
}
ProcessChatStatus(_chunkStatus);
}
}
if (_shouldResetTyping) {
_isUserTyping = false;
DisplayResetUserIsTyping();
}
}
function htmlspecialchars(p_string) {
p_string = p_string.replace(/&/g, '&');
p_string = p_string.replace(//g, '>');
p_string = p_string.replace(/"/g, '"');
// p_string = p_string.replace(/'/g, ''');
return p_string;
};
function AutoLink(_text) {
if( !_text ) return _text;
_text = _text.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, function(url){
nice = url;
if (url.match('^www')) {
url = 'http://' + url;
}
return '' + nice + '';
});
return _text;
}
function EmailChat() {
$.blockUI({message: $('#sendemailcontainer'), overlayCSS: {
background: '#d0d0d0 url(' + _themePath + 'images/uigeneralbg.png) 50% 50% repeat',
filter: 'Alpha(Opacity=50);',
opacity: .5,
'z-index': '100000',
cursor: 'default'
}, css: {
padding: '15px',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
border: '1px solid #d0d0d0',
font: '22px Calibri, Trebuchet MS, Verdana, Arial, Helvetica',
color: '#666666',
width: '400px',
'z-index': '100001',
'top': ($(window).height() - 162) /2 + 'px',
'left': ($(window).width() - 420) /2 + 'px',
cursor: 'default'
}, forceIframe: false});
return true;
}
function ValidateChatSendEmailForm() {
var _emailExpression = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,6}$/;
if ($('#chatsendemail').val() == '') {
// Alert!
$('#chatsendemailinvaliderror').fadeOut('medium');
$('#chatsendemailerror').fadeIn('medium');
return false;
}
$('#chatsendemailerror').fadeOut('medium');
var _emailValue = $('#chatsendemail').val();
if (!_emailValue.match(_emailExpression))
{
// Alert
$('#chatsendemailinvaliderror').fadeIn('medium');
return false;
}
LoadXMLHTTPRequest(_swiftChatEmailURL, 'email=' + escape((_emailValue.replace(/%/g,'%25')).replace(/\+/g,'%2b')), true);
$.unblockUI();
return false;
}
function CloseEmailDialog() {
$.unblockUI();
}
function PlaySound() {
if (!_isSoundEnabled || !_isSoundPluginLoaded)
{
return true;
}
$("#soundcontainer").jPlayer('play');
return true;
}
function SwitchSoundOff() {
_isSoundEnabled = false;
$('#chattoptoolbarsoundon').hide();
$('#chattoptoolbarsoundoff').show();
}
function SwitchSoundOn() {
_isSoundEnabled = true;
$('#chattoptoolbarsoundon').show();
$('#chattoptoolbarsoundoff').hide();
}
function CloseChat() {
self.close();
}
function CloseProactiveChat() {
_chatStatus = 3;
LoadXMLHTTPRequest(_swiftChatEndURL, '', true);
clearInterval(_activeIntervalID);
_globalNoLoop = true;
}
function PrintChat() {
screen_width = screen.width;
screen_height = screen.height;
widthm = (screen_width-400)/2;
heightm = (screen_height-500)/2;
window.open(_swiftChatPrintURL, "printwindow", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=600,left=" + widthm + ",top=" + heightm);
}
$(function() {
$("#soundcontainer").jPlayer( {
ready: function () {
$(this).jPlayer("setMedia", {
mp3: SWIFT.get('swiftpath') + '__swift/themes/visitor/resources/message.mp3'
});
_isSoundPluginLoaded = true;
},
swfPath: SWIFT.get('swiftpath') + '__swift/javascript/__global/plugins/jplayer/resources'
});
});
/**
* ###############################################
* BEGIN ON READY FUNCTIONS
* ###############################################
*/
$(function(){
$('#chatsubject').keyup(function(){
// Get the limit from maxlength attribute
var _limit = parseInt($(this).attr('maxlength'));
// Get the current text inside the textarea
var _text = $(this).val();
// Count the number of characters in the text
var _chars = _text.length;
// Check if there are more characters then allowed
if (_limit > 0 && _chars > _limit) {
// and if there are use substr to get the text before the limit
var _newText = _text.substr(0, _limit);
// and change the current text with the new text
$(this).val(_newText);
}
});
/*
* Author: Rajat Garg
*
* SWIFT-1800 : Unsafe JavaScript attempt to access frame with URL (Issue with generated tag for chat if we use it on different domain any other than where our support center is installed)"
*
* Comments: Cross domain iFrame communication should happen via postMessage.
*/
window.onmessage = function(e) {
if (e.data == 'CloseProactiveChat') {
CloseProactiveChat();
e.source.postMessage('CloseProactiveChat', '*');
}
};
$('#chatpostmsg').blur(function() {
_clientIsTyping = false;
});
});