var http_check = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");

function play_vidoe(file, image, autostart){
		//alert(file);
		//image = '120981464920071112_dream_900x600.jpg_486x311.jpg';
		var s1 = new SWFObject("flvplayer.swf","single","199","190","7");
		s1.addParam("allowfullscreen","true");
		s1.addVariable("file","flv_file/"+file);
		s1.addVariable("image","flv_image/"+image);
		s1.addVariable("autostart",autostart);
		s1.write("player1");
}




/*
function playNow(pid, autostart){
	  	
	document.getElementById("player1").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.split("|***|");	
				if(org_array[1]){
					org_array[1] = org_array[1]+'_553x300.jpg';
				}else{
					org_array[1] = 'videoimage.jpg';
				}
				if (org_array[0] && org_array[1])
				{
					play_vidoe(org_array[0], org_array[1], autostart)
				}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("|***|");	
								
				if (org_array[0] && org_array[1])
				{
					play_vidoe(org_array[0], org_array[1], autostart)
				}			
			}
		}
		http_check.send(null);
	}
	
}
*/
