/*--------------------------------------------------------------------------*
 * 
 * Volusion(C) PowerReviews(C) Integration (Dakota)
 * 
 * Version 1.0.3
 * 
 * Copyright (C) 2009 Brand Labs LLC
 * 
 *--------------------------------------------------------------------------*/

var DakotaSettings={ENABLED:false,MERCHANT_ID:null,PRODUCT_REVIEW_SNIPPET_DOCUMENT:null,PRODUCT_REVIEW_DOCUMENT:null,OVERRIDE_STYLE_SHEET_HTML:null,USE_BASE_STYLE_SHEET:true,USE_MERCHANT_OVERRIDE_STYLE_SHEET:true,CATEGORY_REVIEW_SNIPPET_DOCUMENT:null,PRODUCTS_CONTAINER_ID:'MainForm',MORE_INFO_FILE_NAME:'Bullet_MoreInfo.gif',ADD_TO_CART_FILE_NAME:'btn_addtocart_small.gif',CATEGORY_REVIEW_SNIPPET_CSS_CLASS:null,CATEGORY_MINIMUM_REVIEWS_TO_DISPLAY:0};var Dakota={load:function(){if(!DakotaSettings.ENABLED){return;}
if(location.pathname.toLowerCase()=='/productdetails.asp'||location.pathname.toLowerCase().indexOf('-p/')!=-1||location.pathname.toLowerCase().indexOf('_p/')!=-1){Dakota.addPrerequisites();Event.observe(window,'load',Dakota.windowLoadProduct);}
else if(location.pathname.toLowerCase()=='/searchresults.asp'||location.pathname.toLowerCase().indexOf('-s/')!=-1||location.pathname.toLowerCase().indexOf('_s/')!=-1){Dakota.addPrerequisites();Event.observe(window,'load',Dakota.windowLoadCategory);}},addPrerequisites:function(){document.write('<scr'+'ipt type="text/javascript" src="http://cdn.powerreviews.com/repos/'+DakotaSettings.MERCHANT_ID+'/pr/pwr/engine/js/full.js'+'"><\/scr'+'ipt>');if(DakotaSettings.USE_BASE_STYLE_SHEET){document.write('<link id="prBaseStylesheet" type="text/css" href="http://cdn.powerreviews.com/repos/'+DakotaSettings.MERCHANT_ID+'/pr/pwr/engine/pr_styles_review.css" rel="stylesheet"/>');}
if(DakotaSettings.USE_MERCHANT_OVERRIDE_STYLE_SHEET){document.write('<link id="prMerchantOverrideStylesheet" type="text/css" href="http://cdn.powerreviews.com/repos/'+DakotaSettings.MERCHANT_ID+'/pr/pwr/engine/merchant_styles2.css" rel="stylesheet"/>');}
if(DakotaSettings.OVERRIDE_STYLE_SHEET_HTML!=null){document.write(DakotaSettings.OVERRIDE_STYLE_SHEET_HTML);}},windowLoadCategory:function(){var aa=null;aa=$(DakotaSettings.PRODUCTS_CONTAINER_ID);if(aa==null){return;}
var ba=Class.create(DakotaSettings.CATEGORY_REVIEW_SNIPPET_DOCUMENT,{});anchors=aa.select('a');anchors.each(function(ca){var da=null;var ea=null;da=Dakota.getProductCodeFromURL(ca.href);if(da==null){return;}
da=da.toUpperCase();ea=ca.select('img');if(ea==null||ea.size()!=1){return;}
if(ea.first().src.indexOf(DakotaSettings.MORE_INFO_FILE_NAME)!=-1){return;}
if(ea.first().src.indexOf(DakotaSettings.ADD_TO_CART_FILE_NAME)!=-1){return;}
POWERREVIEWS.display.snippet(new ba(DakotaSettings.CATEGORY_REVIEW_SNIPPET_CSS_CLASS,ca),{pr_page_id:da,pr_read_review:ca.href+'#ReviewHeader',pr_snippet_min_reviews:DakotaSettings.CATEGORY_MINIMUM_REVIEWS_TO_DISPLAY});});},windowLoadProduct:function(){var fa=null;fa=Dakota.getProductCodeFromURL(window.location.href);if(fa==null){return;}
fa=fa.toUpperCase();POWERREVIEWS.display.snippet(DakotaSettings.REVIEW_SNIPPET_DOCUMENT,{pr_page_id:fa});POWERREVIEWS.display.engine(DakotaSettings.REVIEW_DOCUMENT,{pr_page_id:fa});},getProductCodeFromURL:function(ga){var ha=null;if(ga==null){return null;}
ha=ga.match(/\/productdetails\.asp\?(?:[\&]?.*\=.*)*productcode=([^\&\#]+)/i);if(ha!=null&&ha.length>=2){return unescape(ha[1]);}
ha=ga.match(/(?:_p|-p)\/(.+)\.htm/i);if(ha!=null&&ha.length>=2){return unescape(ha[1]);}
return null;}};var DocumentProxy={anchors:document.anchors,forms:document.forms,images:document.images,links:document.links,body:document.body,cookie:document.cookie,domain:document.domain,lastModified:document.lastModified,referrer:document.referrer,title:document.title,URL:document.URL,close:function(){document.close();},getElementById:function(id){return document.getElementById(id);},getElementsByName:function(ia){return document.getElementsByName(ia);},getElementsByTagName:function(ja){return document.getElementsByTagName(ja);},open:function(){document.open();},write:function(ka){},writeln:function(la){this.write(la);this.write('\n');}};var FixedLocationDocument=Class.create(DocumentProxy,{initialize:function(ma){this.containerId=ma;this.container=null;},createContainer:function(){var na=null;if(this.container!=null){return this.container;}
na=$(this.containerId);if(na!=null){this.container=na;return na;}
na=new Element('div',{id:this.containerId});this.addElementToFixedLocation(na);return na;},addElementToFixedLocation:function(oa){},write:function(pa){var qa=this.createContainer();qa.insert(pa);}});var BelowProductPhotoDocument=Class.create(FixedLocationDocument,{IMAGE_ELEMENT_ID:'product_photo',ANCHOR_ELEMENT_ID:'product_photo_zoom_url',addElementToFixedLocation:function(ra){var sa=$(this.ANCHOR_ELEMENT_ID);if(sa==null){sa=$(this.IMAGE_ELEMENT_ID);}
if(sa==null){return;}
sa.insert({after:ra});}});var BelowProductDescriptionDocument=Class.create(FixedLocationDocument,{FORM_NAME:'MainForm',addElementToFixedLocation:function(ta){var ua=document.getElementsByName(this.FORM_NAME);var va=null;if(ua.length<=0){return;}
va=$(ua[0]);if(va==null){return;}
va.insert(ta);}});var AnonymousFixedLocationDocument=Class.create(FixedLocationDocument,{initialize:function(wa,xa){this.container=null;this.containerClass=wa;this.location=xa;},createContainer:function(){var ya=null;if(this.container!=null){return this.container;}
ya=new Element('div');this.container=ya;this.addElementToFixedLocation(ya);ya.addClassName(this.containerClass);return ya;},addElementToFixedLocation:function(za){}});var BelowAnonymousLocationDocument=Class.create(AnonymousFixedLocationDocument,{addElementToFixedLocation:function(Aa){if(this.location==null){return;}
this.location.insert({after:Aa});}});