function  movieover(num)
{
   for( i=1 ;i<=num;i++ )
   {
        var cc= "img"+i;
		//alert(cc);
		document.getElementById(cc).src="/images/115.gif";
   }
   t =num+1
   
   for( i=t ;i<=5;i++ )
   {
	  // alert(cc);
        var cc= "img"+i;
		document.getElementById(cc).src="/images/116.gif";
   }
   
  
}
function  dvmov2()
{
	document.getElementById("vot1").style.display="";  
	document.getElementById("vot2").style.display="none";  
}
function  dvmov1()
{
	document.getElementById("vot2").style.display="";  
	document.getElementById("vot1").style.display="none";  
}

var xmlhttp=null;
var error = null;

function sendvote(url)
{
	
	if (window.XMLHttpRequest){  
		xmlhttp   =   new   XMLHttpRequest();  
		xmlhttp.onreadystatechange   =   processReqChange;  
		xmlhttp.open("GET",   url,   true);
		xmlhttp.send(null);
	}   else   if   (window.ActiveXObject)   {
		isIE   =   true;  
		xmlhttp   =   new   ActiveXObject("Microsoft.XMLHTTP");  
		if   (xmlhttp){  
		xmlhttp.onreadystatechange   =   processReqChange;  
		xmlhttp.open("GET",   url,   true);  
		xmlhttp.send();  
		}  
	}   
}

function sendsub(url)
{
	
	if (window.XMLHttpRequest){  
		xmlhttp   =   new   XMLHttpRequest();  
		xmlhttp.onreadystatechange   =   processReqsub;  
		xmlhttp.open("GET",   url,   true);
		xmlhttp.send(null);
	}   else   if   (window.ActiveXObject)   {
		isIE   =   true;  
		xmlhttp   =   new   ActiveXObject("Microsoft.XMLHTTP");  
		if   (xmlhttp){  
		xmlhttp.onreadystatechange   =   processReqsub;  
		xmlhttp.open("GET",   url,   true);  
		xmlhttp.send();  
		}  
	}   
}


function  processReqsub()   {
	var error = '';
	//alert(xmlhttp.readyState);
	if  (xmlhttp.readyState   ==   4)   {  
	//alert(xmlhttp.responseText);
		if   (xmlhttp.status   ==   200)   {  
			error = xmlhttp.responseText;
			rs =  error.split('|')
			
			if (rs[0] == 201)
			{
				alert('Succeeded!');
			}
			else if (rs[0] == 500)
			{
				
				alert('Already subscribed!');
				//document.getElementById('vodcms').style.display = 'none'
			}
			else if (error==202)
			{
				  alert("Please log in");
			}
			
		}
	}  
 } 
 
 function  processReqChange()   {
	var error = '';
	//alert(xmlhttp.readyState);
	if  (xmlhttp.readyState   ==   4)   {  
	//alert(xmlhttp.responseText);
		if   (xmlhttp.status   ==   200)   {  
			error = xmlhttp.responseText;
			
			rs =  error.split('|')
			
			if (rs[0] == 201)
			{
				  document.getElementById("num").innerHTML =rs[1];
				  document.getElementById("total").innerHTML =rs[2];
				  document.getElementById("cmg").innerHTML =rs[3];
				alert('Rating succeeded, thanks for your participation!');
			}
			else if (rs[0] == 500)
			{
				document.getElementById("num").innerHTML =rs[1];
				  document.getElementById("total").innerHTML =rs[2];
				  document.getElementById("cmg").innerHTML =rs[3];
				alert('You have rated this movie, thanks for your participation!');
				//document.getElementById('vodcms').style.display = 'none'
			}
			else if (rs[0] == 600)
			{
				document.getElementById("num").innerHTML =rs[1];
				  document.getElementById("total").innerHTML =rs[2];
				  document.getElementById("cmg").innerHTML =rs[3];
				//alert('You have rated this movie, thanks for your participation!');
				//document.getElementById('vodcms').style.display = 'none'
			}
		}
	}  
 } 
 
 
 
 function sendcomment(url)
{
	
	if (window.XMLHttpRequest){  
		xmlhttp   =   new   XMLHttpRequest();  
		xmlhttp.onreadystatechange   =   processReqChangemt;  
		xmlhttp.open("GET",   url,   true);
		xmlhttp.send(null);
	}   else   if   (window.ActiveXObject)   {
		isIE   =   true;  
		xmlhttp   =   new   ActiveXObject("Microsoft.XMLHTTP");  
		if   (xmlhttp){  
		xmlhttp.onreadystatechange   =   processReqChangemt;  
		xmlhttp.open("GET",   url,   true);  
		xmlhttp.send();  
		}  
	}   
}

function  processReqChangemt()   {
	var error = '';
     
	if  (xmlhttp.readyState   ==   4)   {  
	//alert(xmlhttp.responseText);
		if   (xmlhttp.status   ==   200)   {  
			error = xmlhttp.responseText;
            if (error==202)
			{
				  alert("Please sign in");
			}
			else
			{
			rs =  error.split('%=+=%')
			//alert(error);
			if (rs[0] == 201)
			
			  {
                var tmp ='<table width="100%" cellpadding="0" cellspacing="0">';
				var num  =  rs.length;
				//alert(num);
				for(i=3;i<num-1;i++)
				{
				    var us=rs[i].split('*|=*');
				   
                   tmp =  tmp + '<tr><td><table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" style=" border:1px dotted #CCCCCC" class="s"><tr><td valign="middle" bgcolor="#F7F7F7"><strong> '+ us[1] +'</strong>&nbsp;&nbsp;'+ us[3] +'</td><td width="7%" bgcolor="#F7F7F7">#'+ us[4] +'</td></tr><tr><td colspan="2" valign="middle" bgcolor="#FFFFFF">'+ us[2] +'</td></tr></table></td></tr>';
                }
				tmp =  tmp + '</table>';
				//alert(tmp);
                  //document.getElementById("comttt").innerHTML = "aa";
				 document.getElementById("clist").innerHTML =tmp;
				 document.getElementById("pg").innerHTML =rs[1];
				  document.getElementById("ctotal").innerHTML = '<STRONG>Comments</STRONG>(<span style="color:red">'+rs[2] +'</span>)';
				
				//alert('<STRONG>Comments</STRONG>(<span style="color:red">'+rs[2] +'</span>)');
			  }
			}
		}
	}  
 } 
 
 function vote(num,movid,username)
 {
    	
		sendvote('/vote.php?action=send&votepoint='+num+'&movid='+movid+'&username='+username);
 }
 
 
 function subj(movid)
 {
    	
		sendsub('/subscriptions.php?action=send&movid='+movid);
 }
 
  function getvote(movid)
 {
    	
		sendvote('/vote.php?movid='+movid);
 }
 
 
 function comment(movid,username)
 {
	var  amt = document.getElementById("content").value;
	//alert(amt);
	if (amt=="" || amt.length<3 || amt.length>500 )
	{
	   alert("The length of comments must be 3 to 500 charaters.");	
	   return false;
	}
	
	document.getElementById("content").value="";
	sendcomment('/comment.php?action=send&content='+amt+'&movid='+movid+'&username='+username);
 }
 
 function gopage(page,movid)
 {
	//alert('comment.php?page='+page+'&movid='+movid);
	sendcomment('/comment.php?page='+page+'&movid='+movid);
	
 }
  function dopage(movid)
 {
      page = document.getElementById("custompage").value;
	  //alert(page+"--"+movid);
      gopage(page,movid)
	
 }
 
 
 
 function dosession(movid,id)
 {
	var error = '';
    var tmp="";
	        error = urlarray[id];	
			rs =  error.split('%=+=%');
			//alert(error);
			if (rs[0] == 201)
			
			{
               
				var num  =  rs.length;
				//alert(num);
				for(i=2;i<num-1;i++)
				{
					 //alert(tmp);
				    var us=rs[i].split('*|=*');
					
				   
                   tmp =  tmp +  '<li>'+ id +'x'+us[2]+'&nbsp;&nbsp;<a target="_blank" href="/tvplay.php?movid='+us[1]+'&urlid='+us[0]+'">'+us[3]+' </a></li>';
                }
				   // alert(tmp);      
				 document.getElementById("urltb").innerHTML =tmp;
			}
	
 }
 /*
 function sendurl(url)
{
	
	if (window.XMLHttpRequest){  
		xmlhttp   =   new   XMLHttpRequest();  
		xmlhttp.onreadystatechange   =   processReqChangeurl;  
		xmlhttp.open("GET",   url,   true);
		xmlhttp.send(null);
	}   else   if   (window.ActiveXObject)   {
		isIE   =   true;  
		xmlhttp   =   new   ActiveXObject("Microsoft.XMLHTTP");  
		if   (xmlhttp){  
		xmlhttp.onreadystatechange   =   processReqChangeurl;  
		xmlhttp.open("GET",   url,   true);  
		xmlhttp.send();  
		}  
	}   
}

function  processReqChangeurl()   {
	var error = '';
    var tmp="";
	if  (xmlhttp.readyState   ==   4)   {  
	//alert(xmlhttp.responseText);
		if   (xmlhttp.status   ==   200)   {  
			error = xmlhttp.responseText;
			
			rs =  error.split('%=+=%');
			//alert(error);
			if (rs[0] == 201)
			
			{
               
				var num  =  rs.length;
				//alert(num);
				for(i=2;i<num-1;i++)
				{
					 //alert(tmp);
				    var us=rs[i].split('*|=*');
					
				   
                   tmp =  tmp +  '<li>'+ rs[1] +'x'+us[2]+'&nbsp;&nbsp;<a target="_blank" href="/tvplay.php?movid='+us[1]+'&urlid='+us[0]+'">'+us[3]+' </a></li>';
                }
				                  //document.getElementById("comttt").innerHTML = "aa";
								//  alert(tmp);
				 document.getElementById("urltb").innerHTML =tmp;
				// var se =  rs[1]+"se"
			   //	 document.getElementById(se).innerHTML =tmp; 
				
				//alert('Comment posted');
			}
		}
	}  
}
 */
