function createHttpRequest(){
	var httpRequest;
	var browser = navigator.appName;
	if(browser== "Microsoft Internet Explorer"){
		httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		httpRequest = new XMLHttpRequest();
	};
	return httpRequest;
};
var httpRequest = createHttpRequest();
var httpRequest2 = createHttpRequest();
var resultId='';
var item_value = '';


function getRequest(){
 if(httpRequest.readyState == 4){
  if(document.getElementById(resultId)){
  document.getElementById(resultId).style.display = 'none';
  document.getElementById(resultId).innerHTML = unescape(httpRequest.responseText);
  document.getElementById(resultId).style.display = '';
  document.getElementById(resultId).style.backgroundImage = '';
  document.getElementById(resultId).style.backgroundImage = 'url(empty.gif)';
  resultId = null;
  }
 };
};

// JavaScript Document
function startList(){
	if(document.all&&document.getElementById){
		navRoot = document.getElementById("div");
		if(navRoot){
			for(i=0; i<navRoot.childNodes.length; i++){
				node = navRoot.childNodes[i];
				if(node.nodeName=="LI"){
					node.onmouseover=function(){
						this.className+=" over";
					}
					node.onmouseout=function(){
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
}

/*ÝÒÎ ÌÎß ÔÓÍÊÖÈß ÈÑÏÎËÜÇÎÂÀÒÜ ÌÎÆÍÎ ÒÎËÜÊÎ ÇÀ Î×ÅÍÜ ÄÎÏÎËÍÈÒÅËÜÍÛÅ ÄÅÍÜÃÈ*/
function xml2text(chNode){
	var xmltext = '';
	for(var i = 0;i <chNode.childNodes.length; i++){
		var chtemp = chNode.childNodes[i];
		if(chtemp.tagName != undefined){
			var attr_str = '';
			for(var j=0; j<chtemp.attributes.length; j++){
				var attr = chtemp.attributes[j];
				if (attr.nodeValue != null && chtemp.getAttribute(attr.nodeName)!=null && attr.specified && attr.nodeName.toLowerCase().indexOf("_moz") != 0){
					var attrval = chtemp.getAttribute(attr.nodeName);
					if (attr.nodeName.toLowerCase() != 'type' && attr.nodeName.toLowerCase() != 'value' && attr.nodeName.toLowerCase() != 'enctype')
						attr_str += ' ' + attr.nodeName.toLowerCase() + '="' + attrval + '"';
				}
			}
			if (chtemp.type && chtemp.type != '')
				attr_str += ' type="' + chtemp.type + '"';
			if (chtemp.value && chtemp.value != '')
				attr_str += ' value="' + chtemp.value + '"';
			if (chtemp.enctype && chtemp.enctype != '' && chtemp.enctype != 'application/x-www-form-urlencoded')
				attr_str += ' enctype="' + chtemp.enctype + '"';
			if(chtemp.tagName.indexOf("/") == -1){
				if(chtemp.tagName.toLowerCase() == "img"
				|| chtemp.tagName.toLowerCase() == "br"
				|| chtemp.tagName.toLowerCase() == "wbr"
				|| chtemp.tagName.toLowerCase() == "hr"
				|| chtemp.tagName.toLowerCase() == "input"){
					xmltext += '<' + chtemp.tagName.toLowerCase() + attr_str + ' />';
				}else{
					xmltext += '<' + chtemp.tagName.toLowerCase() + attr_str + '>';
					xmltext += xml2text(chtemp);
					xmltext += '</' + chtemp.tagName.toLowerCase() + '>';
				};
			};
		}else{
			xmltext += chtemp.nodeValue;
		}
	}
	return xmltext.replace(/\{\{amp\}\}/g,'&');
}

function bottomScroll(){
var theWidth, theHeight;
// Window dimensions: 
	if(window.innerWidth){
	theWidth=window.innerWidth;
	}else if(document.documentElement && document.documentElement.clientWidth){
		theWidth=document.documentElement.clientWidth;
	}else if(document.body){
	theWidth=document.body.clientWidth;
	}
	
	if(window.innerHeight){
		theHeight=window.innerHeight;
	}else if(document.documentElement && document.documentElement.clientHeight){
		theHeight=document.documentElement.clientHeight;
	}else if(document.body){
		theHeight=document.body.clientHeight;
	}
	window.scroll(0,theHeight + 200);
};

var USER_DATA = {

    Browser: {
        KHTML: /Konqueror|KHTML/.test(navigator.userAgent) &&
                !/Apple/.test(navigator.userAgent),
        Safari: /KHTML/.test(navigator.userAgent) &&
                /Apple/.test(navigator.userAgent),
        Opera: !!window.opera,
        MSIE: !!(window.attachEvent && !window.opera),
        Gecko: /Gecko/.test(navigator.userAgent) &&
                !/Konqueror|KHTML/.test(navigator.userAgent)
    },

    OS: {
        Windows: navigator.platform.indexOf("Win") > -1,
        Mac: navigator.platform.indexOf("Mac") > -1,
        Linux: navigator.platform.indexOf("Linux") > -1
    }
}
var IS_IE = USER_DATA['Browser'].MSIE;
function getPosition(e){
    var left = 0;
    var top  = 0;

    while (e.offsetParent) {
        left += e.offsetLeft + (e.currentStyle ?
            (parseInt(e.currentStyle.borderLeftWidth)).NaN0() : 0);
        top  += e.offsetTop  + (e.currentStyle ?
            (parseInt(e.currentStyle.borderTopWidth)).NaN0() : 0);
        e = e.offsetParent;
    }

    left += e.offsetLeft + (e.currentStyle ?
            (parseInt(e.currentStyle.borderLeftWidth)).NaN0() : 0);
    top  += e.offsetTop  + (e.currentStyle ?
            (parseInt(e.currentStyle.borderTopWidth)).NaN0(): 0); 	

    return {x:left, y:top};
}

function getTime() {
    return new Date().getTime();
}

function getTimeDelta(timeBegin, timeEnd) {
    timeEnd = timeEnd || getTime();
    return timeEnd - timeBegin;
}

Number.prototype.NaN0=function() { return isNaN(this) ? 0 : this; }

function getAlignedPosition(e) {
    var left = 0;
    var top  = 0;

    while (e.offsetParent) {
        left += e.offsetLeft + (e.currentStyle ?
            (parseInt(e.currentStyle.borderLeftWidth)).NaN0() : 0);
        top  += e.offsetTop  + (e.currentStyle ?
            (parseInt(e.currentStyle.borderTopWidth)).NaN0() : 0);
        e  = e.offsetParent;
        if (e.scrollLeft) {left -= e.scrollLeft; }
        if (e.scrollTop)  {top  -= e.scrollTop; }
    }

    var docBody = document.documentElement ?
        document.documentElement : document.body;

    left += e.offsetLeft +
        (e.currentStyle ?
                (parseInt(e.currentStyle.borderLeftWidth)).NaN0()
                : 0) +
        (IS_IE ? (parseInt(docBody.scrollLeft)).NaN0() : 0) -
        (parseInt(docBody.clientLeft)).NaN0();
    top  += e.offsetTop  +
        (e.currentStyle ?
                (parseInt(e.currentStyle.borderTopWidth)).NaN0()
                :  0) +
        (IS_IE ? (parseInt(docBody.scrollTop)).NaN0() : 0) -
        (parseInt(docBody.clientTop)).NaN0();

    return {x:left, y:top};
}