/*  Hitting Illustrated JavaScript: Article Clip  */

function articleClipSetup () 
{
	images = document.getElementsByTagName("img");
	for (i=0; i<images.length; i++)
	{
		clip = images[i];
		if (clip.className == "ArticleClip")
		{
			clip.onmouseover = function ()
						  {
							this.className += " Over";
						  }
			clip.onmouseout = function ()
						  {
							this.className = this.className.replace("Over","");
						  }
			clip.onclick = function ()
						{
							source = this.src.replace("S.gif",".gif");
							viewClip(source);
						}
		}
	}
}


function viewClip(source)
{
	var height = (150 + 16) + 60 + 8;
	var width = 225 + 60 + 4;	
	var top = (screen.height - height) / 2;
	var left = (screen.width - width) / 2;
	var viewClip = window.open("", "_blank", "scrollbars=no, menubar=no, height=" + height + ", width=" + width + ", resizable=no, location=no, statusbar=no, left=" + left + ", top=" + top);
	viewClip.document.writeln("<html>");
	viewClip.document.writeln("<head>");
	viewClip.document.writeln("	<title>Clip Of The Day</title>");
	viewClip.document.writeln("</head>");
	viewClip.document.writeln("<body>");
	viewClip.document.writeln("	<div style=\"position:absolute; top:30px; left:30px;\">");
	viewClip.document.writeln("		<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" height=\"166\" width=\"225\">");
	viewClip.document.writeln("			<param name=\"src\" value=\"" + source + "\" />");
	viewClip.document.writeln("			<param name=\"autoplay\" value=\"true\" />");
	viewClip.document.writeln("			<param name=\"controller\" value=\"true\" />");
	viewClip.document.writeln("			<param name=\"loop\" value=\"true\" />");
	viewClip.document.writeln("			<!--[if !IE]>-->");
	viewClip.document.writeln("			<object type=\"video/quicktime\" data=\"" + source + "\" height=\"166\" width=\"225\">");
	viewClip.document.writeln("				<param name=\"autoplay\" value=\"true\" />");
	viewClip.document.writeln("				<param name=\"controller\" value=\"true\" />");
	viewClip.document.writeln("				<param name=\"loop\" value=\"true\" />");
	viewClip.document.writeln("			</object>");
	viewClip.document.writeln("			<!--<![endif]-->");
	viewClip.document.writeln("		</object>");
	viewClip.document.writeln("	</div>");
	viewClip.document.writeln("</body");
	viewClip.document.writeln("</html>");	
}


addEvent(window, "load", articleClipSetup);
removeEvent(window, "unload", articleClipSetup);
