﻿var ajax_cursor_html = '<img src="' + SitePath + '/images/hour_glass2.gif" width="25" height="24">';
var ajax_wait_message = 'Loading...';
var ajax_cursor_class_name = 'hour_glass';
var cursor_x_shift = -2;
var cursor_y_shift = -2;

function trim(s) {
	return rtrim(ltrim(s));
} // end function

function ltrim(s) {
	return s.replace(/^\s+/, ''); 
} // end function

function rtrim(s) {
	return s.replace(/\s+$/, ''); 
} // end function
function findPos(obj)
{
    var curleft = curtop = 0;
    if (obj.offsetParent)
	{
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent)
		{
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
    	}
    }
    return [curleft,curtop];
}
function AddPageId(uri) {
	if (uri.indexOf('?') == -1) uri += '?';
	else if ((uri.charAt(uri.length - 1) != '?') && (uri.charAt(uri.length - 1) != '&')) uri += '&';
	uri += 'page.id=' + PageId;
	return uri;
}
function LoadPage(uri, divId, callback) {
	var div = document.getElementById(divId);
	if (div) {
		var event = 
			function (result) {
				div.style.visibility = "hidden";
				
				div.innerHTML = result;
				
                if (window.startAccordion) startAccordion();
				if (callback) eval(callback);
				div.style.visibility = "visible";
			} // end event
		HttpRequest(SitePath + AddPageId(uri), null, divId, event);		
	} // end if	
	return false;
} // end function



function HidePhoto() {	
	var div = document.getElementById("body");
	var popup = document.getElementById("fotka");
	div.className="";
	popup.style.display="none";
}



function addLoadEvent(func) 
{ 
    var oldonload = window.onload; 
    if (typeof window.onload != 'function'){ 
        window.onload = func; 
    } else {
        window.onload = function(){ 
            oldonload(); 
            func();
        } 
    } 
}