function smilie(thesmilie,$thetxtbox) {
// inserts smilie text
    var oField = document.getElementById($thetxtbox); //get reference to the textarea
	
	
	
    var thesmilie = " " + thesmilie + " ";  //make the first half of the string, which includes the substring of the textarea starting at the first character and ending where the insertion point is at
	
	oField.value += thesmilie;
	
	oField.focus();

}

function newvalidateLogin(form) {
	if (form.txtusername.value == '') {
		alert("Username cannot be left blank.");
		return false;
	}
	if (form.txtpassword.value == '') {
		alert("Password cannot be left blank.");
		return false;
	}
}

function popitup6( $tutorial_id, $step_id ) {
	
	//alert( $tutorial_id + '    ' + $step_id );
	
	var url = "/ajax_popup_tut.php?tID=" + $tutorial_id + "&sID=" + $step_id;
	
	makeHttpRequest( url, popitup7 )
	
	//'./tuts/pics/8/{$tutorial.tutorial_id}/{$item.step_id}/popup.{$item.img_ext}','Temple of Heavenly Bliss', 384, 288,'white'
	
}

function popitup7( result ) {
	
	alert (result);

}



function popitup5(url, iwidth, iheight ) {
  
  var newwindow;
  
  iwidth = iwidth + 30;
  
  iheight = iheight + 50;
  
  newwindow=window.open( url ,'htmlname','width=' + iwidth +',height=' + iheight + ',resizable=1,top=50,left=10,scrollbars=yes,menubar=0');

  if (window.focus) {
	  
	  newwindow.focus()
  
  }
 
  return false;

}


function popupprint( url ) {
  
  var newwindow;
  
  iwidth = 820;
  
  iheight = 1200;
  
  newwindow=window.open( url ,'htmlname','width=' + iwidth +',height=' + iheight + ',resizable=1,top=50,left=10,scrollbars=yes,menubar=yes');

  if (window.focus) {
	  
	  newwindow.focus()
  
  }
 
  return false;

}

function popuplist( url ) {
  
  var newwindow;
  
  iwidth = 500;
  
  iheight = 500;
  
  newwindow=window.open( url ,'htmlname','width=' + iwidth +',height=' + iheight + ',resizable=1,top=50,left=10,scrollbars=yes,menubar=yes');

  if (window.focus) {
	  
	  newwindow.focus()
  
  }
 
  return false;

}



// Routines to tidy up popup windows when page is left
// Call with an onUnload="tidy5()" in body tag

function tidy5() {
    
	if (newwindow && !newwindow.closed) { 
	
	    newwindow.close(); 
		
	}

}