/*--------------------------------------------------------------------------*
 * 
 * Volusion(C) PowerReviews(C) Integration (Dakota)
 * 
 * Version 1.0.6
 * 
 * Copyright (C) 2009 Brand Labs LLC
 * 
 *--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*
 * PowerReviews Configuration
 *--------------------------------------------------------------------------*/
DakotaSettings.MERCHANT_ID = 11258;
DakotaSettings.OVERRIDE_STYLE_SHEET_HTML = '<link type="text/css" rel="stylesheet" href="http://www.shadesdaddy.com/v/dakota/css/powerreviews_express.css"/>';
/*--------------------------------------------------------------------------*/


/*--------------------------------------------------------------------------*
 * PowerReviews Configuration
 *--------------------------------------------------------------------------*/
DakotaSettings.ENABLED = true;

DakotaSettings.REVIEW_DOCUMENT = new BelowProductDescriptionDocument('dakota_review');
DakotaSettings.CATEGORY_REVIEW_SNIPPET_DOCUMENT = BelowAnonymousLocationDocument;
DakotaSettings.CATEGORY_REVIEW_SNIPPET_CSS_CLASS = 'dakota_review_snippet_category';
DakotaSettings.CATEGORY_MINIMUM_REVIEWS_TO_DISPLAY = 1;
/*--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------*
 * Output directly below externally-hosted product photo
 *--------------------------------------------------------------------------*/
var BelowExternalProductPhotoDocument = Class.create(FixedLocationDocument, {
	FORM_NAME: 'MainForm',
	
	addElementToFixedLocation: function(element) {
		var containers = document.getElementsByName(this.FORM_NAME);
		var container = null;
		
		//Make sure something is available
		if(containers.length <= 0) {
			return;
		}

		//Get the element object
		container = $(containers[0]);		
		if(container == null) {
			return;
		}
		
		//Get the table cell with the product photo in it
		try {
			container = container.down('table').down('tr', 1).down('td').down('table').down('tr').down('td', 1).down('img');
			
			//Product photo could be linked to larger photo
			if(container.up().match('a')) {
				container = container.up();
			}
		}
		catch(e) {
			return;
		}
		if(container == null) {
			return;
		}
		
		//Add the element	
		container.insert({after: element});
	}
});
/*--------------------------------------------------------------------------*/

DakotaSettings.REVIEW_SNIPPET_DOCUMENT = new BelowExternalProductPhotoDocument('dakota_review_snippet');


/*--------------------------------------------------------------------------*
 * Start up the module
 *--------------------------------------------------------------------------*/
try {
	Dakota.load();
}
catch(e) {/*No-op*/}
/*--------------------------------------------------------------------------*/