//Function to change page from option list
function linkURL(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

//Function to open pop up window
function winOpener(theURL, winName, scrollbars, resizable, width, height) {
	
	winFeatures = 'left=' + (screen.availWidth-10-width)/2 + ',top=' + (screen.availHeight-30-height)/2 + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',toolbar=0,location=0,status=1,menubar=0'
  	window.open(theURL, winName, winFeatures);
}

//////////////////////////////////////////////////////////////////////////////

function oeffnefenster (url) {
 fenster = window.open(url, "fenster1", "width=920,height=700,status=yes,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes");
 fenster.focus();
}

function OpenPS (url) {
 fenster = window.open(url, "fenster1", "width=920,height=700,status=yes,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes");
 fenster.focus();
}

function OpenForgottenPW (url) {
 fenster = window.open(url, "fensterFPW", "width=700,height=450,status=no,scrollbars=no,resizable=yes,toolbar=no,menubar=no");
 fenster.focus();
}

//Function to open link in main window (PokerSpace)
function openInMainWin(winLocation){
  window.opener.top.location.href = winLocation
  //window.opener.top.focus();
  window.opener.top.focus();
}

//Funtion to check or uncheck all the delete boxes (PokerSpace GuestBook)
function checkAll(){
	
	for (i=0; i < document.frmDelete.chkDelete.length; i++){
		document.frmDelete.chkDelete[i].checked = document.frmDelete.chkAll.checked;
	}
}

//Funtion to only allow numeric input
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}

//Funtion to only allow time input
function checktime(timeinput) {
var a,b,c,f,err=0;
var a=timeinput.value;
if (a.length != 5) err=1;
b = a.substring(0, 2);
c = a.substring(2, 3);
f = a.substring(3, 5);
if (/\D/g.test(b)) err=1;
if (/\D/g.test(f)) err=1;
if (b<0 || b>23) err=1;
if (f<0 || f>59) err=1;
if (c != ':') err=1;
if (err==1) {
alert ('Bitte geben Sie die Zeit in einem gültigen Zeit-Format ein (Bsp: 19:00)');
timeinput.value = "00:00";
timeinput.focus();
}
}

function checktimecomplete(timeinput) {
var a=timeinput.value;
if (a.length == 2) {
timeinput.value = timeinput.value + ':';
}
} 