/* main.js */
AG=new function(){this.Home={};this.Product={}};AG.Home=new function(){this.reloadTable=function(c,d){$.ajax({url:c,dataType:'html1',success:function reloadTableSuccess(a){$(document.getElementById(d)).attr("innerHTML",a).evalScripts();AG.Home.setupFilterButtons()},complete:function(a,b){if(AG.Product&&AG.Product.openSizedWindow)AG.Product.openSizedWindow()}})};this.sortForm=function(a,b,c,d){this.ajaxForm(a,d,'sortDir='+c+'&sortBy='+b)};this.filterForm=function(a,b){var c=document.forms[a];var d=$('#'+a).formSerialize();AG.Home.reloadTable(c.getAttribute('action')+d,b)};this.changeRecordsForm=function(a,b,c){this.ajaxForm(a,c,b+'&sortDir=&sortBy=')};this.changePageForm=function(a,b,c){this.ajaxForm(a,c,b)};this.removeAllFiltersForm=function(a,b){var c=document.forms[a];var d=$('#'+a).formToArray();var e=[];for(i=0;i<d.length;i++){if(d[i].name.slice(-6)=='Filter')continue;if(d[i].name.slice(-9)=='Condition')continue;e.push(d[i])}AG.Home.reloadTable(c.getAttribute('action')+$.param(e),b)};this.ajaxForm=function(a,b,c){var d=document.forms[a];var c=c+'&'+$('#'+a).formSerialize();AG.Home.reloadTable(d.getAttribute('action')+c,b)};this.setupAjax=function(){$(function(){$("#loading").ajaxStart(function(){$(this).show()});$("#loading").ajaxStop(function(){$(this).hide()})})};this.setupFilterButtons=function(){$('.removeFiltersButton').click(function(){AG.Home.removeAllFiltersForm('table','entire_ajax_table')});$('.filterButton').click(function(){AG.Home.filterForm('table','entire_ajax_table')});$('.row').dblclick(function(){var a=$(this).find('a.onDblClick').attr('href');if(a)window.location.href=a});$('select[@name=recordsPerPage]').change(function(){var a=this.options[this.selectedIndex].value;AG.Home.changeRecordsForm('table','&recordsPerPage='+a,'entire_ajax_table')})}};
/* customer.js */
AG.Product=new function(){this.showProductDetails=function(){$('img.product_img').cluetip({attribute:'alt',cluetipClass:'jtip',width:300,showTitle:false,arrows:true,dropShadow:false,hoverIntent:false,sticky:true,mouseOutClose:true,cursor:'pointer'})};this.openSizedWindow=function(){$('a.product_deals').cluetip({positionBy:'fixed',staticPosition:'top',mouseOutClose:false,sticky:true,ajaxCache:true,closePosition:'title',closeText:'<img src="/images/close.gif" />',attribute:'alt',cluetipClass:'dealstip',width:300,topOffset:15,leftOffset:-212,cursor:'pointer',onActivate:function(e){window.open(e.attr('target'),'','width=400, height=400, resizable=yes, left=0, top=0, location=yes, scrollbars=yes, status=yes, menubar=yes');return true},activation:'toggle',ajaxSettings:{timeout:15000}})}};AG.Newsletter=new function(){this.initSignup=function(){$('#newsletter_tip').cluetip({attribute:'title',width:300,showTitle:false,arrows:true,dropShadow:false,hoverIntent:false,sticky:true,closePosition:'bottom',ajaxCache:false,ajaxSettings:{type:"GET",data:"email="+$('#newsletter_email').val()},onActivate:function(e){this.ajaxSettings.data="email="+$('#newsletter_email').val();return true}});$('#newsletter').submit(function(){$('#newsletter_tip').trigger('mouseover');return false})}};AG.Home.setupAjax();$(function(){$("#deals_ticker").newsticker().show();if($("#content").height()>450){heightMenu=$("#content").height()-30}else{heightMenu=450}$('#menu').css('height',heightMenu+'px');$('#idProductFilter').focus(function(){if($('#idProductFilter').val()=='SEARCH FOR PRODUCTS')$('#idProductFilter').val('')});AG.Newsletter.initSignup();AG.Home.setupFilterButtons()});
