// JavaScript Document
		function IsNumeric(sText){
			var ValidChars = "0123456789";
			var IsNumber=true;
			var Char;
			for (i = 0; i < sText.length && IsNumber == true; i++){ 
				Char = sText.charAt(i); 
				if (ValidChars.indexOf(Char) == -1){
					IsNumber = false;
				}
			}
			return IsNumber;		   
		}
		
		function CheckRegister() {
            var reap = new RegExp(/[a-zA-Z0-9_\-]*$/);
            var invalid = " ";
				
    		if((document.RegForm.NewUsername.value.match(reap) == false) || (document.RegForm.NewUsername.value.match(reap)!=document.RegForm.NewUsername.value)) {
	   		    alert("Username is empty or invalid! Please enter a valid username.");
			    document.RegForm.NewUsername.focus();
			    return false;
		    }
			if(document.RegForm.p1.value==""){
				window.alert('Enter your password please!');
				document.RegForm.p1.focus();
				return false;
			}
			//BR: remove whitespace. 10/24/06
			if(document.RegForm.p1.value.match(/\s/g)){
				document.RegForm.p1.value.replace( /\s/g, '' );
				window.alert('Whitespace not valid as an input!');
				document.RegForm.p1.focus();
				document.RegForm.p1.select();
				return false;
			}
			//BR:check min length. Not less than 4. 10/24/06
			if(document.RegForm.p1.value.length < 4){
				window.alert('Password must not be less than four(4) characters.');
				document.RegForm.p1.focus();
				return false;
			}
			//BR: End		
			if(document.RegForm.p2.value==""){
				window.alert('Confirm your password please!');
				document.RegForm.p2.focus();
				return false;
			}
			if(document.RegForm.p1.value != "" && document.RegForm.p2.value != "" && document.RegForm.p1.value != document.RegForm.p2.value){
				window.alert('Your passwords do not match! Please try again.');
				document.RegForm.p1.value="";
				document.RegForm.p2.value="";
				document.RegForm.p1.focus();
				return false;
			}
			if(document.RegForm.FirstName.value==""){
				window.alert('Enter your First Name, please!');
				document.RegForm.FirstName.focus();
				return false;
			}
			if(document.RegForm.LastName.value==""){
				window.alert('Enter your Last Name, please!');
				document.RegForm.LastName.focus();
				return false;
			}
			if(!document.RegForm.email.value.match(/^[a-zA-Z0-9\-\_\.]{1,280}@[a-zA-Z0-9\-\_\.]{2,280}.([a-zA-Z0-9\-\_]{3,280}.)?[a-zA-Z]{2,3}$/)) {
				alert('Please enter a Valid Email format.');
				document.RegForm.email.focus();
				return false;
			}
			if(document.RegForm.email.value != document.RegForm.email2.value) {
				document.RegForm.email2.value="";
				alert('Your email does not match. Re-enter your email address, please.');
				document.RegForm.email2.focus();
				return false;
			}
			if(document.RegForm.AccountType.value==1){
				if(document.RegForm.car_dealer.value==""){
					window.alert('Enter the name of the car dealership company please!');
					document.RegForm.car_dealer.focus();
					return false;
				}
			}
			if(document.RegForm.address.value==""){
				window.alert('Enter your address, please!');
				document.RegForm.state.focus();
				return false;
			}
			if(document.RegForm.state.value==""){
				window.alert('Enter your state, please!');
				document.RegForm.state.focus();
				return false;
			}
			if(document.RegForm.city.value==""){
				window.alert('Enter your city, please!');
				document.RegForm.city.focus();
				return false;
			}
			if(document.RegForm.areacode.value==""){
				window.alert('Enter your Area Code, please!');
				document.RegForm.areacode.focus();
				return false;			
			}
			if(document.RegForm.phone.value==""){
				window.alert('Enter your phone, please!');
				document.RegForm.phone.focus();
				return false;
			}
			if(document.RegForm.phone.value.match(/\s/g)){
				document.RegForm.phone.value.replace( /\s/g, '' );
				window.alert('Whitespace not valid as an input!');
				document.RegForm.phone.focus();
				document.RegForm.phone.select();
				return false;
			}
			if(document.RegForm.phone.value.length < 6){
				window.alert('Phone Number must not be less than six(6) digits.');
				document.RegForm.phone.focus();
				return false;
			}
			if(document.RegForm.phone.value.length > 8){
				window.alert('Phone Number must not be more than eight(8) digits.');
				document.RegForm.phone.focus();
				return false;
			}						
			//if((document.RegForm.phone.value.substring(0,2) != 13) && (document.RegForm.phone.value.substring(0,2) != 18)){
			//	window.alert('Invalid Phone Number.\nFirst two digit should be 13 or 18.');
			//	document.RegForm.phone.focus();
			//	return false;
			//}
			if (!IsNumeric(document.RegForm.phone.value)){ 
				window.alert('Invalid Phone Number.\nNumbers only.') 
				document.RegForm.phone.focus(); 
				return false; 
			}
			if(document.RegForm.checkTerms.checked==false){
				window.alert('You didn\'t agree with our Terms and Conditions, please tick on the checkbox!');
				document.RegForm.checkTerms.focus();
				return false;
			}
		}

		function CheckMail() {
			if(document.PostForm.u_name.value==""){
				alert('Enter your name, please!');
				document.PostForm.u_name.focus();
				return false;
			}
			if(document.PostForm.u_email.value==""){
				alert('Enter your email, please!');
				document.PostForm.u_email.focus();
				return false;
			}
			if(document.PostForm.subject.value==""){
				alert('Enter the subject, please!');
				document.PostForm.subject.focus();
				return false;
			}
			if(document.PostForm.message.value==""){
				alert('Enter your message, please!');
				document.PostForm.message.focus();
				return false;
			}
			if(document.PostForm.CategoryID.value==""){
				alert('Select your Category, please!');
				document.PostForm.CategoryID.focus();
				return false;
			}			
			if(document.PostForm.SubcategoryID.value==""){
				alert('Select your Make, please!');
				document.PostForm.SubcategoryID.focus();
				return false;
			}
			/*if(document.PostForm.make.value==""){
				alert('Select your Model, please!');
				document.PostForm.make.focus();
				return false;
			}*/
			if(document.PostForm.u_year.value==""){
				alert('Enter you Year, please!');
				document.PostForm.u_year.focus();
				return false;
			}
			if(document.PostForm.u_color.value==""){
				alert('Enter you Color, please!');
				document.PostForm.u_color.focus();
				return false;
			}
			if(document.PostForm.description.value==""){
				alert('Enter your Description, please!');
				document.PostForm.description.focus();
				return false;
			}
			if(document.PostForm.textfield.value==""){
				alert('Enter the correct code, please!');
				document.PostForm.textfield.focus();
				return false;
			}
			
		}

		function CheckOffer() {
			if(document.PostForm.CategoryID.value==""){
				alert('Select the category in which your offer will appear!');
				document.PostForm.CategoryID.focus();
				return false;
			}
			if(document.PostForm.SubcategoryID.value==""){
				alert('Select the subcategory in which your offer will appear!');
				document.PostForm.SubcategoryID.focus();
				return false;
			}
			/*
			if(document.PostForm.title.value==""){
				alert('Enter the title, please!');
				document.PostForm.title.focus();
				return false;
			}
			*/
			if(document.PostForm.address.value==""){
				alert('Enter the address, please!');
				document.PostForm.address.focus();
				return false;
			}
			if(document.PostForm.state.value==""){
				alert('Select a state please!');
				document.PostForm.state.focus();
				return false;
			}
			if(document.PostForm.city.value==""){
				alert('Select a city please!');
				document.PostForm.city.focus();
				return false;
			}
			if(document.PostForm.vehicle_type.value==""){
				alert('Select a vehicle type please!');
				document.PostForm.vehicle_type.focus();
				return false;
			}
			if(document.PostForm.year.value==""){
				alert('Select a year please!');
				document.PostForm.year.focus();
				return false;
			}
			if(document.PostForm.transmission.value==""){
				alert('Select a transmission please!');
				document.PostForm.transmission.focus();
				return false;
			}
			if(document.PostForm.fuel_type.value==""){
				alert('Select a fuel type please!');
				document.PostForm.fuel_type.focus();
				return false;
			}
			/*
			if(document.PostForm.ShortDesc.value==""){
				alert('Enter the vehicle short description, please!');
				document.PostForm.ShortDesc.focus();
				return false;
			}
			if(document.PostForm.DetailedDesc.value==""){
				alert('Enter the vehicle detailed description, please!');
				document.PostForm.DetailedDesc.focus();
				return false;
			}
			*/
			if(document.PostForm.Price.value=="" ){
				alert('Enter the vehicle price, please!');
				document.PostForm.Price.focus();
				return false;
			}
			
			if(document.PostForm.Price.value < 10){
				alert('Price must not less than 10.');	
				document.PostForm.Price.focus();
				return false;
			}
            if (isNaN(document.PostForm.Price.value)) {
                alert("Vehicle price does not appear to be a valid number.  Please try again.");
				document.PostForm.Price.focus();
                return false;
            }
		}

	function CheckForgot() {
		if(document.ForgotForm.u2.value==""){
			window.alert('Enter your Username, please!');
			document.ForgotForm.u2.focus();
			return false;
		}
	}
	
		function CheckProfile() {
			if(document.RegForm.p1.value != document.RegForm.p2.value){
				window.alert('Enter and confirm your password again!');
				document.RegForm.p1.value="";
				document.RegForm.p2.value="";
				document.RegForm.p1.focus();
				return false;
			}
			if(document.RegForm.FirstName.value==""){
				window.alert('Enter your First Name, please!');
				document.RegForm.FirstName.focus();
				return false;
			}
			if(document.RegForm.LastName.value==""){
				window.alert('Enter your Last Name, please!');
				document.RegForm.LastName.focus();
				return false;
			}
			/*if(document.RegForm.car_dealer.value==""){
				window.alert('Enter the name of the car dealership company please!');
				document.RegForm.car_dealer.focus();
				return false;
			}*/
			if(document.RegForm.state.value==""){
				window.alert('Enter your state, please!');
				document.RegForm.state.focus();
				return false;
			}
			if(document.RegForm.city.value==""){
				window.alert('Enter your city, please!');
				document.RegForm.city.focus();
				return false;
			}
			if(!document.RegForm.email.value.match(/^[a-zA-Z0-9\-\_\.]{1,280}@[a-zA-Z0-9\-\_]{2,280}.([a-zA-Z0-9\-\_]{3,280}.)?[a-zA-Z]{2,3}$/)){
				alert('Please enter a Valid Email format.');
				document.RegForm.email.focus();
				return false;
			}if(document.RegForm.areacode.value==""){
				window.alert('Enter your Area Code, please!');
				document.RegForm.areacode.focus();
				return false;			
			}
			if(document.RegForm.phone.value==""){
				window.alert('Enter your phone, please!');
				document.RegForm.phone.focus();
				return false;
			}
			if(document.RegForm.phone.value.match(/\s/g)){
				document.RegForm.phone.value.replace( /\s/g, '' );
				window.alert('Whitespace not valid as an input!');
				document.RegForm.phone.focus();
				document.RegForm.phone.select();
				return false;
			}
			if(document.RegForm.phone.value.length < 6){
				window.alert('Phone Number must not be less than six(6) digits.');
				document.RegForm.phone.focus();
				return false;
			}
			if(document.RegForm.phone.value.length > 8){
				window.alert('Phone Number must not be more than eight(8) digits.');
				document.RegForm.phone.focus();
				return false;
			}						
			//if((document.RegForm.phone.value.substring(0,2) != 13) && (document.RegForm.phone.value.substring(0,2) != 18)){
			//	window.alert('Invalid Phone Number.\nFirst two digit should be 13 or 18.');
			//	document.RegForm.phone.focus();
			//	return false;
			//}
			if (!IsNumeric(document.RegForm.phone.value)){ 
				window.alert('Invalid Phone Number.\nNumbers only.') 
				document.RegForm.phone.focus(); 
				return false; 
			}			
			if (image_file_check(document.RegForm.image1.value) == false ) {
						return false;
			}
			if (image_file_check(document.RegForm.image2.value) == false ) {
					return false;
			}            
			if (image_file_check(document.RegForm.image3.value) == false ) {
				return false;
			}           
			if (image_file_check(document.RegForm.image4.value) == false ) {
				return false;
			}
			if (image_file_check(document.RegForm.image5.value) == false ) {
				return false;
			}		
		}

		//Added by: Carlo DATE: Feb. 4, 2008
		function Area_Code(){
			var sel = document.getElementById("state");
			if(sel.options[sel.selectedIndex].value == 'ACT'){
				document.getElementById("02").selected ="02";
			}else if(sel.options[sel.selectedIndex].value == 'NSW'){
				document.getElementById("02").selected="02";
			}else if(sel.options[sel.selectedIndex].value == 'VIC'){
				document.getElementById("03").selected ="03";
			}else if(sel.options[sel.selectedIndex].value == 'TAS'){
				document.getElementById("02").selected ="02";
			}else if(sel.options[sel.selectedIndex].value == 'QLD'){
				document.getElementById("07").selected ="07";
			}else if(sel.options[sel.selectedIndex].value == 'WA'){
				document.getElementById("08").selected ="08";
			}else if(sel.options[sel.selectedIndex].value == 'SA'){
				document.getElementById("08").selected ="08";
			}else if(sel.options[sel.selectedIndex].value == 'NT'){
				document.getElementById("08").selected ="08";
			}
		}//////