
var xmlHttp

function SimpleFetch(action)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url=action;
	//url=url+"?fname="+fname
	//url=url+"&lname="+lname
	var urlAry=url.split("&id=");
	var id = urlAry[1];
	var pg = urlAry[0].split(".");

	//xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 			
			if(id.split(" ").join("")!='')
				document.getElementById(id).innerHTML=xmlHttp.responseText ;
		} 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function SimpleFetch1(action)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url=action;
	//url=url+"?fname="+fname
	//url=url+"&lname="+lname
	var urlAry=url.split("&id=");
	var id = urlAry[1];
	var pg = urlAry[0].split(".");

	//xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 			
			document.getElementById(id).innerHTML=xmlHttp.responseText ;
		} 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}



function UsingGet(action)
{ 
	var xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url=action;
	//url=url+"?fname="+fname
	//url=url+"&lname="+lname
	var urlAry=url.split("&id=");
	var id = urlAry[1];
	var pg = urlAry[0].split(".");

	//xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.onreadystatechange=function(){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
			if(id=='task_list')
			{
				if(pg[0]=='update_task')
				{
					id2 = 'tsk_msg';
					document.getElementById(id2).style.backgroundColor="#90C311";
					document.getElementById(id2).style.color="#FFFFFF";
					document.getElementById(id2).style.fontWeight="bold";					
					document.getElementById(id2).innerHTML='Tasks have been Updated successfully.';	
				}
				document.getElementById(id).innerHTML=xmlHttp.responseText ;					
			}
			else
			{
				if(pg[0]!='project_user_list')
				{
					document.getElementById(id).style.backgroundColor="#90C311";
					document.getElementById(id).style.color="#FFFFFF";
					document.getElementById(id).style.fontWeight="bold";
				}
				document.getElementById(id).innerHTML=xmlHttp.responseText ;
			}
		} 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


 
function UsingPost(action)
{
	var xmlHttp1=GetXmlHttpObject();
	var url = action;
	var params = "fld=1000";
	xmlHttp1.open("POST", url, true);
	
	//Send the proper header information along with the request
	xmlHttp1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp1.setRequestHeader("Content-length", params.length);
	xmlHttp1.setRequestHeader("Connection", "close");
	
	xmlHttp1.onreadystatechange = function() {//Call a function when the state changes.
		if(xmlHttp1.readyState == 4 && xmlHttp1.status == 200) {
			document.getElementById("txtHint").innerHTML=xmlHttp1.responseText 
		}
	}
	xmlHttp1.send(params);	
}



// modified by drashti [for grouping functionality].. date : 06-08-08
function UsingPostGroup(action, params, divid)
{
	var xmlHttp1=GetXmlHttpObject();
	var url = action;
	var params = params;
	xmlHttp1.open("POST", url, true);
	
	//Send the proper header information along with the request
	xmlHttp1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp1.setRequestHeader("Content-length", params.length);
	xmlHttp1.setRequestHeader("Connection", "close");
	
	xmlHttp1.onreadystatechange = function() {//Call a function when the state changes.
		if(xmlHttp1.readyState == 4 && xmlHttp1.status == 200) {
			document.getElementById(divid).innerHTML=xmlHttp1.responseText 
		}
	}
	xmlHttp1.send(params);	
}
// end of modification

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}


function ajaxFunction(url,id)
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
			{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
    xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			document.getElementById(id).innerHTML=xmlHttp.responseText;
		}
	}
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function ajaxFunction_inbox(url,id,id2)
{
	var xmlHttpI;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttpI=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
			{
			xmlHttpI=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttpI=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
    xmlHttpI.onreadystatechange=function()
	{
		if(xmlHttpI.readyState==4)
		{
			document.getElementById(id).innerHTML+=xmlHttpI.responseText;
			document.getElementById(id2).innerHTML='';
			document.getElementById(id2).className='';
		}
	}
    xmlHttpI.open("GET",url,true);
    xmlHttpI.send(null);
}