var ns = document.layers;
var chuw = false;




function addcomment(torid,domainc) 
{
document.getElementById('addcomment').style.display='block';
commentcheck(torid,domainc);
return false;


}


function commentcheck(torid,domainc)
{

    var httpRequest;
    pge=domainc+'ajx'+'/comment.php?v='+torid;
   
    kam='addcomment';
    if(typeof window.ActiveXObject != 'undefined')
    {
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {  
        httpRequest = new XMLHttpRequest();
    }
    httpRequest.open("GET", pge, true);
    httpRequest.onreadystatechange= function () 
    {
        processR(httpRequest, kam) 
    };
    httpRequest.send(null);
    
}



function processRequest(httpRequest, kam, voteh) 
{
    if (httpRequest.readyState == 4)
    {
        if (( httpRequest.status >= 200 && httpRequest.status < 300 ) || httpRequest.status == 304)
        {
            if (typeof kam == 'string') 
            {
                document.getElementById(kam).innerHTML = httpRequest.responseText;
            }
            if (typeof kam == 'function') 
            {
                kam(httpRequest.responseText);
            }
        }
        else
        {
            alert("Loading page error " + httpRequest.status +" : "+ httpRequest.statusText);
        }
    }
    else
    {
        if (typeof kam == 'string' && kam != '') 
        {
            document.getElementById(kam).innerHTML = 'Připravuji...';
            if(voteh=='??') voteh=0;
            document.getElementById('vote').innerHTML = voteh+1;
        }
    }
       
} 

function reperror(xsa,xse)
{

    var httpRequest;
    pge='/'+'ajx'+'/rep.php?a='+xsa+'&b='+xse;
    kam='repe';
    if(typeof window.ActiveXObject != 'undefined')
    {
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {  
        httpRequest = new XMLHttpRequest();
    }
    httpRequest.open("GET", pge, true);
    httpRequest.onreadystatechange= function () 
    {
        processR(httpRequest, kam) 
    };
    httpRequest.send(null);
    
}


function processR(httpRequest, kam) 
{
    if (httpRequest.readyState == 4)
    {
        if (( httpRequest.status >= 200 && httpRequest.status < 300 ) || httpRequest.status == 304)
        {
            if (typeof kam == 'string') 
            {
                document.getElementById(kam).innerHTML = httpRequest.responseText;
            }
            if (typeof kam == 'function') 
            {
                kam(httpRequest.responseText);
            }
        }
        else
        {
            alert("Loading page error " + httpRequest.status +" : "+ httpRequest.statusText);
        }
    }
    else
    {
        if (typeof kam == 'string' && kam != '') 
        {
            document.getElementById(kam).innerHTML = 'x';
      
        }
    }
       
} 

function upd(votei)
{

    var httpRequest;
    pge='/'+'ajx'+'/upd.php?v='+votei;
    kam='torup';
    if(typeof window.ActiveXObject != 'undefined')
    {
        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {  
        httpRequest = new XMLHttpRequest();
    }
    httpRequest.open("GET", pge, true);
    httpRequest.onreadystatechange= function () 
    {
        processR(httpRequest, kam) 
    };
    httpRequest.send(null);
    
}





function checkForm()
{
	var gname, gmessage;
	with(window.document.shout)
	{
		gname = name;
		gmessage = message;
	}
	if(gname.value == '' || gname.value == 'Name')
	{
		alert('Name cannot be null!');
		gname.focus;
		return false;
	}
	if(gmessage.value == '' || gmessage.value == 'Message')
	{
		alert('Message cannot be null!');
		gmessage.focus;
		return false;
	}
	else if(gmessage.value.length > 255)
	{
		alert("Please don't abuse our shoutbox!\nEnter only up to 255 characters.");
		gmessage.focus;
		return false;
	}
	else
	{
		return true;
	}
}
function checkSe()
{
	var smes;
	with(window.document.seo)
	{
		smes = q;
	}
	if(smes.value == "" || smes.value == "hledaný výraz...")
	{
		alert('Musíte zadat hledaný výraz!');
		smes.focus;
		return false;
	}
	else if(smes.value.length > 150)
	{
		alert("Prosím nepřetěžujte náš vyhledávač!\nVkládejte výraz menší než 150 znaků.");
		smes.focus;
		return false;
	}
	else
	{
		return true;
	}
}

  function bkmrk(url,title){

  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

  window.external.AddFavorite(url,title);

  } else if (navigator.appName == "Netscape") {

    window.sidebar.addPanel(title,url,"");

  } else {

    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");

  }

 

}

  function moveElement(id, x, y)
{

var widtha=document.body.clientWidth;

var x=(widtha-x)/2; 


  if(x>0) {
  // move the element with id to x,y
  // where x,y are the horizontal
  // and vertical position in pixels

  var elm = null;
  if (document.getElementById)
  {
    // browser implements part of W3C DOM HTML
    // Gecko, Internet Explorer 5+, Opera 5+
    elm = document.getElementById(id);
  }
  else if (document.all)
  {
    // Internet Explorer 4 or Opera with IE user agent
    elm = document.all[id];
  }
  else if (document.layers)
  {
    // Navigator 4
    elm = document.layers[id];
  }

  if (!elm)
  {
    // browser not supported or element not found
  }
  else if (elm.style)
  {
    // browser implements part of W3C DOM Style
    // Gecko, Internet Explorer 4+, Opera 5+

    if (typeof(elm.style.left) == 'number')
    {
      // Opera 5/6 do not implement the standard correctly
      // and assume that elm.style.left and similar properties
      // are numbers.
      elm.style.left = x;
      elm.style.top  = y;
    }
    else
    {
      // Gecko/Internet Explorer 4+
      // W3C DOM Style states that elm.style.left is a string
      // containing the length followed by the unit. e.g. 10px
      // Gecko will allow you to omit the unit only in Quirks 
      // mode. 
      // Gecko REQUIRES the unit when operating in Standards
      // mode.
      elm.style.left = x + 'px';
      elm.style.top  = y + 'px';
    }
  }
  else if (typeof(elm.left) == 'number')
  {
    // Navigator 4
    elm.left = x;
    elm.top  = y;
  }
  }
}
