

function chkMultiStatusChange(frm)
{
	var NoOfRecords = frm.hidNoOfRecords.value;
	var isSel = 0;
	if(!frm.slChange.value)
	return false;
	
	for(i=0;i<NoOfRecords;i++)
	{
		comObj = eval("frm.chk_" + i);
		if(comObj.checked == true)
		{
			isSel = 1;
		}
	}
	if(!isSel)
	{
		alert("Please select atleast one record to change the status");
		frm.slChange.value = '';
		return false;
	}
	frm.submit();
	return true;
//txtShortDesc, chk_, hidNoOfPrices, flImage, slStatus
}

function chkReferAFriend(frm)
{
	if(!notEmpty(frm.txtName,"Friend's Name"))
		return false;
	if(!notEmpty(frm.txtEmail,"Friend's E-mail"))
		return false;
	else
		return true;
}

function chkAddTemplate(frm)
{
	if(!notEmpty(frm.txtName,"Template Name"))
		return false;
	/* if(!notEmpty(frm.txtShortDesc,"Short Description"))
		return false;
	if(!notSelected(frm.slStatus,"Status"))
	return false; */
	else
	return true;
}

function chkStuWebpageFrm(frm)
{
	if(!notSelected(frm.slStatus,"Status"))
		return false;
	else
		return true;
}

function chkContactFrm(frm)
{
	if(!notEmpty(frm.txtPostcode,"Postcode"))
		return false;
	else
		return true;
}

function chkAccessFrm(frm)
{
	if(!notEmpty(frm.txtAccessEmail,"E-mail Address"))
		return false;
	else if(!notEmail(frm.txtAccessEmail,"E-mail Address"))
		return false;
	else
		return true;
}

function changePaymentType(frm)
{
	x = document.getElementById("ccDiv");
	comval = frm.slPaymentType.value;
	if(comval == 'CC')
	{
		x.style.display = '';
	}
	else
	{
		x.style.display = 'none';
	}
	return true;
}

function changeEnrollmentStatus(frm)
{
	x = document.getElementById("paidDiv");
	comval = frm.slEnrollStatus.value;
	if(comval == 'P')
	{
		x.style.display = '';
	}
	else
	{
		x.style.display = 'none';
	}
	return true;
}

function chkAddTemplateFrm(frm,isEdit)
{
	if(!notEmpty(frm.txtName,"Template Title"))
		return false;
	else
	return true;
}

function chkSendNewsletter(frm)
{
	if(!notEmpty(frm.txtSubject,"Subject"))
		return false;
	if(!notEmpty(frm.txtEmail,"E-mail addresses"))
		return false;
	else
		return true;
}

function chkAddArticleFrm(frm,isEdit)
{
	if(!notEmpty(frm.txtName,"Article Title"))
		return false;
	if(!notEmpty(frm.txtShortDesc,"Short Description"))
		return false;
	if(!isEdit)
	{
		if(!noFileSelected(frm.flImage,"Image"))
			return false;
	}
	if(!notSelected(frm.slStatus,"Status"))
	return false;
	else
	return true;
}

function chkAddDocumentFrm(frm,isEdit)
{
	if(!notEmpty(frm.txtName,"Document Title"))
		return false;
	if(!notEmpty(frm.txtShortDesc,"Short Description"))
		return false;
	if(!isEdit)
	{
		//if(!noFileSelected(frm.flDoc,"Document File"))
		//	return false;
	}
	if(!notSelected(frm.slStatus,"Status"))
	return false;
	else
	return true;
}

function chkAddWebpageFrm(frm)
{
	if(!notEmpty(frm.txtTitle,"Website Title"))
		return false;
	if(!notEmpty(frm.txtEthinicity,"Ethinicity"))
		return false;
	if(!notEmpty(frm.txtHairColor,"Hair Color"))
		return false;
	if(!notEmpty(frm.txtEyeColor,"Eye Color"))
		return false;
	if(!notEmpty(frm.txtWeight,"Weight"))
		return false;
	if(!notEmpty(frm.txtHeight,"Height"))
		return false;
	if(!notEmpty(frm.txtHeadSize,"Head Size"))
		return false;

	if(!notEmpty(frm.txtChest,"Chest"))
		return false;
	if(!notEmpty(frm.txtWaist,"Waist"))
		return false;
	if(!notEmpty(frm.txtHips,"Hips"))
		return false;
	if(!notEmpty(frm.txtArms,"Arms"))
		return false;
	if(!notEmpty(frm.txtNeck,"Neck"))
		return false;
	if(!notEmpty(frm.txtClothesSize,"Clothes Size"))
		return false;

	if(!notEmpty(frm.txtOutsideLeg,"Outside Leg"))
		return false;
	if(!notEmpty(frm.txtInsideLeg,"Inside Leg"))
		return false;
	if(!notEmpty(frm.txtShoeSize,"Shoe Size"))
		return false;
	if(frm.txtBlogTitle1)
	{
		if(!notEmpty(frm.txtBlogTitle1,"Blog title-1"))
			return false;
	}
	if(frm.flImage1)
	{
		if(!frm.hidWebpageBoxId_1.value)
		{
			if(!noFileSelected(frm.flImage1,"Image"))
			return false;
		}
	}
	else
		return true;
/*
	if(!notEmpty(frm.txtTraining,"E-mail"))
		return false;
	if(!notEmpty(frm.txtWorkExp,"Gender"))
		return false;
	if(!notEmpty(frm.txtInterestSkills,"Birth Date"))
		return false;
*/
}

function chkAddStudentFrm(frm,isEdit)
{
	if(!notEmpty(frm.txtStudentCode,"Student Code"))
		return false;
	if(!notEmpty(frm.txtFirstName,"First Name"))
		return false;
	if(!notEmpty(frm.txtLastName,"Last Name"))
		return false;
	//if(!notEmpty(frm.txtEmail,"E-mail"))
		//return false;
	if(!notRadioSelected(frm.rdGender,"Gender"))
		return false;
	if(!notEmpty(frm.txtBirthDate,"Birth Date"))
		return false;

	if(!notEmpty(frm.txtAddress1,"Address"))
		return false;
	if(!notEmpty(frm.txtSuburb,"Suburb"))
		return false;
	if(!notEmpty(frm.txtState,"State"))
		return false;
	if(!notEmpty(frm.txtZipcode,"Post code"))
		return false;

	if(!notEmpty(frm.txtContNo,"Contact No"))
		return false;
	else if(!notPhone(frm.txtContNo,"Contact No"))
		return false;

	if(frm.slStatus)
	{
		if(!notSelected(frm.slStatus,"Status"))
		return false;
	}
	if(frm.rdNewsletter)
	{
		if(!notRadioSelected(frm.rdNewsletter,"Newsletter"))
		return false;
	}

	if(!notEmpty(frm.txtEmergencyContact,"Emergency Contact"))
		return false;
	if(!notEmpty(frm.txtEmergencyContNo,"Emergency Contact No"))
		return false;
	else if(!notPhone(frm.txtEmergencyContNo,"Emergency Contact No"))
		return false;
	if(!notRadioSelected(frm.rdYoung,"15 Years Age"))
		return false;

	if(frm.rdYoung[1].checked == true)
	{
		if(!notEmpty(frm.txtParentsName,"Parents Name"))
			return false;
		if(!notEmpty(frm.txtParentsEmail,"Parents E-mail"))
			return false;
		if(!notEmpty(frm.txtParentsContNo,"Parents Contact No"))
			return false;
		else if(!notPhone(frm.txtParentsContNo,"Parents Contact No"))
			return false;
	}

	if(!isEdit)
	{
		if(!notSelected(frm.slBranch,"Branch"))
			return false;
		if(!notSelected(frm.slCourse,"Course"))
			return false;
		if(!notSelected(frm.slEnrollStatus,"Enrolment Status"))
			return false;
	
		comval = frm.slPaymentType.value;
		comStatus = frm.slEnrollStatus.value;
		
		if(comStatus == 'P')
		{
			if(!notSelected(frm.slPaymentType,"Payment Type"))
				return false;
			
			if(comval == 'CC')
			{
				if(!notSelected(frm.slCreditCard,"Credit Card Type"))
				return false;
				if(!notEmpty(frm.txtCCName,"Name on Credit Card"))
				return false;
				if(!notEmpty(frm.txtCCNumber,"Credit Card Number"))
				return false;
				else if(!notPosNumber(frm.txtCCNumber,"Credit Card Number"))
				return false;
				if(!notSelected(frm.expiryDateMonth,"Credit Card Expiry Month"))
				return false;
				if(!notSelected(frm.expiryDateYear,"Credit Card Expiry Year"))
				return false;
				if(!notEmpty(frm.txtSecurityCode,"Security Code"))
				return false;
			}
		}
		
		if(!notEmpty(frm.txtAmountPaid,"Amount"))
			return false;
		else if(!notCurrency(frm.txtAmountPaid,"Amount"))
			return false;
	}
	else
		return true;
}

function chkChangePass(frm)
{
	if(!notEmpty(frm.txtOldPassword,"Old Password"))
	return false;
	if(!notEmpty(frm.txtPassword,"New Password"))
	return false;
	if(!notEmpty(frm.txtPasswordConf,"Confirm New Password"))
	return false;
	else if(!notCompare(frm.txtPassword,frm.txtPasswordConf,"Password doesn't match"))
	return false;
}

function chkEvaStudentsOfClass(frm)
{
	var NoOfCri = frm.hidNoOfCri.value;
	var NoOfEnr = frm.hidNoOfEnr.value;
	var comObj;
	
	for(c=0;c<NoOfEnr;c++)
	{
		for(h=0;h<NoOfCri;h++)
		{
			//alert('here');
			comObj = eval("document.frmEvaStudentsOfClass.txtEva_" + c + "_" + h);
			//alert("document.frmEvaStudentsOfClass.txtEva_" + i + "_" + p);
			//alert(comObj.value);
			if(comObj)
			{
				if(!notEmpty(comObj,"grade"))
					return false;
				else if(!notCurrency(comObj,"grade"))
					return false;
			}
		}
	}
	return true;
}

function chkEnrStudentFrm(frm,isEdit)
{
	if(!notSelected(frm.slStudent,"Student"))
		return false;
	if(!notSelected(frm.slBranch,"Branch"))
		return false;
	if(!notSelected(frm.slCourse,"Course"))
		return false;
	if(!notSelected(frm.slEnrollStatus,"Enrolment Status"))
		return false;

	comval = frm.slPaymentType.value;
	comStatus = frm.slEnrollStatus.value;
		
	if(comStatus == 'P')
	{
		if(!notSelected(frm.slPaymentType,"Payment Type"))
			return false;
			
		if(comval == 'CC')
		{
			if(!notSelected(frm.slCreditCard,"Credit Card Type"))
				return false;
			if(!notEmpty(frm.txtCCName,"Name on Credit Card"))
				return false;
			if(!notEmpty(frm.txtCCNumber,"Credit Card Number"))
				return false;
			else if(!notPosNumber(frm.txtCCNumber,"Credit Card Number"))
				return false;
			if(!notSelected(frm.expiryDateMonth,"Credit Card Expiry Month"))
				return false;
			if(!notSelected(frm.expiryDateYear,"Credit Card Expiry Year"))
				return false;
			if(!notEmpty(frm.txtSecurityCode,"Security Code"))
				return false;
		}
	}
		
	if(!notEmpty(frm.txtAmountPaid,"Amount"))
		return false;
	else if(!notCurrency(frm.txtAmountPaid,"Amount"))
		return false;
}

function chkAddAgentFrm(frm,isEdit)
{
	if(!notEmpty(frm.txtAgentCode,"Agent Code"))
		return false;
	if(!notEmpty(frm.txtFirstName,"First Name"))
		return false;
	if(!notEmpty(frm.txtLastName,"Last Name"))
		return false;
	if(!notEmpty(frm.txtEmail,"E-mail"))
		return false;
	if(!notRadioSelected(frm.rdGender,"Gender"))
		return false;

	if(!notEmpty(frm.txtAddress1,"Address"))
		return false;
	if(!notEmpty(frm.txtSuburb,"Suburb"))
		return false;
	if(!notEmpty(frm.txtState,"State"))
		return false;
	if(!notEmpty(frm.txtZipcode,"Post code"))
		return false;

	if(!notEmpty(frm.txtContNo,"Contact No"))
		return false;
	else if(!notPhone(frm.txtContNo,"Contact No"))
		return false;

	if(frm.slStatus)
	{
		if(!notSelected(frm.slStatus,"Status"))
		return false;
	}
	if(frm.rdNewsletter)
	{
		if(!notRadioSelected(frm.rdNewsletter,"Newsletter"))
		return false;
	}
	if(!notMultiSelected(frm["slStudent[]"],"Student"))
		return false;
	else
	return true;
}

function chkAddManagerFrm(frm,isEdit)
{
	if(!notEmpty(frm.txtManagerCode,"Manager Code"))
		return false;
	if(!notSelected(frm.slBranch,"Branch"))
		return false;
	if(!notEmpty(frm.txtFirstName,"First Name"))
		return false;
	if(!notEmpty(frm.txtLastName,"Last Name"))
		return false;
	if(!notEmpty(frm.txtEmail,"E-mail"))
		return false;
	if(!notRadioSelected(frm.rdGender,"Gender"))
		return false;

	if(!notEmpty(frm.txtAddress1,"Address"))
		return false;
	if(!notEmpty(frm.txtSuburb,"Suburb"))
		return false;
	if(!notEmpty(frm.txtState,"State"))
		return false;
	if(!notEmpty(frm.txtZipcode,"Post code"))
		return false;

	if(!notEmpty(frm.txtContNo,"Contact No"))
		return false;
	else if(!notPhone(frm.txtContNo,"Contact No"))
		return false;

	if(frm.txtMobileNo,"Mobile No")
	{
		if(!notPhone(frm.txtMobileNo,"Mobile No"))
		return false;
	}

	if(frm.slStatus)
	{
		if(!notSelected(frm.slStatus,"Status"))
		return false;
	}
	if(frm.rdNewsletter)
	{
		if(!notRadioSelected(frm.rdNewsletter,"Newsletter"))
		return false;
	}
	else
	return true;
}

function chkAddBranchFrm(frm,isImage)
{
	if(!notEmpty(frm.txtName,"Branch Name"))
		return false;
	if(!notEmpty(frm.txtAddress1,"Branch Address"))
		return false;
	if(!notEmpty(frm.txtSuburb,"Branch Suburb"))
		return false;
	if(!notEmpty(frm.txtState,"Branch State"))
		return false;
	if(!notEmpty(frm.txtZipcode,"Post code"))
		return false;

	if(!notEmpty(frm.txtPhoneNumber,"Phone No"))
		return false;
	else if(!notPhone(frm.txtPhoneNumber,"Phone No"))
		return false;

	if(frm.txtFaxNumber.value)
	{
		if(!notPhone(frm.txtFaxNumber,"Fax No"))
		return false;
	}
	
	if(frm.flImage && !isImage)
	{
		if(!noFileSelected(frm.flImage,"Image"))
		return false;
	}

	if(frm.slWebStatus)
	{
		if(!notSelected(frm.slWebStatus,"Webcam Status"))
		return false;
	}
	if(frm.slStatus)
	{
		if(!notSelected(frm.slStatus,"Status"))
		return false;
	}
	else
	return true;
}

function chkAddCourseFrm(frm,isEdit)
{
	if(!notEmpty(frm.txtTitle,"Course Title"))
		return false;
	if(!notEmpty(frm.txtCourseCode,"Course Code"))
		return false;
	if(!notSelected(frm.slBranch,"Branch"))
		return false;
	if(!notEmpty(frm.txtShortDesc,"Short description"))
		return false;
	if(!notEmpty(frm.txtStartDate,"Start Date"))
		return false;
	if(!notEmpty(frm.txtEndDate,"End Date"))
		return false;

	if(!notEmpty(frm.txtCourseFee,"Course Fee"))
		return false;
	if(frm.slHoliCourse)
	{
		if(!notSelected(frm.slHoliCourse,"Holiday Course"))
		return false;
	}
	if(frm.slStatus)
	{
		if(!notSelected(frm.slStatus,"Status"))
		return false;
	}
	else
	return true;
}

function chkQckSearch(frm)
{
	if(frm.txtKey.value=='Enter Your Keyword')
		frm.txtKey.value = '';

	if(!notEmpty(frm.txtKey,"Search Keyword"))
		return false;
	else
		return true;
}

function chkContactUsFrm(frm)
{
	if(!notEmpty(frm.txtName,"Name"))
		return false;
	if(!notEmpty(frm.txtEmail,"E-Mail Address"))
		return false;
	if(!notEmpty(frm.txtContNo,"Contact No"))
		return false;
	else if(!notPhone(frm.txtContNo,"Contact No"))
		return false;
	if(!notEmpty(frm.txtEnquiry,"Enquiry"))
		return false;
	else
	return true;
}

function chkImportMember(frm)
{
		if(!noFileSelected(frm.flImage,"Excel File"))
			return false;
}


function chkForgotPassword(frm)
{
	if(!notEmpty(frm.txtUserName,"User Name"))
	return false;
	if(!notEmpty(frm.txtEmail,"E-mail"))
	return false;
}

function chkLogin(frm)
{
	if(!notEmpty(frm.UserName,"User Name"))
	return false;
	if(!notEmpty(frm.Pwd,"Password"))
	return false;
	else
	{
	//document.frmLoginFrm.submit();
	return true;
	}
}



function interFrmSubmit()
{
	frm = document.paypal_form;
	//alert(frm);
	frm.submit();
	return false;
}


function ageOptionChange(frm)
{
	var chkOpt = frm.rdYoung[1].checked;
	x = document.getElementById("parentdet");
	if(chkOpt == true)
		x.style.display = '';
	else
		x.style.display = 'none';
	return true;
}

function showStudioImage(comid,branchid)
{
	//alert('inside');
	//setTimeout("firstLoadFunction()", 5000);
	firstLoadFunction(comid,branchid);
}

function showImage(comid)
{
	setTimeout("showImageFinal('" + comid + "' )", 500);
}

function showImageFinal(comid)
{
	x = document.getElementById("lstgalimage");
	x.src = eval("document.tmpform." + comid + ".value");
	return true;
}

function dateSelected(comDate,forDate,NoOfEvaluations)
{
	x = document.getElementById(comDate);
	if(x.className != 'weekDayBack')
	x.className = 'weekDayBack';
	else
	x.className = 'weekDay';
	
	y = document.getElementById('dateSelArea');
	var inCon = new String(y.innerHTML);
	var formCon = new String(document.frmAddClass.hidDates.value);
	var NoOfEvaluations = NoOfEvaluations;

	if(navigator.appName == 'Microsoft Internet Explorer')
		var comIcon = '<BR>';
	else
		var comIcon = '<br>';


	if(x.className != 'weekDayBack')
	{
		var confBack;
		confBack = true;
		if(NoOfEvaluations > 0)
		{
			confBack = confirm("This class/session has been evaluated before.\n\nIf you remove that class/session from this course, assessment information associated with it will be deleted.\n\nAre you sure you want to uncheck this class/session?");
		}
		if(confBack == true)
		{
			y.innerHTML = inCon.replace(forDate + comIcon,'');
			document.frmAddClass.hidDates.value = formCon.replace(comDate + ',','');
		}
		else
		{
			x.className = 'weekDayBack';
		}
	}
	else
	{
		y.innerHTML = y.innerHTML + forDate + comIcon;
		document.frmAddClass.hidDates.value = formCon + comDate + ',';
	}
	
	z = document.getElementById('butDiv');
	if(y.innerHTML)
		z.style.display = '';
	else
		z.style.display = 'none';

	return true;
}

function showMenu(comId)
{
	x = document.getElementById(comId);
	x.className = 'mItemOver ' + comId +'Over';

	chkmouseover(comId);
		//alert(document.forms.length);
		for(i=0;i<document.forms.length;i++)
		{
			var theForm = document.forms[0];
			//alert(theForm.elements.length);
			for(p=0;p<theForm.elements.length;p++)
			{
				//alert(theForm.elements[p].type);
				if(theForm.elements[p].type == 'select-one')
				theForm.elements[p].style.display = 'none';
			}
		}

	return true;
}

function hideMenu(comId)
{
	x = document.getElementById(comId);
	x.className = comId;

	chkmouseout(comId);
		//alert(document.forms.length);
		for(i=0;i<document.forms.length;i++)
		{
			var theForm = document.forms[0];
			for(p=0;p<theForm.elements.length;p++)
			{
				if(theForm.elements[p].type == 'select-one')
				theForm.elements[p].style.display = '';
			}
		}

	return true;
}


function chkQuickSearchFront(frm)
{
	if(!frm.txtQckSearch.value && !frm.slCarType.value)
	{
		alert('Please select atleast one option!');
		return false;
	}
	else
	return true;
}

function chkQuickSearchTwo(frm)
{
	if(!notSelected(frm.slOpt,"Option"))
		return false;
	if(!notEmpty(frm.keyword,"Search Keyword"))
		return false;
	else
		return true;
}

function notChecked(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(passObj.checked == false)
	{
		alert(msg);
		passObj.focus();
		return false;
	}
	return true;
}

function notEmptyFocus(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(!passObj.value)
	{
		alert('Please enter a value for ' + msg + ' Field !!');
		return false;
	}
	return true;
}

function notEmail(obj)
{
	var passObj = obj;
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;

	// search email text for regular exp matches
	if (passObj.value.search(validRegExp) == -1)
	{
		alert('Please enter valid e-mail address');
		passObj.focus();
		return false;
	}
	return true; 
}

function notEmpty(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(!passObj.value)
	{
		alert('Please enter a value for ' + msg + ' Field !!');
		passObj.focus();
		return false;
	}
	return true;
}

function notValidRange(obj,start,end,msg)
{
	var passObj = new String(obj.value);
	var passMsg = msg;
	if(passObj.length < 4 || passObj.length > 14)
	{
		alert('Your ' + msg + ' has to be between ' + start + ' and ' + end + ' characters!!');
		obj.focus();
		return false;
	}
	return true;
}

function notCurrency(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890.";
	var matched = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		for (j = 0;  j < checkOK.length;  j++)
		{
			if(passObj.charAt(p) == checkOK.charAt(j))
			{
			matched = 1;
			break;
			}
		}
		if(matched==0)
		{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
		}
	}
	return true;
}

function notNumber(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890";
	var matched = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		for (j = 0;  j < checkOK.length;  j++)
		{
			if(passObj.charAt(p) == checkOK.charAt(j))
			{
			matched = 1;
			break;
			}
		}
		if(matched==0)
		{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
		}
	}
	return true;
}

function notPosNumber(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890";
	var matched = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		for (j = 0;  j < checkOK.length;  j++)
		{
			if(passObj.charAt(p) == checkOK.charAt(j))
			{
			matched = 1;
			break;
			}
		}
		if(matched==0)
		{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
		}
	}
	if(passObj <= 0)
	{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
	}
	return true;
}

function notPhone(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890-()+ ";
	var matched = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		for (j = 0;  j < checkOK.length;  j++)
		{
			if(passObj.charAt(p) == checkOK.charAt(j))
			{
			matched = 1;
			break;
			}
		}
		if(matched==0)
		{
			alert("Please enter a valid " + msg);
			obj.focus();
			return false;
		}
	}
	return true;
}

function notCompare(obj,secobj,msg)
{
	var passObj = obj;
	var passObjSec = secobj;
	var passMsg = msg;
	if(passObj.value != passObjSec.value)
	{
		alert(msg);
		passObjSec.focus();
		return false;
	}
	return true;
}
function notSelected(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(!passObj.value)
	{
		alert('Please select a value for ' + msg + ' Field !!');
		passObj.focus();
		return false;
	}
	return true;
}

function notMultiSelected(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	var noOfEle = obj.length;
	var found = 0;
	
	for(i=0;i<noOfEle;i++)
	{
		if(obj[i].selected == true)
		{
			found = 1;
			break;
		}
	}
	if(found==0)
	{
		alert('Please select atleast one option for ' + msg);
		return false;
	}
	return true;

}

function notTwoDecimalCurrency(obj,msg)
{
	var passObj = obj.value;
	var passMsg = msg;
	var checkOK = "1234567890.";
	var matched = 0;
	var afterDot = 0;
	for (p = 0;  p < passObj.length;  p++)
	{
		matched = 0;
		if(passObj.charAt(p) == '.')
		{
			afterDot = (passObj.length - p) - 1;
			if(afterDot > 0 && afterDot < 3)
			return true
			else if(afterDot == 0)
			{
				alert("Invalid . (dot) in price !!!");
				obj.focus();
				return false;
			}
			else if(afterDot > 2)
			{
				alert("There has to be only 2 decimal places !!!");
				obj.focus();
				return false;
			}
		}
	}
	return true;
}


function noFileSelected(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	if(!passObj.value)
	{
		alert('Please select ' + msg + ' !!');
		passObj.focus();
		return false;
	}
	return true;
}

function notRadioSelected(obj,msg)
{
	var passObj = obj;
	var passMsg = msg;
	var noOfEle = obj.length;
	var found = 0;
	
	for(i=0;i<noOfEle;i++)
	{
		if(obj[i].checked == true)
		{
			found = 1;
			break;
		}
	}
	if(found==0)
	{
		alert('Please select an option for ' + msg);
		return false;
	}
	return true;
}

////////////////////////////////////////////////////////////////////
// XML functions and AJAX things
////////////////////////////////////////////////////////////////////
var xmlHttp;

function retCourses(BraId)
{
	xmlHttp = GetXmlHttpObject()
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return false;
	}

	var urlPass = "retrieve-courses.php";
	urlPass = urlPass + "?BraId=" + BraId;
	urlPass = urlPass + "&sid="+Math.random();
	//alert(urlPass);
	xmlHttp.onreadystatechange = fillCourses;
	urlPass = new String(urlPass);
	xmlHttp.open("GET",urlPass);
	xmlHttp.send(null);
	return true;
}

function fillCourses()
{
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		document.getElementById("slCourse").innerHTML = xmlHttp.responseText;
	}

	return true;
}

function GetXmlHttpObject()
{ 
	var objXMLHttp=null;
	if(window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}


////////////////////////////////////////////////////////////////////
// menu functions
////////////////////////////////////////////////////////////////////

function chkmouseover(passobj)
{
	x = document.getElementById(passobj);
	curX = findPosX(x);
	curY = findPosY(x);
	//alert("curX " + curX);
	//alert("curY " + curY);

	y = document.getElementById('menu' + passobj);

	y.style.display = '';

	if(passobj == 'catmenu' || passobj == 'supportmenu' || passobj == 'actcatmenu' || passobj == 'actsupportmenu')
	{
		if(navigator.appName == 'Microsoft Internet Explorer')
		{
			y.style.top = curY + 108;
			y.style.left = curX - 222;
		}
		else
		{
			y.style.top = (curY + 1) + "px";
			y.style.left = (curX - 222) + "px";
		}
	}
	else
	{
		if(navigator.appName == 'Microsoft Internet Explorer')
		{
			y.style.top = curY + 21;
			y.style.left = curX - 1;
		}
		else
		{
			y.style.top = (curY + 20) + "px";
			y.style.left = (curX + 0) + "px";
		}
	}
	//alert(y.style.top);
	//alert(y.style.left);
}

function chkmouseout(passobj)
{
	y = document.getElementById('menu' + passobj);

	y.style.display = 'none';
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function screenWidth()
{
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	return frameWidth;
}

function screenHeight()
{
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	return frameHeight;
}
