function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function tmline(gt){
	$("#tline").append('<div id="my-timeline" style="height: 550px; font-family: Arial; font-size: 10px; font-weight: bold;"></div>');
	$("#tline").unbind('click');
				
	var styl =  Timeline.getDefaultTheme();
	styl.autoWidth = true;

	var eventSource1 = new Timeline.DefaultEventSource();
	var bandInfos = [
		Timeline.createBandInfo({
			eventSource:	eventSource1,
			width:          35, 
			intervalUnit:   Timeline.DateTime.MONTH, 
			intervalPixels: 30,
			theme:			styl,
			zoomIndex:      10,
			zoomSteps:      new Array(
			  {pixelsPerInterval: 280,  unit: Timeline.DateTime.HOUR},
			  {pixelsPerInterval: 140,  unit: Timeline.DateTime.HOUR},
			  {pixelsPerInterval:  70,  unit: Timeline.DateTime.HOUR},
			  {pixelsPerInterval:  35,  unit: Timeline.DateTime.HOUR},
			  {pixelsPerInterval: 400,  unit: Timeline.DateTime.DAY},
			  {pixelsPerInterval: 200,  unit: Timeline.DateTime.DAY},
			  {pixelsPerInterval: 100,  unit: Timeline.DateTime.DAY},
			  {pixelsPerInterval:  50,  unit: Timeline.DateTime.DAY},
			  {pixelsPerInterval: 400,  unit: Timeline.DateTime.MONTH},
			  {pixelsPerInterval: 200,  unit: Timeline.DateTime.MONTH},
			  {pixelsPerInterval: 100,  unit: Timeline.DateTime.MONTH} // DEFAULT zoomIndex
			)
		}),
		Timeline.createBandInfo({
			overview:		true,
			eventSource:	eventSource1,
			width:          35,
			theme:			styl,
			intervalUnit:   Timeline.DateTime.YEAR, 
			intervalPixels: 100
		}),
		Timeline.createBandInfo({
			overview:		true,
			eventSource:	eventSource1,
			width:          35, 
			theme:			styl,
			intervalUnit:   Timeline.DateTime.DECADE, 
			intervalPixels: 100
		})
	];

	bandInfos[1].syncWith = 0;
	bandInfos[1].highlight = true;
	bandInfos[2].syncWith = 0;
	bandInfos[2].highlight = true;

	tl = Timeline.create(document.getElementById("my-timeline"), bandInfos);
	tl.loadJSON('/inc/Timeline/dane.php?s='+gt, function(json,url){
		eventSource1.loadJSON(json,url);
		tl.finishedEventLoading(); 
	});

	 Timeline.OriginalEventPainter.prototype._showBubble = function(x, y, evt) {
	  var id = new String(evt.getDescription());
	  switch(id.charAt(0)){
			case 'b':
				link = id.substr(1)+',obiekt.html';
			break;
			case 'u':
				link = id.substr(1)+',str.html';
			break;
	  }
		window.location = '/'+link;
		//(evt.getDescription());
	  }

}

function pokaz2(co){
    $("#"+co).slideToggle(300);
}

function pokazj(co){

	if($("#"+co).css("display")=="none"){
		$("#"+co).show();
	} else {
		$("#"+co).hide();
	}
}

function JQ_Jump(selObj){
	//alert(selObj+'th:'+$(this));
	if(selObj.options[selObj.selectedIndex].value.charAt(1)=='t'){
		MM_goToURL('this',selObj.options[selObj.selectedIndex].value);
	} else {
		$("#srche").load(selObj.options[selObj.selectedIndex].value, null, function(){
			nadaj_wysz();
		});
	}
}

function pokazzm(top,left)
{
	var scrollYPos; 
	//document.getElementById("lyb").style.visibility='visible';
	$("#lyb").show(500);
	//$('#lyb').css('display', 'block');

	if(!top || !left){
		top = -220;
		left = 20;
	}

	 if(navigator.appName=="Netscape")
	 {
		  document.addEventListener('mousemove', function (evt) { 
			  window.status = evt.clientX + ':' + evt.clientY; 
				   document.getElementById("lyb").style.top=-220+evt.clientY+window.pageYOffset+"px";
				   document.getElementById("lyb").style.left=20+evt.clientX+"px";
			 }, 
			 false 
		   ); 
		   }

		else{


		   if (typeof window.pageYOffset != 'undefined') { 
			 scrollYPos = window.pageYOffset; 
		   } 
		   else if (document.compatMode && document.compatMode != 'BackCompat') { 
			 scrollYPos = document.documentElement.scrollTop; 
		   } 
		   else { 
			 scrollYPos = document.body.scrollTop; 
		   } 
		   if (typeof scrollYPos != 'undefined') { 
			   document.getElementById("lyb").style.top=top+event.y+scrollYPos;
			    document.getElementById("lyb").style.left=left+event.x+"px";

			 // use it here e.g. 
		   } 
		}
}

function schowajm()
{
	$("#lyb").hide(500);
	//document.getElementById("lyb").style.visibility='hidden';
}

function getPosition(elementId) {

var element = document.getElementById(elementId);
var left = 0;
var top = 0;

if (element != null)
{
    // Try because sometimes errors on offsetParent after DOM changes.
    try
    {
        while (element.offsetParent)
        {
            // While we haven't got the top element in the DOM hierarchy
            // Add the offsetLeft
            left += element.offsetLeft;
            // If my parent scrolls, then subtract the left scroll position
            if (element.offsetParent.scrollLeft) {left -= element.offsetParent.scrollLeft; }

            // Add the offsetTop
            top += element.offsetTop;
            // If my parent scrolls, then subtract the top scroll position
            if (element.offsetParent.scrollTop) { top -= element.offsetParent.scrollTop; }

            // Grab
            element = element.offsetParent;
        }
    }
    catch (e)
    {
        // Do nothing
    }

    // Add the top element left offset and the windows left scroll and subtract the body's client left position.
    left += element.offsetLeft + document.body.scrollLeft - document.body.clientLeft;

    // Add the top element topoffset and the windows topscroll and subtract the body's client top position.
    top += element.offsetTop + document.body.scrollTop - document.body.clientTop;
}
return {x:left, y:top};
}

function pozycjonuj(obiekt,layer){
	pos = getPosition("tee_art");
	$("#Layer22").css("left",pos.x+54);
	$("#Layer22").css("top",pos.y+2);
	$("#Layer22").show();
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}