var xmlHttp
function show_video(str)
{ 
	var url="show_external_video.php?videocode=" + str
	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
} 


function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("videodis").innerHTML=xmlHttp.responseText 
	} 
} 

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
	}
} 
function video_movie(str,songurl,songname)
{ 
    
	var url="show_song_name.php?movie_id=" + str+"&songurl="+songurl+"&songname="+songname;
	xmlHttp=GetXmlvideomovieHttpObject(statevideomovieChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null);
	
} 

function statevideomovieChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("songnamedisplay").innerHTML=xmlHttp.responseText 
	} 
} 

function GetXmlvideomovieHttpObject(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
	}
} 


function show_largevideo(url,songname)
{ 
	var url="show_large_video.php?videourl=" + url+"&songname="+songname;
	xmlHttp=GetXmlLargevideoHttpObject(statelargevideoChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
} 

function statelargevideoChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("songvideodisplay").innerHTML=xmlHttp.responseText 
	} 
} 

function GetXmlLargevideoHttpObject(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
	}
} 
function isAlphaNumeric(Input) 
{
	var numbers="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_ .'!)(:-`*';,";
	var CharacterCheck;
	var counter = 0; 

	for (var i=0; i < Input.length; i++)
	{
		CharacterCheck = Input.substring(i, i+1); 
		if (numbers.indexOf(CharacterCheck) != -1)
		{
			counter ++;
		}

	}
	if (counter != Input.length)
	{
		return true;
	}
	return false;
}

function comments()
{
	if(isAlphaNumeric(document.frm_comments.txtname.value))
	{
		alert("Special characters (@ # $ % ^ & ~) are not allowed for Name")
		document.frm_comments.txtname.focus()
		return false
	}
	else if (document.frm_comments.txtname.value=="")
	{
		alert("Please enter Name")
		document.frm_comments.txtname.focus()
		return false
	}
	if(document.frm_comments.optMovie[1].checked)
	{
		if(document.frm_comments.selsongid.selectedIndex=="")
		{
			alert("Please select Song Name")
			document.frm_comments.selsongid.focus()
			return false
		}
	}/**/
	if(isAlphaNumeric(document.frm_comments.txtcomments.value))
	{
		alert("Special characters (@ # $ % ^ & ~) are not allowed  for Comments")
		document.frm_comments.txtcomments.focus()
		return false
	}
	else if (document.frm_comments.txtcomments.value=="")
	{
		alert("Please enter Comments")
		document.frm_comments.txtcomments.focus()
		return false
	}
	else
	{
		if(document.frm_comments.optMovie[0].checked)
		{
			//var url="show_comments.php";
			var url="show_comments.php?name="+document.frm_comments.txtname.value+"&comments="+document.frm_comments.txtcomments.value+"&movie=0";
			document.frm_comments.txtname.value="";
			document.frm_comments.txtcomments.value="";
			xmlHttp=GetXml_HttpObject(state_Changed)
			xmlHttp.open("GET", url , true)
			xmlHttp.send(null)
		}
		else
		{
			var url="show_comments.php?name="+document.frm_comments.txtname.value+"&comments="+document.frm_comments.txtcomments.value+"&movie=1&songid="+document.frm_comments.selsongid.value;
			document.frm_comments.txtname.value="";
			document.frm_comments.txtcomments.value="";
			document.frm_comments.selsongid.value="";
			xmlHttp=getxml1_HttpObject(status_Changed)
			xmlHttp.open("GET", url , true)
			xmlHttp.send(null)
		}
	}
} 

function state_Changed() 
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("moviecommentdisp").innerHTML=xmlHttp.responseText 
	} 
} 


function status_Changed() 
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("songcommentdisp").innerHTML=xmlHttp.responseText 
	} 
} 


function GetXml_HttpObject(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
	}
} 

function getxml1_HttpObject(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
	}
} 