var App_Product= { _options : { productId : "productId", container : "content", navigationLink : "tab-navigation", pdfId : "data-sheet", currentClass : "product_current" }, changeProduct: function () { $('#' + this._options.productId).bind('change', function(){ if (this.value != 0) { window.location = BASE_URL + '/' + CURRENT_PAGE_FINAL + '/' + this.value; } }); }, ajaxContentLoaded: function (data) { $('#' + App_Product._options.container).html(data.content); }, init: function (options) { this._options = $.extend(this._options, options); this.changeProduct(); $('#' + this._options.navigationLink + ' a').bind('click', function(){ $.ajax({ dataType : 'json', type : 'POST', cache : true, url : this, data : null, success : App_Product.ajaxContentLoaded }); if ($(this).attr('id') != App_Product._options.pdfId) { $('#' + App_Product._options.navigationLink + ' a') .removeClass(App_Product._options.currentClass); $(this).addClass(App_Product._options.currentClass); return(false); } }); } };