<!--

// Function to 'activate' images.
function imgOn(imgName) {
        if (document.images) {
            document.images[imgName].src = eval(imgName + "on.src"); 
        }
}
// Function to 'deactivate' images.
function imgOff(imgName) {
        if (document.images) {
            document.images[imgName].src = eval(imgName + "off.src");
        }
}


function popWindow(windowTitle, windowURL, windowHeight, windowWidth)

{
	var linkSite = windowURL

	editSiteNoteWin=dhtmlmodal.open("tempWindow", "iframe", linkSite, windowTitle, "width=" +  windowWidth + ",height=" + windowHeight + ",resize=1,scrolling=1,center=1", "recal")
	
	editSiteNoteWin.onclose=function()
	{ //Run custom code when window is being closed (return false to cancel action)
		return parent.location.href = parent.location.href;
		
		return true; //confirm('Are you sure you want to close this window?');
	}
}

function popWindow2(windowTitle, windowURL, windowHeight, windowWidth)

{
	var linkSite = windowURL

	editSiteNoteWin=dhtmlmodal.open("tempWindow", "iframe", linkSite, windowTitle, "width=" +  windowWidth + ",height=" + windowHeight + ",resize=1,scrolling=1,center=1", "recal")
	
	editSiteNoteWin.onclose=function()
	{ 
		return true; 
	}
}
// -->

var AJAX_LIKES, xmlHttp_Likes, likeStr;

function showLikes(type, ID, likes, newWindow, videoLikes)
{	
	//AJAX CALL --------------------------------------------------
	xmlHttp_Likes=GetXmlHttpObject_Likes()
	if (xmlHttp_Likes==null)
	{alert ("Your browser does not support AJAX!"); return;} 
	var url="/global/getLikes.asp?type=" + type + "&id=" + ID + "&newWindow=" + newWindow + "&time=" + new Date();
	xmlHttp_Likes.onreadystatechange=function() {stateChanged_Likes(type, ID, likes, newWindow, videoLikes);}
	xmlHttp_Likes.open("GET",url,true);
	xmlHttp_Likes.send(null);
	///AJAX CALL --------------------------------------------------	
}

function hideLikes(type, ID, likes, newWindow, videoLikes)
{	
	likeStr = "<strong><a href='javascript:;' onClick='showLikes(\"" + type + "\", " + ID + ", " + likes + ", \"" + newWindow + "\", \"" + videoLikes + "\");' title='See Who Likes This'>" + likes
	
	if (likes > 1)
		{likeStr = likeStr + " people</a> like this";}
	else
		{likeStr = likeStr + " person</a> likes this";}
		
	likeStr = likeStr + "</strong>"
	
	if (videoLikes=="true")	
	{parent.document.getElementById(type + 'Likes' + ID).innerHTML='';}
	
	document.getElementById(type + 'Likes' + ID).innerHTML=likeStr;
}

function stateChanged_Likes(type, ID, likes, newWindow, videoLikes) 
{
	if (xmlHttp_Likes.readyState==4)
	{AJAX_LIKES = xmlHttp_Likes.responseText;
	
	likeStr = "<strong><a href='javascript:;' onClick='hideLikes(\"" + type + "\", " + ID + ", " + likes + ", \"" + newWindow + "\", \"" + videoLikes + "\");' title='Hide Likes'>" + likes	
	

	if (videoLikes=="true")
	{
		if (likes > 1)
		{likeStr = likeStr + " people</a> like this";}
		else
		{likeStr = likeStr + " person</a> likes this";}
		
		parent.document.getElementById(type + 'Likes' + ID).innerHTML=AJAX_LIKES + '<br>';
		document.getElementById(type + 'Likes' + ID).innerHTML=likeStr;
	}
	else
	{
		if (likes > 1)
		{likeStr = likeStr + " people</a> like this:";}
		else
		{likeStr = likeStr + " person</a> likes this:";}
		
		likeStr = likeStr + "</strong> " + AJAX_LIKES
	}
	
	document.getElementById(type + 'Likes' + ID).innerHTML=likeStr;
	
	}
}
	
function GetXmlHttpObject_Likes()
{
	var xmlHttp_Likes=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp_Likes=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{xmlHttp_Likes=new ActiveXObject("Msxml2.XMLHTTP");}
	  catch (e)
		{xmlHttp_Likes=new ActiveXObject("Microsoft.XMLHTTP");}
	  }
	return xmlHttp_Likes;
}