// Mobile Geek JavaScript Document

function togglevis( targetId, targetState ){
	if (document.getElementById){
		target = document.getElementById( targetId );
		if (targetState) {
			if (targetState == "on") {
				target.style.display = "block";
			}
			else {
				target.style.display = "none";
			}
		}
		else {
			if (target.style.display == "block"){
				target.style.display = "none";
	  		} else {
				target.style.display = "block";
	  		}
		}
	}
}

function updatepage(str, targetid){
    document.getElementById(targetid).innerHTML = str;
}

function ajax_request(strURL, targetid, varstring, loadstring, doreturn) {
	var xmlHttpReq = false;
    var self = this;
    if (loadstring) { updatepage(loadstring, targetid); }
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            if (doreturn) { ajax_returned(self.xmlHttpReq.responseText); }
        	if (targetid) { updatepage(self.xmlHttpReq.responseText, targetid); }
        }
    }
	self.xmlHttpReq.send(varstring);
}


