    function AjaxSubmit(form,id){
        AjaxRequest.submit(
    		form,
			{
				'ajax':1
      			,'onSuccess':function(req){ AjaxDisplayResult(id,req.responseText); }
				,'onLoading':function(req) { AjaxWorking(); }
				,'onLoaded':function(req) { AjaxFinished(); }
				,'onError':function(req) { }
    		}
  		);
	}
    
    function AjaxGet(href,id){
        AjaxRequest.get(
            {
                'url': href + getHrefSeparator(href) + 'ajax=1'
                ,'onSuccess':function(req) { AjaxDisplayResult(id,req.responseText); }
                ,'onLoading':function(req) { AjaxWorking(); }
                ,'onLoaded':function(req) { AjaxFinished(); }
                ,'onError':function(req) { }
            }
        );
	}
    
    function AjaxAnketaVote(href,idAnketa){
        AjaxRequest.get(
            {
                'url': href + getHrefSeparator(href) + 'ajax=1'
                ,'onSuccess':function(req) { AjaxDisplayResult('anketa' + idAnketa,req.responseText); }
                ,'onLoading':function(req) { AjaxDisplayResult('moznosti' + idAnketa,'<div class="progress"></div>'); }
            }
        );
	}
    
    function AjaxConfirm(href,id,msg){
        if(confirm(msg)){
            AjaxRequest.get(
			    {
                    'url': href + getHrefSeparator(href) + 'ajax=1'
                    ,'onSuccess':function(req) { AjaxDisplayResult(id,req.responseText); }
                    ,'onLoading':function(req) { AjaxWorking(); }
                    ,'onLoaded':function(req) { AjaxFinished(); }
                    ,'onError':function(req) { }
                }
            );
        }
	}
    
    function getHrefSeparator(href){
        return (href.indexOf('?') != -1) ? '&' : '?';
    }
    
    function AjaxDisplayResult(id,result){
        var e = document.getElementById(id);
        if(e != undefined){
            e.innerHTML = result;
        }
	}
    
    function AjaxWorking(){
        var e = document.getElementById('progress');
        if(e == undefined){
            var objBody = document.getElementsByTagName("body").item(0);
            var e = document.createElement("div");
            e.setAttribute('id','progress');
            e.style.display = 'none';
            e.style.position = 'absolute';
            e.style.zIndex = '10';
            e.style.width = '60px';
            e.style.height = '60px';
            objBody.insertBefore(e, objBody.firstChild);
        }
        
        var arrayPageSize = AjaxGetPageSize();
        var arrayPageScroll = AjaxGetPageScroll();
        e.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - e.style.width) / 2) + 'px');
        e.style.left = (((arrayPageSize[0] - 20 - e.style.height) / 2) + 'px');
        e.style.display = 'block';
    }
    
    function AjaxFinished(){
        var e = document.getElementById('progress');
        if(e != undefined){
            e.style.display = 'none';
        }
    }
    
    function AjaxGetPageScroll(){
        var yScroll;
        if (self.pageYOffset) {
            yScroll = self.pageYOffset;
        } else if (document.documentElement && document.documentElement.scrollTop){
            yScroll = document.documentElement.scrollTop;
        } else if (document.body) {
            yScroll = document.body.scrollTop;
        }
        arrayPageScroll = new Array('',yScroll) 
        return arrayPageScroll;
    }
    
    function AjaxGetPageSize(){
        var xScroll, yScroll;
        if (window.innerHeight && window.scrollMaxY) {	
            xScroll = document.body.scrollWidth;
            yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){
            xScroll = document.body.scrollWidth;
            yScroll = document.body.scrollHeight;
        } else {
            xScroll = document.body.offsetWidth;
            yScroll = document.body.offsetHeight;
        }
	
        var windowWidth, windowHeight;
	    if (self.innerHeight) {
            windowWidth = self.innerWidth;
            windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        } else if (document.body) {
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }	
        
        if(yScroll < windowHeight){
            pageHeight = windowHeight;
        } else { 
            pageHeight = yScroll;
        }
        
        if(xScroll < windowWidth){	
            pageWidth = windowWidth;
        } else {
            pageWidth = xScroll;
        }
        
        arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
        return arrayPageSize;
    }
