﻿function ShowSnippet(pageId, reviewsDivId, zipLocation, writeReviewUrl)
{
	InitPowerReviewsConstants(pageId, zipLocation, writeReviewUrl);
	ExtendJScriptMethods();
	snippet(jQuery(document.getElementById(reviewsDivId)));
	prData(pr_data_callback);
}

function ShowEngine(pageId, reviewsDivId, zipLocation, writeReviewUrl)
{
	InitPowerReviewsConstants(pageId, zipLocation, writeReviewUrl);
	ExtendJScriptMethods();
	engine(jQuery(document.getElementById(reviewsDivId)));
	prData(pr_data_callback);
}

function InitPowerReviewsConstants(pageId, zipLocation, writeReviewUrl)
{
	pr_page_id = pageId;
	pr_zip_location=zipLocation;
	pr_write_review=writeReviewUrl;
	pr_data_callback = function(info){
	};
}

function InitWriteReviewsConstants(pageId, merchantId, source)
{
	pr_page_id = pageId 
	pr_merchant_id = merchantId;
	pr_source = source;
}

function ExtendJScriptMethods()
{
	jQuery.fn.extend({
		write: function(text) {
		if(text.lastIndexOf('<link rel="stylesheet" ')== -1)
			this[0].innerHTML+=text;
		return this;
        }
    });
    
  jQuery.fn.extend({
	getElementById: function(id) {
				return document.getElementById(id);
       }
   });
}

