// JavaScript Document
var xmlHttp;

function change_langId(langStr)
{
	var url="ajaxService.php?type=changeLangId&langStr=" + langStr;
	xmlHttp=GetXmlHttpObject(stateChanged) ;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function add_times_download(id,file)
{
	var url="ajaxService.php?type=addTimesDownload&recId=" + id + "&file=" + file;
	xmlHttp=GetXmlHttpObject(stateChanged) ;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function videoList(page,linkstr)
{
	var url="ajaxService.php?type=videoList&page=" + page + linkstr;
	xmlHttp=GetXmlHttpObject(stateChanged) ;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function videoListChannel(page,linkstr)
{
	var url="ajaxService.php?type=videoListChannel&page=" + page + linkstr;
	xmlHttp=GetXmlHttpObject(stateChanged) ;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function video_show(recId)
{
	var url="ajaxService.php?type=videoShow&recId=" + recId;
	xmlHttp=GetXmlHttpObject(stateChanged) ;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function video_show_channel(recId)
{
	var url="ajaxService.php?type=videoShowChannel&recId=" + recId;
	xmlHttp=GetXmlHttpObject(stateChanged) ;
	xmlHttp.open("GET", url , true);
	xmlHttp.send(null);
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
    var s=xmlHttp.responseText.split("+");
	//alert(s[0] + "   " + s[1]);return false;
    switch(s[0])
	{
		case "videoShow":
			document.getElementById("tv").innerHTML="<embed src='admin/" + s[1] + "' width='352' height='288'></embed>";
			document.getElementById("des").innerHTML=s[2];
			document.getElementById("videoTitle").innerHTML=s[3];
			break;
		case "videoList":
			document.getElementById("vedioList").innerHTML=s[1];
			document.getElementById("pagediv").innerHTML=s[2];
			set_css_videoblog();
			break;
		case "videoListChannel":
			document.getElementById("vedioList").innerHTML=s[1];
			document.getElementById("pagediv").innerHTML=s[2];
			set_css_videoblog();
			break;
		case "ok":
			window.location.href = "force-download.php?path=" + s[1];
			//window.location.href = "staff_database.php";
			break;
		case "changeLangid":
			//alert(s[1]);
			window.location.href = window.location.href;
			break;
		case "videoShowChannel":
			document.getElementById("tv").innerHTML="<embed src='admin/" + s[1] + "' width='502' height='456'></embed>";
			document.getElementById("des").innerHTML=s[2];
			document.getElementById("videoTitle").innerHTML=s[3];
			break;
	}
}
}

function GetXmlHttpObject(handler)
{
var objXmlHttp=null

if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera")
return;
}
if (navigator.userAgent.indexOf("MSIE")>=0)
{
var strName="Msxml2.XMLHTTP"

if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
}
try
{
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler
return objXmlHttp
}
catch(e)
{
alert("Error. Scripting for ActiveX might be disabled")
return
}
}
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler
return objXmlHttp
}
}
