function GetXmlHttpObject()
{
    var objXMLHttp=null
    if (window.XMLHttpRequest)
    {
        objXMLHttp=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp
}

function video(section)

{

	var currentDate = new Date();

 	if(typeof(window.innerWidth) == 'number')

	{ 

        availHeight = window.innerHeight; 

        availWidth = window.innerWidth; 

    }

	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))					

	{ 

        availHeight = document.documentElement.clientHeight; 

        availWidth = document.documentElement.clientWidth; 

    }

	else if(document.body && (document.body.clientWidth || document.body.clientHeight))

	{ 

        availHeight = document.body.clientHeight; 

        availWidth = document.body.clientWidth; 

    }

	var fader = document.getElementById('videoFade');

    fader.style.height = availHeight+"px";

    fader.style.width = availWidth+"px";

    fader.style.display="block";

    fader.style.zIndex = "100";

    fader.style.left = "0px";

    fader.style.top = "0px";

    

    fader.style.position="fixed";

    

    var indicatorWidth = 380;

    var indicatorHeight = 300;

    var left = (availWidth/2) - (indicatorWidth/2);

    var top = (availHeight/2) - (indicatorHeight/2);

	var vid = document.getElementById('divVideo');

    vid.style.top=top+"px";

    vid.style.left=left+"px";

    vid.style.display="block";

    vid.style.zIndex = "999";

    vid.style.position="fixed";

    



	var url = "video.php";

	var params = "v="+section+"&t="+currentDate.getSeconds();

    xmlhttp=GetXmlHttpObject();

    xmlhttp.open("GET", url+"?"+params, true);

	xmlhttp.onreadystatechange = function() 

	{
		//Call a function when the state changes.

		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) 

		{

			document.getElementById('divVideo').innerHTML = xmlhttp.responseText;

		}
	}
	xmlhttp.send(null);    

}


function getVideo(section)
{
	var currentDate = new Date();

	var url = "getVideo.php";
	var params = "v="+section+"&t="+currentDate.getSeconds();
    xmlhttp=GetXmlHttpObject();
    xmlhttp.open("GET", url+"?"+params, true);
	xmlhttp.onreadystatechange = function() 
	{
		//Call a function when the state changes.
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200) 
		{
		 	
			document.getElementById('videoPlayer').innerHTML = xmlhttp.responseText;
			//alert(xmlhttp.responseText);
		}
	}
	xmlhttp.send(null);    
	window.scroll(0,150); 
}
function cVideo()
{
	document.getElementById('divVideo').innerHTML = "";
	var fader = document.getElementById('videoFade');
	fader.style.display = "none";
	var decline = document.getElementById('divVideo');
    decline.style.display = "none";
}
