var myTWin = window.myTWin;

function popupGalleryWindow(link,winName,width,height)
{
  var retValue=true;
  if (myTWin!=null && !myTWin.closed)
  {
    myTWin.focus();
    myTWin.location.href=link.href;
  }
  else
  {
    myTWin=window.open('/getfoto.php?file='+link.href,winName, "toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, width="+width+", height="+height);
    if (myTWin==null || typeof(myTWin)=="undefined")
      retValue=false;
    else
    {
      link.target=winName;
      myTWin.focus();
    }
  }
  return retValue;
}

// vlastni select pomoci div+a -->
function selectClick(par) {
  optionHidden();
  alloption=document.getElementById(par);
  alloption.style.display="block";
  activeoption=0;
  return false;
}
function optionClick(table, par) {
  alert(table+' '+par);
  return false;
}
var activeoption=2;
var alloption;
document.onclick=function(){
  optionHidden();
};
function optionHidden() {
  if (activeoption==1){
    alloption.style.display="none";
    activeoption=0;
  } else if (activeoption==0){
    activeoption=1;
  }
}

function OpenMyWin(link,winName,w,h,scrollb)
{
  var retValue = true;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings="width="+w+",height="+h+",top="+TopPosition+",left="+LeftPosition+",scrollbars="+scrollb+",location=0,menubar=0,resizable=0,status=0,titlebar=0,toolbar=0";
  if (myTWin!=null && !myTWin.closed)
  {
    myTWin.focus();
    myTWin.location.href=link.href;
  }
  else
  {

		myTWin=window.open(link.href,winName,settings);
    if (myTWin==null || typeof(myTWin)=="undefined")
      retValue=false;
    else
    {
      link.target=winName;
      myTWin.focus();
    }
  }
  return retValue;
}

function changeLocation(menuObj)
{
   var i = menuObj.selectedIndex;

   if(i > 0)
   {
      window.location = menuObj.options[i].value;
   }
}

/*$(document).ready(function(){

	$('#Content a').filter(function() {
      return this.hostname && this.hostname !== location.hostname;
     }).addClass('ExternalLink');

		//Apply CSS class to all A links that end in .pdf
    $("a[href$='.pdf']").addClass("LinkPDF");

     //Apply CSS class to all A links that end in .doc
     $("a[href$='.doc']").addClass("LinkDOC");

     //Apply CSS class to all A links that end in .xls
     $("a[href$='.xls']").addClass("LinkXLS");

     //Apply CSS class to all A links that end in .ppt
     $("a[href$='.ppt']").addClass("LinkPPT");

     //Apply CSS class to all A links that end in .jpg
     $("a[href$='.jpg']").addClass("LinkImage");

     //Apply CSS class to all A links that end in .gif
     $("a[href$='.gif']").addClass("LinkImage");

		//Apply CSS class to all A links that end in .png
     $("a[href$='.png']").addClass("LinkImage");

     //Apply CSS class to all A links that start with http://
     //$("a[href^='http://']").addClass("ExternalLink");

     //Remove CSS class to all A links that start with http://www.YOURDOMAINHERE.co.uk
     //$("a[href^='http://www.mydomain.co.uk']").removeClass("ExternalLink");

     //Apply CSS class to all A links that start with mailto:
     $("a[href^='mailto:']").addClass("Mail");

});*/

this.screenshotPreview = function(xo,yo){	
	/* CONFIG */
		
		xOffset = xo;
		yOffset = yo;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	$("a.screenshot").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='' />"+ c +"</p>");								 
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#screenshot").remove();
    });	
	$("a.screenshot").mousemove(function(e){
		$("#screenshot")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
