function OpenLTPgnViewerDemo()
{ window.open("ltpgnviewer.html?ltpgnviewerdemo.html","LTPgnViewerDemoWindow","width=640,height=390,menubar=no,locationbar=no,resizable=yes,status=no,scrollbars=no");
}
function OpenLTPgnBoard(urlstr, width, height)
{ window.open("ltpgnboard.html"+urlstr,"","width="+width+",height="+height+",menubar=no,locationbar=no,resizable=yes,status=no,scrollbars=no");
}
function OpenWindow(urlstr, width, height)
{ window.open(urlstr,"","width="+width+",height="+height+",menubar=no,locationbar=no,resizable=yes,status=no,scrollbars=no");
}
function OpenLTPgnViewer(urlstr, width, height)
{ window.open(urlstr,"LTPgnViewerWindow","width="+width+",height="+height+",menubar=no,locationbar=no,resizable=yes,status=no,scrollbars=no");
}
var selector;
function checking(selector) {
if((selector.options[selector.selectedIndex].text == '-----------------------------------') || selector.options.defaultIndex) {
selector.options.selectedIndex = selector.options.defaultIndex;
}
else {
passstr(selector);
}
}
function passstr(selector) 
{
str = selector.value;
OpenLTPgnViewer('ltpgnviewer.html?'+str+'.txt&ParsePgn=1&RotateBoard=true&AllowRecording=true&MoveForward=1', 760, 500);
}


function passfile(str) 
{
if ((str.search(".pgn") != -1 ) ||  (str.search(".txt") != -1 )) {
  
      myArray = new Array();
      myArray = str.split("\\");
      i = myArray.length - 1;
      str = myArray[i];

	if (str.search(".pgn") != -1 ) {		
alert("This only works for .txt files in pgn notation. Please make a copy of your .pgn file, saves as .txt, and try again.");
	} else {
	 	window.open("ltpgnviewer.html?"+str+"&ParsePgn=1", "", "width=760, height=500, menubar=no, locationbar=no, resizable=yes, status=no, scrollbars=no"); 
	}

} else {
alert("This only works for .txt files in pgn notation.")
}
}

function validateLogin(form)
      {
        if(!form.username.value || form.username.value == 'username')
        {
          alert('Username is required to login.');
          form.username.focus();
          return false;
        }
        if(!form.password.value)
        {
          alert('Password is required to login.');
          form.password.focus();
          return false;
        }
        return true;
      }
onerror = null;
function errorHandler(msg, url, line) {
        return true;
}       
window.onerror=errorHandler;
