// JavaScript Document
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;
}

/*********** Paging *********************/
function ajaxPaging(urls,list){
	//alert(urls); alert(list);
	retDiv=list;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
  	}
	var url=urls;
	url=url+"&sid="+Math.random();
	//url=url+"&tblname="+tableName+"&idfld="+idField+"&statfld="+statusField+"&id="+id;//alert(url);
	xmlHttp.onreadystatechange=retPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function retPage()
{
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById(retDiv).innerHTML=xmlHttp.responseText;
	}
	else
	{ 
	document.getElementById(retDiv).innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" />";
	}
}
/************************************************************************************/
function selstate(stateId)
{
	/*alert(stateId);
	alert("alert(string);");*/
	xmlHttp=GetXmlHttpObject();
	
	if (xmlHttp==null)
  	{
		alert ("Your browser does not support AJAX!");
  		return;
  	} 
	var url="tdyCinema.php";
	url=url+"?stateId="+stateId;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=choose_state;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);	
}
function choose_state()
{ 
	if (xmlHttp.readyState==4)
	{
		document.getElementById("load").innerHTML = "&nbsp;";
		document.getElementById("temp").innerHTML=xmlHttp.responseText;
	}
	else 
	{
		
	}
	
}
/***************************************************************************/
function ajaxReply(cmntId){
	retDiv="rplyDiv"+cmntId;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	}
	document.getElementById('cmntDiv').innerHTML="";
	var url='comments/replyFields.php?cmntId='+cmntId;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=retPage;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function retPage()
{
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById(retDiv).innerHTML=xmlHttp.responseText;
	}
	else
	{ 
	document.getElementById(retDiv).innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" />";
	}
}
/***************************************************************************/
function loadCommentFields(){
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
  	}
	var url='comments/commentFields.php';
	url=url+"?sid="+Math.random();
	xmlHttp.onreadystatechange=cmntField;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function cmntField()
{
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('cmntDiv').innerHTML=xmlHttp.responseText;
	}
	else
	{ 
	document.getElementById('cmntDiv').innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" />";
	}
}
/******************************************************************/
function cartoontype(type){
	//alert(type);
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
  	}
	var url='retCartoon.php?type='+type;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=cField;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function cField()
{
	//alert("hihi");
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('cartoon').innerHTML=xmlHttp.responseText;
	}
	else
	{ 
	document.getElementById('cartoon').innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" />";
	}
}

/************************************ arogyam *********************************************/
function arogyam(Id,k){
	/*alert(Id);
	alert(k);*/
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
  	}
	x="catgry_"+k;
	//alert(x);
	var url='arogyamCatgry.php?Id='+Id;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=cmntField;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function cmntField()
{
	//alert(x);
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('catgry').innerHTML=xmlHttp.responseText;
	}
	else
	{ 
	document.getElementById('catgry').innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" /> ";
	}
}


/*****************************Matham******************************************************/
function matham(Id,k){
	/*alert(Id);
	alert(k);*/
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
  	}
	x="catgry_"+k;
	//alert(x);
	var url='mathamCatgry.php?Id='+Id;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=mathm;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function mathm()
{
	//alert(x);
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('catgry').innerHTML=xmlHttp.responseText;
	}
	else
	{ 
	document.getElementById('catgry').innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" /> ";
	}
}

/*****************************Thozhil******************************************************/
function thozhil(Id,k){
	/*alert(Id);
	alert(k);*/
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
  	}
	x="catgry_"+k;
	//alert(x);
	var url='thozhilCatgry.php?Id='+Id;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=thozh;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function thozh()
{
	//alert(x);
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('catgry').innerHTML=xmlHttp.responseText;
	}
	else
	{ 
	document.getElementById('catgry').innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" /> ";
	}
}


function avakasham(Id,k){	
	/*alert(Id);
	alert(k);*/
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
  	}
	x="catgry_"+k;
	//alert(x);
	var url='avaashamCatgry.php?Id='+Id;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=human_right;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function human_right()
{
	//alert(x);
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('catgry').innerHTML=xmlHttp.responseText;
	}
	else
	{ 
	document.getElementById('catgry').innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" /> ";
	}
}


function votepoll(Id,k,vote,visibility){	
	/*alert(Id);
	alert(k); alert(vote);*/
	document.getElementById('resultpoll').style.display = visibility;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
  	}
	x="catgry_"+k;
	//alert(x);
	var url='votingresult.php?Id='+k+'&c='+vote;
	url=url+"&sid="+Math.random();
	//alert(url);
	xmlHttp.onreadystatechange=poll_re;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function poll_re()
{
	//alert(x);
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById('resultpoll').innerHTML=xmlHttp.responseText;
		}
	else
	{ 
	document.getElementById('resultpoll').innerHTML="<img src=\"images/003.gif\" height=\"20\" width=\"20\" /> ";
	}
}
