// Analytics2
try
{
	var pageTracker = _gat._getTracker("UA-5672573-1");
	pageTracker._setDomainName(".myreviewer.com");
	pageTracker._trackPageview();
	
	// Analytics
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
}
catch(error)
{
	// Do nothing
}

// OTP
DM_tag();

// Bubble tooltips
var intCookieStep, intCheckStep;

intCookieStep = readCookie("CookieStep");
if (!intCookieStep)
	intCookieStep = 0;
else
	intCookieStep = parseInt(intCookieStep);
intCheckStep = 1;

if (intCookieStep < intCheckStep++)
	showTooltip("helpSearchBox", "You can search our site for lots of things, quick and easily, just type the name of something into this box, and click Go!", 100, 5);
else if (intCookieStep < intCheckStep++)
	showTooltip("helpAddContent", "You can add your own items for review, write your own articles and even start discussions, using this button!", 100, 20);
else if (intCookieStep < intCheckStep++)
	showTooltip("helpAddReviews", "Want to post a full review of something yourself? Or add an article, lyrics or video to this item? You can do all that by clicking here!", -50, 20, true);
else if (intCookieStep < intCheckStep++)
	showTooltip("helpOther", "Don't like the colour scheme or text size? You can change them to another one by clicking one of the buttons here!", -90, 5, true);
else if (intCookieStep < intCheckStep++)
	showTooltip("helpRelatedItem", "Items appear here which have similar tags to the ones you are currently viewing!", 100, 5);
else if (intCookieStep < intCheckStep++)
	showTooltip("helpRelatesBox", "You can view more details about this article, video or image, by clicking the item it relates to!", -130, 20, true);
else if (intCookieStep < intCheckStep++)
	showTooltip("helpTagBox", "Tags are specific words which describe or relate to an item, such as artists, dates and formats. You can click them to find other items that share the same tag!", -100, 5, true);
/*else if (intCookieStep < intCheckStep++)
	showTooltip("helpBreadcrumbs", "You can quickly navigate around !", 100, 5);*/
// product details and the fact you can change them if they are wrong
// ratings

function showTooltip(strItemID, strTooltipText, intXOffset, intYOffset, intFlip)
{
	var objTooltip;
	
	objTooltip = document.getElementById("Tooltip");
	if (objTooltip)
	{
		var objTipText, objAnchor;

		if (intFlip)
			objTooltip.className = "thebubbleflip";
		
		objTipText = document.getElementById("TooltipText");
		if (objTipText)
			objTipText.innerHTML = strTooltipText;
		
		objAnchor = document.getElementById(strItemID);
		if (objAnchor)
		{
			objTooltip.style.left = (findPosX(objAnchor) + intXOffset) + "px";
			objTooltip.style.top = (findPosY(objAnchor) + intYOffset) + "px";
			objTooltip.style.display = "block";
		}
	}
}

function hideTooltip()
{
	var objTooltip;
	
	objTooltip = document.getElementById("Tooltip");
	if (objTooltip)
		objTooltip.style.display = "none";
	intCookieStep++;
	createCookie("CookieStep", intCookieStep, 365);
	return false;
}

function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
	    while(1) 
	    {
	      curleft += obj.offsetLeft;
	      if(!obj.offsetParent)
	        break;
	      obj = obj.offsetParent;
	    }
	else if(obj.x)
	    curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
	    while(1)
	    {
	      curtop += obj.offsetTop;
	      if(!obj.offsetParent)
	        break;
	      obj = obj.offsetParent;
	    }
	else if(obj.y)
	    curtop += obj.y;
	return curtop;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
