// JavaScript Document

	function php_check(name, value, reference, action){
		var php_success = function(o){
			if(o.responseXML !== undefined){
				var objXML = o.responseXML.documentElement;
				var result = objXML.getElementsByTagName("result")[0].firstChild.nodeValue.trim();
				php_return(action, result);		
			}
			else{
				php_return(action, "failed");	
			}
		};

		var php_failure = function(o){
			php_return(action, "failed");
		};

		var php_cb = {
			success:php_success,
			failure:php_failure
		};
		
		var post_string = encodeURIComponent(name) + "=" + encodeURIComponent(value);
		if(post_string == "="){
			post_string = "";	
		}
		if(arguments[4]){
			post_string += arguments[4];	
		}

		YAHOO.util.Connect.asyncRequest("POST",reference,php_cb,post_string);
	}
	
	function php_get(name, value, reference, action){
		var php_success = function(o){
			if(o.responseXML !== undefined){
				var objXML = o.responseXML.documentElement;
				php_return(action, objXML);			
			}
			else{
				php_return(action, false);	
			}
		};

		var php_failure = function(o){
			php_return(action, false);
		};

		var php_cb = {
			success:php_success,
			failure:php_failure
		};
		
		var post_string = encodeURIComponent(name) + "=" + encodeURIComponent(value);
		if(post_string == "="){
			post_string = "";	
		}
		if(arguments[4]){
			post_string += arguments[4];	
		}
		YAHOO.util.Connect.asyncRequest("POST",reference,php_cb,post_string);
	}
	
	function php_getHTML(name, value, reference, action){
		var php_success = function(o){
			if(o.responseText !== undefined){
				var html = o.responseText;
				var objHTML = document.createElement("DIV");
				objHTML.innerHTML = html;
				php_return(action, objHTML);			
			}
			else{
				php_return(action, false);	
			}
		};

		var php_failure = function(o){
			php_return(action, false);
		};

		var php_cb = {
			success:php_success,
			failure:php_failure
		};
		
		var post_string = encodeURIComponent(name) + "=" + encodeURIComponent(value);
		YAHOO.util.Connect.asyncRequest("POST",reference,php_cb,post_string);
	}	
	
	
	function global_php_getHTML(name, value, reference, action){
		var php_success = function(o){
			if(o.responseText !== undefined){
				var html = o.responseText;
				var objHTML = document.createElement("DIV");
				objHTML.innerHTML = html;
				global_php_return(action, objHTML);			
			}
			else{
				global_php_return(action, false);	
			}
		};

		var php_failure = function(o){
			global_php_return(action, false);
		};

		var php_cb = {
			success:php_success,
			failure:php_failure
		};
		
		var post_string = encodeURIComponent(name) + "=" + encodeURIComponent(value);
		YAHOO.util.Connect.asyncRequest("POST",reference,php_cb,post_string);
	}			
