var ns = (document.layers) ? 1:0

var ns6 = (window.innerHeight && !document.layers) ? 1:0
var ie = (document.getElementById && !window.innerHeight) ? 1:0;
var mz = (document.getElementById && window.innerHeight) ? 1:0;
var op = (mz && !document.getElementsByTagNameNS) ? 1:0;


var mac = (navigator.platform.indexOf('Mac') > -1) ? 1:0
var ispc = (!mac) ? 1:0


// flag ajax support
var ajax = ((ie && !mac) || mz || op) ? 1:0;

// begin generic ajax communication module
function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} 
		catch (e) {
			xmlhttp = false;
		}
	}
  return xmlhttp;
}

var http = getHTTPObject(); // We create the HTTP Object
// end ajax module






// customize for each use
function handleHttpResponse() {
  if (http.readyState == 4) {  // meaning the request is complete
    var response = http.responseText;
   
    if (response.indexOf('invalid') == -1) {
		if (response.indexOf("?xml") != -1) {
			
			if (http.responseXML) {	// did we get a valid xml document?	
				var xmlDocument = http.responseXML; 
			
				if (xmlDocument) {	
				//do nothing
				//formatResults(xmlDocument);			
				}
			}
		}	
		else {
			// Split the comma delimited response into an array
			results = http.responseText.split(",");		
		}
	}
	
	// no matter what the outcome, we stop working
	loading = false;   
  }
}




// customize for each use
function acknowledgeHttpResponse() {
  if (http.readyState == 4) {  // meaning the request is complete
    var response = http.responseText;
	//alert(response);
	// no matter what the outcome, we stop working
	sending = false;   
  }
}




var sendurl = "http://dev.interactiondesigners.com/en/discuss/update.php?";

var sending = false;
function updateServer(post,tags) {

	if (!sending && http) {
		if (ajax) {
		
			now = new Date();
			min = now.getMinutes();
			sec = now.getSeconds();
			cache = ""+min+sec;
		
			http.open("GET", sendurl + "post=" + escape(post) + "&tags=" + escape(tags) + "&cache=" + escape(cache), true);
		
			http.onreadystatechange = acknowledgeHttpResponse;
			sending = true;
			http.send(null);
		}
	}
	
	// keep trying until the channel is open
	else if (http) {
		setTimeout("updateServer('"+uqid+"', '"+action+"')",1000);
	}

}


