/***************************AJAX CODE *****************************/

var xmlHttp
var count = "0" ;
function showhorocopedb(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/home/astrologydb.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=Changeshowhorocopedb
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
document.getElementById("horoscp_signid").innerHTML="<a class=\"moreData1\" href='/astrology/"+str+".html'>अधिक पढ़ें</a>"

}

function Changeshowhorocopedb() 
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	 { 
		document.getElementById("astrologyid").innerHTML = xmlHttp.responseText 
		 document.getElementById("horescopeimg").src= document.getElementById("imagevalue").value;
	 } 
}

function openhoroscope(str)
{
	window.open("/EventOfYear/varshikrashiphalBenemadhaw.php?rashivalue="+str);
}
function showhorocopedbspecial(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/home/astrologydb1.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=Changeshowhorocopedb
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
document.getElementById("horoscp_signidspecial").innerHTML="<a class=\"moreData1\" href='/EventOfYear/varshikrashiphalBenemadhaw.php?rashivalue="+str+"'>अधिक पढ़ें</a>"

}

function Changeshowhorocopedb() 
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	 { 
		document.getElementById("astrologyid").innerHTML = xmlHttp.responseText 
		 document.getElementById("horescopeimg").src= document.getElementById("imagevalue").value;
	 } 
}


function showastrology(str)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/home/headerAstrologyt.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=ChangeAstrology
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function ChangeAstrology() 
{ 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	 { 
	 document.getElementById("headerastrologydetail").innerHTML = xmlHttp.responseText 
	 } 
}

function showLocationWeather(str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	}
	var url="/home/LocationWeathe.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=ChangeLocationWeather
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function ChangeLocationWeather() 
{ 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{ 
	document.getElementById("headerweather").innerHTML = xmlHttp.responseText 
	} 
}

function getHorescopeStory(str)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		{
		alert ("Browser does not support HTTP Request")
		return
		}
		var url="/home/horescopedb.php"
		url=url+"?q="+str
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=getHorescopeStoryChange
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		while(document.getElementById("horoscopetab").innerHTML.indexOf('horoscope_changeclass')>0)
		{
		document.getElementById("horoscopetab").innerHTML=document.getElementById("horoscopetab").innerHTML.replace('horoscope_changeclass','horoscope_class');
		}
		document.getElementById(str).className="horoscope_changeclass";
}

function getHorescopeStoryChange()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	 document.getElementById("horocoevalue").innerHTML=xmlHttp.responseText 
	} 
}

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="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 downbreakingnews()
{
	var count=parseInt(document.getElementById("relatednewsLast").value)-1;
	if(document.getElementById("DIV_"+count)!=null)
	{
		document.getElementById("changeBreakNews").innerHTML="";
		document.getElementById("changeBreakNews").innerHTML=document.getElementById("DIV_"+count).innerHTML
		document.getElementById("relatednewsLast").value=parseInt(document.getElementById("relatednewsLast").value)-1;
	}
	else
	{
		return false;
	}		
}

function upbreakingnews()
{ 
	var count=parseInt(document.getElementById("relatednewsLast").value)+1;
	if(document.getElementById("DIV_"+count)!=null)
	{
		document.getElementById("changeBreakNews").innerHTML="";
		document.getElementById("changeBreakNews").innerHTML=document.getElementById("DIV_"+count).innerHTML
		document.getElementById("relatednewsLast").value=parseInt(document.getElementById("relatednewsLast").value)+1;
	}
	else
	{		
		return false;
	}
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		//alert(xmlHttp.responseText )
		document.getElementById("mainstory").innerHTML=xmlHttp.responseText 
		var spkirval=document.getElementById("hdnent_finalval").value.split("-")
		document.getElementById("hdnent_"+spkirval[3]).value=xmlHttp.responseText 
	 } 
}

function storyclick()
{	
}

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)
	if (navigator.userAgent.toLowerCase().indexOf('mozilla')>0||navigator.userAgent.indexOf('Firefox')>0||navigator.userAgent.indexOf('Mozilla')||navigator.userAgent.indexOf('3.0.1')>0)
	{
		while(document.getElementById("EntertainmentMainDiv").innerHTML.indexOf('class="entertainment_bg_class"')>=0)
		{
		document.getElementById("EntertainmentMainDiv").innerHTML=document.getElementById("EntertainmentMainDiv").innerHTML.replace("entertainment_bg_class","entertainment_bg");
		}
	}
	else
	{
		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(str).className="entertainment_bg_class";
	//document.getElementById(str).setAttribute("onlick", "alert()");
	//alert(document.getElementById("EntertainmentMainDiv").innerHTML)
}
function showStory1(str)
{ 
	document.getElementById("hdnent_finalval").value=str;
	var splitval=str.split("-");
	alert(document.getElementById("EntertainmentMainDiv").innerHTML)
	//alert("splitvalssss")
	if(document.getElementById("hdnent_"+splitval[3]).value!="")
	{
		//ssalert("heres")		
		document.getElementById("mainstory").innerHTML=document.getElementById("hdnent_"+splitval[3]).value
		if (navigator.userAgent.toLowerCase().indexOf('mozilla')>0||navigator.userAgent.indexOf('Firefox')>0||navigator.userAgent.indexOf('Mozilla')||navigator.userAgent.indexOf('3.0.1')>0)
		{
		while(document.getElementById("EntertainmentMainDiv").innerHTML.indexOf('class="entertainment_bg_class"')>=0)
		{
		document.getElementById("EntertainmentMainDiv").innerHTML=document.getElementById("EntertainmentMainDiv").innerHTML.replace("entertainment_bg_class","entertainment_bg");
		}
		}
		else
		{
		while(document.getElementById("EntertainmentMainDiv").innerHTML.indexOf('class=entertainment_bg_class')>0)
		{
		document.getElementById("EntertainmentMainDiv").innerHTML=document.getElementById("EntertainmentMainDiv").innerHTML.replace('entertainment_bg_class','entertainment_bg');
		//document.getElementById("EntertainmentMainDiv").innerHTML=document.getElementById("EntertainmentMainDiv").innerHTML.replace('&amp;','&');
		}
		}	
	}
	else
	{
		//alert('yes')
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="/home/entertainmentdb_detail.php"
		url=url+"?q="+str
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=stateChanged 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
		if (navigator.userAgent.toLowerCase().indexOf('mozilla')>0||navigator.userAgent.indexOf('Firefox')>0||navigator.userAgent.indexOf('Mozilla')||navigator.userAgent.indexOf('3.0.1')>0)
		{
			while(document.getElementById("EntertainmentMainDiv").innerHTML.indexOf('class="entertainment_bg_class"')>=0)
			{
			document.getElementById("EntertainmentMainDiv").innerHTML=document.getElementById("EntertainmentMainDiv").innerHTML.replace("entertainment_bg_class","entertainment_bg");
			}
		}
		else
		{
		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(str).className="entertainment_bg_class";
}

function abc()
{
//alert('here')
}

function showSportStory(str)
{ 
	
document.getElementById("hdnspo_finalval").value=str;
	var splitval=str.split("-");
	if(document.getElementById("hdnspo_"+splitval[3]).value!="")
	{
		document.getElementById("maincricstory").innerHTML=document.getElementById("hdnspo_"+splitval[3]).value
			if (navigator.userAgent.toLowerCase().indexOf('mozilla')>0||navigator.userAgent.indexOf('Firefox')>0||navigator.userAgent.indexOf('Mozilla')||navigator.userAgent.indexOf('3.0.1')>0)
{
	while(document.getElementById("SportMainDiv").innerHTML.indexOf('class="entertainment_bg_class"')>=0)
	{
	document.getElementById("SportMainDiv").innerHTML=document.getElementById("SportMainDiv").innerHTML.replace("entertainment_bg_class","entertainment_bg");
	
	}
}
else
{
while(document.getElementById("SportMainDiv").innerHTML.indexOf('class=entertainment_bg_class')>0)
{
document.getElementById("SportMainDiv").innerHTML=document.getElementById("SportMainDiv").innerHTML.replace('class=entertainment_bg_class','class=entertainment_bg');
}
}
	}
	else
	{
//		alert("ankur")
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		 {
		 alert ("Browser does not support HTTP Request")
		 return
		 }
		var url="/home/sportdb_detail.php"
		url=url+"?q="+str
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=stateCricChanged 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	if (navigator.userAgent.toLowerCase().indexOf('mozilla')>0||navigator.userAgent.indexOf('Firefox')>0||navigator.userAgent.indexOf('Mozilla')||navigator.userAgent.indexOf('3.0.1')>0)
	{
		while(document.getElementById("SportMainDiv").innerHTML.indexOf('class="entertainment_bg_class"')>=0)
		{
		document.getElementById("SportMainDiv").innerHTML=document.getElementById("SportMainDiv").innerHTML.replace("entertainment_bg_class","entertainment_bg");	
		}
	}
	else
	{
	while(document.getElementById("SportMainDiv").innerHTML.indexOf('class=entertainment_bg_class')>0)
		{
		document.getElementById("SportMainDiv").innerHTML=document.getElementById("SportMainDiv").innerHTML.replace('class=entertainment_bg_class','class=entertainment_bg');
		}
	}			
		
	}
	document.getElementById(str).className="entertainment_bg_class";
}

function stateCricChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
			
		document.getElementById("maincricstory").innerHTML=xmlHttp.responseText 
	var spkirval=document.getElementById("hdnspo_finalval").value.split("-")
	document.getElementById("hdnspo_"+spkirval[3]).value=xmlHttp.responseText 
	 } 
}

function showLocation(str)
{ 
	//alert('hoe')
	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="/home/Locationdb_detail.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateLocationChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showUserLocation(str)
{ 
	if(str == "SELECT")
		{
			return false;
		}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		{
		alert ("Browser does not support HTTP Request")
		return
		}
	var url="/home/usercitylocation.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateUserLocationChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showWeather(str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/home/weather_chankdb_detail.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=showWeatherXML 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	document.getElementById("weather_cityid").innerHTML="<a class=\"moreData1\" href='/weather/"+str+".html'>अधिक पढ़ें</a>"
}

function shownews(str)
{	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="/home/Specialdb_detail.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateNewsChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	while(document.getElementById("changeSpecialCss").innerHTML.indexOf('special_tab1')>0)
		{		
			document.getElementById("changeSpecialCss").innerHTML=document.getElementById("changeSpecialCss").innerHTML.replace('special_tab1','special_tab2');
		}	
	document.getElementById(str).className="special_tab1";
}

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="/home/Locationdb_story.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedLocation 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedLocation() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
		if(document.getElementById("blankid"))
		 {
					document.getElementById("blankid").innerHTML='';
		 }
		 document.getElementById("mainlocationstory").innerHTML=xmlHttp.responseText 
	
	 
	 } 
}
function getSectionStory(str,b)
{	
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
	var url="/home/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 stateNewsChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("SpecialMainDiv").innerHTML=xmlHttp.responseText 
	 } 
}

function stateChangedSection()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("newtipsdb").innerHTML=xmlHttp.responseText 
	 } 
}

function insertPollChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("PollMsgDiv").innerHTML=xmlHttp.responseText 
		//alert( document.getElementById("PollMsgDiv").innerHTML);
		window.location.href="poll.php?value="+document.getElementById("PollMsgDiv").innerHTML;
	 } 
}

function downbreakingnewsChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("changeBreakNews").innerHTML=xmlHttp.responseText 
	 } 
}

function upbreakingnewsChanged()
{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("changeBreakNews").innerHTML=xmlHttp.responseText 
	 } 
}

function showWeatherXML() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	 document.getElementById("newweather").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 stateUserLocationChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("userlocationmainstory").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 showmostnews(str)
{ 
	document.getElementById("rattingDiv").innerHTML=document.getElementById(str+"_1").innerHTML;
	//mostemailnews
	if(str =='hitnews')
	{
		document.getElementById('hitnewstd').className="bgmost_home";
		document.getElementById('ratetd').className="bgmost1_home";
        document.getElementById('mostemailnewstd').className="bgmost1_home";
	}
	if(str =='rate')
	{
		document.getElementById('hitnewstd').className="bgmost1_home";
		document.getElementById('ratetd').className="bgmost_home";
        document.getElementById('mostemailnewstd').className="bgmost1_home";	
	}
	if(str =='mostemailnews')
	{
		document.getElementById('hitnewstd').className="bgmost1_home";
		document.getElementById('ratetd').className="bgmost1_home";
		document.getElementById('mostemailnewstd').className="bgmost_home";
	}
}

function fromgallerypage(str1,str,str2)
{
	var str3 =5;
//	window.location.href="photogallery.php?categoryvalue="+str+"&q="+str1+"&maincategory="+str2+"&menuvalue="+str3;
	window.location.href="/photo_gallery/photogallery.php?categoryvalue="+str1+"&q="+str+"&imgid="+str2+"&menuvalue="+str3;
}

function hideout(key,varname,len)
{
	for(var i=1; i <= len; i++)
	{
	document.getElementById(varname+i).style.display = 'none';
	}
	document.getElementById(varname+key).style.display = 'block';	
}

function setCSS(key,varname,len,old_css,new_css)
{
	for(var i=1; i <= len; i++)
		{
		obj = document.getElementById(varname+i).className= old_css;
		}
	obj = document.getElementById(varname+key).className = new_css;
}