var ShowWindow = "";

function OpenShow(ShowUrl, ShowWidth, ShowHeight)
	{
	ShowWidth = parseInt(ShowWidth, 10) + 20;
	ShowHeight = parseInt(ShowHeight, 10) + 20;
	
	ShowWindow = window.open(ShowUrl, "Show", 'width='+ShowWidth+', height='+ShowHeight+', left=20, top=20, resizable=yes');
	ShowWindow.focus();
	}


function OpenShowPosition(ShowUrl, ShowWidth, ShowHeight, ShowLeft, ShowTop)
	{
	ShowWidth = parseInt(ShowWidth, 10) + 20;
	ShowHeight = parseInt(ShowHeight, 10) + 20;
	
	ShowWindow = window.open(ShowUrl, "Show", 'width='+ShowWidth+', height='+ShowHeight+', left='+ShowLeft+', top='+ShowTop+', resizable=yes');
	ShowWindow.focus();
	}


function readCookie(cookieName) {
 var theCookie=" "+document.cookie;
 var ind=theCookie.indexOf(" "+cookieName+"=");
 if (ind==-1) ind=theCookie.indexOf(";"+cookieName+"=");
 if (ind==-1 || cookieName=="") return "";
 var ind1=theCookie.indexOf(";",ind+1);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+cookieName.length+2,ind1));
}

function setCookieVal (cookieKey, cookieVal, expireVal) {
	var now = new Date();
  var expireDate = new Date(now.getTime() + expireVal);
  //alert(expireDate.toGMTString());
  document.cookie = cookieKey + "=" + cookieVal + "; expires=" + expireDate.toGMTString() + "; path=/";
}

function checkLogin() {
	var checkboxVal = 	$('input#angemeldet_bleiben:checkbox:checked').val();
	if (checkboxVal != null && checkboxVal=="on") {
	 var username = $('input#username').val();
	 //alert(username +" will eingelogged werden ");
	 if (username != null && username.length > 0) {
	 	  setCookieVal("want_to_remain_loggedin", username, 1000*60*60*24*365*15); // 2027	
	   //alert("Cookie gesetzt " + readCookie("want_to_remain_loggedin"));
	 }
	}
	return true;
}

