﻿// script.js
var req;
var gBW = new detectBrowser();

function detectBrowser()
{
	var d = document;
	var nav=navigator;
	this.agt=nav.userAgent.toLowerCase();
	this.major = parseInt(nav.appVersion);
	this.ns=(d.layers);
	this.dom=(d.getElementById)?1:0;
	this.ns4up=(this.ns && this.major >=4);
	this.ns6=(this.agt.indexOf("Netscape6")!=-1);
	this.op=(window.opera? 1:0);
	if(d.all)
		this.ie=1;
	else 
		this.ie=0;
	this.ie4up=(this.ie && this.major >= 4);
	this.ie5=(d.all&&this.dom);
	this.gk=(typeof(nav.product)!="undefine"&&nav.product)?1:0;
	this.fb=(this.agt.indexOf("firebird")!=-1);
	this.fx=(this.agt.indexOf("firefox")!=-1);
	this.sf=(this.agt.indexOf("safari")!=-1);
	this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
	this.mac=(this.agt.indexOf("mac")!=-1);
}

function getReqXMLHTTPObj()
{
	var a = null;
	try{a = new ActiveXObject("Msxml2.XMLHTTP")}
	catch(b)
	{
		try{a = new ActiveXObject("Microsoft.XMLHTTP")}
		catch(c){a=null;}
	}
	if(!a && typeof XMLHttpRequest!="undefined")
	{
		a = new XMLHttpRequest();
	} 
	return a;
}

function AjaxCall(url, onCallback) 
{
	req = getReqXMLHTTPObj();
    req.onreadystatechange = onCallback;
    var rnd = Math.floor(Math.random()*100000)
    url = url + "&rnd=" + rnd;
    req.open("GET", url, true);
    req.send(null);
}

function AjaxCallNoCallBack(url) 
{
	req = getReqXMLHTTPObj();
    req.open("GET", url, false);
    req.send(null);
}

function AjaxPostCall(url, qs, onCallback) 
{
	req = getReqXMLHTTPObj();
    if (onCallback)
        req.onreadystatechange = onCallback;
    var rnd = Math.floor(Math.random()*100000);
    qs = qs + "&rnd=" + rnd + "&method=post";
    req.open("POST", url, true);
	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.setRequestHeader("Accept","text/xml");
    req.send(qs);
}

