function checkform(of)
{
	setCookie('inpVal',getFormString(of,true));

	// Test if DOM is available and there is an element called required
	if(!document.getElementById || !document.createTextNode){return;}
	if(!document.getElementById('required')){return;}


	// Split the required fields
	var reqfields=document.getElementById('required').value.split(',');

	// loop over required fields
	for(var i=1;i<reqfields.length;i++)
	{
	// check if required field is there
		var f=document.getElementById(reqfields[i]);
		if(!f){continue;}
		// test if the required field has an error, 
		// according to its type
		switch(f.type.toLowerCase())
		{
			case 'text':
				if(f.value==''){alert("Mandatory fields missing. All the fields marked with a (*) are required. Please enter a proper value");return false;}							
			break;
			case 'textarea':
				if(f.value==''){alert("Mandatory fields missing. All the fields marked with a (*) are required. Please enter proper html text");return false;}							
			break;
			case 'checkbox':
				if(!f.checked){alert("Mandatory fields missing. All the fields marked with a (*) are required. Please use the checkbox");return false;}							
			break;
			case 'radio':
				if(!f.value){alert("Mandatory fields missing. All the fields marked with a (*) are required. Please click the radio button of your choice");return false;}							
			break;
			case 'select-one':
				if(!f.selectedIndex && f.selectedIndex==0){alert("Mandatory fields missing. All the fields marked with a (*) are required. Please select your choice");return false;}							
			break;
		}
	}
	return true;
}
