// JavaScript Document

var tmpLastElement
function makeActive(tmpElement)
{
	if (window.parent.document.getElementById("editmode").value == "true")
	{
		if (tmpLastElement != undefined || tmpLastElement == "")
		{
			document.getElementById(tmpLastElement).style.borderStyle = "none";
		}
		tmpLastElement = tmpElement;
		document.getElementById(tmpElement).style.border = "1px solid red";

		window.parent.document.getElementById("hdncurrstoryid").value = document.getElementById(tmpElement).storyid;
		window.parent.document.getElementById("activeIndicator").value = tmpElement;
	}
}

function swapFrame(url,tmpCurrTemplateID)
{
	window.location = url;
}


function reorder()
{
	tmpLoc = document.getElementById("currentpageid").value;
	tmpUrl = "/console/reorder.asp?pageid=" + tmpLoc;
	window.showModalDialog(tmpUrl,null,"dialogHeight:700px;dialogWidth:600px")
	window.location = window.location
}

function playVideo(file)
{	

	 var flashObject = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="382" height="287">'
	+ '            	 <param name="movie" value="http://www.youtube.com/v/' + file + '" />'
	+ '            	 <param name="quality" value="high" />'
	+ '      	  	<param name="wmode" value="transparent" />'
	+ '            	 <embed src="http://www.youtube.com/v/' + file + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="382" height="287" wmode="transparent"></embed>'
	+ '            	 </object>'
	document.getElementById("videoLeftBody").innerHTML = flashObject;
}





function sendPageLink(headline)
{
	tmpURL = "includes/sendPageLink.asp?pageID=" + document.getElementById("currentpageid").value;
	window.open(tmpURL, null, "height=600,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function printPage()
{
	tmpURL = "print.asp?storyid=" + document.getElementById("currentstoryid").value;
	window.open(tmpURL, "null", "height=800,width=630,status=yes,toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes");
}

function sendHomeLink(headline)
{
	tmpURL = "sendHomeLink.asp?pageID=" + document.getElementById("currentpageid").value;
	window.open(tmpURL, null, "height=600,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}

function sendStoryLink()
{
	tmpURL = "includes/sendStoryLink.asp?storyid=" + document.getElementById("currentstoryid").value;
	window.open(tmpURL, null, "height=600,width=800,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes");
}


function hideDaddy()
{
	allAnchors = document.getElementsByTagName("a")
	for (var i = 0; i < allAnchors.length; i++) 
	{
		if (allAnchors[i].href == "http://www.polldaddy.com/")
		{
			allAnchors[i].style.display = "none";
		}
	}
}


function showGallery(id)
{
	document.getElementById("galleryDiv").style.height = "580px";
	document.getElementById("galleryDiv").style.width = "360px";
	
	var flashObject = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="580" height="360">'
	+ '<param name="movie" value="/gallery.swf?gid=' + id + '">'
	+ '<param name="quality" value="high">'
	+ '	<param name="wmode" value="transparent" />'
	+ '<embed src="/gallery.swf?gid=' + id + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="580" height="360" wmode="transparent"></embed>'
	+ '</object>'
	document.getElementById("galleryDiv").innerHTML = flashObject;
}

function closeGallery()
{
	document.getElementById("galleryDiv").innerHTML = "";
	document.getElementById("galleryDiv").style.height = "0px";
	document.getElementById("galleryDiv").style.width = "0px";
}