var http_check = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");

function play_vidoe123(file, image, autostart){
		//alert(file);
		//image = '120981464920071112_dream_900x600.jpg_486x311.jpg';
		var s1 = new SWFObject("flvplayer.swf","single","450","330","7");
		s1.addParam("allowfullscreen","true");
		s1.addVariable("file","videoupload/"+file);
		s1.addVariable("image","videoimages/"+image);
		s1.addVariable("autostart",autostart);
		s1.write("player1");
}

function play_vidoeplay(file, image, autostart){
		
		//image = '120981464920071112_dream_900x600.jpg_486x311.jpg';
		var s1 = new SWFObject("flvplayer.swf","single","256","200","7");
		s1.addParam("allowfullscreen","true");
		s1.addVariable("file","fck_image/"+file);
		s1.addVariable("image","content_image/"+image);
		s1.addVariable("autostart",autostart);
		s1.write("player1");
}

function playNow(pid, autostart){
	  	
	//document.getElementById("player1").innerHTML = play_vidoe('', '', false, 450, 330);
	
	var url_check = "video_file.php?video_id=" + pid;
	if(pid){  
		http_check.open("GET", url_check, true);
		http_check.onreadystatechange = function test(){
			if(http_check.readyState == 4) {		
				//alert(http_check.responseText);
				org_array = http_check.responseText.split("|***|");	
				
				//org_array[1] = org_array[1]+'_553x300.jpg';
				
				if (org_array[0])
				{
					document.getElementById("player1").innerHTML = play_vidoe(org_array[0], org_array[1], autostart, 450, 330);
				}else{
					alert('video are not available');
					//document.getElementById("player1").innerHTML = '<FONT SIZE="1" COLOR="white">video are not available, click another<BR></FONT>';
				}
				
			}
		}
		http_check.send(null);
	}else{
		http_check.open("GET", url_check, true);
		http_check.onreadystatechange = function test(){
			if(http_check.readyState == 4) {		
				
				//alert(http_check.responseText);
				org_array = http_check.responseText.split("|***|");	
				//org_array[1] = 'videoimages/'+org_array[1];	
				
				if (org_array[0])
				{
					document.getElementById("player1").innerHTML = play_vidoe(org_array[0], org_array[1], autostart, 450, 330);
				}			
			}
		}
		http_check.send(null);
	}
	
}

function play_vidoemost(file, image, autostart){
		//alert(file);
		//image = '120981464920071112_dream_900x600.jpg_486x311.jpg';
		var s1 = new SWFObject("flvplayer.swf","single","601","400","7");
		s1.addParam("allowfullscreen","true");
		s1.addVariable("file","videoupload/"+file);
		s1.addVariable("image","content_image/"+image);
		s1.addVariable("autostart",autostart);
		s1.write("playermost");
}

function playNowmost(pid, autostart){
	 /* 	
	if(document.getElementById("newsdivpage")){
		document.getElementById("newsdivpage").style.display = "none";
	}
	*/
	document.getElementById("playermost").innerHTML = '<FONT SIZE="2" COLOR="white">loading...<BR></FONT>';
	
	var url_check = "video_file.php?video_id="+pid;
	if(pid){  
		http_check.open("GET", url_check, true);
		http_check.onreadystatechange = function test(){
			if(http_check.readyState == 4) {		
				//alert(http_check.responseText);
				org_array = http_check.responseText;	
			
				if (org_array[0]){
					document.getElementById("playermost").innerHTML = play_vidoe(org_array, autostart, 675, 350);
				}else{
					alert('video are not available');
					//document.getElementById("playermost").innerHTML = '<FONT SIZE="1" COLOR="white">video are not available, click another<BR></FONT>';
				}
				
			}
		}
		http_check.send(null);
	}else{
		http_check.open("GET", url_check, true);
		http_check.onreadystatechange = function test(){
			if(http_check.readyState == 4) {		
				
				//alert(http_check.responseText);
				org_array = http_check.responseText;						
				document.getElementById("playermost").innerHTML = play_vidoe(org_array, autostart, 675, 350);
							
			}
		}
		http_check.send(null);
	}
	flvPlayVideo('2', false, '', '1.mp3');
}

function playfooter(pid, autostart, divid){
	  	//alert(document.getElementById("player_"+divid));
	document.getElementById("player_"+divid).innerHTML = '<FONT SIZE="2" COLOR="white">loading...<BR></FONT>';
	
	var url_check = "video_file.php?video_id="+pid;
	if(pid){  
		http_check.open("GET", url_check, true);
		http_check.onreadystatechange = function test(){
			if(http_check.readyState == 4) {		
				//alert(http_check.responseText);
				org_array = http_check.responseText;	
			
				if (org_array[0]){
					document.getElementById("player_"+divid).innerHTML = play_vidoe(org_array, autostart, 140, 73);
				}else{
					alert('video are not available');
					//document.getElementById("playermost").innerHTML = '<FONT SIZE="1" COLOR="white">video are not available, click another<BR></FONT>';
				}
				
			}
		}
		http_check.send(null);
	}else{
		http_check.open("GET", url_check, true);
		http_check.onreadystatechange = function test(){
			if(http_check.readyState == 4) {		
				
				//alert(http_check.responseText);
				org_array = http_check.responseText;						
				document.getElementById("player_"+divid).innerHTML = play_vidoe(org_array, autostart, 140, 73);
							
			}
		}
		http_check.send(null);
	}
	
}
//&link=http://vod-lt.com&title=Stanton Media&linktarget=http://vod-lt.com&
function play_vidoe(file, autostart, getWidth, getHeight){
	var image = '';
	//alert(file);
	//return player = ' <embed src="player.swf" width="'+getWidth+'" height="'+getHeight+'" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" autostart = "'+autostart+'" flashvars="height='+getHeight+'&width='+getWidth+'&file='+file+'&image='+image+'&searchbar=false&showstop=true&autostart='+autostart+'"/>';
	return player = ' <embed src="player.swf" width="'+getWidth+'" height="'+getHeight+'" allowscriptaccess="always" allowfullscreen="true" wmode="transparent" autostart = "'+autostart+'" flashvars="height='+getHeight+'&width='+getWidth+'&file='+file+'&searchbar=false&showstop=true&autostart='+autostart+'"/>';
	
}

function flvPlayVideo(file, autostart, getWidth, getHeight){
	//alert(pid);
	document.getElementById("playerDivfooter").innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="2" height="2" align="middle"><PARAM NAME="_cx" VALUE="20373"><PARAM NAME="_cy" VALUE="13229"><PARAM NAME="FlashVars" VALUE="file=1.mp3&autostart='+autostart+'"><PARAM NAME="Movie" VALUE="player.swf"><PARAM NAME="Src" VALUE="player.swf"><PARAM NAME="WMode" VALUE="transparent"><PARAM NAME="Play" VALUE="1"><PARAM NAME="Loop" VALUE="true"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE="LT"><PARAM NAME="Menu" VALUE="1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="NoScale">	<PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE="#ffffff"><PARAM NAME="Color" VALUE="#ffffff"><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all">	<PARAM NAME="AllowFullScreen" VALUE="true"><embed src="player.swf?AllowFullScreen=1&file=1.mp3&autostart='+autostart+'&Loop=true" quality="high" bgcolor="#ffffff" color="#ffffff" width="2" height="2" scale="noscale" salign="lt" align="middle" WMode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/></object>';	
}

function singleplayernew(playlistfile){
	var folder = "videos_folder/"+playlistfile;
	//xmlpath = folder+userid+"/"+pid+".xml";
		
	var s2 = new SWFObject("flvplayer.swf", "playlist", "463", "420", "7");
		s2.addVariable("file",playlistfile);
		s2.addVariable("backcolor","0x00000");
		s2.addVariable("frontcolor","0xEECCDD");
		s2.addVariable("lightcolor","0xCC0066");
		s2.addVariable("displayheight","320");
		s2.addVariable("width","463");
		s2.addVariable("height","420");
		s2.addVariable("repeat","true");
		s2.addVariable("showdownload","false");
		s2.addVariable("showdigits","true");
		s2.addParam("allowfullscreen","true");
		s2.addVariable("autostart","true");
		s2.addParam("WMode","transparent");
		s2.write("playermost");		
}

function playNowmost_video_list(pid, autostart){
	 /* 	
	if(document.getElementById("newsdivpage")){
		document.getElementById("newsdivpage").style.display = "none";
	}
	*/
	document.getElementById("video_album_play").innerHTML = '<FONT SIZE="2" COLOR="white">loading...<BR></FONT>';
	
	var url_check = "video_list.php?video_id="+pid;
	if(pid){  
		http_check.open("GET", url_check, true);
		http_check.onreadystatechange = function test(){
			if(http_check.readyState == 4) {		
				//alert(http_check.responseText);
				org_array = http_check.responseText;	
			
				if (org_array){
					document.getElementById("video_album_play").innerHTML = play_vidoe(org_array, autostart, 675, 350);
				}else{
					alert('video are not available');
					//document.getElementById("playermost").innerHTML = '<FONT SIZE="1" COLOR="white">video are not available, click another<BR></FONT>';
				}
				
			}
		}
		http_check.send(null);
	}
	
}
