function goSubmit()
{
	if(cTrim(document.MyInfo.ScreenName.value,0)=="")
	{checkinfo($('ScreenName'),'Please enter your ScreenName.'); return;}
	else
	{
		if(cTrim(document.MyInfo.ScreenName.value,0).length>50)
		{checkinfo($('ScreenName'),'ScreenName must be <br> fewer than 50 characters.'); return;}
	}
	if(cTrim(document.MyInfo.Location.value,0)=="")
	{checkinfo($('Location'),'Please input your Location'); return;}
	else
	{
		if(cTrim(document.MyInfo.Location.value,0).length>200)
		{checkinfo($('Location'),'Location must be <br> less than 200 characters!'); return;}
	}
	if(cTrim(document.MyInfo.Age.value,0)!="")
	{
		if(isNaN(cTrim(document.MyInfo.Age.value,0)))
		{checkinfo($('Age'),'Age must be Numbers!'); return;}
	}
	if(cTrim(document.MyInfo.Country.value,0)!="")
	{
		if(cTrim(document.MyInfo.Country.value,0).length>30)
		{checkinfo($('Country'),'Country must be <br> less than 30 characters!'); return;}
	}
	
	if(cTrim(document.MyInfo.MyFavoritePlace.value,0)!="")
	{
		if(cTrim(document.MyInfo.MyFavoritePlace.value,0).length>100)
		{checkinfo($('MyFavoritePlace'),'My Favorite Place must be <br> less than 100 characters!'); return;}
	}
	if(cTrim(document.MyInfo.password.value,0)!=""||cTrim(document.MyInfo.Newpassword.value,0)!=""||cTrim(document.MyInfo.reNewpassword.value,0)!="")
	{
		if(cTrim(document.MyInfo.password.value,0)=="")
		{checkinfo($('password'),'Please enter your password!'); return;}
		else
		{
			if(cTrim(document.MyInfo.Newpassword.value,0)=="")
			{checkinfo($('Newpassword'),'Please enter your <br>new password.'); return;}
			if(cTrim(document.MyInfo.reNewpassword.value,0)=="")
			{checkinfo($('reNewpassword'),'Please retype your <br>new password.'); return;}
			else
			{
				if(cTrim(document.MyInfo.Newpassword.value,0)!=cTrim(document.MyInfo.reNewpassword.value,0))
				{checkinfo($('reNewpassword'),'rePassword is not<br> the same as Password.'); return;}
			}
		}
	}
	document.MyInfo.submit();
}

function ChangeType(TypeName)
{
	switch (TypeName)
	{
		case "Destination":window.location.href="DestinationsWriteReviews.asp";break;
		case "Attraction" :window.location.href="AttractionsWriteReviews.asp";break;
		case "Hotel"      :window.location.href="HotelsWriteReviews.asp";break;
		case "Restaurant" :window.location.href="RestaurantsWriteReviews.asp";break;
	}
}
function goSearch(TypeName)
{
	if ((TypeName=="Attraction")||(TypeName=="Restaurant")||(TypeName=="Hotel"))
	{
		if(cTrim(document.frm1.SearchName.value,0)=="")
		{
			alert("Please enter " + TypeName.toLowerCase() + " name.");
			document.frm1.SearchName.focus();
			return;
		}
	}
	if (TypeName=="Destination")
	{
		if (cTrim(document.frm1.SearchName.value,0)=="")
		{
			alert("Please enter " + TypeName.toLowerCase() + " name.");
			document.frm1.SearchName.focus();
			return;
		}
	}
	document.frm1.submit();
}

function CreateDestination()
{
	if (cTrim(document.Des.DestinationName.value,0) == "")
	{checkinfo($('DestinationName'),'Please enter destination name.'); return;}
	else
	{ 
		if(cTrim(document.Des.DestinationName.value,0).length>20)
		{checkinfo($('DestinationName'),'Destination name must <br>be fewer than 20 characters.'); return;}
	}
	
	if (cTrim(document.Des.Description.value,0) == "")
	{checkinfo($('Description'),'Please describe your destination.'); return;}
	if(cTrim(document.Des.Description.value,0)!="")
	{
		if(cTrim(document.Des.Description.value,0).length>5000)
		{checkinfo($('Description'),'Description must be <br>fewer than 5000 characters.'); return;}
	}
	
	var ArrRadio = new Array(6,5);
	var RadioSelected;
	
	ArrRadio[0] = document.Des.Accommodation;
	ArrRadio[1] = document.Des.Dining;
	ArrRadio[2] = document.Des.Entertainment;
	ArrRadio[3] = document.Des.Scenery;
	ArrRadio[4] = document.Des.Shopping;
	ArrRadio[5] = document.Des.Transportation;

	for (var i=0;i< 6;i++)
	{
		RadioSelected =false;
		for(var j=0;j<5;j++)
		{
			if(ArrRadio[i][j].checked){RadioSelected =true;continue;}
		}
		if(!RadioSelected)
		{
			//if (i==0){alert("You have not rated for the Accommodation yet!");}
			//if (i==1){alert("You have not rated for the Dining yet!");}
			//if (i==2){alert("You have not rated for the Entertainment yet!");}
			//if (i==3){alert("You have not rated for the Scenery yet!");}
			//if (i==4){alert("You have not rated for the Shopping yet!");}
			//if (i==5){alert("You have not rated for the Transportation yet!");}
			alert("Please rate each category, then click Submit.");
			ArrRadio[i][0].focus();
			return;
		}
	}
	
	if(cTrim(document.Des.Howtogetthere.value,0)!="")
	{
		if(cTrim(document.Des.Howtogetthere.value,0).length>2000)
		{checkinfo($('Howtogetthere'),'How to get there must be <br>less than 2000 characters.'); return;}
	}

	document.Des.submit();
}

function CreateAttraction()
{
	if (cTrim(document.Att.Destination.value,0) == -1)
	{checkinfo($('Destination'),'Please select a destination.'); return;}

	if (cTrim(document.Att.SiteName.value,0) == "")
	{checkinfo($('SiteName'),'Please enter attraction name.'); return;}
	else
	{ 
		if(cTrim(document.Att.SiteName.value,0).length>50)
		{checkinfo($('SiteName'),'Attraction name must be <br>fewer than 50 characters.'); return;}
	}
	
	if (cTrim(document.Att.Description.value,0) =="")
	{checkinfo($('Description'),'Please describe your attraction.'); return;}
	else
	{
		if(cTrim(document.Att.Description.value,0).length>4000)
		{checkinfo($('Description'),'Description must be <br>fewer than 4000 characters.'); return;}
	}
	if(cTrim(document.Att.Admission.value,0)!="")
	{
		if(cTrim(document.Att.Admission.value,0).length>100)
		{checkinfo($('Admission'),'Address must be <br>fewer than 60 characters.'); return;}
	}
	if(cTrim(document.Att.Hours.value,0)!="")
	{
		if(cTrim(document.Att.Hours.value,0).length>100)
		{checkinfo($('Hours'),'Hours must be fewer than 100 characters.'); return;}
	}
	if(cTrim(document.Att.Tel.value,0)!="")
	{
		if(cTrim(document.Att.Tel.value,0).length>20)
		{checkinfo($('Tel'),'Telephone number must be fewer than 20 characters.'); return;}
	}
	if(cTrim(document.Att.Website.value,0)!="")
	{
		if(cTrim(document.Att.Website.value,0).length>100)
		{checkinfo($('Website'),'URL must be fewer than 100 characters.'); return;}
	}
	if(cTrim(document.Att.Howtogetthere.value,0)!="")
	{
		if(cTrim(document.Att.Howtogetthere.value,0).length>2000)
		{checkinfo($('Howtogetthere'),'How to get there must be <br>fewer than 2000 characters.'); return;}
	}

	document.Att.submit();
}

function CreateHotel()
{
	if (cTrim(document.Hotel.Destination.value,0) == -1)
	{checkinfo($('Destination'),'Please select a destination.'); return;}

	if (cTrim(document.Hotel.HotelName.value,0) == "")
	{checkinfo($('HotelName'),'Please enter hotel name.'); return;}
	else
	{ 
		if(cTrim(document.Hotel.HotelName.value,0).length>50)
		{
		checkinfo($('HotelName'),'Hotel name must be fewer than 50 characters.'); return;}

	}
	
	if(cTrim(document.Hotel.Address.value,0)!="")
	{
		if(cTrim(document.Hotel.Address.value,0).length>50)
		{checkinfo($('Address'),'Address must be fewer than 50 characters.'); return;}
	}
	if(cTrim(document.Hotel.Tel.value,0)!="")
	{
		if(cTrim(document.Hotel.Tel.value,0).length>20)
		{checkinfo($('Tel'),'Telephone number must be <br>fewer than 20 characters.'); return;}
	}
	if(cTrim(document.Hotel.Fax.value,0)!="")
	{
		if(cTrim(document.Hotel.Fax.value,0).length>20)
		{checkinfo($('Fax'),'Fax number must be fewer than 20 characters.'); return;}
	}
	if(cTrim(document.Hotel.CardsAccepted.value,0)!="")
	{
		if(cTrim(document.Hotel.CardsAccepted.value,0).length>100)
		{checkinfo($('CardsAccepted'),'Card names must be fewer that 100 characters.'); return;}
	}
	//if(cTrim(document.Hotel.PostCode.value,0)!="")
	//{
	//	if(cTrim(document.Hotel.PostCode.value,0).length>20)
	//	{checkinfo($('PostCode'),'Postal code must be fewer than 20 characters.'); return;}
	//}
	if(cTrim(document.Hotel.Howtogetthere.value,0)!="")
	{
		if(cTrim(document.Hotel.Howtogetthere.value,0).length>2000)
		{checkinfo($('Howtogetthere'),'How to get there must be <br>fewer than 2000 characters.'); return;}
	}
	
	var ArrRadio = new Array(4,5);
	var RadioSelected;
	
	ArrRadio[0] = document.Hotel.Facilities;
	ArrRadio[1] = document.Hotel.Price;
	ArrRadio[2] = document.Hotel.Service;
	ArrRadio[3] = document.Hotel.Transportation;

	for (var i=0;i< 4;i++)
	{
		RadioSelected =false;
		for(var j=0;j<5;j++)
		{
			if(ArrRadio[i][j].checked){RadioSelected =true;continue;}
		}
		if(!RadioSelected)
		{
			//if (i==0){alert("You have not rated for the Facilities yet!");}
			//if (i==1){alert("You have not rated for the Price yet!");}
			//if (i==2){alert("You have not rated for the Service yet!");}
			//if (i==3){alert("You have not rated for the Transportation yet!");}
			alert("Please rate each category, then click Submit.");
			ArrRadio[i][0].focus();
			return;
		}
	}

	if (cTrim(document.Hotel.Description.value,0) =="")
	{checkinfo($('Description'),'Please describe your hotel.'); return;}
	else
	{
		if(cTrim(document.Hotel.Description.value,0).length>4000)
		{checkinfo($('Description'),'Description must be <br>fewer than 4000 characters.'); return;}
	}
	document.Hotel.submit();
}

function CreateRestaurant()
{
	if (cTrim(document.Res.Destination.value,0) == -1)
	{checkinfo($('Destination'),'Please select a destination.'); return;}

	if (cTrim(document.Res.RestaurantName.value,0) == "")
	{checkinfo($('RestaurantName'),'Please enter restaurant name.'); return;}
	else
	{ 
		if(cTrim(document.Res.RestaurantName.value,0).length>50)
		{
		document.Res.RestaurantName.focus();
		checkinfo($('RestaurantName'),'Restaurant name must be <br>fewer than 50 characters.'); return;}

	}
	
	if (cTrim(document.Res.Cuisine.value,0) == 0)
	{checkinfo($('Cuisine'),'Please select a cuisine type.'); return;}
	if(cTrim(document.Res.Address.value,0)!="")
	{
		if(cTrim(document.Res.Address.value,0).length>50)
		{checkinfo($('Address'),'Address must be fewer than 50 characters.'); return;}
	}
	if(cTrim(document.Res.AveragePrice.value,0)!="")
	{
		if(isNaN(cTrim(document.Res.AveragePrice.value,0)))
		{checkinfo($('AveragePrice'),'Price must be entered numerically.'); return;}
	}
	if(cTrim(document.Res.Tel.value,0)!="")
	{
		if(cTrim(document.Res.Tel.value,0).length>20)
		{checkinfo($('Tel'),'Telephone number must be <br>fewer than 20 characters.'); return;}
	}
	if(cTrim(document.Res.CardsAccepted.value,0)!="")
	{
		if(cTrim(document.Res.CardsAccepted.value,0).length>50)
		{checkinfo($('CardsAccepted'),'Card names must be <br>fewer than 50 characters.'); return;}
	}
	if(cTrim(document.Res.Howtogetthere.value,0)!="")
	{
		if(cTrim(document.Res.Howtogetthere.value,0).length>2000)
		{checkinfo($('Howtogetthere'),'How to get there must be <br>fewer than 2000 characters.'); return;}
	}
	
	var ArrRadio = new Array(4,5);
	var RadioSelected;
	
	ArrRadio[0] = document.Res.Ambiance;
	ArrRadio[1] = document.Res.Food;
	ArrRadio[2] = document.Res.Price;
	ArrRadio[3] = document.Res.Service;

	for (var i=0;i< 4;i++)
	{
		RadioSelected =false;
		for(var j=0;j<5;j++)
		{
			if(ArrRadio[i][j].checked){RadioSelected =true;continue;}
		}
		if(!RadioSelected)
		{
			//if (i==0){alert("You have not rated for the Ambiance yet!");}
			//if (i==1){alert("You have not rated for the Food yet!");}
			//if (i==2){alert("You have not rated for the Price yet!");}
			//if (i==3){alert("You have not rated for the Service yet!");}
			alert("Please rate each category, then click Submit.");
			ArrRadio[i][0].focus();
			return;
		}
	}
	
	if (cTrim(document.Res.Description.value,0) =="")
	{checkinfo($('Description'),'Please describe your restaurant.'); return;}
	else
	{
		if(cTrim(document.Res.Description.value,0).length>4000)
		{checkinfo($('Description'),'Description must be <br>fewer than 4000 characters.'); return;}
	}
	document.Res.submit();
}


function UploadPicCheck(PageCode,PicNum)
{
	if (PageCode=="Att")
	{
		if (cTrim(document.Att.Picture.value,0) == 0)
		{checkinfo($('Picture'),'Please select your photo.'); return;}
		if (cTrim(document.Att.Destination.value,0) == 0)
		{checkinfo($('Destination'),'Please select a destination.'); return;}

		if (cTrim(document.Att.SiteName.value,0) == "")
		{checkinfo($('SiteName'),'Please enter attraction name.'); return;}
		else
		{ 
			if(cTrim(document.Att.SiteName.value,0).length>200)
			{checkinfo($('SiteName'),'Attraction name must <br>be fewer than 200 characters.'); return;}
		}
		if(PicNum >= 1)
		{
			alert("Sorry, you can upload only one photo.");return;
		}
		
		
	}
}

function ChangeOrder()
{
	document.frm1.submit();
}
