var xmlHttp;

function post_blog_comment()
{ 

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
	var bid=document.getElementById('bid').value;
	var mid=document.getElementById('mid').value;
	var post_mid=document.getElementById('post_mid').value;
	var comment_text=document.getElementById('comment_text').value;
	
	var url="comment_post_blog.php?q_comment_text="+comment_text+"&q_post_mid="+post_mid+"&q_mid="+mid+"&q_bid="+bid;
	//xmlHttp.onreadystatechange=BlogCommentPostChanged;
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 			
			tbl=document.getElementById('123');
			//rows=tbl.rows.length;
			tblrow=tbl.insertRow(0);
			tblcell=tblrow.insertCell(0);
			tblcell.innerHTML=xmlHttp.responseText;
			document.getElementById('comment_text').value="";
			
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

///-------------------------------member comments---------------------------------------------------------------

function post_member_comment()
{ 
alert("Thank you for making a comment.");
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
	
	var mid=document.getElementById('mid_id').value;	
	var comment_text=document.getElementById('comment_text').value;
	
	var url="comment_post_member.php?q_comment_text="+comment_text+"&q_mid="+mid;
	//xmlHttp.onreadystatechange=BlogCommentPostChanged;
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 			
			tbl=document.getElementById('123');
			//rows=tbl.rows.length;
			tblrow=tbl.insertRow(0);
			tblcell=tblrow.insertCell(0);
			tblcell.innerHTML=xmlHttp.responseText;
			document.getElementById('comment_text').value="";
			
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


//---------------------------------------------audio comments----------------------------------------------------
function post_audio_comment()
{ 
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
	var audio_id=document.getElementById('audio_id').value;
	
	var mid=document.getElementById('mid').value;
	var post_mid=document.getElementById('post_mid').value;
	var comment_text=document.getElementById('comment_text').value;
	
	var url="comment_post_audio.php?q_comment_text="+comment_text+"&q_post_mid="+post_mid+"&q_mid="+mid+"&q_audio="+audio_id;
	
	//xmlHttp.onreadystatechange=BlogCommentPostChanged;
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 			
			tbl=document.getElementById('123');
			//rows=tbl.rows.length;
			tblrow=tbl.insertRow(0);
			tblcell=tblrow.insertCell(0);
			tblcell.innerHTML=xmlHttp.responseText;
			document.getElementById('comment_text').value="";
			
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


//------------------------------end-----------------------------------------------------------------------





//---------------------------------------------audio comments----------------------------------------------------
function post_show_comment()
{ 
	alert("sfdfdf")
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Your browser does not support AJAX!");
  		return;
  	} 
	var event_id=document.getElementById('event_id').value;
	
	var mid=document.getElementById('mid').value;
	var post_mid=document.getElementById('post_mid').value;
	var comment_text=document.getElementById('comment_text').value;
	
	var url="comment_post_event.php?q_comment_text="+comment_text+"&q_post_mid="+post_mid+"&q_mid="+mid+"&q_event="+event_id;
	
	//xmlHttp.onreadystatechange=BlogCommentPostChanged;
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 			
			tbl=document.getElementById('123');
			//rows=tbl.rows.length;
			tblrow=tbl.insertRow(0);
			tblcell=tblrow.insertCell(0);
			tblcell.innerHTML=xmlHttp.responseText;
			document.getElementById('comment_text').value="";
			
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}


//------------------------------end-----------------------------------------------------------------------





//--------------------video comments---------------------------------------------------------------------------


		function post_video_comment()
		{ 
			
			xmlHttp=GetXmlHttpObject();
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			} 
			var video_id=document.getElementById('video_id').value;
			
			var mid=document.getElementById('mid').value;			
			var comment_text=document.getElementById('comment_text').value;
			
			var url="comment_post_video.php?q_comment_text="+comment_text+"&q_mid="+mid+"&q_video="+video_id;
			
			//xmlHttp.onreadystatechange=BlogCommentPostChanged;
			xmlHttp.onreadystatechange=function(){
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{ 			
					tbl=document.getElementById('123');
					//rows=tbl.rows.length;
					tblrow=tbl.insertRow(0);
					tblcell=tblrow.insertCell(0);
					tblcell.innerHTML=xmlHttp.responseText;
					document.getElementById('comment_text').value="";
					
				}
			}
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		}


//--------------------------------end------------------------------------------------------------------------------
//--------------------Shows comments---------------------------------------------------------------------------


		function post_show_comment()
		{ 
			
			xmlHttp=GetXmlHttpObject();
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			} 
			var event_id=document.getElementById('event_id').value;
			
			var mid=document.getElementById('mid').value;			
			var comment_text=document.getElementById('comment_text').value;
			
			var url="comment_post_show.php?q_comment_text="+comment_text+"&q_mid="+mid+"&q_video="+event_id;
			
			//xmlHttp.onreadystatechange=BlogCommentPostChanged;
			xmlHttp.onreadystatechange=function(){
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{ 			
					tbl=document.getElementById('123');
					//rows=tbl.rows.length;
					tblrow=tbl.insertRow(0);
					tblcell=tblrow.insertCell(0);
					tblcell.innerHTML=xmlHttp.responseText;
					document.getElementById('comment_text').value="";
					
				}
			}
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
		}


//--------------------------------end------------------------------------------------------------------------------


function cancel_rating_song() 
	{ 
		document.getElementById("Layer_rate_song").innerHTML="";	 
	} 


//--------------------song rating-----------------------------------------


	function func_rating_song(id_sg)
	{ 
		xmlHttp0=GetXmlHttpObject()
		if (xmlHttp0==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		var url="songs_rating.php?audio_id="+id_sg;		
		alert(url)
		xmlHttp0.onreadystatechange=Changed_songs_rating 
		xmlHttp0.open("GET",url,true)
		xmlHttp0.send(null)
	}
	function Changed_songs_rating() 
	{ 
		if (xmlHttp0.readyState==4 || xmlHttp0.readyState=="complete")
		{ 
			document.getElementById("Layer_rate_song").innerHTML=xmlHttp0.responseText;	 
		} 
	} 
//--------------------------------------------------------------------------------------------------------
//general ajax function
var divid="";
function ajax_href(url,div)
	{ 
	divid=div;
		xmlHttpNew=GetXmlHttpObject()
		if (xmlHttpNew==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		var url=url;		
		xmlHttpNew.onreadystatechange=state_changed_ajax_href 
		xmlHttpNew.open("GET",url,true)
		xmlHttpNew.send(null)
	}
	function state_changed_ajax_href() 
	{ 
		if (xmlHttpNew.readyState==4 || xmlHttpNew.readyState=="complete")
		{ 
			document.getElementById(divid).innerHTML=xmlHttpNew.responseText;	 
		} 
	} 

//-------------------------------------------------------------


	function artist_featured(id_sg,cnt,tot_featured)
	{ 
		xmlHttp0=GetXmlHttpObject()
		if (xmlHttp0==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		var url="index_featured.php?mem_id="+id_sg+"&ccd="+cnt+"&tot_feturd="+tot_featured;		
		//alert(url);
		xmlHttp0.onreadystatechange=Changed_mem_ar
		xmlHttp0.open("GET",url,true)
		xmlHttp0.send(null)
	}
	function Changed_mem_ar() 
	{ 
		if (xmlHttp0.readyState==4 || xmlHttp0.readyState=="complete")
		{ 
			document.getElementById("f_artist").innerHTML=xmlHttp0.responseText;	 
		} 
	} 
//--------------------------------------------------------------------------------------------------------
//--------------------video rating-----------------------------------------


	function func_rating_video(id_vd)
	{ 
		xmlHttp0=GetXmlHttpObject()
		if (xmlHttp0==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		var url="videos_rating.php?video_id="+id_vd;		
		xmlHttp0.onreadystatechange=Changed_videos_rating 
		xmlHttp0.open("GET",url,true)
		xmlHttp0.send(null)
	}
	function Changed_videos_rating() 
	{ 
		if (xmlHttp0.readyState==4 || xmlHttp0.readyState=="complete")
		{ 
			document.getElementById("Layer_rate_video").innerHTML=xmlHttp0.responseText;	 
		} 
	} 
	
	
	
	function cancel_rating_video() 
	{ 
		document.getElementById("Layer_rate_video").innerHTML="";	 
	} 
	
	
	function cancel_rating_show() 
	{ 
		document.getElementById("Layer_rate_show").innerHTML="";	 
	} 
//-------------------------------end -------------------------------------------------------------------------



function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

