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;
}
//manoj code
// function for filter table
function filter(term, _id, type)
{
	xmlhttp=getxmlhttpobject();
	var suche = term.value.toLowerCase();
	var table = document.getElementById(_id);
	var ele;
	var query='';
	if (table.rows)
	{
			ele = '';
			query=query+"txtval="+suche;
			query=query+"&type="+type;
			for (var r = 0; r < table.rows.length; r++)
			{
				table.rows[r].style.display = 'none';
			}
			document.getElementById("filter").innerHTML='Searching...';
			xmlhttp.onreadystatechange=function()
			{
				if (xmlhttp.readyState==4)
				{
					document.getElementById("filter").innerHTML=xmlhttp.responseText;
					//document.getElementById("filt").value=suche;
					//parent.frames['content'].location.reload(true);
				}
			}
			xmlhttp.open("GET","passnext.php?action=searchtable&"+query,true);
			xmlhttp.send(null);
			//return false;

			/*
			for (var ctr=0; ctr < (table.rows[r].cells.length -1); ctr++)
			{
				
				ele += table.rows[r].cells[ctr].innerHTML.replace(/<[^>]+>/g,"")+ ' ';				
			}

			if (ele.toLowerCase().indexOf(suche) >=0)
			{
				table.rows[r].style.display = '';
			}
			else 
			{
				table.rows[r].style.display = 'none';
			}
			*/
		//}
	}	
}
// function for save n delete

function deleteAll(frm,type)
{
	
	var query='';
	var i=0;
	xmlhttp=getxmlhttpobject();
	for (var ctr=0; ctr < frm.length; ctr++)
	{
		field_name = frm.elements[ctr].name;
			if (field_name.indexOf("chk") != -1)
			{
				var data=frm.elements[ctr].value;
				query=query+"val_"+i+"="+data+"&";
				i=i+1;
			}
	}
	query=query+"type="+type+"&rec="+i;
	document.getElementById("deleting").innerHTML='Deleting...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("deleting").innerHTML=xmlhttp.responseText;
		}
	}
	alert(query);
	xmlhttp.open("GET","passnext.php?action=delete&"+query,true);
	xmlhttp.send(null);
	return false;
}
//////////////////
function editValueNoTxtbx(frm,id,data,type)
{
	xmlhttp=getxmlhttpobject();
	var query="val="+data+"&id="+id+"&type="+type;
	document.getElementById("ajaxrep").innerHTML='Saving...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			parent.frames['content'].location.reload(true);
		}
	}
	xmlhttp.open("GET","passnext.php?action=edit&"+query,true);
	xmlhttp.send(null);
	return false;
}

////////////////////////////////////////////////////
function editValue(frm,id,rowno,type)
{
	xmlhttp=getxmlhttpobject();
	for (var ctr=0; ctr < frm.length; ctr++)
	{
		field_name = frm.elements[ctr].name;
		if (field_name.indexOf("txt") != -1)
		{
			var cnt=frm.elements[ctr].name.split("_");
			if(cnt[1]==rowno)
			{
				var data=frm.elements[ctr].value;
				var query="val="+data+"&id="+id+"&type="+type;
		
				document.getElementById("ajaxrep").innerHTML='Saving...';
				xmlhttp.onreadystatechange=function()
				{
					if (xmlhttp.readyState==4)
				 	{
				  		document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
				 	}
				}
				xmlhttp.open("GET","passnext.php?action=edit&"+query,true);
				xmlhttp.send(null);
				return false;
			}
		}
	}
}
///////////////////////////////////////////////

function deleteValueDynamic(frm,id,type,joinvalue)
{
	$con = confirm('Are you sure to delete this Album?');
	if($con == true){
	xmlhttp=getxmlhttpobject();
	var query="id="+id+"&type="+type;
	var divId = joinvalue+id;
	document.getElementById(divId).innerHTML = 'deleting...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById(divId).innerHTML='';
		}
	}
	xmlhttp.open("GET","passAjax.php?action=delete&"+query,true);
	xmlhttp.send(null);
	}else{
	return false;
	}
}

///////////////////////////////////////////////////

function deleteValue(frm,id,type)
{
	
	$con = confirm('Are you sure to delete?');
	if($con == true){
	xmlhttp=getxmlhttpobject();
	var query="id="+id+"&type="+type;
	document.getElementById("ajaxrep").innerHTML='Deleting...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			window.location.href='group.php';
			parent.frames['content'].location.reload(true);
		}
	}
	
	xmlhttp.open("GET","pass.php?action=delete&"+query,true);
	xmlhttp.send(null);
	}else{
	return false;
	}
}
//check user name verification for jobseeker //
function chkuname_owner()
{
		
	xmlhttp7 = getxmlhttpobject()
	var user_name = document.getElementById("user_name").value;
	var query = "user_name="+user_name;
	
	document.getElementById("chkuname").innerHTML = "<span class='ajaxmsg'>Checking...</span><img src=images/icon_loading.gif />";
	xmlhttp7.onreadystatechange=function(){
	if (xmlhttp7.readyState==4)
	  { 
	    chck = xmlhttp7.responseText;
	    
		if(chck == "<span class='ajaxmsg'>Already taken.Choose another.</span>")
		{
		 alert('Already taken Choose another.');
		 document.getElementById("user_name").value ='';
		 document.getElementById("user_name").focus();
		}
		if(chck == "<span class='ajaxmsg'>Please Enter Username.</span>")
		{
		 alert('Please Enter Username.');
		 document.getElementById("user_name").value ='';		 
		 document.getElementById("user_name").focus();
		 return false;
		}
		document.getElementById("chkuname").innerHTML=xmlhttp7.responseText;
	  }
	}
	xmlhttp7.open("GET","pass.php?block=main&go=registerview_owner&"+query,true)
	xmlhttp7.send(null)
}
//check valid email id for edit contact us page..
function chkemail_owner()
{
		
	xmlhttp7 = getxmlhttpobject()
	var email = document.getElementById("email").value;
	var query = "email="+email;
	
	document.getElementById("chkemail").innerHTML = "<span class='ajaxmsg'>Checking...</span><img src=images/icon_loading.gif />";
	xmlhttp7.onreadystatechange=function(){
	if (xmlhttp7.readyState==4)
	  { 
	    chck = xmlhttp7.responseText;
	    
		if(chck == "<span class='ajaxmsg'>Already taken.Choose another.</span>")
		{
		 alert('Already taken Choose another.');
		 document.getElementById("user_name").value ='';
		 document.getElementById("user_name").focus();
		}
		if(chck == "<span class='ajaxmsg'>Please Enter Username.</span>")
		{
		 alert('Please Enter Username.');
		 document.getElementById("user_name").value ='';		 
		 document.getElementById("user_name").focus();
		 return false;
		}
		document.getElementById("chkemail").innerHTML=xmlhttp7.responseText;
	  }
	}
	xmlhttp7.open("GET","pass.php?block=main&go=checkemail_owner&"+query,true)
	xmlhttp7.send(null)
}

//check user name verification //
function chk_username()
{
	xmlhttp7 = getxmlhttpobject()
	var name = document.getElementById("name").value;
	var query = "name="+name;
	document.getElementById("chkun").innerHTML = "<span class='ajaxmsg'>Checking...</span><img src=images/icon_loading.gif />";
	xmlhttp7.onreadystatechange=function(){
	if (xmlhttp7.readyState==4)
	  { 
	    chck = xmlhttp7.responseText;
	   if(chck == "<span class='ajaxmsg'>Already taken.Choose another.</span>")
		{
		 alert('Already taken Choose another.');
		 document.getElementById("name").value ='';
		 document.getElementById("name").focus();
		}
		if(chck == "<span class='ajaxmsg'>Please Enter Username.</span>")
		{
		 alert('Please Enter Username.');
		 document.getElementById("name").value ='';		 
		 document.getElementById("name").focus();
		 return false;
		}
		document.getElementById("chkun").innerHTML=xmlhttp7.responseText;
	  }
	}
	xmlhttp7.open("GET","pass.php?action=user_name&"+query,true)
	xmlhttp7.send(null)
}
//rating//
function couponwork(frm,id,type,val)
{
	xmlhttp=getxmlhttpobject();
	var query="id="+id+"&type="+type+"&value="+val;
	//alert(query);
	document.getElementById("ajaxrep").innerHTML='Deleting...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			window.location.href='group.php';
			parent.frames['content'].location.reload(true);
		}
	}
	xmlhttp.open("GET","passAjax.php?action=rating&"+query,true);
	xmlhttp.send(null);
}

function deleteMainTopic(frm,id,type)
{
	
	 $con = confirm('Are you sure to delete main topic?');
	
	if($con == true){
	
	xmlhttp=getxmlhttpobject();
	var query="id="+id+"&type="+type;
	//alert(query);
	document.getElementById("ajaxrep").innerHTML='Deleting...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			window.location.href='group.php';
			//parent.frames['content'].location.reload(true);
		}
	}

	xmlhttp.open("GET","passAjax.php?action=delete&"+query,true);
	xmlhttp.send(null);
	}else{
	return false;
	}
}


function friendreject(frm,id,type){
	
	 $con = confirm('Are you sure to Reject this Friendship?');
	
	if($con == true){
	
	xmlhttp=getxmlhttpobject();
	var query="id="+id+"&type="+type;
	
	document.getElementById("ajaxrep").innerHTML='Deleting...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			parent.frames['content'].location.reload(true);
		}
	}

	xmlhttp.open("GET","passAjax.php?action=rejectfrn&"+query,true);
	xmlhttp.send(null);
	}else{
	return false;
	}
	}
function friendconfirm(frm,id,type){
	xmlhttp=getxmlhttpobject();
	var query="id="+id+"&type="+type;
	
	document.getElementById("ajaxrep").innerHTML='Friend Confirm...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			parent.frames['content'].location.reload(true);
		}
	}
	xmlhttp.open("GET","passAjax.php?action=confirmfrn&"+query,true);
	xmlhttp.send(null);
}	
function removefriend(frm,id,type){
	 $con = confirm('Are you sure to Delete this Friend?');
	
	if($con == true){
	
	xmlhttp=getxmlhttpobject();
	var query="id="+id+"&type="+type;
	
	document.getElementById("ajaxrep").innerHTML='Deleting...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			parent.frames['content'].location.reload(true);
		}
	}
	xmlhttp.open("GET","passAjax.php?action=deletefrn&"+query,true);
	xmlhttp.send(null);
	}else{
	return false;
	}
	}
// for temporary 
function editValue1(frm,id,rowno)
{
	xmlhttp=getxmlhttpobject();
	for (var ctr=0; ctr < frm.length; ctr++)
	{
		field_name = frm.elements[ctr].name;
		if (field_name.indexOf("txt") != -1)
		{
			var cnt=frm.elements[ctr].name.split("_");
			if(cnt[1]==rowno)
			{
				var data=frm.elements[ctr].value;
				var query="val="+data+"&id="+id;
				//alert(query);
				document.getElementById("ajaxrep").innerHTML='Saving...';
				xmlhttp.onreadystatechange=function()
				{
					if (xmlhttp.readyState==4)
				 	{
				  		document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
				 	}
				}
				xmlhttp.open("GET","passnext.php?action=editmusic&"+query,true);
				xmlhttp.send(null);
			}
		}
	}
}
function deleteValue1(frm,id,rowno)
{
	
	xmlhttp=getxmlhttpobject();
	var query="id="+id;
	
	alert(query);
	
	document.getElementById("ajaxrep").innerHTML='Saving...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			parent.frames['content'].location.reload(true);		
		}
	}
	xmlhttp.open("GET","passnext.php?action=deletemusic&"+query,true);
	xmlhttp.send(null);
	return false;
}

// end function
// end
// pre made 
function chkuname()
{
	
	xmlhttp=getxmlhttpobject();
	var uname = document.getElementById("uname").value;
	var query = "uname="+uname;
	
	document.getElementById("chkuname").innerHTML = "<span class='ajaxmsg'>Checking...</span><img src=images/icon_loading.gif />";
	xmlhttp.onreadystatechange=function(){
	if (xmlhttp.readyState==4)
	  { 
	    chck = xmlhttp.responseText;
	    if(chck == "<span class='ajaxmsg'>Already taken.Choose another.</span>")
		{
		 alert('Already taken Choose another.');
		 document.getElementById("uname").value ='';
		 document.getElementById("uname").focus();
		}
		if(chck == "<span class='ajaxmsg'>Please Enter Username.</span>")
		{
		 alert('Please Enter Username.');
		 document.getElementById("uname").value ='';
		 document.getElementById("uname").focus();
		}
		document.getElementById("chkuname").innerHTML=xmlhttp.responseText;
	  }
	}
	xmlhttp.open("GET","pass.php?action=registerview&"+query,true)
	xmlhttp.send(null)
}

function chkVcode()
{
	var str=document.getElementById("varification").value;
	var url="pass.php?block=main&go=check_Vcode&v_code="+str;
			alert (url);
			xmlHttp=getobject();
			//xmlHttp.onreadystatechange=VcChanged;
			document.getElementById("Vc_div").innerHTML='checking...';
			xmlHttp.onreadystatechange=function()
				{
					if (xmlHttp.readyState==4)
				 	{
				  		document.getElementById("Vc_div").innerHTML=xmlHttp.responseText;
				 	}
				}			
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);
			return false;
}

function editValueStatus(frm,id,data)
{
	
	xmlhttp=getxmlhttpobject();
	var query="val="+data+"&id="+id;
	document.getElementById("ajaxrep").innerHTML='Saving...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			parent.frames['content'].location.reload(true);
		}
	}
	//alert("pass.php?action=edit&"+query);
	xmlhttp.open("GET","pass.php?action=editstatus&"+query,true);
	xmlhttp.send(null);
	//return false;
}
/*********CODE***********/
	function chkuname1(id)
{
	xmlhttp7 = getxmlhttpobject()
	var uname = id.value;
	var query = "uname="+uname;
	document.getElementById("chkuname1").innerHTML = "<span class='ajaxmsg'>Checking...</span><img src=images/icon_loading.gif />";
	xmlhttp7.onreadystatechange=function(){
	if (xmlhttp7.readyState==4)
	  { 
	    chck = xmlhttp7.responseText;
		
		if(chck == "<span class='ajaxmsg'>Please enter right code.</span>")
		{	
		 document.getElementById("varification").value ='';
		 document.getElementById("varification").focus();
		 //return false;
		}
		if(chck == "<span class='ajaxmsg'>Please Enter verification code.</span>")
		{
		 document.getElementById("varification").value ='';
		 document.getElementById("varification").focus();
		 //return false;
		}
		
		document.getElementById("chkuname1").innerHTML=xmlhttp7.responseText;
		return false;
	  }
	}
	
	xmlhttp7.open("GET","pass.php?action=check&"+query,true)
	xmlhttp7.send(null)
}

/*******************************************************************/
/******************MANAGE SPECIFICATION*****************************/
/*******************************************************************/

	function show_basic_specification(bsid){
		xmlhttp3=getxmlhttpobject()
		document.getElementById("divbs2").innerHTML="<span class='ajaxmsg'>Loading...</span><img src=images/working1.gif />";
		document.getElementById("divbs3").innerHTML="";
		xmlhttp3.onreadystatechange=function(){
			if (xmlhttp3.readyState==4)
			{
				document.getElementById("divbs2").innerHTML=xmlhttp3.responseText;
			}
		}
		xmlhttp3.open("GET","pass.php?action=show_basic_spec&bsid="+bsid,true)
		xmlhttp3.send(null)
	}

	function show_pg_specification(pgsid){
		xmlhttp3=getxmlhttpobject()
		document.getElementById("divpgs2").innerHTML="<span class='ajaxmsg'>Loading...</span><img src=images/working1.gif />";
		document.getElementById("divpgs3").innerHTML="";
		xmlhttp3.onreadystatechange=function(){
			if (xmlhttp3.readyState==4)
			{
				document.getElementById("divpgs2").innerHTML=xmlhttp3.responseText;
			}
		}
		xmlhttp3.open("GET","pass.php?action=show_pg_spec&pgsid="+pgsid,true)
		xmlhttp3.send(null)
	}
	function show_ppg_specification(ppgsid){
		//alert(ppgsid);
		xmlhttp3=getxmlhttpobject()
		document.getElementById("divppgs2").innerHTML="<span class='ajaxmsg'>Loading...</span><img src=images/working1.gif />";
		document.getElementById("divppgs3").innerHTML="";
		xmlhttp3.onreadystatechange=function(){
			if (xmlhttp3.readyState==4)
			{
				document.getElementById("divppgs2").innerHTML=xmlhttp3.responseText;
			}
		}
		xmlhttp3.open("GET","pass.php?action=show_ppg_spec&ppgsid="+ppgsid,true)
		xmlhttp3.send(null)
	}
/*******************************************************************/
/******************MANAGE SPECIFICATION*****************************/
/*******************************************************************/	
	function change_cityname(cid){
		xmlhttp3=getxmlhttpobject()
		document.getElementById("divcity2").innerHTML="<span class='ajaxmsg'>Loading...</span><img src=images/working1.gif />";
		document.getElementById("divcity3").innerHTML="";
		xmlhttp3.onreadystatechange=function(){
			if (xmlhttp3.readyState==4)
			{
				document.getElementById("divcity2").innerHTML=xmlhttp3.responseText;
			}
		}
		xmlhttp3.open("GET","pass.php?action=show_change_city&cid="+cid,true)
		xmlhttp3.send(null)
	}
/***********MANAGE CATEGORY AND SUBCATEGORY*************/
function show_sub_cat(catid,type)
{
		//alert(type);
	xmlhttp3=getxmlhttpobject()
	document.getElementById("div2").innerHTML="<span class='ajaxmsg'>Loading...</span><img src=images/working1.gif />";
	document.getElementById("div3").innerHTML="";
	xmlhttp3.onreadystatechange=function(){
		if (xmlhttp3.readyState==4)
		{
			document.getElementById("div2").innerHTML=xmlhttp3.responseText;
		}
	}
	xmlhttp3.open("GET","pass.php?action=show_sub_cat&catid="+catid+"&type="+type,true)
	xmlhttp3.send(null)
}

function show_option(sub_catid)
{
	xmlhttp4=getxmlhttpobject()
	document.getElementById("div3").innerHTML="<span class='ajaxmsg'>Loading...</span><img src=images/working1.gif />";
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			document.getElementById("div3").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","passnext.php?action=show_option&sub_catid="+sub_catid,true)
xmlhttp4.send(null)
}


///////////////top ten list/////////////////////
function toptenlist(id){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			document.getElementById("divtoplist").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","toptenlist.php?ttl="+id,true)
	xmlhttp4.send(null)
}
///////////////contact us question answer////////////////
function questionanswer(qid){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			document.getElementById("answerdiv").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","quesanswer.php?qid="+qid,true)
	xmlhttp4.send(null)
}
//////////////COMPANY LIST BY THE CHAR///////////////////////
function allcompanylist(char){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			document.getElementById("companylist").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=companychar&char="+char,true)
	xmlhttp4.send(null)
}
/********************************************************************************************************/
// LATEST JOBS , MOST COMMENTED JOBS , MOST VIEWED JOBS , EXPIRY JOBS 
/********************************************************************************************************/
function additional_information(info){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			document.getElementById("additioalinfo").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=job&go="+info,true)
	xmlhttp4.send(null)	
}


//mongoltown ajax..............................
function mongolianSongs(){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			document.getElementById("musiclist").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=mongoliansongs",true)
	xmlhttp4.send(null)
}
function foreignSongs(){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			document.getElementById("musiclist").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=foreignsongs",true)
	xmlhttp4.send(null)
}

function latest_songs(){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			var latestbutton = "<table border='0' cellspacing='0' cellpadding='0'><tr><td id='blackbutton' valign='middle' align='center'><a href='javascript:void(null);' class='link' onclick='return latest_songs();' title='Latest Now'>Latest Now</a></td><td width='6px'></td><td id='whitebutton1' align='center' valign='middle'><a href='javascript:void(null);' class='text5' onclick='return most_popular_songs();' title='Foreign Songs'>Foreign Songs</a></td><td width='6px'></td><td id='whitebutton2' align='center' valign='middle'><a href='javascript:void(null);' class='text5' onclick='return featured_songs();' title='Most Listened'>Most Listened</a></td></tr></table>";
			document.getElementById("buttondiv").innerHTML=latestbutton;
			document.getElementById("songlist").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=latestsongs",true)
	xmlhttp4.send(null)
	}

function most_popular_songs(){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			var latestbutton = "<table border='0' cellspacing='0' cellpadding='0'><tr><td id='whitebutton1' valign='middle' align='center'><a href='javascript:void(null);' class='text5' onclick='return latest_songs();' title='Latest Now'>Latest Now</a></td><td width='6px'></td><td id='blackbutton' align='center' valign='middle'><a href='javascript:void(null);' class='link' onclick='return most_popular_songs();' title='Foreign Songs'>Foreign Songs</a></td><td width='6px'></td><td id='whitebutton2' align='center' valign='middle'><a href='javascript:void(null);' class='text5' onclick='return featured_songs();' title='Most Listened'>Most Listened</a></td></tr></table>";
			document.getElementById("buttondiv").innerHTML=latestbutton;	
			document.getElementById("songlist").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=mostpopularsongs",true)
	xmlhttp4.send(null)
}

function featured_songs(){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			var latestbutton = "<table border='0' cellspacing='0' cellpadding='0'><tr><td id='whitebutton1' valign='middle' align='center'><a href='javascript:void(null);' class='text5' onclick='return latest_songs();' title='Latest Now'>Latest Now</a></td><td width='6px'></td><td id='whitebutton1' align='center' valign='middle'><a href='javascript:void(null);' class='text5' onclick='return most_popular_songs();' title='Foreign Songs'>Foreign Songs</a></td><td width='6px'></td></tr></table>";
			document.getElementById("buttondiv").innerHTML=latestbutton;
			document.getElementById("songlist").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=featuredsongs",true)
	xmlhttp4.send(null)
}
/**********************************************/
	function latest_video(){
		xmlhttp4=getxmlhttpobject()
		xmlhttp4.onreadystatechange=function(){
			if (xmlhttp4.readyState==4)
			{
				var latestbutton = "<table align='left' border='0' cellspacing='0' cellpadding='0'><tr><td id='blackbutton3' valign='middle' align='center'><a href='javascript:void(null);' class='link' onclick='return latest_video();' title='Latest Now'>&#1057;&#1199;&#1199;&#1083;&#1076; &#1053;&#1101;&#1084;&#1101;&#1075;&#1076;&#1089;&#1101;&#1085;</a></td><td width='6px'></td><td id='whitebutton3' align='center' valign='middle'><a href='javascript:void(null);' class='text5' onclick='return popular_video();' title='Most popular' >&#1061;&#1072;&#1084;&#1075;&#1080;&#1081;&#1085; &#1069;&#1088;&#1101;&#1083;&#1090;&#1090;&#1101;&#1081;</a></td><td width='6px'></td></tr></table>";
				//alert(xmlhttp4.responseText);
				document.getElementById("buttondiv2").innerHTML=latestbutton;
				document.getElementById("videolist2").innerHTML=xmlhttp4.responseText;
			}
		}
		xmlhttp4.open("GET","pass.php?action=latestvideos",true)
		xmlhttp4.send(null)
	}

function popular_video(){
		xmlhttp4=getxmlhttpobject()
		xmlhttp4.onreadystatechange=function(){
			if (xmlhttp4.readyState==4)
			{
				var latestbutton = "<table align='left' border='0' cellspacing='0' cellpadding='0'><tr><td id='whitebutton3' valign='middle' align='center'><a href='javascript:void(null);' class='text5' onclick='return latest_video();' title='Latest Now'>&#1057;&#1199;&#1199;&#1083;&#1076; &#1053;&#1101;&#1084;&#1101;&#1075;&#1076;&#1089;&#1101;&#1085;</a></td><td width='6px'></td><td id='blackbutton3' align='center' valign='middle'><a href='javascript:void(null);' class='link' onclick='return popular_video();' title='Most popular' >&#1061;&#1072;&#1084;&#1075;&#1080;&#1081;&#1085; &#1069;&#1088;&#1101;&#1083;&#1090;&#1090;&#1101;&#1081;</a></td><td width='6px'></td></tr></table>";
				//alert(xmlhttp4.responseText);
				document.getElementById("buttondiv2").innerHTML=latestbutton;
				document.getElementById("videolist2").innerHTML=xmlhttp4.responseText;
			}
		}
		xmlhttp4.open("GET","pass.php?action=popularvideos",true)
		xmlhttp4.send(null)
	}
	function feature_video(){
		xmlhttp4=getxmlhttpobject()
		xmlhttp4.onreadystatechange=function(){
			if (xmlhttp4.readyState==4)
			{
				var latestbutton = "<table align='left' border='0' cellspacing='0' cellpadding='0'><tr><td id='whitebutton3' valign='middle' align='center'><a href='javascript:void(null);' class='text5' onclick='return latest_video();' title='Latest Now'>&#1057;&#1199;&#1199;&#1083;&#1076; &#1053;&#1101;&#1084;&#1101;&#1075;&#1076;&#1089;&#1101;&#1085;</a></td><td width='6px'></td><td id='whitebutton3' align='center' valign='middle'><a href='javascript:void(null);' class='text5' onclick='return popular_video();' title='Most popular' >&#1061;&#1072;&#1084;&#1075;&#1080;&#1081;&#1085; &#1069;&#1088;&#1101;&#1083;&#1090;&#1090;&#1101;&#1081;</a></td><td width='6px'></td></tr></table>";
				//alert(xmlhttp4.responseText);
				document.getElementById("buttondiv2").innerHTML=latestbutton;
				document.getElementById("videolist2").innerHTML=xmlhttp4.responseText;
			}
		}
		xmlhttp4.open("GET","pass.php?action=featurevideos",true)
		xmlhttp4.send(null)
		}
/***********************************************/

function datafetch(action,type,page) 
{ 
	//alert(type);
	xmlhttp4=getxmlhttpobject(); 
	xmlhttp4.onreadystatechange=function(){ 
		if (xmlhttp4.readyState==4){ 
			document.getElementById('allnews').innerHTML=xmlhttp4.responseText; 
		} 
	} 
    xmlhttp4.open("GET","pass.php?action=mgt_pagging&page="+page+"&type="+type,true); 
    xmlhttp4.send(null); 
}	
function datafetchNew(action,type,page) 
{ 
	alert(type);
	xmlhttp4=getxmlhttpobject(); 
	xmlhttp4.onreadystatechange=function(){ 
		if (xmlhttp4.readyState==4){ 
			document.getElementById('allnewsNew').innerHTML=xmlhttp4.responseText; 
		} 
	} 
    xmlhttp4.open("GET","pass.php?action=mgt_paggingNew&page="+page+"&type="+type,true); 
    xmlhttp4.send(null); 
}	
function news_bycategory(ncid){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
	if (xmlhttp4.readyState==4){
			document.getElementById("allnews").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=newsbycat&ncid="+ncid,true)
	xmlhttp4.send(null)
}
function product_bycategory(pcid){
	//alert(pcid);	
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
	if (xmlhttp4.readyState==4){
			document.getElementById("allnews").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=productbycat&pcid="+pcid,true)
	xmlhttp4.send(null)
}
function photo_bycategory(pcid){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
	if (xmlhttp4.readyState==4){
			document.getElementById("allnews").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=photobycat&pcid="+pcid,true)
	xmlhttp4.send(null)
}
function album_bycategory(acid){
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
	if (xmlhttp4.readyState==4){
			document.getElementById("allnews").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=albumbycat&acid="+acid,true)
	xmlhttp4.send(null)
}
function video_bycategory(vcid){
	//alert(vcid);	
	xmlhttp4=getxmlhttpobject()
	xmlhttp4.onreadystatechange=function(){
	if (xmlhttp4.readyState==4){
		//	alert(xmlhttp4.responseText);
			document.getElementById("allnews").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=videobycat&vcid="+vcid,true)
	xmlhttp4.send(null)
}

function top_video_change(vid , dvid){
	document.getElementById(dvid).style.display='none';
	document.getElementById(vid).style.display='';
}

/*********************************************	ADD PHOTO COMMENTS   ******************************************************************************/

function submit_comment(frm,commentid,commentval){
	if(commentval.length == 0){
		alert("Please insert some comment");
	}else{
	xmlhttp4=getxmlhttpobject()
	var query="val="+commentval+"&id="+commentid;
	xmlhttp4.onreadystatechange=function(){
		if (xmlhttp4.readyState==4)
		{
			document.getElementById("commentdiv").innerHTML=xmlhttp4.responseText;
		}
	}
	xmlhttp4.open("GET","pass.php?action=addcomment&"+query,true)
	xmlhttp4.send(null)
	}
}

function addtofriend(uid){
	//alert(uid);
	//mobin id pass...
	xmlhttp4=getxmlhttpobject(); 
	xmlhttp4.onreadystatechange=function(){ 
		if (xmlhttp4.readyState==4){ 
			document.getElementById('friendrequest').innerHTML=xmlhttp4.responseText; 
		} 
	} 
    xmlhttp4.open("GET","pass.php?action=friendrequest&uid="+uid,true); 
    xmlhttp4.send(null); 
}
function acceptrequest(frdto){
	xmlhttp4=getxmlhttpobject(); 
	xmlhttp4.onreadystatechange=function(){ 
		if (xmlhttp4.readyState==4){ 
			//alert(xmlhttp4.responseText);
			document.getElementById('friendrequestaccept').innerHTML=xmlhttp4.responseText; 
			//window.location.href = 'friendrequest.php';
		} 
	} 
    xmlhttp4.open("GET","pass.php?action=friendrequestaccept&frdto="+frdto,true); 
    xmlhttp4.send(null); 
}
function deleteFriend(from,type)
{
	
	$con = confirm('Are you sure to delete Friend in friend List?');
	if($con == true){
	xmlhttp=getxmlhttpobject();
	var query="from="+from+"&type="+type;
	document.getElementById("ajaxrep").innerHTML='Deleting...';
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			document.getElementById("ajaxrep").innerHTML=xmlhttp.responseText;
			window.location.href = 'friend.php';
		}
	}
	//alert(query);
	xmlhttp.open("GET","pass.php?action=delete&"+query,true);
	xmlhttp.send(null);
	}else{
	return false;
	}
}
