/******************************************************************

	ashjax.js
	---------
	
	Author:			Ashley Meadows
	Created:		10/03/2009
	Copyright:	(c) Ashley Meadows 2009.
	Version:		0.10.20 (beta)
	
	Description
	-----------
	
	ASHJAX is a small ajax request callback class, allows the user
	to create and transmit multiple ajax requests at any one time,
	with a built in debugging filter. Useful functions are included
	please refer to the usres guide for these and how to tuse them.
	
 ******************************************************************/
var $_browser=new browserInfo();function $_url(a){return a.join("&");};function $_form(name){if(eval("document." + name)){return new Object(eval("document." + name));};};function in_array(needle, haystack){if($_browser.isIE){for(var i=0; i<haystack.length; i++){if(needle==haystack[i]){return true;};};}else{if(haystack.indexOf(needle)!=-1){return true;};};return false;};function browserInfo(){var ua, s, i;this.isIE=false;this.isNS=false;this.version=null;ua=navigator.userAgent;s="MSIE";if((i=ua.indexOf(s))>=0){this.isIE=true;this.version=parseFloat(ua.substr(i+s.length));return;};s="Netscape6/";if((i=ua.indexOf(s))>=0){this.isNS=true;this.version=parseFloat(ua.substr(i+s.length));return;};s="Gecko";if((i=ua.indexOf(s))>=0){this.isNS=true;this.version=6.1;return;};};function $(i){if((document.getElementById(i)!=null) && (i!=null)){return document.getElementById(i);};};function $_element(t, id){var say=null;switch(t.toLowerCase()){case "id":if(document.getElementById(id)!=null){say=new Object(document.getElementById(id));};break;case "name":if(id.match(/:+/)){var tag_data=id.split(":");if(document.getElementsByTagName(tag_data[0])[tag_data[1]]!=null){say=new Object(document.getElementsByName(tag_data[0])[tag_data[1]]);};}else{say=new Object(document.getElementsByName(id));};break;case "tag":if(id.match(/:+/)){var tag_data=id.split(":");if(document.getElementsByTagName(tag_data[0])[tag_data[1]]!=null){say=new Object(document.getElementsByTagName(tag_data[0])[tag_data[1]]);};}else{say=new Object(document.getElementsByTagName(id));};break;};return say;};function ashjax(o){this.config={errorMsg:["Error: Invalid method attempted, valid methods are GET or POST."],datatype:["content-type", "application/x-www-form-urlencoded"],goMethod:["get", "post"]};this.URI=function(s,a,m){if((a!=null) && (a.length>0)){return ((!m)?s+"?"+(new Date()).getTime()+"&"+a.join("&"):encodeURI((new Date()).getTime()+"&"+a.join("&")));}else{return ((!m)?s+"?"+(new Date()).getTime():encodeURI((new Date()).getTime()));};};this.httpXML=function(){if(window.XMLHttpRequest){return (new XMLHttpRequest());}else if(window.ActiveXObject){try{return (new ActiveXObject("Msxml2.XMLHTTP"));}catch(e){try{return (new ActiveXObject("Microsoft.XMLHTTP"));}catch(e){return null;};};};};if((o.method!=null) && (o.method.toLowerCase()==this.config.goMethod[0])){var x=this.httpXML(), m="";x.open(this.config.goMethod[0], this.URI(o.script, o.get_vars, false));x.onreadystatechange=function(){if((o.debug==true) && (x.readyState==4)){if(o.script!=null){m+="script:\n"+o.script+"\n\n";};if(o.method!=null){m+="method:\n"+o.method+"\n\n";};if(o.get_vars!=null){m+="GET vars:\n"+o.get_vars.join("&")+"\n\n";};if(o.post_vars!=null){m+="POST vars:\n"+o.post_vars.join("&")+"\n\n";};m+="state:\n"+x.readyState+"\n\n";m+="status:\n"+x.status+"\n\n";m+="response:\n"+x.responseText;alert("-- Debug --\n\n"+m);}else{if((x.readyState==4) && (x.status==200) && (o.callback!=null)){eval(o.callback(x.responseText));};};};x.send(null);}else if((o.method!=null) && (o.method.toLowerCase()==this.config.goMethod[1])){var x=this.httpXML(), m="";x.open(this.config.goMethod[1], this.URI(o.script, o.get_vars, false));x.setRequestHeader(this.config.datatype[0], this.config.datatype[1]);x.onreadystatechange=function(){if((o.debug==true) && (x.readyState==4)){if(o.script!=null){m+="script:\n"+o.script+"\n\n";};if(o.method!=null){m+="method:\n"+o.method+"\n\n";};if(o.get_vars!=null){m+="GET vars:\n"+o.get_vars.join("&")+"\n\n";};if(o.post_vars!=null){m+="POST vars:\n"+o.post_vars.join("&")+"\n\n";};m+="state:\n"+x.readyState+"\n\n";m+="status:\n"+x.status+"\n\n";m+="response:\n"+x.responseText;alert("-- Debug --\n\n"+m);}else{if((x.readyState==4) && (x.status==200) && (o.callback!=null)){eval(o.callback(x.responseText));};};};x.send(this.URI(null, o.post_vars, true));}else{if(o.debug==true){alert(this.config.errorMsg[0]);};};};