var IEPNGFix=window.IEPNGFix||{};IEPNGFix.tileBG=function(elm,pngSrc,ready){var data=this.data[elm.uniqueID],elmW=Math.max(elm.clientWidth,elm.scrollWidth),elmH=Math.max(elm.clientHeight,elm.scrollHeight),bgX=elm.currentStyle.backgroundPositionX,bgY=elm.currentStyle.backgroundPositionY,bgR=elm.currentStyle.backgroundRepeat;if(!data.tiles){data.tiles={elm:elm,src:'',cache:[],img:new Image(),old:{}};}
var tiles=data.tiles,pngW=tiles.img.width,pngH=tiles.img.height;if(pngSrc){if(!ready&&pngSrc!=tiles.src){tiles.img.onload=function(){this.onload=null;IEPNGFix.tileBG(elm,pngSrc,1);};return tiles.img.src=pngSrc;}}else{if(tiles.src)ready=1;pngW=pngH=0;}
tiles.src=pngSrc;if(!ready&&elmW==tiles.old.w&&elmH==tiles.old.h&&bgX==tiles.old.x&&bgY==tiles.old.y&&bgR==tiles.old.r){return;}
var pos={top:'0%',left:'0%',center:'50%',bottom:'100%',right:'100%'},x,y,pc;x=pos[bgX]||bgX;y=pos[bgY]||bgY;if(pc=x.match(/(\d+)%/)){x=Math.round((elmW-pngW)*(parseInt(pc[1])/100));}
if(pc=y.match(/(\d+)%/)){y=Math.round((elmH-pngH)*(parseInt(pc[1])/100));}
x=parseInt(x);y=parseInt(y);var repeatX={'repeat':1,'repeat-x':1}[bgR],repeatY={'repeat':1,'repeat-y':1}[bgR];if(repeatX){x%=pngW;if(x>0)x-=pngW;}
if(repeatY){y%=pngH;if(y>0)y-=pngH;}
this.hook.enabled=0;if(!({relative:1,absolute:1}[elm.currentStyle.position])){elm.style.position='relative';}
var count=0,xPos,maxX=repeatX?elmW:x+0.1,yPos,maxY=repeatY?elmH:y+0.1,d,s,isNew;if(pngW&&pngH){for(xPos=x;xPos<maxX;xPos+=pngW){for(yPos=y;yPos<maxY;yPos+=pngH){isNew=0;if(!tiles.cache[count]){tiles.cache[count]=document.createElement('div');isNew=1;}
var clipR=Math.max(0,xPos+pngW>elmW?elmW-xPos:pngW),clipB=Math.max(0,yPos+pngH>elmH?elmH-yPos:pngH);d=tiles.cache[count];s=d.style;s.behavior='none';s.left=(xPos-parseInt(elm.currentStyle.paddingLeft))+'px';s.top=yPos+'px';s.width=clipR+'px';s.height=clipB+'px';s.clip='rect('+
(yPos<0?0-yPos:0)+'px,'+
clipR+'px,'+
clipB+'px,'+
(xPos<0?0-xPos:0)+'px)';s.display='block';if(isNew){s.position='absolute';s.zIndex=-999;if(elm.firstChild){elm.insertBefore(d,elm.firstChild);}else{elm.appendChild(d);}}
this.fix(d,pngSrc,0);count++;}}}
while(count<tiles.cache.length){this.fix(tiles.cache[count],'',0);tiles.cache[count++].style.display='none';}
this.hook.enabled=1;tiles.old={w:elmW,h:elmH,x:bgX,y:bgY,r:bgR};};IEPNGFix.update=function(){for(var i in IEPNGFix.data){var t=IEPNGFix.data[i].tiles;if(t&&t.elm&&t.src){IEPNGFix.tileBG(t.elm,t.src);}}};IEPNGFix.update.timer=0;if(window.attachEvent&&!window.opera){window.attachEvent('onresize',function(){clearTimeout(IEPNGFix.update.timer);IEPNGFix.update.timer=setTimeout(IEPNGFix.update,100);});};$(function(){$("#outlet").scrollable({circular:true}).autoscroll({interval:3000});});function addToCart(link){var product=$(link).parents('.product');var id=$(product).children('.iditem').val();var quantity=0;$.ajax({url:"/addToCart",cache:false,data:"product="+id,success:function(quant){}});if(cart[id]!=undefined){$('#cart #items .product .iditem').each(function(index){if($(this).val()==id){quantity=cart[id]+1;$(this).parents('.item').children('.ammount').children('.quantity').val(quantity);}})}else{html='<div class="item"><div class="edit"><a href="/addToCart?product='+id+'&quantity=0" rel="nofollow" onclick="return removeFromCart(this)" title="Remover"><img src="/img/remove.png" alt="Remover" /></a></div><div class="ammount"><input type="text" class="quantity" value="1" size="1" maxlength="2" onchange="return updateCart(this)" /></div><div class="product">'+product.html()+'</div></div>';if(cart.length==0){$('#cart #items').html(html);}else{$('#cart #items').append(html);}
quantity=1;}
cart[id]=quantity;$('#proceed').css('display','block');return false;}
function removeFromCart(link){if(!confirm('Tem a certeza que pretende remover este item do carrinho?'))
return false;var product=$(link).parents('.item').children('.product');var id=$(product).children('.iditem').val();$.ajax({url:"/addToCart",cache:false,data:"product="+id+"&quantity=0",success:function(quant){}});cart[id]=undefined;cart=iremove(cart,id);$(product).parents('.item').remove();if(cart.length==0){$('#cart #items').html('<p>Carrinho de compras<br />vazio.</p>');$('#proceed').css('display','none');}
return false;}
function updateCart(link){var product=$(link).parents('.item').children('.product');var id=$(product).children('.iditem').val();var quantity=parseInt($(link).val());$.ajax({url:"/addToCart",cache:false,data:"product="+id+"&quantity="+quantity,success:function(quant){}});if(quantity==0){cart[id]=undefined;cart=iremove(cart,id);$(product).parents('.item').remove();}else{cart[id]=quantity;}
if(cart.length==0){$('#cart #items').html('<p>Carrinho de compras<br />vazio.</p>');$('#proceed').css('display','none');}
return false;}
function iremove(arr,index){var newarr=new Array();for(var i in arr){if(index==i)
continue;else
newarr[i]=arr[i];}
return newarr;};var isMSIE=/*@cc_on!@*/false;var isIEmac=false;/*@cc_on @if(@_jscript&&!(@_win32||@_win16)&& 
(@_jscript_version<5.5)) isIEmac=true; @end @*/var undefined;function isEmpty(s){return((s=='')||/^\s*$/.test(s));}
var addBookmarkObj={linkText:'',title:document.title,URL:location.href,addTextLink:function(parId){var a=addBookmarkObj.makeLink(parId,1);if(a){jQuery(a).text(addBookmarkObj.linkText);return;}
var cont=addBookmarkObj.getParent(parId);if(!cont)return;jQuery(cont).append('<span>'+addBookmarkObj.findKeys()+'</span>');},addImageLink:function(parId,imgPath){if(!imgPath||isEmpty(imgPath))return;var o=addBookmarkObj,a=o.makeLink(parId),img=document.createElement('img');img.title=img.alt=o.modal?o.linkText:o.findKeys();img.src=imgPath;img.width=21;img.height=21;a.appendChild(img);},makeLink:function(parId,isText){var cont=addBookmarkObj.getParent(parId);if(!cont)return null;var a=document.createElement('a');a.href=addBookmarkObj.URL;var s=document.createElement('div').style;var isFx35plus=((navigator.userAgent.toLowerCase().indexOf('firefox')!=-1)&&(s.wordWrap!==undefined)&&(s.MozTransform!==undefined));if(window.external&&isMSIE&&!isIEmac){a.onclick=function(){try{window.external.AddFavorite(addBookmarkObj.URL,addBookmarkObj.title);}catch(ex){var t=addBookmarkObj.findKeys();alert('After closing this, '+t.charAt(0).toLowerCase()+t.slice(1));}
return false;}
addBookmarkObj.modal=1;}else if(window.opera||isFx35plus){a.title=addBookmarkObj.title,a.rel='sidebar';addBookmarkObj.modal=1;}else if(isText){return null;}else{a.onclick=function(){var t=this.firstChild.title;alert('After closing this, '+t.charAt(0).toLowerCase()+t.slice(1));return false;}}
return cont.appendChild(a);},getParent:function(parId){if(!document.getElementById||!document.createTextNode)return null;parId=((typeof(parId)=='string')&&!isEmpty(parId))?parId:'addBookmarkContainer';return document.getElementById(parId)||null;},findKeys:function(){var ua=navigator.userAgent.toLowerCase(),isMac=(ua.indexOf('mac')!=-1),isWebkit=(ua.indexOf('webkit')!=-1),str=(isMac?'Command/Cmd':'CTRL');if(window.opera&&(!opera.version||(opera.version()<9))){str+=' + T';}else if(ua.indexOf('konqueror')!=-1){str+=' + B';}else if(window.opera||window.home||isWebkit||isMSIE||isMac){str+=' + D';}
return((str)?'Press '+str+' to bookmark this page.':str);}}
jQuery(document).ready(function(){addBookmarkObj.addImageLink('','/img/favorite.png');});