function readAndShowJoke() {
	var url="http://www.toolsbysk.com/jokes.txt";
	var oRequest = new XMLHttpRequest();
	oRequest.open("GET",url,false);
	oRequest.setRequestHeader("User-Agent",navigator.userAgent);
	oRequest.send(null)

	if (oRequest.status==200){
		document.getElementById('jokepara').innerHTML=oRequest.responseText;
	}
	else document.getElementById('jokepara').innerHTML="Could not get joke.<br/><br/>Network connection interrupted!!!";
}

function readAndShowQuote() {
	var url="http://www.toolsbysk.com/quotes.txt";
	var oRequest = new XMLHttpRequest();
	oRequest.open("GET",url,false);
	oRequest.setRequestHeader("User-Agent",navigator.userAgent);
	oRequest.send(null)

	if (oRequest.status==200){
		document.getElementById('quotepara').innerHTML=oRequest.responseText;
	}
	else document.getElementById('quotepara').innerHTML="Could not get quote.<br/><br/>Network connection interrupted!!!";
}

function readAndShowSplitterAds() {
	var url="http://www.toolsbysk.com/sksplitter/ads/splitterads.html";
	var oRequest = new XMLHttpRequest();
	oRequest.open("GET",url,false);
	oRequest.setRequestHeader("User-Agent",navigator.userAgent);
	oRequest.send(null)

	if (oRequest.status==200){
		document.getElementById('splitterad').innerHTML=oRequest.responseText;
	}
	else document.getElementById('splitterad').innerHTML="Could not get quote.<br/><br/>Network connection interrupted!!!";
}

function loadFromJar( pJarName, pMainClass, pTitle) {
	// specify window parameters
	skspliterWin = window.open( "", "photo", "width=420,height=320,status,screenX=20,screenY=40,left=20,top=40", resizable="no");
		
	// wrote content to window
	skspliterWin.document.write('<html style="padding:0; margin:0;"><head><title>' + pTitle + '</title>');
	skspliterWin.document.write('<script language=\"javascript\" type=\"text/javascript\">function checkJavaScriptValidity() {document.getElementById("jsEnabled").style.visibility="visible"\; document.getElementById("jsDisabled").style.visibility="hidden";}<\/script><script language="javascript" type="text/javascript" src="/toolsbysk_common.js"></script><\/head>');
	skspliterWin.document.write('<body style="background-color:#CCCC66; padding: 5px; margin:0px;" onload="checkJavaScriptValidity()">');
	skspliterWin.document.write('<div id="jsEnabled" style="visibility:hidden"><applet alt="Sorry, cant run" code='+pMainClass+' archive='+ pJarName+' width=410 height=200>Please enable java in browser...<\/applet><\/div>');
	skspliterWin.document.write('<div style="width:420; height:100; margin-top:4px;" id="splitterad"><script type="text/javascript">readAndShowSplitterAds()</script></div>');
		skspliterWin.document.write('<div id="jsDisabled">JavaScript is disabled in your browser. Please enable javascript to run this application</div>');
	skspliterWin.document.write('</body>');
	skspliterWin.document.write('</html>');
	skspliterWin.document.close();	
	
	// If we are on NetScape, we can bring the window to the front
	if (navigator.appName.substring(0,8) == "Netscape") skspliterWin.focus();
}

function checkJavaScriptValidity() {
	document.getElementById("jsEnabled").style.visibility="visible"; 
	document.getElementById("jsDisabled").style.visibility="hidden";
}

function checkRegisterForm(form){
	if (form.firstname.value.match(/^s+$/) || form.firstname.value == "") {
		alert( "Firstname can't be empty.." );
		form.firstname.focus();
		return false ;
	}
	if (! form.firstname.value.match(/^\w+$/)) {
		alert( "Firstname can have only letters, digits or uderscore. No other characters including space are allowed." );
		form.firstname.focus();
		return false ;
	}
	if (form.lastname.value.match(/^s+$/) || form.lastname.value == "") {
		alert( "Lastname can't be empty.." );
		form.lastname.focus();
		return false ;
	}
	if (form.emailid.value == "") {
		alert( "Email address can't be null." );
		form.emailid.focus();
		return false ;
	}
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (! filter.test(form.emailid.value)) {
		alert( "Invalid email address.." );
		form.emailid.focus();
		return false ;
	}
	if (form.password.value == "") {
		alert( "Password cannot be empty.." );
		form.password.focus();
		return false ;
	}
	return true ;
}
