/*
############################################################
Programmer Name : Suresh Kumar Dubey
Created On : 12th March 2007
Description : This file is used to show and hide the details of categories.
###########################################################
*/
function callAjax( elemid, url, options )
{
  var params = options.params || "";
  var meth = options.meth || "post";
  var async = options.mode || true;
  var startfunc = options.startfunc || "";
  var endfunc = options.endfunc || "";
  var errorfunc = options.errorfunc || "";

  if( startfunc != "" )
    eval( startfunc );

 var url_with_param = url+( params != "" ? "?"+params : "" );

 

  loadXMLDoc();
//----------------------------------------------------------------
	var xmlhttp
	function loadXMLDoc()
	{
		// code for Mozilla, etc.
		if (window.XMLHttpRequest)
		  {
			  xmlhttp=new XMLHttpRequest()
			  xmlhttp.onreadystatechange=xmlhttpChange
			  xmlhttp.open(meth,url_with_param,async)
			  xmlhttp.send('')
		  }
		// code for IE
		else if (window.ActiveXObject)
		  {
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
			if (xmlhttp)
			{
				xmlhttp.onreadystatechange=xmlhttpChange
				xmlhttp.open(meth,url_with_param,async)
				xmlhttp.send('')
					return false;
			  }else
			  {
					alert( "Your browser cannot perform the requested action. "+
						 "Either your security settings are too high or your "+
						 "browser is outdated. Try the newest version of "+
						 "Internet Explorer or Mozilla Firefox." );
					return false;
			  }
		  }
	}

	function xmlhttpChange()
	{
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4)
	  {
		  if (xmlhttp.status==200)
			{
			 var objXML = xmlhttp.responseXML;
			 var objXML1 = xmlhttp.responseText;
			 if(elemid!='')
				{
					document.getElementById(elemid).innerHTML = objXML1;
				}
			 if( endfunc != "" )
				{
				eval( endfunc );
				}
		  }
		  else
			{
			  alert(xmlhttp.status)
				alert("Problem retrieving XML data")
				if( endfunc != "" )
					eval( endfunc );
			  if( errorfunc != "" )
					eval( errorfunc );
				  return false;
			}
		}
	}
}
//END OF AJAX FUNCTIONS.

//This function is used for show the details of categories
function show_details(id,limitvalue)
{
	close_details('',limitvalue)
	div_name="d2"+id;
	url="show_details.php?id="+id+"&val="+limitvalue;
	callAjax(div_name,url,"");
}

function refresh_captcha()
{
	//alert("dfgd");
	div_name="captcha_div_id";
	url="./show_captcha.php";
	callAjax(div_name,url,"");
}
//This function is used for hide the details of categories
function close_details(id,val)
{
	
	div_name="d1";
	url="close_details.php?id="+id+"&val="+val;
	callAjax(div_name,url,"");
}