var xmlHttp
var str
var url
// turns on and off the visiblity of a div
function toggle_visibility(id) {
//alert(id);
		 var e = document.getElementById(id);

			   if(e.style.display == 'block')
				  e.style.display = 'none';
			   else
				  e.style.display = 'block';
    }
	// turns on and off the visiblity of a div
function toggle_display(id) {
//alert(id);
		 var e = document.getElementById(id);

			   if(e.style.display == 'block')
				  e.style.display = 'none';
			   else
				  e.style.display = 'block';
    }
	
function showDiv(divname) {
    if(document.getElementById(divname).style.display == "block") {
	document.getElementById(divname).style.display = "none";
    } else {
	document.getElementById(divname).style.display = "block";
    }
}
	

function confirmDelete() {
	var r = confirm('Would you really like to delete this character? \n NOTICE: This will delete you character from all active battles.');
	if(r == true) {
		return alert('the character has been deleted.');
	} else {
		return false;
	}
}

/////////////////////////////////////////////////////////////
function showForm(){
	var theForm = document.useredit
	var 	alertText = "?"
   	for(i=0; i<theForm.elements.length; i++){   
		   alertText += "" + theForm.elements[i].name + "=" + theForm.elements[i].value + "&"
		}
	return alertText;
	}
 /////////////////////////////////////////////////////////////

    function makeRequest(url,useID) {
		
        var http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
               
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
		
        http_request.onreadystatechange = function() { alertContents(http_request,useID); };
        http_request.open('GET', url, true);
        http_request.send(null);
    }




///////////////////////////////////////////////////
function alertContents(http_request,useID) {
  
        if (http_request.readyState == 4) {
            if (http_request.status == 200) { 	
	         var text = http_request.responseText ;
			 try {
	         document.getElementById(useID).innerHTML=text;
			 }catch(e) {
				 //alert("use ID = "+useID+"\nerror = "+e);
			 }
            } else {
                alert('There was a problem with the request.');
            }
        }
    }
///////////////////////////////////////////////////
	



//////////////////////////////////////////////////////////

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


