// JavaScript Document

function checkRegistrationForm()
{
    if(RegistrationForm.username.value=="")
	{
		alert("You must enter the Username");
		RegistrationForm.username.focus();
		return false;
	}
	
	if(RegistrationForm.pass.value=="")
	{
		alert("You must enter the Password");
		RegistrationForm.pass.focus();
		return false;
	}

	if(RegistrationForm.repass.value=="")
	{
		alert("You must enter the Confirm Password");
		RegistrationForm.repass.focus();
		return false;
	}

	if(RegistrationForm.firstname.value=="")
	{
		alert("You must enter the First Name");
		RegistrationForm.firstname.focus();
		return false;
	}

	if(RegistrationForm.lastname.value=="")
	{
		alert("You must enter the Last Name");
		RegistrationForm.lastname.focus();
		return false;
	}

	if(RegistrationForm.phone.value=="")
	{
		alert("You must enter the Phone Number");
		RegistrationForm.phone.focus();
		return false;
	}

	if(RegistrationForm.email.value=="")
	{
		alert("You must enter the Email Address");
		RegistrationForm.email.focus();
		return false;
	}
	
	if(RegistrationForm.add1.value=="")
	{
		alert("You must enter the Address");
		RegistrationForm.add1.focus();
		return false;
	}

	if(RegistrationForm.city.value=="")
	{
		alert("You must enter the City/Town");
		RegistrationForm.city.focus();
		return false;
	}

	if(RegistrationForm.state.value=="")
	{
		alert("You must select the Province/State");
		RegistrationForm.state.focus();
		return false;
	}

	if(RegistrationForm.zip.value=="")
	{
		alert("You must enter the Postal/Zip Code");
		RegistrationForm.zip.focus();
		return false;
	}

	if(RegistrationForm.country.value=="")
	{
		alert("You must selsct the Country Name");
		RegistrationForm.country.focus();
		return false;
	}

	if(RegistrationForm.phone.value=="")
	{
		alert("You must enter the Phone Number");
		RegistrationForm.phone.focus();
		return false;
	}

	if(RegistrationForm.pass.value!=RegistrationForm.repass.value)
	{
		alert("Your Password and Confirm Password is not same.");
		RegistrationForm.pass.focus();
		return false;
	}
	
	else
		return true;
}


function checkInformationForm()
{
   
	if(InformationForm.firstname.value=="")
	{
		alert("You must enter the First Name");
		InformationForm.firstname.focus();
		return false;
	}

	if(InformationForm.lastname.value=="")
	{
		alert("You must enter the Last Name");
		InformationForm.lastname.focus();
		return false;
	}

	if(InformationForm.phone.value=="")
	{
		alert("You must enter the Phone Number");
		InformationForm.phone.focus();
		return false;
	}

	if(InformationForm.email.value=="")
	{
		alert("You must enter the Email Address");
		InformationForm.email.focus();
		return false;
	}

	if(InformationForm.name.value=="")
	{
		alert("You must enter the ship to name");
		InformationForm.name.focus();
		return false;
	}
	
	if(InformationForm.address.value=="")
	{
		alert("You must enter the Address");
		InformationForm.address.focus();
		return false;
	}

	if(InformationForm.city.value=="")
	{
		alert("You must enter the City/Town");
		InformationForm.city.focus();
		return false;
	}

	if(InformationForm.country.value=="USA" && InformationForm.state.value=="")
	{
		alert("You must select the Province/State");
		InformationForm.state.focus();
		return false;
	}

	if(InformationForm.zip.value=="")
	{
		alert("You must enter the Postal/Zip Code");
		InformationForm.zip.focus();
		return false;
	}

	if(InformationForm.country.value=="")
	{
		alert("You must selsct the Country Name");
		InformationForm.country.focus();
		return false;
	}

	else
		return true;
}


function checkPictureForm()
{
    if(pictureForm.eventId.value=="" && pictureForm.eventnamenew.value=="")
	{
		alert("You must select existing event name or enter new event name");
		pictureForm.eventnamenew.focus();
		return false;
	}
	
	if(pictureForm.fleImage1.value=="")
	{
		alert("You must select photo");
		pictureForm.fleImage1.focus();
		return false;
	}

	if(pictureForm.cat.value=="")
	{
		alert("You must select photo category");
		pictureForm.cat.focus();
		return false;
	}

	else
		return true;
}


function viewCategory(catId)
{
	window.location.href = 'index.php?view=category&catId=' + catId;
}

function viewProduct(pdId,catId)
{
	window.location.href = 'index.php?view=product&pdId=' + pdId + '&catId=' + catId;
}

function updateContact()
{
	window.location.href = 'index.php?view=update_contact' ;
}

function updateBusiness()
{
	window.location.href = 'index.php?view=update_business' ;
}

function viewPicture()
{
	window.location.href = 'index.php?view=view_picture' ;
}

function addPicture()
{
	window.location.href = 'index.php?view=add_picture' ;
}

function updatePicture(pictureId)
{
	window.location.href = 'index.php?view=update_picture&pictureId=' + pictureId ;
}

function deletePicture(pictureId)
{
	if (confirm('Delete this picture with their details')) {
	window.location.href = 'processUser.php?action=deletePicture&pictureId=' + pictureId ;
	}
}
