/***************************AJAX CODE *****************************/

var xmlHttp
function showStory(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="entertainmentdb_detail.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function showSportStory(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="sportdb_detail.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function PollValue(str)
{
document.getElementById('getpoll').value=str;
}

function insertPoll(pollid)
{ 
	var str=document.getElementById('getpoll').value;
if(str)
	{

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="../include/vote.php"
url=url+"?q="+str+"&pollid="+pollid
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=insertPollChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
	}
else
	{
	alert('Please select atleast one poll option!');
	return false;

	}
}

function insertPollChanged()
{
	var str1=document.getElementById('menuvalue').value;
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("PollMsgDiv").innerHTML=xmlHttp.responseText 
		//alert( document.getElementById("PollMsgDiv").innerHTML);
		window.location.href="/include/poll.php?value="+document.getElementById("PollMsgDiv").innerHTML+"&menuvalue="+str1;
	 } 
}

function showLocation(str)
{ 
	
	document.getElementById('parent_id').value=str;
	if(str == "SELECT")
	{
		return false;
	}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="Locationdb_detail.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateLocationChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function showDeshLocation(str)
{ 
	
		if(str=="सेलेक्ट")
	{
			return false;
	}
document.getElementById('location_parent_id').value=str;
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="deshsublocation.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateDeshLocationChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
	var statename=document.getElementById('locationdown').options[document.getElementById('locationdown').selectedIndex].text;
//var localname=document.getElementById('location_city_down').options[document.getElementById('location_city_down').selectedIndex].text;
document.getElementById("localnameid").innerHTML="<span class='localnameclass'>("+statename+")</span>";

}



function shownews(str)
{
	
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="Specialdb_detail.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateNewsChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function showLocationStory(str)
{ 
	if(str == "SELECT" || str == "")
	{
	str=document.getElementById('parent_id').value;
	}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="Locationdb_story.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedLocation 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function showSubLocationStory(str)
{ 
	//alert(str);
if(str == "SELECT")
	{
		//alert(str);
		str=document.getElementById('location_parent_id').value
		//alert(str);
	}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="deshsublocationdetail.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedSubLocation 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
var statename=document.getElementById('locationdown').options[document.getElementById('locationdown').selectedIndex].text;
var localname=document.getElementById('location_city_down').options[document.getElementById('location_city_down').selectedIndex].text;
	if(localname=="सेलेक्ट")
	{
		document.getElementById("localnameid").innerHTML="<span class='localnameclass'>("+statename+")</span>";
	}
	else
	{
		document.getElementById("localnameid").innerHTML="<span class='statename'>"+localname+"</span><span class='localnameclass'>&nbsp;("+statename+")</span>";
	}
//alert(document.getElementById("localnameid").innerHTML);
}


function getSectionStory(str,b)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
	var url="/desh/sectiondb.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedSection
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	while(document.getElementById("tipstab").innerHTML.indexOf('tipschangeclass')>0)
	{
		document.getElementById("tipstab").innerHTML=document.getElementById("tipstab").innerHTML.replace('tipschangeclass','tipsclass');
	}
	document.getElementById(b).className="tipschangeclass";
}

function stateChangedSection()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("newtipsdb").innerHTML=xmlHttp.responseText 
 } 
}


function stateNewsChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("SpecialMainDiv").innerHTML=xmlHttp.responseText 
 } 
}


function mostviewnewsChange()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("MostMainDiv").innerHTML=xmlHttp.responseText 
 }
}


function stateNewsChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("SpecialMainDiv").innerHTML=xmlHttp.responseText 
 } 
}


function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("mainstory").innerHTML=xmlHttp.responseText 

 } 

}
function stateLocationChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
var splitselect=xmlHttp.responseText.split("&^%");

 document.getElementById("locationmainstory").innerHTML=splitselect[0]; 
document.getElementById("mainlocationstory").innerHTML=splitselect[1];
 } 

}
function stateDeshLocationChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	var splitselect=xmlHttp.responseText.split("&^%");
 document.getElementById("subdeshlocation").innerHTML=splitselect[0]; 
 document.getElementById("sectionstorydetail").innerHTML=splitselect[1];
 } 
}


function stateChangedLocation() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
		if(document.getElementById("blankid"))
	 {
				document.getElementById("blankid").innerHTML='';
	 }
	 document.getElementById("mainlocationstory").innerHTML=xmlHttp.responseText 
 
 } 
}

function stateChangedSubLocation() 
{ 
	
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("sectionstorydetail").innerHTML=xmlHttp.responseText 
 } 
}



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;
}

function EntertainmentBgClass(GetId)
{

	while(document.getElementById("EntertainmentMainDiv").innerHTML.indexOf('class=entertainment_bg_class')>0)
		{
		
			document.getElementById("EntertainmentMainDiv").innerHTML=document.getElementById("EntertainmentMainDiv").innerHTML.replace('class=entertainment_bg_class','class=entertainment_bg');
		}
		
	document.getElementById(GetId).className="entertainment_bg_class";
}


function SportBgClass(GetId)
{

	while(document.getElementById("SportMainDiv").innerHTML.indexOf('class=sport_bg_class')>0)
		{
		
			document.getElementById("SportMainDiv").innerHTML=document.getElementById("SportMainDiv").innerHTML.replace('class=sport_bg_class','class=sport_bg');
		}
		
	document.getElementById(GetId).className="sport_bg_class";
}

function fromgallerypage(str1,str,str2)
{
	window.location.href="../photo_gallery/photogallery.php?menuvalue=5&categoryvalue="+str1+"&q="+str;
}