var iepg=document.all;
var nspg6=document.getElementById&&!document.all;
function ietruebodypg()
	{
		return (document.compatMode!="BackCompat")? document.documentElement : document.body
	}
function enlargescreen(divobj,stype)
	{
		
		if (stype == 'mask')
			{
				var elm = getStyleObject(divobj);
				var x =  parseInt(ietruebodypg().scrollHeight);
				elm.height = x + "px";
				
			}
		else
			{		
				if (iepg||nspg6)
					{
						crossobj=getObject(divobj)
						pgyoffset=nspg6? parseInt(pageYOffset) : parseInt(ietruebodypg().scrollTop)
						horzpos=nspg6? pageXOffset+window.innerWidth/2-150 : ietruebodypg().scrollLeft+ietruebodypg().clientWidth/2-150
						vertpos=nspg6? pgyoffset+window.innerHeight/2-150 : pgyoffset+ietruebodypg().clientHeight/2-150
						crossobj.style.left=horzpos+"px"
						crossobj.style.top=vertpos+"px"
					}
			}
	}


function setposition(divobj)
	{
	crossobj=getObject(divobj)
	  var myLeft = (screen.width-crossobj.style.width)/2;
	 var myTop = (screen.height-crossobj.style.height)/2;
	 crossobj.style.left=myLeft+"px"
	crossobj.style.top=myTop+"px"
	}

function showMedia() 
	{
		
		switchLayer2('maskID', 1);
		enlargescreen('maskID','mask');
		switchLayer2('mediaID', 1);
		enlargescreen('mediaID','');
		switchLayer2('flashcontent2', 1);
	}

function hideMedia(strHidType) 
	{
		if (strHidType == 1)
			{
				
				if (sGlobalState != 0)
					{
						sendEvent('playpause')
					}
				
			}
			
		switchLayer2('flashcontent', 0); 
		switchLayer2('maskID', 0); 
		switchLayer2('mediaID', 0);
	}

function playmedia(fileID,sTitle,cburl)
	{
		sGlobalState = 0;
		sglobalfileId = fileID;
		sglobalTitle = sTitle;
		var FZ = { 	movie:vfLoc+"/videos/flvplayer1.swf",id:"mediaplayer",width:"320",height:"260",majorversion:"8",build:"0",bgcolor:"#FFFFFF",allowfullscreen:"true",
						flashvars:"file="+vfLoc +"/ginclude/playlist.asp?q=" + fileID +"&displayheight=240&autoscroll=true&linkfromdisplay=true&linktarget=_new&autostart=true&repeat=false&showdigits=true&enablejs=true&lightcolor=0x609824&backcolor=0x000000&frontcolor=0xCCCCCC&showfsbutton=true&fsreturnpage="+rpage+"?q="+fileID+"&fullscreenpage=/videos/fullscreen.asp&callback=/videos/activity.asp?q="+cburl };
		
		
		setProperMediaImage(cburl);
		switchLayer2('flashcontent', 1);
		UFO.create(	FZ, "flashcontent")
		document.getElementById("filetitle").innerHTML =  sTitle;
		showMedia();

	}

function getUpdate(typ,pr1,pr2) {
	var ids
	if (typ=="state")
		{
			sGlobalState = Math.round(pr1);
		}
		
	
	
};


function sendEvent(typ,prm) {
	thisMovie("mediaplayer").sendEvent(typ,prm);
};

function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
};


function setProperMediaImage(mediaType)
	{
	if (mediaType == "TM")
			{
				document.getElementById("mediaImg").src = "/ginclude/images/puremichiganMedia.gif";
			}
		else
			{
				document.getElementById("mediaImg").src = "/ginclude/images/michiganupperhandMedia.gif";
			}
	
	}



function emailmedia(sfileId,sTitle,sMedType)
	{
		sGlobalState = 0;
		if (sMedType.length > 0)
			{
				setProperMediaImage(sMedType);
			}
		if	(sfileId.length == 0)
			{
				sfileId = sglobalfileId;
				sTitle = sglobalTitle;
			}
		else
			{
				sglobalfileId = sfileId;
				switchLayer2('flashcontent', 1);
				showMedia();
			}
		switchLayer2('flashcontent2', 0);
		document.getElementById("flashcontent").innerHTML = document.getElementById("emailform").innerHTML;
		document.getElementById("filetitle").innerHTML =  sTitle;
	}
	

	
var xmlHttp,strFrmval,strToval,sglobalfileId,sglobalTitle, sGlobalState
 

function sendLinkInfo()

{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="/ginclude/emailmedia.asp"
url=url+"?q="+sglobalfileId+"&qf="+strFrmval+"&qt="+escape(strToval)
url=url+"&sid="+Math.random()+"&sc="+rpage+"&sq="+rpageVar
//alert(url);
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}






function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
var xval = xmlHttp.responseText
if (xval != "true")
	{
		alert(xval);
	}
else
	{
		alert("The Video was sent to the specified recipients : "+strToval)
		hideMedia(1);
	}

} 
}  

function GetXmlHttpObject(handler)
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
} 

function PlayMediaAttach()
	{
		
		if (PostVideoJsI.length >0)
			{
				playmedia(PostVideoJsI,PostVideoJsT,PostVideoJsU);
			}
	}
window.attachEvent('onload',PlayMediaAttach);


