var util_init = function($)
{
$.fn.spacingTop = function()
{
var $this = $(this);
return parseInt($this.css('margin-top'), 10) + parseInt($this.css('padding-top'), 10);
};
$.displayText = function(value)
{
if (value === true)
return 'yes';
else if (value === false)
return 'no';
else
return value || ' '
};
$.emptyString = function(str, prompt)
{
if ((str === null) || (str === undefined) || (str === ''))
return prompt;
else
return str;
};
$.live = function(selector, type, callback)
{
var obj = $([]);
obj.selector = selector;
obj.context = document;
if (type && callback) {
$(document).on(type, selector, callback);
}
return obj;
};
$.doformsToggle = function(selector, clicked, reclicked)
{
var obj = $([]);
obj.selector = selector;
obj.context = document;
if (clicked && reclicked) {
$(document).on('click', selector, function(selector) {
if($(this).hasClass(CONST_TOGGLE_CLICKED_CLASS)) {
$(this).removeClass(CONST_TOGGLE_CLICKED_CLASS);
reclicked($(this));
} else {
$(this).addClass(CONST_TOGGLE_CLICKED_CLASS);
clicked($(this));
}
});
}
return obj;
};
$.removeFromArray = function(elem, array)
{
array.splice($.inArray(elem, array), 1);
};
$.removeAllFromArray = function(array)
{
array.splice(0, array.length);
};
$.compareInArray= function(elt, array)
{
var resultIndex = -1;
$.each(array, function(index, value) {
if (value.toLowerCase() == elt.toLowerCase()) {
resultIndex = index;
return false;
}
});
return resultIndex;
};
$.containInArray= function(elt, array)
{
var resultIndex = -1;
$.each(array, function(index, value) {
if (elt.indexOf(value) >= 0) {
resultIndex = index;
return false;
}
});
return resultIndex;
};
$.insertToArrayBefore = function(elem, array, beforeElement)
{
array.splice($.inArray(beforeElement, array), 0, elem);
};
$.insertToArrayBefore2Element = function(elem, array, beforeElement)
{
var index = $.inArray(beforeElement, array);
if(index>0){
index -= 1;
}
array.splice(index, 0, elem);
};
$.insertToArrayAfter = function(elem, array, afterElement)
{
array.splice($.inArray(afterElement, array) + 1, 0, elem);
};
$.toast = function(message)
{
var $toast = $('.toast');
$toast
.empty()
.append('' + message + '')
.animate(
{ bottom: '-' + ($toast.outerHeight(true) -
$toast.find('span').outerHeight(true) -
20) + 'px' },
'slow',
function()
{
setTimeout(function()
{
$toast.animate({ bottom: '-15em' }, 'slow');
}, 3000);
});
};
$.toastNew = function(message)
{
/*var myDocument = window.parent.document;
var scrollTop;
var offsetTop;
try{
scrollTop = myDocument.scrollingElement.scrollTop;
offsetTop = myDocument.getElementById('fancybox-wrap').offsetTop;
}catch(ex){
}
try{
if(scrollTop == undefined){
scrollTop = $(myDocument).scrollTop();
}
}catch(ex){
return;
}
try{
if(offsetTop == undefined){
offsetTop = $(myDocument).find('#fancybox-wrap').offset().top;
}
}catch(ex){
return;
}
var $toast = $('.toast');
$toast
.empty()
.append('' + message + '')
.animate(
{ bottom: CONST_VALUE_INITIAL,
height: '50px',
'padding-top': CONST_VALUE_INITIAL,
left: '30%',
top: '20px'},//(scrollTop - offsetTop + 200) + 'px'},
'slow',
function()
{
setTimeout(function()
{
$toast.animate({ bottom: '-15em' }, 'fast');
//$toast.animate({ bottom: '-15em', top: '-200em', height: '50px'}, 'slow');
}, 3000);
});*/
$('.toast')
.empty()
.append('' + message + '').offset({
top: 200,
left:0
}).animate({
"left": "+=500px"
}, "slow", function() {
setTimeout(function() {
$('.toast').offset({
top: -2000,
left: -2000
});
}, 3000);
});
};
$.fn.debugName = function()
{
var $this = $(this);
var result = $this.get(0).tagName.toLowerCase();
if ($this.attr('id') !== '')
result += '#' + $this.attr('id');
else if ($this.attr('class') !== '')
result += '.' + $this.attr('class').split(/ +/).join('.');
if ($this.get(0).tagName !== 'BODY')
result = $this.parent().debugName() + ' ' + result;
return result;
};
};
;(function($){
util_init($);
})(jQuery);
/*
* Copyright (c) 2007 Josh Bush (digitalbush.com)
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Version: Beta 1
* Release: 2007-06-01
*/
;(function($) {
var map=new Array();
$.Watermark = {
ShowAll:function(){
for (var i=0;i 0 ? '\\.' : '$') + ')';
return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&,');
};
function getDateTime5MinuteAfter(strDateTime){
var scheduleTime;
if(strDateTime === ''){
scheduleTime = getCurrentTime(CONST_VALUE_DATE_SPACE_TIME, false);
} else{
scheduleTime = strDateTime;
}
try {
//var newDate = new Date((new Date(scheduleTime)).getTime() + 5*60*1000); // plus 5 minutes
var newDate = new Date(scheduleTime); // change request 03/01/15: not plus 5 minutes
scheduleTime = newDate.format("mm/dd/yyyy hh:MM:ss TT");
} catch (e) { }
var arrDTInfo = scheduleTime.split(' ');
var datePart = arrDTInfo[0];
var hourPart = '01';
var minutePart = '00';
var apm = 'AM';
try {
if(arrDTInfo.length > 1){
hourPart = arrDTInfo[1].split(':')[0];
apm = arrDTInfo[2];
// set min minute matched for edit case
if(strDateTime != ''){
var minuteNum = parseInt(arrDTInfo[1].split(':')[1]);
if(minuteNum < 15){
minutePart = '00';
} else if(minuteNum < 30){
minutePart = '15';
} else if(minuteNum < 45){
minutePart = '30';
} else {
minutePart = '45';
}
}
}
} catch (e) { }
return {
date: datePart,
hour: hourPart,
minute: minutePart,
apm: apm
};
};
function getTimezoneName() {
var tzName = '';
try {
//return /\((.*)\)/.exec(new Date().toString())[1];
tzName = (new Date()).toString().split('(')[1].replace(')','');
} catch (e) { }
return tzName;
};
function getModalSelector(hrefStr) {
if(hrefStr.indexOf('#') >= 0) {
var modalClassName = hrefStr.substring(hrefStr.indexOf('#') + 1, hrefStr.length);
var jquerySelector = $('.' + modalClassName);
return jquerySelector;
}
return $('.modal');
}
var matched, browser;
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || [];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
if ( !jQuery.browser ) {
var
matched = jQuery.uaMatch( navigator.userAgent ),
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
}
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");