var isIE5=navigator.userAgent.toUpperCase().indexOf("MSIE 5")!=-1;
var targetElementID="contents", targetElementStyleOffset=0;

function createControl(param, div_id) { 
	var d = document.getElementById(div_id); 
	d.innerHTML = param; 
}

externalLinks=function() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height, resizable, scrollbar)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar='+scrollbar+',resizable='+resizable+',copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function placeFocus(id, error)
{
	if (document.getElementById(id))
	{
		var el = document.getElementById(id);
		el.focus();
		if (!error || error == 'undefined'){
		}
		else{
			el.parentNode.parentNode.setAttribute('class','missing');
			el.parentNode.parentNode.setAttribute('className','missing');
		}
	}
}

function showhide(divId,imageId, rootdir) {
	if (document.getElementById)
	{
		var id = document.getElementById(divId);
		var imgid = document.getElementById(imageId);
		var imgsrc = '';
	
		if (id.style.display == "none") {
			imgsrc = rootdir+'i/common/minus.gif';
			eval("id.style.display = 'block'");
			eval( "imgid.src = imgsrc");
		}
		else {
			imgsrc = rootdir+'i/common/plus.gif';
			eval("id.style.display = 'none'");
			eval( "imgid.src = imgsrc"); 
		}
	}
}

function showhideWithNoImage(divId) {
	if (document.getElementById)
	{
		var id = document.getElementById(divId);
	
		if (id.style.display == "none") {
			eval("id.style.display = 'block'");
		}
		else {
			eval("id.style.display = 'none'");
		}
	}
}

function showWithNoImage(divId) {
	if (document.getElementById)
	{
		var id = document.getElementById(divId);
	
		if (id.style.display == "none") {
			eval("id.style.display = 'block'");
		}
		else {
		}
	}
}

function hideWithNoImage(divId) {
	if (document.getElementById)
	{
		var id = document.getElementById(divId);
	
		if (id.style.display == "none") {
		}
		else {
			eval("id.style.display = 'none'");
		}
	}
}

function compareSwitch(value, compareValue, divId) {
	if (value == compareValue)
	{
		showWithNoImage(divId);
	}
	else
	{
		hideWithNoImage(divId);
	}

}

function whatCorrector() {
  var replaces = 0;
  var alltags = document.all ? document.all.tags("DIV") : document.getElementsByTagName("*");
  for (i=0; i < alltags.length; i++) {
    if (alltags[i].className == 'whateffect') {
      while (alltags[i].innerHTML.indexOf('##'+'kukac##') != -1 && replaces < 10000) {
        alltags[i].innerHTML = alltags[i].innerHTML.replace('##'+'kukac##', String.fromCharCode(64));
        replaces++;
      }
    }
  }
}

function adjustHeight() {
  if (document.getElementById) {
    var targetElement=document.getElementById(targetElementID),
        documentHeight, totalOffset;
    if (targetElement && document.documentElement.offsetHeight
        && targetElement.offsetHeight) {// && targetElement.offsetTop
      	documentHeight=document.documentElement.offsetHeight;
      if (targetElement.offsetHeight<documentHeight-targetElement.offsetTop) {
        if (isIE5)
          totalOffset=targetElement.offsetTop;
          else totalOffset=targetElement.offsetTop+targetElementStyleOffset;
        targetElement.style.height=String(documentHeight-totalOffset)+'px';
      }
    }
  }
}

window.onresize=adjustHeight;

function changePage(s)
{
	if (self.parent.frames.length != 0) self.parent.location=s;
}
