var obj;
onresize = liveResize;

function resizePic()
{
	if(!fits())
	{
		if(obj.width == windowWidth())
		{
			obj.width = origWidth;
			obj.height = origHeight;
		}else{
			obj.width = windowWidth();
			obj.height = (origHeight/origWidth) * obj.width;
		}
	}
}

function liveResize()
{
	if(!fits())
	{
		if (obj.width != origWidth)
		{
			obj.width = windowWidth();
			obj.height = (origHeight/origWidth) * obj.width;
		}
	}
}

function setPicWidth()
{
	obj = document.getElementById('pic');
	if(!fits())
	{
		obj.width = windowWidth();
	}
}

function fits()
{
	if(origWidth <= windowWidth())
	{
		obj.width = origWidth;
		obj.height = origHeight;
		return true;
	}else{
		return false;
	}
}

function windowWidth()
{
	if(navigator.appName == "Netscape")
	{
		size = window.innerWidth;
	}else{
		size = document.body.offsetWidth;
	}
	return size-275;
}

function guestbook()
{	
	field = document.getElementById('gb_input');
	link = document.getElementById('gb_link');
	field.style.display = (field.style.display == 'none')?'block':'none';
	link.firstChild.data = (field.style.display == 'none')?'Eintrag erstellen':'verstecken';
}