function redir (loc)
{
   window.location.href=loc;
}

function getWidth()
{
   var viewportwidth;
 
   // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
   if (typeof window.innerWidth != 'undefined')
   {
   //alert("1");
      viewportwidth = window.innerWidth;
   }
   else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
   {
   //alert("2");
      // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
      viewportwidth = document.documentElement.clientWidth;
   }
   else
   {
      //alert("3");

      // older versions of IE
      viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
   }
   return viewportwidth;
}

function getHeight()
{
   var viewportheight;
 
   // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
   if (typeof window.innerWidth != 'undefined')
   {
      viewportheight = window.innerHeight;
   }
   else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
   {
      // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
      viewportheight = document.documentElement.clientHeight;
   }
   else
   {
      // older versions of IE
      viewportheight = document.getElementsByTagName('body')[0].clientHeight;
   }
   return viewportheight;
}


function popupvideo()
{
   var flashvars = {};

   var params = { allowscriptaccess: "sameDomain", menu: "false", wmode: "transparent"};

   swfobject.embedSWF("/SimpleSimon.swf", "videodiv", "720", "480", "10.0.0", "", flashvars, params );

   var mediaContainer = window.document.getElementById("mediacontainer");
   mediaContainer.style.top = "0px";
   mediaContainer.style.left = "0px";
   
   var overlayImage = window.document.getElementById("overlayImg");
   overlayImage.style.width = parseInt(document.documentElement.scrollWidth) + "px";
   overlayImage.style.height = parseInt(document.documentElement.scrollHeight) + "px";
   
   var videoContainer = window.document.getElementById("videocontainer");
   videoContainer.style.position="absolute";
   videoContainer.style.top=((getHeight() / 2) - 240) + parseInt(document.documentElement.scrollTop) + "px";
   videoContainer.style.left=((getWidth() / 2) - 360) + parseInt(document.documentElement.scrollLeft) + "px";
   videoContainer.style.border="1px solid black";
   
   var closebtn = window.document.getElementById("closebtn");
   closebtn.style.position="absolute";
   closebtn.style.top=((getHeight() / 2) - 240) + parseInt(document.documentElement.scrollTop) + "px";
   closebtn.style.left=((getWidth() / 2) + 332) + parseInt(document.documentElement.scrollLeft) + "px";
   closebtn.style.cursor="pointer";

   mediaContainer.style.display="";

   closebtn.onclick = closevideo;
   
}

function closevideo()
{

   window.document.getElementById("videocontainer").innerHTML="<div id=\"videodiv\"></div>"

   window.document.getElementById("mediacontainer").style.display="none";
   
}
