var errorstr = '';

///////////////////////////////////////////////////////////////////////////////
function onLoad_doc(event){
	if(!event) event = window.event;
	if(window.AntiSpam_mailto) AntiSpam_mailto();
	if(window.customOnLoad_doc) customOnLoad_doc(event);
	if(window.errorstr) setTimeout('alert(errorstr);', 100);
	}

///////////////////////////////////////////////////////////////////////////////
function AntiSpam_mailto(){
	var arrA = document.getElementsByTagName('A');
	for(var i=0; i<arrA.length; i++){
		if(!arrA[i].getAttributeNode('href')) continue;
		aElementHref = arrA[i].getAttributeNode('href');
		aElementHref.value = aElementHref.value.replace(/^(mailto:.*)_KUKAC_/, '$1@');
		arrA[i].innerHTML = arrA[i].innerHTML.replace(/_KUKAC_/g, '@');
		}
	}

///////////////////////////////////////////////////////////////////////////////
function openPopup(url,name,width,height,left,top,params) {
	if (!params) params = ', location=no, menubar=no, toolbar=no, directories=no, status=no, resizable=yes, scrollbars=yes';
	if (width=='auto') width = Math.round(window.screen.availWidth);
	if (height=='auto') height = Math.round(window.screen.availHeight);
	if (left='center') left = Math.round((window.screen.availWidth-width)/2);
	if (top='center') top = Math.round((window.screen.availHeight-height)/2);
	if (width) width = ', width = '+(width-12); //12 = border
	if (height) height = ', height = '+(height-31); // 31 = border + title
	if (!isNaN(left)) left = ', left = '+left;
	if (!isNaN(top)) top = ', top = '+top;
	params = width+height+left+top+params;
	window.open(url,name,params);
	}

///////////////////////////////////////////////////////////////////////////////
function setDisplay(obj, display){
	if(typeof(obj)=='string') obj = document.getElementById(obj);
	if(!obj) return;
	if(display==undefined) display = (obj.style.display=='none') ?'block' :'none';
	obj.style.display = display;
	return true;
	}
///////////////////////////////////////////////////////////////////////////////
function setClassName(obj, name){
	if(typeof(obj)=='string') obj = document.getElementById(obj);
	if(!obj) return;
	obj.className = name;
	return true;
	}

///////////////////////////////////////////////////////////////////////////////
function retF(){return false;}
///////////////////////////////////////////////////////////////////////////////
function cancelEvent(event){
	if(!event) event = window.event;
	if(event.stopPropagation) event.stopPropagation();
	if(event.preventDefault) event.preventDefault();
	event.cancelBubble = true;
	event.cancel = true;
	event.returnValue = false;
	return false;
	}
///////////////////////////////////////////////////////////////////////////////
function ignoreEvent(event){
	if(!event) event = window.event;
	event.returnValue = false;
	if(event.preventDefault) event.preventDefault();
	return false;
	}
///////////////////////////////////////////////////////////////////////////////
function disableIMGInteractivity(imgobj){
	if(typeof(imgobj)=='string') imgobj = document.getElementById(imgobj);
	if(!imgobj || imgobj.tagName!='IMG') return;
	imgobj.style.MozUserSelect = 'none';
	imgobj.unselectable = 'on';
	imgobj.onselectstart = ignoreEvent;
	imgobj.onmousedown = ignoreEvent;
	imgobj.galleryImg = false;
	}
///////////////////////////////////////////////////////////////////////////////
function disableInteractivity(obj){
	if(typeof(obj)=='string') obj = document.getElementById(obj);
	if(!obj) return;
	obj.style.MozUserSelect = 'none';
	obj.unselectable = 'on';
	obj.onselectstart = ignoreEvent;
	obj.onmousedown = ignoreEvent;
	}

///////////////////////////////////////////////////////////////////////////////
function mouseEvent(event){
	if(!event) return;
	var result = {x:0, y:0, button:event.button};
	if(event.pageX || event.pageY) {result.x = event.pageX; result.y = event.pageY;}
	else if(event.clientX || event.clientY){result.x = event.clientX; result.y = event.clientY;
		if(document.documentElement) {result.x += document.documentElement.scrollLeft; result.y += document.documentElement.scrollTop;}
		else if(document.body) {result.x += document.body.scrollLeft; result.y += document.body.scrollTop;}
		}
	return result;
	}

///////////////////////////////////////////////////////////////////////////////
function getOffset(obj){
	if(typeof(obj)=='string') obj = document.getElementById(obj);
	if(!obj) return;
	var left = 0, top = 0;
	while(obj && obj.tagName!='BODY'){
		left += Math.abs(obj.offsetLeft);
		top += Math.abs(obj.offsetTop);
		obj = obj.offsetParent;
		}
	return [left,top];
	}

///////////////////////////////////////////////////////////////////////////////
function gotoAnchor(anchorname){
	window.location.hash = anchorname;
	return false;
	}

///////////////////////////////////////////////////////////////////////////////
function preload(src){
	var obj = new Image;
	obj.src = src;
	delete obj;
	}

///////////////////////////////////////////////////////////////////////////////
Object.extend = function(destination, source){
	for (var property in source) destination[property] = source[property];
	return destination;
	};

///////////////////////////////////////////////////////////////////////////////
