﻿/***************************AJAX CODE *****************************/

var xmlHttp
var count="";
function showLocation(str)
{ 

	document.getElementById('parent_id').value=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="/include/Locationdb_detail.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateLocationChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


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)
	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=document.getElementById('parent_id').value;
	}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/include/Locationdb_story.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedLocation 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function stateNewsChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("SpecialMainDiv").innerHTML=xmlHttp.responseText 
 } 
}



function stateCricChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("maincricstory").innerHTML=xmlHttp.responseText 
 } 
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
//	alert(xmlHttp.responseText)
 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 stateUserLocationChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("userlocationmainstory").innerHTML=xmlHttp.responseText 
 } 

}

function stateChangedLocation() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{		 
		if(document.getElementById("blankid"))
	 {
				document.getElementById("blankid").innerHTML='';
	 }
	 document.getElementById("mainlocationstory").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 fromgallerypage(str1,str,str2)
{

var str3 =5;

	window.location.href="/photo_gallery/photogallery.php?menuvalue=5&categoryvalue="+str1+"&q="+str;
}

function cricbuzzgallerypage(str1,str,str2)
{
var str3 =5;
	window.open("/photo_gallery/photogallery.php?menuvalue=5&categoryvalue="+str1+"&q="+str)
}

function fromvideogallery(str1,str)
{
window.location.href="../video_gallery/photogallery.php?menuvalue=6&categoryvalue="+str1+"&q="+str;
}


function showmostnews(str,mnuid,day_css)
{ 
	document.getElementById("rattingDiv").innerHTML=document.getElementById(str+"_1").innerHTML;
	if(mnuid == 50)
	{
		if(str =='hitnews')
		{
			document.getElementById('hitnewstd').className="bgmost"+day_css;
			document.getElementById('ratetd').className="bgmost1"+day_css;
			document.getElementById('mostemailnewstd').className="bgmost1"+day_css;		
		}
		if(str =='rate')
		{
			document.getElementById('hitnewstd').className="bgmost1"+day_css;
			document.getElementById('ratetd').className="bgmost"+day_css;
			document.getElementById('mostemailnewstd').className="bgmost1"+day_css;		
		}
		if(str =='mostemailnews')
		{
			document.getElementById('hitnewstd').className="bgmost1"+day_css;
			document.getElementById('ratetd').className="bgmost1"+day_css;
			document.getElementById('mostemailnewstd').className="bgmost"+day_css;
		}

	}
	else
	{
		if(str =='hitnews')
		{
			document.getElementById('hitnewstd').className="bgmost";
			document.getElementById('ratetd').className="bgmost1";
			document.getElementById('mostemailnewstd').className="bgmost1";		
		}
		if(str =='rate')
		{
			document.getElementById('hitnewstd').className="bgmost1";
			document.getElementById('ratetd').className="bgmost";
			document.getElementById('mostemailnewstd').className="bgmost1";		
		}
		if(str =='mostemailnews')
		{
			document.getElementById('hitnewstd').className="bgmost1";
			document.getElementById('ratetd').className="bgmost1";
			document.getElementById('mostemailnewstd').className="bgmost";
		}
	}
}

function showWeather(str)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/include/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=\"moreData\" href='/weather/"+str+".html'>अधिक पढें</a>"
}


function showWeatherXML() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		 document.getElementById("newweather").innerHTML=xmlHttp.responseText 
		} 
}


function getHorescopeStory(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/include/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_rightbar','horoscope_class_rightbar');
		}
	
		document.getElementById(str).className="horoscope_changeclass_rightbar";
}

function getHorescopeStoryChange()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	 document.getElementById("horocoevalue").innerHTML=xmlHttp.responseText 
 } 
}

var xmlHttp
var count = "0" ;
function showhorocopedb(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="/include/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 changeRightvalue(str)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url;
	if(str=="todayweather")
	{
	url="/include/weatherright.php"
	}
	else
	{
		url="/include/horescope.php"
	}

url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=changeRightvaluestate
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
	if(str=="todayweather")
	{
	document.getElementById("todayweather").className="weather_bgimage_2";
	document.getElementById("todayastrology").className="weather_bgimage_1";
	
	}
	else
	{
		document.getElementById("todayweather").className="weather_bgimage_1";
		document.getElementById("todayastrology").className="weather_bgimage_2";
	}

}

function changeRightvaluestate() 
{
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
		 { 
			document.getElementById("rightnavigation").innerHTML = xmlHttp.responseText 
		
		 } 
}

function gotourl()
{  
	var sb;      
	var x;
	sb = document.getElementById('transl1'); 
	var Uxrbsite = document.getElementById('siteOption');
	if(Uxrbsite.checked == true)
	{
	  x="/home/keyword.php?kw="+sb.value;                               
	  window.location=x;
	}
	else
	{
	  x = "/home/GoogleSearch.php?q="+sb.value+"&engine="+"Google"; 
	  window.location=x;
	}
  }

function focustext()
{
document.getElementById('newsearchbox_new').focus();
}
function setFocus(e) 
{
	if(e.keyCode == 13 )  
	{
	document.getElementById('imgtext').focus();
	gotourl();
	}
	return false;

}

function setHomepage()
{
if (document.all)
    {
       document.body.style.behavior='url(#default#homepage)';
       document.body.setHomePage('http://www.livehindustan.com');
    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
   {  
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
         }  
         catch(e)  
         {  
    alert("To make this page as your homepage in FireFox, Drag HT icon from address bar to Home icon in your browser");  
         }
    } 
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage','http://www.livehindustan.com');
 }
}

function entervalidkey(field, event)
	{
	if(event.keyCode!=13)
	{
	document.getElementById('transl1').focus();
		return ;
	}
		else
		{
			gotourl();
		return false;
		}
	}


function entervalid(field, event)
	{
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13 ) {
	gotourl();
	return false;
	}
	else
	return true;
	}

function htkeybord(str)
{
	var writesearch = document.getElementById('transl1').value;
	document.getElementById('htsearch').innerHTML ="<input  class='search_box'  id='transl1'  charset='utf-8'  onKeyPress='javascript:convertThis(event);return entervalid(this,event);'  onKeyDown='toggleKBMode(event);return entervalidkey(this,event);''>"+writesearch;
	document.getElementById('transl1').focus();
	document.getElementById('transl1').focus();
}

function htkeybordcomment(str)
{
	var writesearch = document.getElementById('txtwrite').value;
	document.getElementById('htsearch').innerHTML ="<textarea name='txtwrite' id='txtwrite' style='width: 380px; height: 138px;'  charset='utf-8'  onKeyPress='javascript:convertThis(event);return entervalid(this,event);'  onKeyDown='toggleKBMode(event);return entervalidkey(this,event);''>"+writesearch+"</textarea>";
	document.getElementById('txtwrite').focus();
	document.getElementById('txtwrite').focus();
}

function advancesearchKey(str)
{	
	var writesearch = document.getElementById('transl2').value;
	document.getElementById('addtextboxvalue').innerHTML ="<input name='transl2' id='transl2' charset='utf-8'   '>"+writesearch;
	document.getElementById('transl2').focus();
	document.getElementById('transl2').focus();
}


function setSingin()
{
	x = "/editorial/userprofile.php";
	 window.location=x;
}