var cDisplay = 'none';

function showScreen(movie, picNr, lab)
{
	window.open("http://www.senseofview.de/showscreen.php?movie="+movie+"&screenNr="+picNr+"&label="+lab, "Screenshot", "left=200,top=100,width=600,height=400,locationbar=no,menubar=no,scrollbars=no,status=no");
}

function show(datei)
{
//	var ziel = "http://www.senseofview.de/sense2/" + datei;
	fenster=window.open(datei, "", "width=800,height=600,locationbar=no,menubar=no,scrollbars=yes");
	fenster.focus();
}

function showHelp(query, width, height)
{
	var datei = "help.php";
	var url = datei + "?h=" + query;
	fenster=window.open(url, "", "width="+width+",height="+height+",locationbar=no,menubar=no,scrollbars=no");
	fenster.focus();
}

function showPic(file)
{
	win = window.open("http://www.senseofview.de/showpic.php?file="+file, "Image", "width=400,height=250,locationbar=no,menubar=no,scrollbars=yes");
	win.focus();
}

function newsread(nid)
{
	var ziel="http://www.senseofview.de/modules/newsticker.php?read="+nid;
	fenster=window.open(ziel,"Newsticker","toolbar=no,menubar=no,location=no,scrollbars=yes,height=500,width=450");
	fenster.focus();
	return false;
}

function ValidateEmail(emailField)
{
	s = emailField.value;
	if ( s.length > 0 )
	{
		if ( s.search )
			return ( s.search(new RegExp("^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\.)+[a-zA-Z]{2,4}$","gi")) >= 0 )

		if ( s.indexOf )
		{
			at_character = s.indexOf('@');
			if( (at_character <= 0) || (at_character+4 > s.length) )
				return false;
		}

		if ( s.length < 6 )
			return false;
		else
			return true;
	}
	else
		return true;
}

function checkForm(form)
{
	if ( form.name.value == '' )
	{
		alert('Bitte gebe doch Deinen Namen an. :)');
		form.name.focus();
		return false;
	}

	if ( form.email.value != '' )
	{
		if ( ValidateEmail(form.email) == false )
		{
			alert('Deine Emailadresse scheint nicht ganz okay zu sein. :)');
			form.email.focus();
			return false;
		}
	}

	if ( form.comment.value == '' )
	{
		alert('Bitte das Kommentarfeld ausfüllen. :)');
		form.comment.focus();
		return false;
	}

	return true;
}

function showCommentField()
{
	if ( cDisplay == 'none' )
		cDisplay = 'block';
	else
		cDisplay = 'none';

	document.getElementById('addcomments').style.display = cDisplay;
}