function print_r(input, _indent)
{
if(typeof(_indent) == 'string') {
var indent = _indent + ' ';
var paren_indent = _indent + ' ';
} else {
var indent = ' ';
var paren_indent = '';
}

switch(typeof(input)) {
case 'string':
var output = "" + input + "\n";
break;
case 'boolean':
var output = (input ? 'true' : 'false') + "\n";
break;
case 'object':
var output = ((input.reverse) ? 'Array' : 'Object') + "\n";
for(var i in input) {
output += indent + "[" + i + "] => " + print_r(input[i], indent);
}
output += paren_indent + ")\n";
break;
}
return output;
}

// Quick ajax function to change the login box depending on what login they select.
function changeLoginBox(){
	var box = document.getElementById('type');
var value = box.options[box.selectedIndex].value;
ajax_please('loginbox','/ajax/loginbox.php','?type=' + value);

}

function ajaxSupport(ajaxRequest){


        try{
                // Opera 8.0+, Firefox, Safari
                ajaxRequest = new XMLHttpRequest();
        } catch (e){
                // Internet Explorer Browsers
                try{
                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                        try{
                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch (e){
                                // Something went wrong
                                alert("Your browser broke!");
                                return false;
                        }
                }
        }
 return ajaxRequest;
 }



function ajax_please(field,url,query_string){
var ajaxRequest =ajaxSupport();
// The variable that makes Ajax possible!


        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){

                if(ajaxRequest.readyState == 4)
                /* ready.states are!
                0 - Uninitialized
                1 - loading
                2 - loaded
                3 - interactive
                4 - complete
                */
                {

					 var ajaxDisplay = document.getElementById(field);
                        ajaxDisplay.innerHTML = ajaxRequest.responseText;

                }
				else{
				document.getElementById(field).innerHTML = '<p><img src="/images/ajaxloading.gif" border="0"> Loading</p>';
				}
        }
        ajaxRequest.open("GET", url+query_string, true);
        ajaxRequest.send(null);
}