
	/**
	   *widget_response function contain the dual response of query processing.
	   *@param query is a simple sql statement that send any widget for processing.
	   *@return dual response first for query execution and other for displaying resultset of query.
	*/
	
	var widgetID;
	var which;
	var funcName;
	var iterator=1;
	//var httpRequest;
	/*
	function widget_response_get(func,type,dt)
	{
		funcName = func;
		which = type
		datetime = dt;
	}
	var createFunction = 'function '+funcName+'(){
		var qry = "SELECT projID,projTitle FROM uc_project WHERE projLead";
						new Ajax.Request("wt_ajax_response.php", { 
						 onSuccess : function(resp) { 
						  ////////////////
						 //setTimeout("alert1()",5000);
									var url = "http://www.converge.cc/widgets/wt-my-project.php";
									new Ajax.Request("curl_call.php", { 
									 onSuccess : function(resp1) { 
										document.getElementById("MyProjects_'+datetime+'").innerHTML=resp1.responseText;
									 }, 
									 onFailure : function(resp1) { 
									   alert("Oops, Second Ajax Response Alert."); 
									 }, 
									 parameters : "curlparam="+resp.responseText+"&url="+url 
									});
						  
						 }, 
						 onFailure : function(resp) { 
						   alert("Oops, First Ajax Response Alert"); 
						 }, 
						 parameters : "query="+qry+"&which="+which  
						});
	  
					   }
					   
		'; 
	document.write(createFunction);
	
	function getCurrentTimeDate(type)
	{
		var dt;
		dt = new Date();
		dt = dt.getYear()+''+dt.getMonth()+''+dt.getDay()+''+dt.getHours()+''+dt.getMinutes()+''+dt.getSeconds();
		type = type + dt ;
		return type;
	}*/
	
	
	
	
	
	
	
	
	
	
	function testwidget(type,dtID)
	{
		var url = null;
		which = type;
		widgetID = dtID;
		if(which == "MyProjects")
		{
			var qry3 = "SELECT projID,projTitle FROM uc_project WHERE projLead";
			url = "query="+qry3+"&which="+which;
		}
		else if(which == "MyProjectStatus")
		{
			var  qry2 ="";
			url = "query="+qry2+"&which="+which;
		}else if(which == "MyMeeting")
		{
			var qry1 ="SELECT m.meetID,m.meetingDate,m.meetingTime,m.meetingTitle FROM uc_user_meetings u,uc_meetings m WHERE m.meetID@u.meetID AND u.usrID@{usrID} AND m.meetingDate >@ '{today}' ORDER BY meetingDate ASC";
			
			url = "query="+qry1+"&which="+which;
		}
		url = url +"&sid="+Math.random();
		httpRequest = createXMLHttpRequest();
		iterator = iterator + 1;
		
		sendRequest("POST","wt_ajax_response.php",testwidgetDisplay,url); 
	}
	function testwidget3()
	{
		// do nothing
	}
	function testwidgetDisplay()
	{
		 if(httpRequest.readyState == 4)
		 {
			var VAL = httpRequest.responseText;
			var only = null;
			
			
			/*while(true)
			{	
				if(only == null)
				{
					only= "NMooddd";*/
					
					testwidget2(which,widgetID,VAL);	
					/*
					
				}
				if(document.getElementById(widgetID).innerHTML != "")
				{
					break;
				}
			}**/
 		 }
	}
	function testwidget2(type,dt,VALUE)
	{
		which = type;
		widgetID = dt;
		if(which == "MyProjects")
		{
			url = "http://www.converge.cc/widgets/wt-my-project.php";
		}
		else if(which == "MyProjectStatus")
		{
			url="http://www.converge.cc/widgets/wt-project-tasks-summary.php";
		}else if(which == "MyMeeting")
		{
			url="http://www.converge.cc/widgets/wt-my-meeting.php";
		}
		
		url = "curlparam="+VALUE+"&url="+url+"&sid="+Math.random();
		//url = "curlparam='"+httpRequest.responseText+"'&url="+url;
		httpRequest = createXMLHttpRequest();
		sendRequest("POST","curl_call_class.php",testwidgetDisplay2,url); 
	}
	function testwidgetDisplay2()
	{
		if(httpRequest.readyState == 4)
		{
			if(http_request.status == 200)
			{
				document.getElementById(widgetID).innerHTML = httpRequest.responseText;
			}
  		}
	}
	function widget_response_myproject_get(type,dt)
	{
		which = type
		datetime = dt;
		var qry = "SELECT projID,projTitle FROM uc_project WHERE projLead";
		new Ajax.Request("wt_ajax_response.php", { 
		 onSuccess : function(resp) { 
		  ////////////////
		
					var url = "http://www.converge.cc/widgets/wt-my-project.php";
					
					
				/*	new Ajax.Updater('MyProjects_'+datetime+'', 'curl_call.php?curlparam='+resp.responseText+'&url='+url, {
		method: 'post'
		});*/
					
					
					new Ajax.Request("curl_call.php", { 
					 
					 onSuccess : function(resp1) { 
						
						document.getElementById('MyProjects_'+datetime).innerHTML=resp1.responseText;
					 }, 
					 onFailure : function(resp1) { 
					   alert("Oops, there's been an error324."); 
					 }, 
					 parameters : "curlparam="+resp.responseText+"&url="+url 
					});
		  
		 }, 
		 onFailure : function(resp) { 
		   alert("Oops, there's been an error."); 
		 }, 
		 parameters : "query="+qry+"&which="+which  
		});
	}
	function alert1()
	{
		// do nothing
	}
	function widget_response_myproject_get2(type,dt)
	{
		which = type
		datetime = dt;
		var qry = "SELECT projID,projTitle FROM uc_project WHERE projLead";
		new Ajax.Request("wt_ajax_response.php", { 
		 onSuccess : function(resp) { 
		  ////////////////
		 setTimeout("alert1()",5000);
					var url = "http://www.converge.cc/widgets/wt-my-project.php";
					
					
					/*new Ajax.Updater('MyProjects_'+datetime, 'curl_call.php?curlparam='+resp.responseText+'&url='+url, {
		method: 'get'
		});*/
					
					
					new Ajax.Request("curl_call.php", { 
					 onSuccess : function(resp) { 
						document.getElementById('MyProjects_'+datetime).innerHTML=resp.responseText;
					 }, 
					 onFailure : function(resp) { 
					   alert("Oops, there's been an error324."); 
					 }, 
					 parameters : "curlparam="+resp.responseText+"&url="+url 
					});
		  
		  // resp.responseText  = resp.responseText.replace(/&amp;/g,"_");
		 
		  // top.frames[0].document.getElementById('new').innerHTML=resp.responseText; 
		 }, 
		 onFailure : function(resp) { 
		   alert("Oops, there's been an error."); 
		 }, 
		 parameters : "query="+qry+"&which="+which  
		});
	}
	
	function widget_response_myprojectstatus_get(type1,dt1)
	{
		qry = "";
		which = type1;
		datetime = dt1;
		new Ajax.Request("wt_ajax_response.php", { 
		 onSuccess : function(resp) { 
		  ////////////////
		 	var url = "http://www.converge.cc/widgets/wt-project-tasks-summary.php";
			new Ajax.Request("curl_call.php", { 
			 onSuccess : function(resp1) { 
				document.getElementById('MyProjectStatus_'+datetime).innerHTML=resp1.responseText;
			 }, 
			 onFailure : function(resp) { 
			   alert("Oops, there's been an error324."); 
			 }, 
			 parameters : "curlparam="+resp1.responseText+"&url="+url 
			});
		 }, 
		 onFailure : function(resp1) { 
		   alert("Oops, there's been an error."); 
		 }, 
		 parameters : "query="+qry+"&which="+which 
		});
	}
	function widget_response_mymeeting_get(type2,dt2)
	{
		qry = "SELECT m.meetID,m.meetingDate,m.meetingTime,m.meetingTitle FROM uc_user_meetings u,uc_meetings m WHERE m.meetID@u.meetID AND u.usrID@{usrID} and m.meetingDate >@ '{today}' ORDER BY meetingDate ASC";
		which = type2;
		datetime = dt2;
		new Ajax.Request("wt_ajax_response.php", { 
		 onSuccess : function(resp2) { 
		  ////////////////
		 	var url = "http://www.converge.cc/widgets/wt-my-meeting.php";
			new Ajax.Request("curl_call.php", { 
			 onSuccess : function(resp2) { 
				document.getElementById('MyMeeting_'+datetime).innerHTML=resp2.responseText;
			 }, 
			 onFailure : function(resp2) { 
			   alert("Oops, there's been an error324."); 
			 }, 
			 parameters : "curlparam="+resp2.responseText+"&url="+url 
			});
		 }, 
		 onFailure : function(resp2) { 
		   alert("Oops, there's been an error."); 
		 }, 
		 parameters : "query="+qry+"&which="+which 
		});
	}

