
// switch class fucntion, invisible/visible.
function classChange( id, newclass )
		  {
		    element = document.getElementById(id);
		    if(element)
		      element.className = newclass ;
		  }

// Popup window script. Passes height, width, title, img 
		
function newWindow(img,title,w,h) {
var day= new Date();
var id = day.getTime();
var ww = w+30; // Make room for scrollbars
var wh = h+60; // and a close button
var params = 'width='+ww+',height='+wh+',scrollbars,resizable';

// Build the output and store it all in msg
var msg='<html><head><title>'+img+'</title><link rel="stylesheet" href="http://www.mmmach.com.au/css/new.css" type="text/css"></head><body><div class="h3_nolink">&nbsp;'+
title+'</div>\n<div align="center"><img src="'+img+'" style="float: left;" width="'+w+'" height="'+h+'" border="0" alt="'+title+'"><br>\n'+
'<a class="close" href="javascript:window.close();">close window</a><br>\n'+
'</div></body></html>\n';

// Write it all out
var win = open('',id,params);
win.document.write(msg);
win.document.close();
}
	
function validateForm() {
with (document.stock_adm) {
var alertMsg = "Please select a record to update/delete!";
radioOption = -1;
for (counter=0; counter<stock_id.length; counter++) {
if (stock_id[counter].checked) radioOption = counter;
}
{
if (action.value == "insert_page") radioOption = counter;
}

if (radioOption == -1) alertMsg += "\n";
if (alertMsg != "Please select a record to update/delete!") {
alert(alertMsg);
return false;
} else {
return true;
} } }

// non-empty textbox

function isEmpty(strng) {
var error = "";
  if (strng.length == 0) {
     error = "The mandatory text area has not been filled in.\n"
  }
return error;	  
}


// exactly one radio button is chosen

function checkRadio(checkvalue) {
var error = "";
   if (!(checkvalue)) {
       error = "Please check a radio button.\n";
    }
return error;
}

// valid selector from dropdown list

function checkDropdown(choice) {
var error = "";
    if (choice == 0) {
    error = "You didn't choose an option from the drop-down list.\n";
    }    
return error;
}    
