// JavaScript Document

d=document;l=(d.layers)?1:0;op=navigator.userAgent.toLowerCase().indexOf('opera')!=-1;ie=(d.all)?1:0;
function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}

function sE(e){if(l)e.visibility='show';else e.style.visibility='visible';}
function hE(e){if(e!=null){if(l)e.visibility='hide';else e.style.visibility='hidden';}}

function s2E(e){ e.style.display='block';}
function h2E(e){ e.style.display='none';}

function openNewWin(URL,w,h,wname)
{
window.open(URL,wname,"toolbar=no, location=no, scrollbars=yes, directories=no, status=no, menubar=no, resizable=yes, width="+w+", height="+h+", left=100, top=100");
}


function saveCookie(name,value,days) {
	if (days) {
		var date=new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000))
		var expires="; expires="+date.toGMTString()
	} else expires=""
	document.cookie=name+"="+value+expires+"; path=/"
}

function readCookie(name) {
	var nameEQ=name+"="
	var ca=document.cookie.split(';')
	for(var i=0;i<ca.length;i++) {
		var c=ca[i];
		while (c.charAt(0)==' ') c=c.substring(1,c.length)
		if (c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length)
	}
	return null
}



function sX(e,x){if(l)e.left=x;else if(op)e.style.pixelLeft=x;else e.style.left=x+'px';}
function gX(e){if(l)return e.left;else if(op)return e.style.pixelLeft;else return parseInt(e.style.left);}
function sY(e,y){if(l)e.top=y;else if(op)e.style.pixelTop=y;else e.style.top=y+'px';}
function gY(e){if(l)return e.top;else if(op)return e.style.pixelTop;else return parseInt(e.style.top);}
function sW(e,w){if(l)e.clip.width=w;else if(op)e.style.pixelWidth=w;else e.style.width=w;}
function gW(e){if(l)return e.clip.width;else if(op)return e.style.pixelWidth;else return parseInt(e.style.width);}
function sH(e,h){if(l)e.clip.height=h;else if(op)e.style.pixelHeight=h;else e.style.height=h;}
function gH(e){if(l)return e.clip.height;else if(op)return e.style.pixelHeight;else return parseInt(e.style.height);}

function mT(e,x,y){sX(e,x);sY(e,y);}
function mB(e,x,y){sX(e,gX(e)+x);sY(e,gY(e)+y);}


function wH(e,h){if(l){Y=e.document;Y.write(h);Y.close();}if(e.innerHTML)e.innerHTML=h;}
function wHa(e,h){if(l)	{Y=e.document;Y.write(h);Y.close();}if(e.innerHTML)	e.innerHTML=e.innerHTML+h;
						}
function sC(e,t,r,b,x){if(l){X=e.clip;X.top=t;X.right=r;X.bottom=b;X.left=x;}else e.style.clip='rect('+t+'px '+r+'px '+b+'px '+x+'px)';}

function winW(){if(window.innerWidth)return window.innerWidth;else return d.body.clientWidth;}
function winH(){if(window.innerHeight)return window.innerHeight;else return d.body.clientHeight;}
function winL(){if(ie)return d.body.scrollLeft;else return window.pageXOffset;}
function winT(){if(ie)return d.body.scrollTop;else return window.pageYOffset;}

// akoze ajax -spustanie php skriptov  ----------------------------------------------------------------------------------
function runPhpScript(url,postRequest,intoDivId)
{
	 	var http_request = false;
        //var postRequest = "string="+string;
		var r='';
        if (window.XMLHttpRequest) {
            http_request = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
            try {
              http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (eror) {
              http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
		if(intoDivId!='')
        	http_request.onreadystatechange = function() { showRequest(http_request,intoDivId); };

        http_request.open('POST', url, true);
        http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http_request.send(postRequest);
}
function showRequest(http_request,intoDivId) {
		//alert('Chyba'+http_request.responseText);
        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
				document.getElementById(intoDivId).innerHTML=http_request.responseText;
                //alert(http_request.responseText);
            } else {
                alert('Chyba');
            }
        }
    }
    
        
 function tableCellSwapStyle(farba,pozadie,bunka)
 {
 	
 	bunkaE=gE(bunka);
 	bunkaE.style.color='#'+farba;
 	bunkaE.style.background='#'+pozadie;
 	
 	
 	
 }
