Number.prototype.formatMoney=function(c,d,t){var n=this,c=isNaN(c=Math.abs(c))?2:c,d=d==undefined?",":d,t=t==undefined?".":t,s=n<0?"-":"",i=parseInt(n=Math.abs(+n||0).toFixed(c))+"",j=(j=i.length)>3?j%3:0;return s+(j?i.substr(0,j)+t:"")+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+t)+(c?d+Math.abs(n-i).toFixed(c).slice(2):"");};$j(document).ready(function(){$j('.lounge').eq(0).addClass('lounge-first');$j('.lounge-btn').bind('mouseup',function(){switch_what=$j(this).index()-1;switchTo();clearInterval(switch_iv);if(switch_to){clearTimeout(switch_to);}
switch_to=setTimeout(function(){startSwitch(switch_what);},2000);});var switch_what=0;var switch_iv;var switch_to;function startSwitch(){switch_iv=setInterval(function(){switchTo();},4000)}
function switchTo(){var ann=$j('.lounge');if(ann.length == 1){return false;}$j('.lounge-on').fadeOut(500,function(){$j('.lounge').eq(switch_what).fadeIn(500,function(){$j('.lounge-on').removeClass('lounge-on');$j(this).addClass('lounge-on')});$j('.lounge-btn').removeClass('loungebtn-on');$j('.lounge-btn').eq(switch_what).addClass('loungebtn-on');});switch_what++;if(switch_what==(ann.length)){switch_what=0;}}
startSwitch();items.total=items.recent.length;$j('.recent-premium-prev-a').bind('mouseup',function(){if(items.current>0){items.current--;}
items.check();});$j('.recent-premium-next-a').bind('mouseup',function(){if(items.current<items.total){items.current++;}
items.check();});if(items.total>0){$j('.recent-premium-next-a').css('visibility','visible');}
$j('#trending-a').bind('mouseup',function(){$j('.trending-holder').html('<div style="text-align:center;padding:10px;"><img src="/images/loading.gif" border="0" /></div>');if(items.trending_to_show>=(items.trending.length-1)){items.trending_to_show=0;}else{items.trending_to_show++;}
$j.post('/ajax?reload=1&id='+items.trending[items.trending_to_show],{action:'estore.ajax',func:'home.items'},function(r){$j('.trending-holder').html(r);});});});var items={trending_to_show:0,trending:Array(),recent:Array(),current:1,total:0,check:function(){if(items.total==0)return false;if(items.current>1){$j('.recent-premium-prev-a').css('visibility','visible');}else{$j('.recent-premium-prev-a').css('visibility','hidden');}
if(items.current>=(items.total-1)){$j('.recent-premium-next-a').css('visibility','hidden');}else{$j('.recent-premium-next-a').css('visibility','visible');}
var obj=$j.parseJSON(items.recent[items.current]);var sale_price_html='';var was_price_html='';var sale_price_other_html='';var was_price_other_html='';$j('.recent-premium-item').fadeOut('slow',function(){$j('.recent-premium-item-thumb').html(obj.link+'<img src="'+obj.thumb+'" border="0" /></a>');$j('.recent-premium-item-name').html(obj.link+obj.name+'</a>');if(obj.sale_price>0){if(obj.currency_default=='USD'){sale_price_html='$'+(Math.round((obj.sale_price)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,'.',',');was_price_html=' was '+''+(Math.round((obj.price*obj.currency_value)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,obj.currency_decimal,obj.currency_thousands);sale_price_other_html=obj.currency_symbol+''+(Math.round((obj.sale_price*obj.currency_value)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,obj.currency_decimal,obj.currency_thousands);was_price_other_html=' was '+''+(Math.round((obj.price)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,'.',',');}else{sale_price_html=obj.currency_symbol+''+(Math.round((obj.sale_price*obj.currency_value)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,obj.currency_decimal,obj.currency_thousands);was_price_html=' was '+obj.currency_symbol+''+(Math.round((obj.price*obj.currency_value)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,obj.currency_decimal,obj.currency_thousands);sale_price_other_html='$'+(Math.round((obj.sale_price)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,'.',',');was_price_other_html=' was '+''+(Math.round((obj.price)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,'.',',');}
$j('.recent-premium-item-price-now').html(sale_price_html);$j('.recent-premium-item-price-was').html(was_price_html);$j('.recent-premium-item-price-now-other').html(sale_price_other_html);$j('.recent-premium-item-price-was-other').html(was_price_other_html);$j('.recent-premium-item-price-reg').html('');$j('.recent-premium-item-price-reg-other').html('');}else{var sale_price_html='';var was_price_html='';if(obj.currency_default=='USD'){var price_html='$'+(Math.round((obj.price)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,'.',',');var price_html_other=obj.currency_symbol+''+(Math.round((obj.price*obj.currency_value)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,obj.currency_decimal,obj.currency_thousands);}else{var price_html=obj.currency_symbol+''+(Math.round((obj.price*obj.currency_value)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,obj.currency_decimal,obj.currency_thousands);var price_html_other='$'+(Math.round((obj.price)*Math.pow(10,2))/Math.pow(10,2)).formatMoney(2,'.',',');}
$j('.recent-premium-item-price-reg').html(price_html);$j('.recent-premium-item-price-now').html(sale_price_html);$j('.recent-premium-item-price-was').html(was_price_html);$j('.recent-premium-item-price-reg-other').html(price_html_other);$j('.recent-premium-item-price-now-other').html(sale_price_html);$j('.recent-premium-item-price-was-other').html(was_price_html);}
$j('.recent-premium-item-free-shipping').html('');if(obj.free_shipping==1){$j('.recent-premium-item-free-shipping').html('Free Shipping!');}
$j('.recent-premium-item-addcart').html(obj.cart);$j('.recent-premium-item').fadeIn();});}}
