
// create object for Ajax (but using for synchronous this time);
function createHttpRequest(){
	if(window.ActiveXObject){
	    try {
	        return new ActiveXObject("Msxml2.XMLHTTP") 
	    } catch (e) {
	        try {
	            return new ActiveXObject("Microsoft.XMLHTTP") 
	        } catch (e2) {
	            return null;
	        }
	     }
	} else if(window.XMLHttpRequest){
	    return new XMLHttpRequest(); 
	} else {
	    return null;
	}
}

function requestFile( method , fileName , async )
{
    var httpoj = createHttpRequest();
    httpoj.open( method , fileName , async ); 

    httpoj.send(null);
//    if(async) {
//        httpobj.onreadystatechange = function () {};
    //alert(httpoj.getAllResponseHeaders()); 
    //alert(httpoj.getResponseHeader("Date"));
    return httpoj.responseText;
}

function random(max_value) {
	return Math.floor(Math.random() * max_value)
}

function normalize_charactor(input)
{
	var pattern = "012346789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	input %= pattern.length
	return pattern.charAt(input)
}

function random_string(max_length) {
	var length, string, i;
	length = max_length + 1;

	string = "";
        for (i = 0; i < length; i++)
        	string = string + normalize_charactor(random(32767))

	return string;
}

function getElement (n) {
    var doc = window.document;
    if (doc.getElementById)
        return doc.getElementById(n);
    else if (doc.all)
        return doc.all[n];
}

function getStyle (obj) {
    if(window.document.all) {
        return obj.currentStyle;
    } else {
        return document.defaultView.getComputedStyle(obj, '');
    }
}

