

function open_win(url_add)
   {
   if (top.location==document.location)
     {
     window.open(url_add,'welcome',
     'width=620,height=360,menubar=no,status=no,location=no,toolbar=no,scrollbars=no');
     }
     else
     {
     document.location=url_add;
     }
   }
var window_feedback = ''
function Ajax(url, sTarget, func){
	try{
		// Firefox, Opera 8.0+, Safari
		httpRequest=new XMLHttpRequest();
		httpRequest.overrideMimeType("text/html; charset=windows-1250");
	}
	catch (e){
	    // Internet Explorer
  		try{
		    httpRequest=new ActiveXObject("Msxml2.XMLHTTP");

    	}
		catch (e){
	    	try{
		      	httpRequest=new ActiveXObject("Microsoft.XMLHTTP");

        	}
			catch (e){

			  return false;
			}
    	}
	}

			httpRequest.open("GET", url, true);
                        httpRequest.onreadystatechange= function () {
                                                                    processRequest(sTarget);
                                                                    if (func) {func()};
                                                                    } ;
                        httpRequest.send(null);
}

function processRequest(sTarget){

         if (httpRequest.readyState == 4)
            {
            if(httpRequest.status == 200)
               {
               var target = document.getElementById(sTarget);
               target.innerHTML = httpRequest.responseText;
               }
            else
               {
               //alert("Chyba pri nacitani stanky"+ httpRequest.status +":"+ httpRequest.statusText);
               }
            }
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
		}
	}
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curtop += obj.offsetTop
		}
	}
	return curtop;
}

/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.imagePreview = function(){
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result

	/* END CONFIG */
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");


                var docViewTop = $(window).scrollTop();
                var docViewBottom = docViewTop + $(window).height();



                $("#preview")
			.css("top",(Math.min(e.pageY - xOffset,docViewBottom-$("#preview").height())-20) + "px")
			.css("left",(e.pageX + yOffset) + "px");
		$("#preview").fadeIn("fast");


    },
	function(){
		this.title = this.t;
		$("#preview").remove();
    });
	$("a.preview").mousemove(function(e){
                var docViewTop = $(window).scrollTop();
                var docViewBottom = docViewTop + $(window).height();
		$("#preview")
			.css("top",(Math.min(e.pageY - xOffset,docViewBottom-$("#preview").height()-20)) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};




