
 
	/*
		This script block is called by the statisticssummary.js javascript file to return the JSON
		results of the query.  The following are properties of the jsonData object that will most
		likely be used:

			totalReviews --the total number of reviews received
			averageRating --the average rating for the product
			reviewsUrl --the url of the rating summary page
	*/
	function BVHandleSummaryResults(jsonData) { 
		if(jsonData.totalReviews > 0 && jsonData.reviewsUrl.length > 0) { 
			/* 
				the following code comprises the jquery calls used to take the JSON data and set the values for the
				elements on the page.
			*/
			$("a#readReview3227901").html("Read all " + jsonData.totalReviews + " Reviews"); // sets the display html
			$("a#readReview3227901").attr("href",jsonData.reviewsUrl); // sets the url of the anchor
			$("a#readReview3227901").click  // opens the URL in a new window
			(
				function()
				{
					window.open($(this).attr("href"),"reviews","width=805,height=575,scrollbars=yes,toolbar=no");
					return false;
				}
			);
			/* 
				if you wish to use Fellowes' images, the following is the URL path to Fellowes' images:
				
				http://www.fellowes.com/fellowes/images/BVRatings
				
				and then the image names are:
				
				rating-x_y.gif
				
				where x = the integer and y = the decimal.  For instance, if the averageRating property returned a value of "4.111100196838379", then you would need to 
				round the value to one decimal, convert it to a string, and then replace the decimal with an underscore.  The following code illustrates how to do so:
			*/
			$("img#starImage").attr("src","http://www.fellowes.com/fellowes/images/BVRatings/rating-" + jsonData.averageRating.toFixed(1).toString().replace(".","_") + ".gif");
			$("img#starImage").attr("alt",jsonData.averageRating.toFixed(1).toString() + " of 5 stars");// sets the alt tag for the image
			$("img#starImage").attr("title",jsonData.averageRating.toFixed(1).toString() + " of 5 stars");// sets the alt tag for the image
		} 
		else
		{
			/* if no review data is available, then hide the review display elements */
			$("a#readReview3227901").hide();	
			$("img#starImage").hide();	
		}
	} 



var popUpWin=0;
function popUpWindow(URLStr, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+'');
}

var timerID = null
var timerRunning = false
var delay = 1000
var phpConId = "";
function Initialize(PhpContainerId)
{
	
	phpConId = PhpContainerId
    StopTheClock()
	timerRunning = true
    timerID = self.setTimeout("InjectLivePhpCode()", delay)
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function InjectLivePhpCode()
{
    var DivPhpLive = findObj(phpConId)
	var DivPHPLiveCode = findObj('DivPHPLiveCode')
	if (DivPhpLive)
	{
		DivPHPLiveCode.style.display='block'
		DivPhpLive.appendChild(DivPHPLiveCode)
	}
	StopTheClock()
}

// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}
