
var csel={};$(document).ready(function(){try{if($("div#csBreadcrumb").length>0){$("div#breadcrumbs div")[0].innerHTML=$("div#csBreadcrumb")[0].innerHTML;}}catch(e){}
$('table.csScrolltable thead tr').each(function(){var c=this.insertCell(this.cells.length);c.style.width='26px';});$('table.csScrolltable').each(function(){var r=this.insertRow(this.rows.length);var c=r.insertCell(r.cells.length);c.style.height='100%';c.innerHTML='&nbsp;';});$('.csInfoBarMenu').live('mouseover',function(){$(this).css('background-color','#4D8B76');$('#'+this.id+'Popup').css('left',$(this).offset().left+'px').show();});$('.csInfoBarMenu').live('mouseout',function(){$(this).css('background-color','');$('#'+this.id+'Popup').hide();});$('.csInfoBarSubMenu').live('mouseover',function(){$(this).css('background-color','#f0f0f0');$('#'+this.id+'Popup').css({left:$(this).offset().left+$(this).width()+'px'}).show();});$('.csInfoBarSubMenu').live('mouseout',function(){$(this).css('background-color','');$('#'+this.id+'Popup').hide();});$('#csImageThumbs img').click(function(){$(this).ThumbClick();});$('.csDeleteProduct').click(function(){return confirm('Are you sure you want to delete this product?');});$('#csMainImagePane img').live('click',function(){$(this).ShowPic();});$('div.csContainer').each(function(){$(this).ShadowBox();});csel.ShowRecentProducts();$('div#search input').val('Search our website...').addClass('watermark');$('div#search input').blur(function(){if($(this).val()==''){$(this).addClass('watermark');$(this).val('Search our website...');}});$('div#search input').focus(function(){if($(this).val()=='Search our website...'){$(this).val('');}$(this).removeClass('watermark');});});function cselAPI(){};cselAPI.prototype.ShowRecentProducts=function(){var sProds=dnn.dom.getCookie('RecentProducts');if(!sProds)return;var prods=sProds.split('^');if($('#csRecentProducts').length==0){csel.AddInfoBarMenu('csRecentProducts','Recent Products');}
for(var i=0;i<prods.length;i++){var prod=prods[i].split('|');$('#csRecentProductsPopup>div').append($('<a href="/viewproduct.aspx?prodid='+prod[0]+'">'+prod[1]+'</a>'));}};cselAPI.prototype.AddInfoBarMenu=function(id,title){$('#csInfoBarContainer').append($('<div></div>').attr({id:id}).hide().addClass('csInfoBarMenu').append('<span>'+title+'</span>').append($('<div></div>').attr({id:id+'Popup'}).addClass('csInfoBarPopup').append($('<h4>'+title+'</h4>')).append($('<div></div>'))).fadeIn());};cselAPI.prototype.AddViewedProduct=function(ProdID,Description,Group){var sProds=dnn.dom.getCookie('RecentProducts');var prods;if(sProds){prods=sProds.split('^');for(var i=0;i<prods.length;i++){if(prods[i].split('|')[0]==ProdID)return;}}else{prods=[];};prods.push(ProdID+'|'+Description+'|'+Group);var recent=[];if(prods.length>0){var start=prods.length-11;start=start<0?0:start;for(var i=prods.length-1;i>start;i--){recent.push(prods[i]);}}
dnn.dom.setCookie('RecentProducts',recent.join('^'),31,'/');csel.ShowRecentProducts();};csel=new cselAPI();$.fn.ShowPic=function(){var transDiv;transDiv=$('<div></div>').addClass('transback').addClass('imagePopup').css({position:'fixed',zIndex:99,left:'0px',top:'0px',width:'100%',height:'100%'}).click(function(){$('.imagePopup').remove();}).appendTo('body');var clone=$('<div></div>').addClass('imagePopup').css({border:'10px solid black',width:'50px',height:'50px',left:($(window).width()/2)-25+'px',top:($(window).height()/2)-25+'px',backgroundColor:'white',position:'fixed',zIndex:100}).attr('id','imageClone').append($(this).clone().attr({title:''}).css({width:'auto',display:'none'}).load(function(){var imH=$(this).height();var imW=$(this).width();var wH=$(window).height()-50;var wW=$(window).width()-50;var width,height;if(wW<imW||wH<imH){if((wW/wH)>(imW/imH)){height=wH;width=height*(imW/imH);}else{width=wW;height=width*(imH/imW);}}else{width=imW;height=imH;}
$(this).parent().animate({left:($(window).width()/2)-(width/2)+'px',top:($(window).height()/2)-(height/2)+'px',width:width+'px',height:height+'px'},'fast',function(){$($(this).children()[0]).css({maxWidth:width+'px',maxHeight:height+'px'}).fadeIn();});})).append($('<img></img>').attr('src','/portals/0/images/cancel_32.png').css({position:'absolute',right:'0px',top:'0px',marginRight:'-20px',marginTop:'-20px',cursor:'pointer'}).click(function(){$('.imagePopup').remove();}));$(clone).appendTo('body');};$.fn.ThumbClick=function(){$('#csMainImagePane').empty().append($('<img src="/images/loading.gif" alt="loading" />').css({width:'auto',height:'auto',marginTop:'144px',marginLeft:'104px'}));$('<img></img>').attr({src:$(this).attr('src').replace('Thumbnail.aspx?size=100&image=','')}).load(function(){$('#csMainImagePane').empty().append($(this));});};$.fn.ShadowBox=function(){var fChild=$(this).children()[0];if(fChild){if($(fChild).css("margin-top")!=''){$(fChild).css("margin-top","0px");}}
var top=$('<div></div>').addClass('cs_top');var middle=$('<div></div>').addClass('cs_middle');var bottom=$('<div></div>').addClass('cs_bottom');top.append($('<div></div>').append($('<div></div>')));bottom.append($('<div></div>').append($('<div></div>')));var sib=$(this).prev();var parent=$(this).parent();var mid=$('<div></div>').append($(this));middle.append(mid);var cont=$('<div></div>').css("display","inline-block");cont.append(top).append(middle).append(bottom);if(sib.length==0){$(parent).prepend(cont);}else{$(sib).after(cont);}
return $(cont);};$.fn.print=function(){if(this.size()>1){this.eq(0).print();return;}else if(!this.size()){return;}
var strFrameName=("printer-"+(new Date()).getTime());var jFrame=$("<iframe name='"+strFrameName+"'>");jFrame.css("width","1px").css("height","1px").css("position","absolute").css("left","-9999px").appendTo($("body:first"));var objFrame=window.frames[strFrameName];var objDoc=objFrame.document;var jStyleDiv=$("<div>").append($("link").clone()).append($("style").clone());var htm=this.html();objDoc.open();objDoc.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");objDoc.write("<html>");objDoc.write("<body>");objDoc.write("<head>");objDoc.write("<title>");objDoc.write(document.title);objDoc.write("</title>");objDoc.write(jStyleDiv.html());objDoc.write("</head>");objDoc.write(this.html());objDoc.write("</body>");objDoc.write("</html>");objDoc.close();objFrame.focus();objFrame.print();setTimeout(function(){jFrame.remove();},(60*1000));}
var cartText;$(document).ready(function(){$('a.csAddProd').show();$('a.csChooseProd').show();cartText=$('#csShoppingBar>span').text();$('a.csAddProd').click(function(){$('div.csProdSelection').hide();if($(this.parentNode).hasClass('csProdSelection')){$(this.parentNode).hide()}
var ProdID=this.id.replace('AddProd','');var Description=$(this).find('span.hide').text();Description=Description==null?this.title:Description;addToCart(ProdID,Description);UpdateCart();});$('a.AddToCartLarge, a.CartDropDownLarge').hover(function(){$(this).css('background-position','0px -25px')},function(){$(this).css('background-position','0px 0px')});$('a.AddToCartLarge, a.CartDropDownLarge').mousedown(function(){$(this).css('background-position','0px -50px')});$('a.AddToCartLarge, a.CartDropDownLarge').mouseup(function(){$(this).css('background-position','0px -25px')});$('a#csDisplayCookie').click(function(){var c=dnn.dom.getCookie('ShoppingCart');alert(c);return false;});$('a.csClearProducts').click(function(){if(confirm('Empty '+cartText+' - are you sure?')){dnn.dom.setCookie('ShoppingCart','',0,'/');UpdateCart();}
return false;});$('a.csChooseProd').click(function(e){$('div.csProdSelection').hide();$('div#csPS'+this.id.replace('csChooseProd','')).show();});$('.csShoppingCart a').live('click',function(){DeleteProduct(this.id.replace('cart',''));UpdateCart();});$('#csSaveCookie').click(function(){SaveCart();});UpdateCart(null,true);});function LoadSmallCart(){$('<div></div>').attr({id:'SmallCart'}).appendTo('#header').append($('<h2></h2>').append($('<a id="csViewOrder" href="Order.aspx" title="View order">View</a>')));};function addToCart(ID,Description){$('#csShoppingBar').addClass('csShopCartDown');window.setTimeout(function(){$('#csShoppingBar').removeClass('csShopCartDown')},1000);var prods=getSCProds();var found=false;if(prods){for(var i=0;i<prods.length;i++){if(prods[i].StockProdID==ID){found=true;prods[i].Quantity=(prods[i].Quantity*1)+1;}}}else{prods=[];}
if(!found){prods.push({StockProdID:ID,Description:Description,Quantity:1});}
SaveCookie(prods);$('input.CartSaveButton').fadeIn();};function showProductOrdered(ID){var src=$('#'+$('#AddProd'+ID).attr('name')).find('img.csThumb').attr('src');var img=$('<img></img>').attr({'src':src}).addClass('csPopupPic').appendTo('body');$(img).css({'top':(($(window).scrollTop()+$(window).height())-$(img).height())+'px'}).fadeIn(function(){$(this).fadeOut(function(){$(this).remove()});});};function DeleteProduct(ID){var prods=getSCProds();if(prods){for(var i=0;i<prods.length;i++){if(prods[i].StockProdID==ID){prods.splice(i,1);SaveCookie(prods);$('input.CartSaveButton').fadeIn();return;}}}};function SaveCookie(prods){var s=[];for(var i=0;i<prods.length;i++){s.push(prods[i].StockProdID+'|'+prods[i].Description+'|'+prods[i].Quantity);}
var cook=s.join('^');dnn.dom.setCookie('ShoppingCart',cook,31,'/');};function UpdateCart(prods,first){first=first==null?false:first;$('.csShoppingCart').empty();if(!prods){prods=getSCProds();}
var totalOrdered=0;if(prods){$('<table></table').appendTo($('.csShoppingCart'));for(var i=0;i<prods.length;i++){totalOrdered+=(prods[i].Quantity*1);$('<tr></tr>').append($('<td></td>').append($('<a></a>').attr({href:'#',id:'cart'+prods[i].StockProdID,title:'Remove from '+cartText}).addClass('del').css('padding-left','0px'))).append($('<td></td>').html(prods[i].Description)).append($('<td></td>').text(prods[i].Quantity)).appendTo($('.csShoppingCart table'));}}
$('.csShoppingCart tr:odd').css('background-color','#efefef');if(totalOrdered==0){if(first){$('#SmallCart:visible').hide();$('#csCart:visible').hide();}else{$('#SmallCart:visible').fadeOut();$('#csCart:visible').fadeOut();}
$('#csShoppingBar>span').text(cartText+' (empty)');}else{if(first){$('#SmallCart:hidden').show();$('#csCart:hidden').show();}else{$('#SmallCart:hidden').fadeIn();$('#csCart:hidden').fadeIn();}
$('#SmallCart h2').text(totalOrdered);$('#csShoppingBar>span').text(cartText+' ('+totalOrdered+')');}};function getSCProds(){var c=dnn.dom.getCookie('ShoppingCart');if(c){var prods=[];var p=c.split('^');for(var i=0;i<p.length;i++){var s=p[i].split('|');prods.push({StockProdID:s[0],Description:s[1],Quantity:s[2]});}
return prods;}else{return null;}}