function opensmallWindow(theURL) {
  if(!window.smallwindow) {
  	smallwindow = window.open(theURL,'smallwindow','scrollbars=no,resizable=yes,width=500,height=500');
  } else {
  	if(!smallwindow.closed) {
  		window.smallwindow.focus();
		smallwindow.location = theURL;
	} else {
    	smallwindow = window.open(theURL,'smallwindow','scrollbars=no,resizable=yes,width=500,height=500');	
	}
  }
}

function openSlideshow(theURL) {

var top = 0;
var left = 0;

var width = screen.availWidth;
var height = screen.availHeight;

 if(!window.slideshow) {
  	slideshow = window.open(theURL,'slideshow','scrollbars=no,resizable=yes,fullscreen=yes,left=' + left + ',top=' + top + ',width='+width+',height='+height);
  } else {
  	if(!slideshow.closed) {
  		window.slideshow.focus();
		slideshow.location = theURL;
	} else {
  	slideshow = window.open(theURL,'slideshow','scrollbars=no,resizable=yes,fullscreen=yes,left=' + left + ',top=' + top + ',width='+width+',height='+height);	
	}
  }
  
 } 

function openNormalWindow(bars, theURL) {

var top = (screen.availHeight - 720)/2;
var left = (screen.availWidth - 1000)/2;

 if(!window.normalwindow) {
  	normalwindow = window.open(theURL,'normalwindow','scrollbars=yes,resizable=yes,left=' + left + ',top=' + top + ',width=1000,height=720');
  } else {
  	if(!normalwindow.closed) {
  		window.normalwindow.focus();
		normalwindow.location = theURL;
	} else {
  	normalwindow = window.open(theURL,'normalwindow','scrollbars=yes,resizable=yes,left=' + left + ',top=' + top + ',width=1000,height=720');	
	}
  } 
    
/*
  var top = parseInt((screen.height - 750)/2);
  var left = parseInt((screen.width - 1000)/2);

  // alert(this.name);

  if(this.name == 'noscrollbars')
  {
  	if(bars == 'no')
	{
	  // alert("this.name = 'noscrollbars', scrollbars = 'no'");
	  this.location = theURL;
	} else
	{
	  // alert("this.name = 'noscrollbars', scrollbars = 'yes'");
	  window.open(theURL, 'scrollbars', 'scrollbars=yes, resizable=yes, left=+left+, top=+top+, width=1000, height=750');
	  this.close();
	}
  } else if(this.name == 'scrollbars')
  {
  	if (bars == 'yes')
	{
	  // alert("this.name = 'scrollbars', scrollbars = 'yes'");
	  this.location = theURL;
	} else
	{
	  // alert("this.name = 'scrollbars', scrollbars = 'no'");
	  window.open(theURL, 'noscrollbars', 'scrollbars=no, resizable=yes, left=+left+, top=+top+, width=1000, height=750');
	  this.close();
	}
  } else
  {
  	if (bars == 'yes')
	{
	  if(window.noscrollbars)
		window.noscrollbars.close();

	  window.open(theURL, 'scrollbars', 'scrollbars=yes, resizable=yes, left=+left+, top=+top+, width=1000, height=750');
	  // alert("this.name=ganz was anderes, scrollbars='yes'");
	} else
	{
	  // alert("this.name=ganz was anderes+, scrollbars='no'");
  	  if(window.scrollbars) 
	  	window.scrollbars.close(); 
	  
	  window.open(theURL, 'noscrollbars', 'scrollbars=no, resizable=yes, left=+left+, top=+top+, width=1000, height=750');
	}  
  }

*/




}

function forceNormalOpen(scrollbars,theURL) {
	//this.close();
	/*if (this.name == 'normalwindow') {
		window.normalwindow.close();
		window.normalwindow.opener.window.open(theURL,'normalwindow','scrollbars='+scrollbars+',resizable=yes,width=1000,height=750');
		alert("haha");
	} else {
	//normalwindow.close();
	normalwindow = window.open(theURL,'normalwindow','scrollbars='+scrollbars+',resizable=yes,width=1000,height=750');
	alert("haha2");	
	}*/
	
	openNormalWindow(scrollbars, theURL);

}

function openfullScreen(theURL) {
	var fullwindow = window.open(theURL,'fullwindow',"resizable=yes,height=" + screen.availHeight + ",width=" + screen.availWidth);

}


function scrollhorizontal(X) {
/*
var scrolling = 0;
	while(scrolling <= X)
	{
	window.scrollBy(10,0)
	scrolling = scrolling + 10;
	}
*/

window.scrollBy(X,0);	
}
