').parent().html();
jQuery('#kcontent').html(ajax_response[key].content);
jQuery('#kcontent .koverlay').css({'height': jQuery('#kcontent').innerHeight() + 'px'});
} else if (key == 'ContentWithTitle') {
jQuery('#kcontent').html(ajax_response[key].content);
} else if (params.modal) {
kModal({'method': 'ON', 'divid': params.primary, 'title': params.modal, 'content': ajax_response[key].content});
params.modal = 0;
} else if (jQuery('#' + key).length != 0 && params.overlay && params.primary != 'ContentWithTitle') {
ajax_response[key].content += jQuery('#' + key + ' .koverlay').clone().wrap('
').parent().html();
jQuery('#' + key).html(ajax_response[key].content);
kOverlayManager();
} else if (jQuery('#' + key).length != 0) {
jQuery('#' + key).html(ajax_response[key].content);
} // End of if statement.
} // End of if statement.
} // End of if statement.
if (ajax_response[key].js_docready) {eval(ajax_response[key].js_docready);}
if (ajax_response[key].js_windowload) {setTimeout(function() {eval(ajax_response[key].js_windowload);}, 200);}
if (ajax_response[key].js_windowdelayed) {js_windowdelayed[key] = ajax_response[key].js_windowdelayed;}
});
setTimeout(function() {commonDoWindowLoad();}, 400);
if (params.scrollto) {
var thisoffset = jQuery('#' + params.scrollto).offset().top;
if (thisoffset < jQuery(window).scrollTop()) {setTimeout(function() {jQuery('html, body').animate({scrollTop: thisoffset}, 600);}, 600);}
} // End of if statement.
if (params.overlay) {
thisdivid = params.primary; if (thisdivid == 'ContentWithTitle') {thisdivid = 'kcontent';}
setTimeout(function() {kOverlay({'status': 'OFF', 'divid': params.primary});}, 600);
} // End of if statement.
if (!jQuery.isEmptyObject(js_windowdelayed)) {setTimeout(function() {jQuery.each(js_windowdelayed, function(key,value) {eval(value);});}, 800);}
return false;
} // End of function.
// +------------------------------------------------------------------+
// | Function: formGetObject |
// +------------------------------------------------------------------+
function formGetObject (params,callback,doupload) {
if (!params.formid) {return false;}
if (!callback) {return false;}
if (jQuery('#' + params.formid).length == 0) {return false;}
var formobj = new Object();
formobj.object = {};
jQuery.each(jQuery('#' + params.formid).serializeArray(), function() {
var arrayfield = this.name.match(/\[\]$/);
var fieldname = this.name.replace(/\[\]$/,'');
if (fieldname == 'ajax' || fieldname == 'guiactive') {
return true;
} else if (formobj.object[fieldname] !== undefined) {
if (!formobj.object[fieldname].push) {
formobj.object[fieldname] = [formobj.object[fieldname]];
} // End of if statement.
formobj.object[fieldname].push(this.value || '');
} else if (arrayfield) {
formobj.object[fieldname] = [];
formobj.object[fieldname].push(this.value || '');
} else {
formobj.object[fieldname] = this.value || '';
} // End of if statement.
});
var fileinputsseen = 0;
var fileinputstriggered = 0;
jQuery('#' + params.formid + ' input[type=file]').each(function(){fileinputsseen++;});
if ((!fileinputsseen) || (!doupload)) {
if (fileinputsseen) {
jQuery('#' + params.formid + ' input[type=file]').each(function(){
formobj.object[jQuery(this).attr('name')] = jQuery(this).val() || '';
});
} // End of if statement.
params.formobj = formobj;
return window[callback](params);
} // End of if statement.
jQuery('#' + params.formid + ' input[type=file]').each(function(){
if (this.files[0]) {
var reader = new FileReader();
var fieldname = jQuery(this).attr('name');
var fieldval = jQuery(this).val();
reader.onload = function(e) {
formobj.object[fieldname + '--ajaxfilecontent'] = reader.result;
formobj.object[fieldname + '--ajaxfilename'] = fieldval;
formobj.object[fieldname] = 'FOUND';
}
reader.readAsDataURL(this.files[0]);
formobj.object[jQuery(this).attr('name')] = jQuery(this).val();
fileinputstriggered++;
} else {
formobj.object[jQuery(this).attr('name')] = '';
} // End of if statement.
});
setTimeout(function() {
params.formobj = formobj;
return window[callback](params);
}, 200 * fileinputstriggered);
} // End of function.
// +------------------------------------------------------------------+
// | Function: postAJAX |
// +------------------------------------------------------------------+
function postAJAX(params) {
if (!params.callback) {return false;}
if (!params.callbackparams) {return false;}
if (thisRemoteSkinExport) {jQuery.each(params.callbackparams.ajax_request, function(key,value) {params.callbackparams.ajax_request[key]['remoteskinexporter'] = 1;});}
var ajaxData = {'app': 'core', 'ns': 'ajaxrequest', 'ajax': 1, 'ajax_request': jQuery.toJSON(params.callbackparams.ajax_request)};
if (thisGUIactive) {ajaxData['guiactive'] = thisGUIactive;}
jQuery.ajax({'type': 'POST',
'url': thisURL,
'data': ajaxData,
'success': function(data) {params.callbackparams.ajax_response = data; window[params.callback](params.callbackparams);},
'error': function(data) {params.callbackparams.ajax_response = 'ERROR: Failed jQuery ajax request.'; window[params.callback](params.callbackparams);},
'dataType': 'text',
'async': params.async,
'cache': false});
} // End of function.
// +------------------------------------------------------------------+
// | Function: wysiwygLoad |
// +------------------------------------------------------------------+
function wysiwygLoad(divid) {
if (!divid) {return false;}
if (jQuery('#' + divid).length == 0) {return false;}
jQuery('#' + divid + '--wysiwyglink').hide('fade', 300);
setTimeout(function() {jQuery('#' + divid + '--wysiwyglink').css({'display': 'none'});}, 300);
jQuery('#' + divid).trumbowyg({minimalLinks: true, btns: ['viewHTML','|','formatting','|',['bold','italic','underline'],'|','link','|',
['justifyLeft','justifyCenter','justifyRight','justifyFull'],'|',['unorderedList','orderedList'],'|','horizontalRule']});
return false;
} // End of function.
// +------------------------------------------------------------------+
// | Function: kPriceFormat |
// +------------------------------------------------------------------+
function kPriceFormat (price, currency) {
if ((currency == '$') || (currency == '¥') || (currency == '£') || (currency == '€')) {
return currency + kNumberFormat(price, 2, '.', ',');
} else {
return currency + ' ' + kNumberFormat(price, 2, '.', ',');
} // End of if statement.
} // End of function.
// +------------------------------------------------------------------+
// | Function: kNumberFormat |
// +------------------------------------------------------------------+
function kNumberFormat (number, decimals, dec_point, thousands_sep) {
number = (number + '').replace(/[^0-9+-Ee.]/g, '');
var n = !isFinite(+number) ? 0 : +number;
var prec = !isFinite(+decimals) ? 0 : Math.abs(decimals);
var sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep;
var dec = (typeof dec_point === 'undefined') ? '.' : dec_point;
var s = '';
var toFixedFix = function (n, prec) {var k = Math.pow(10, prec); return '' + Math.round(n * k) / k;};
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
if (s[0].length > 3) {s[0] = (s[0] + '').replace(/(\d)(?=(\d{3})+$)/g, '$1' + sep);}
if ((s[1] || '').length < prec) {s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0');}
return s.join(dec);
} // End of function.
// +------------------------------------------------------------------+
// | Function: priceAutoUpdate |
// +------------------------------------------------------------------+
function priceAutoUpdate(params) {
if (!params.formid) {return false;}
if (jQuery('#' + params.formid).length == 0) {return false;}
if (window.mytimeout) {window.clearTimeout(window.mytimeout);}
setTimeout(function() {formGetObject(params,'priceAutoUpdateFormPost',0);}, 10);
return false;
} // End of function.
// +------------------------------------------------------------------+
// | Function: priceAutoUpdateFormPost |
// +------------------------------------------------------------------+
function priceAutoUpdateFormPost(params) {
if (!params.formid) {return false;}
if (!params.formobj) {return false;}
var formobj = params.formobj; delete params.formobj;
formobj.object.ns = params.priceautoupdatens;
params.divname = params.formid + '--priceautoupdate--name';
params.divprice = params.formid + '--priceautoupdate--price';
if (jQuery('#' + params.divname).length == 0) {return false;}
if (jQuery('#' + params.divprice).length == 0) {return false;}
jQuery('#' + params.divprice).html('
');
params.ajax_request = {'priceAutoUpdate': formobj.object};
postAJAX({'callback': 'priceAutoUpdateResult', 'callbackparams': params, 'async': true});
return false;
} // End of function.
// +------------------------------------------------------------------+
// | Function: priceAutoUpdateResult |
// +------------------------------------------------------------------+
function priceAutoUpdateResult(params) {
if (!params.formid) {return false;}
if (!params.divname) {return false;}
if (!params.divprice) {return false;}
if (!params.ajax_request) {return false;}
if (!params.ajax_response) {return false;}
if (params.ajax_response.match(/^ERROR/)) {return false;}
var ajax_response = jQuery.evalJSON(params.ajax_response);
if (ajax_response['priceAutoUpdate'].content) {
if (ajax_response['priceAutoUpdate'].content.match(/^ERROR/)) {
var injecthtml = 'TBD';
jQuery('#' + params.divprice).html(injecthtml);
return false;
} else {
var injecthtml = ajax_response['priceAutoUpdate'].content;
jQuery('#' + params.divprice).html(injecthtml);
} // End of if statement.
} // End of if statement.
if (ajax_response['priceAutoUpdate'].js_docready) {eval(ajax_response['priceAutoUpdate'].js_docready);}
if (ajax_response['priceAutoUpdate'].js_windowload) {setTimeout(function() {eval(ajax_response['priceAutoUpdate'].js_windowload);}, 200);}
setTimeout(function() {commonDoWindowLoad();}, 400);
if (ajax_response['priceAutoUpdate'].js_windowdelayed) {setTimeout(function() {eval(ajax_response['priceAutoUpdate'].js_windowdelayed);}, 600);}
return false;
} // End of function.
// +------------------------------------------------------------------+
// | End of File |
// +------------------------------------------------------------------+