/*  Ajaxination - Simple JavaScript framework, version 1.0

 *  (c) 12 Feb 2006 Sajan John <saj@ajaxination.com>

 *  Ajaxination is an easy to use ajax framework for your Web2.0 Application.

 *  Using Ajaxination you can update multiple Div tags with just one object.

 *  Ajaxination is freely distributable under the terms of GNU license.

 *  Feel free to modify/edit the code according to your requirements .

 *  If you are adding any additional features in this framework please

 *  send me a statusBox to saj@ajaxination.com. Enjoy Ajaxination, - Ajax Simplified

 *  for updates visit : www.ajaxination.com

/*--------------------------------------------------------------------------*/



 function ajaxination(param,tagName,url,mode) { 
   // You can even pass the action mode = post/get  and act is the parameter u wanted to pass with the url. 

   show=1;

   ajax.open('get', url); 

   ajax.onreadystatechange = responseHandler; 

   contentHandler.tagName = tagName;

   contentHandler.url=url;

   setTimeout ("ajax", 500); 

   ajax.send(null); 



} 



var ajax = createXMLHttpRequest(); 

var contentHandler = new TagHandler(null); 

function createXMLHttpRequest(){

   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}

   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}

   try { return new XMLHttpRequest(); } catch(e) {}

   alert("XMLHttpRequest not supported");

   return null;

}



function TagHandler(tagName) 

{ 

   var tagName; 

   return tagName; 

}



function responseHandler() { 






	if(ajax.readyState == 1) 
	{ 
	document.getElementById('statusBox').innerHTML = "<img src='web/images/common/loadingCircle.gif'>";  
	}

	


   if(ajax.readyState == 4)

	{

		if(ajax.status == 200)

		{

			

			document.getElementById('statusBox').innerHTML = "";

			var updateContent = ajax.responseText; 

		    if(updateContent) { 

						

			    document.getElementById(contentHandler.tagName).innerHTML = updateContent; 

							

			} 

		}

		else if(ajax.status == 404)

		{

			// Retrive error message or redirect to error page 

			document.getElementById('statusBox').innerHTML = "File not found";

		}

		else

		{

			document.getElementById('statusBox').innerHTML = "There was a problem with server connection.";

		}

	} 



} 






