var my_open = false;
function newwin(url, width, height, bgurl, top, left, scrollbars, resizable)
{
    if(width != undefined && width > 0 && height > 0)
    {
        var jetzt = new Date();
        var name = "win_" + jetzt.getTime();
        left = left != undefined ? left : 0;
        top = top != undefined ? top : 0;
        scrollbars = (scrollbars != undefined && scrollbars == 1) ? ",scrollbars=yes" : "";
        resizable = (resizable != undefined && resizable ==1) ? ",resizable=yes" : "";
        f = window.open(url, name, "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + scrollbars + resizable);
    }else{
        f = window.open(url);
    }
    if(bgurl != undefined && bgurl != "")
            location.href = bgurl;
    f.focus;
}


function folgeseite(seite,key)
{
    if(key == 1)
    {
	new Ajax.Request('/'+seite,
	{
	    method: 'post',
	    onSuccess: function(transport)
	    {
	        $('middle_content').replace(transport.responseText);
		slider1 = new Control.Slider('handle1', 'track1',{
		axis: 'vertical',
		range: $R(0, ($('scrollable1').scrollHeight-$('scrollable1').offsetHeight)/10),
		onSlide: function(v) { scrollVertical(v, $('scrollable1'), slider1);  },
		onChange: function(v) { scrollVertical(v, $('scrollable1'), slider1); }
		});
		var bla = (($('scrollable1').scrollHeight-$('scrollable1').offsetHeight)/10);
		if(bla == 0)
		{
		    $('handle1').remove();
		    $('track1').remove();
		}
		// Event.stopObserving('scrollable1');
		$('scrollable1').stopObserving();
		// mozilla
		Event.observe('scrollable1', 'DOMMouseScroll', wheel);
		// IE/Opera
		Event.observe('scrollable1', 'mousewheel', wheel);		
		
	    }        
	}
	);
    }
    else
    {
	new Ajax.Request('/zurueck_'+seite,
	{
	    method: 'post',
	    onSuccess: function(transport)
	    {
	        $('middle_content').replace(transport.responseText);
	    }        
	}
	);	
    }
}




function markentechnik(key)
{
    if(key == 1)
    {
	new Ajax.Request('/markentechnik',
	{
	    method: 'post',
	    onSuccess: function(transport)
	    {
	        $('middle_content').replace(transport.responseText);
	    }        
	}
	);
    }
    else
    {
	new Ajax.Request('/zurueck',
	{
	    method: 'post',
	    onSuccess: function(transport)
	    {
	        $('middle_content').replace(transport.responseText);
	    }        
	}
	);	
    }
}
function impressum(key)
{
    if(key == 1)
    {
	new Ajax.Request('/impressum',
	{
	    method: 'post',
	    onSuccess: function(transport)
	    {
	        $('middle_content').replace(transport.responseText);
	    }        
	}
	);
    }
    else
    {
	new Ajax.Request('/zurueck',
	{
	    method: 'post',
	    onSuccess: function(transport)
	    {
	        $('middle_content').replace(transport.responseText);
	    }        
	}
	);	
    }
}
function getPageSize() {
		
	 var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}

function closechange(div)
{
    my_open = false;
    if($('galeriedetail'))
	$('galeriedetail').remove();    
    if($('overlay'))
	$('overlay').remove();
    
    $(div).hide();
}


i=0;
document.observe("dom:loaded", function()
{
  
}
);
