function submitNewsletterUnSubscription(){
	var root = document.newsletter;
	var name = root.name.value;
	var email = root.email.value;
	if (name == '' ){
		alert('Please enter your name.');
		root.name.focus();
		return false;
	}
	if (email == '' ){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	root.action= '/mailinglist/suscribeUnsus.php?subscribtion=no';
	root.submit();
	return true;
}
function submitNewsletterSubscription(){
	var root = document.newsletter;
	var name = root.name.value;
	var email = root.email.value;
	if (name == '' ){
		alert('Please enter your name.');
		root.name.focus();
		return false;
	}
	if (email == '' ){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	root.action= '/mailinglist/suscribeUnsus.php?subscribtion=yes';
	root.submit();
	return true;
}
function validateCardForm(){
	var root = document.send_card;

	var greeting = root.greeting.value;
	var sig = root.signature.value;
	var name = root.sender_name.value;
	var email = root.sender_email.value;
	var fname = root.reciever_name.value;
	var femail = root.reciever_email.value;

	if (greeting == '' || greeting == 'Dear'){
		alert('Please enter your greeting for your friend');
		root.greeting.select();
		return false;
	}
	if (sig == ''){
		alert('Please enter your signature.');
		root.signature.focus();
		return false;
	}
	if (name == ''){
		alert('Please enter your name');
		root.sender_name.focus();
		return false;
	}
	if (email == ''){
		alert('Please enter your email address');
		root.sender_email.focus();
		return false;
	}
	if (fname == ''){
		alert('Please enter your friend\'s name.');
		root.reciever_name.focus();
		return false;
	}
	if (femail == ''){
		alert('Please enter your friend\'s email address.');
		root.reciever_email.focus();
		return false;
	}
	
	return true;
}

function openWindowForAudioInterview(id){
	window.open('/press_release/open_sound_window.php?id=' + id, 'Sound', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=220,height=100,top=400,left=200');
	return false;
}
function verifyGuestbook(){
	var name = document.sig_form.name.value;

	if(name == ""){
		alert('Please enter your name');
		document.sig_form.name.focus();
		return false;
	}

	var email = document.sig_form.email.value;
	if(email == ''){
		alert("Please enter your email address.");
		document.sig_form.email.focus();
		return false;
	}
	var comments = document.sig_form.comments.value;
	if(comments == ""){
		alert('Please enter your comments.');
		document.sig_form.comments.focus();
		return false;
	}
}

function validateSendProfile(){
	var root = document.myform;
	var fullname = root.fullname.value;
	var age = root.age.value;
	var email = root.email.value;
	var country_id = root.country_id.value;
	var sex = root.sex.value;
	var hobbies = root.hobbies.value;
	var abt_urself = root.abt_urself.value;
	var others_criteria = root.others_criteria.value;
	var hair_color = root.hair_color.value;
	var eyes_color = root.eyes_color.value;
	var height = root.height.value;
	var weight = root.weight.value;
	var body_look = root.body_look.value;
	var preffered_color = root.color.value;
	var preview = root.preview.value;
	if (fullname == '' || age == '' || email == '' || country_id == '' || sex == '' || hobbies == '' || abt_urself == '' || others_criteria == '' || hair_color == '' || eyes_color == '' || height == '' || weight == '' || body_look == '' || preffered_color == '' || preview == ''){
		alert('Please fill up all the required Fields');
		return false;
	}
	var ep = root.enable_phone.checked;
	if (ep == true){
		return confirm('You have enabled your phone. This means that your phone number will be available to all people viewing this section of the website. Are you sure?');
	}
	else {
		return true;
	}
}

function validateAskQuestion(){
		
	var name = document.ask_question.name.value;
	var question = document.ask_question.question.value;
	if (name == ''){
		alert('Please give your name.');
		document.ask_question.name.focus();
		return false;
	}
	if (question == ''){
		alert('Please give a question.');
		document.ask_question.question.focus();
		return false;
	}
	return true;
}

function validateMailMatchmaker(){
	var root = document.mail_matchmaker;
	var name = root.name.value;
	var email = root.email.value;
	var message = root.message.value;
	if (name == '' || email == '' || message == ''){
		alert('Please fill up all the fields');
		return false;
	}
	return true;
}
function resetContactForm(){
	
	if (confirm('Are you sure you want to reset the form?')){
		var root = document.contactForm;
		root.contact_type.value = '';
		root.firstname.value = '';
		root.lastname.value = '';
		root.country_id.value = '';
		root.email.value = '';
		root.city.value = '';
		root.website_url.value = '';
		root.company.value = '';
		root.phone.value = '';
		root.fax.value = '';
		root.comments.value = '';
		return false;
	}
	else return false;
	
	
	
	
	if (contact_type == '' || firstname == '' || lastname == '' || country == '' || email == ''){
		alert('Please fill up all the required Fields');
		return false;
	}
	return true;
}

function validateContactForm(){
	
	var root = document.contactForm;
	var contact_type = root.contact_type.value;
	var firstname = root.firstname.value;
	var lastname = root.lastname.value;
	var country = root.country_id.value;
	var email = root.email.value;
	
	if (contact_type == '' || firstname == '' || lastname == '' || country == '' || email == ''){
		alert('Please fill up all the required Fields');
		return false;
	}
	root.submit();
	return true;
}

function openWindowForBackground(id){
	window.open('/dedications/open_sound_window.php?id=' + id, 'Sound', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=150,height=100,top=400,left=200');
	return false;
}
function validateSendForm(){
	var root = document.send_dedication;
	
	var name = root.name.value;
	var email = root.email.value;
	var fname = root.fname.value;
	var femail = root.femail.value;
	
	if (name == '') {
		alert('Please enter your name.');
		root.name.focus();
		return false;
	}
	if (email == ''){
		alert('Please enter your email');
		root.email.focus();
		return false;
	}
	if (fname == ''){
		alert('Please enter your friend\'s name');
		root.fname.focus();
		return false;
	}
	if (femail == ''){
		alert('Please enter your friend\'s email');
		root.femail.focus();
		return false;
	}
	return true;
}

function validatePaparazziForm(){
	var root = document.add_paparazzi;
	
	var title = root.title.value;
	var comments = root.comments.value;
	var photo = root.photo.value;
	var year = root.year.value;
	var month = root.month.value;
	var day = root.day.value;
	var hr = root.hour.value;
	var min = root.minute.value;
	var name = root.name.value;
	var email = root.email.value;
	var country = root.country_id.value;
	
	if (title == ''){
		alert ('Please enter a title for the picture.');
		root.title.focus();
		return false;
	}
	if (comments == ''){
		alert('Please enter your comments on the picture.');
		root.comments.focus();
		return false;
	}
	if (photo == '') {
		alert('Please select a photo to upload');
		root.photo.focus();
		return false;
	}
	if (year == '' || month == '' || day == ''){
		alert('Please select the date when the picture was taken');
		return false;
	}
	if (hr == '' || min == ''){
		alert('Please select the time the picture was taken at.');
		return false;
	}
	if (name == ''){
		alert ('Please enter your name');
		root.name.focus();
		return false;
	}
	if (email == ''){
		alert('Please enter your email address.');
		root.email.focus();
		return false;
	}
	if (country == ''){
		alert('Please select your country.');
		return false;
	}
	
	return true;
}
function validateAddPhotoPicture(){
	var root = document.add_photo;
	var album = root.album_id.value;
	var title = root.title.value;
	var comments = root.comments.value;

	if (album == '') {
		alert('Please choose an album.');
		return false;
	}
	if (title == '') {
		alert('Please enter a title for the picture.');
		return false;
	}
	if (comments == '') {
		alert('Please enter the comments for the picture.');
		return false;
	}
	
	var rad1 = document.add_photo.image_choice_[0].checked;
	var rad2 = document.add_photo.image_choice_[1].checked;
	var rad3 = document.add_photo.image_choice_[2].checked;
	if (rad1 == '' && rad2 == '' && rad3 == ''){
		alert('Please select an option for the image');
		return false;
	}
	if (rad2){
	var existing_image = document.add_photo.existing_image_.value;
	if (existing_image == ''){
		alert('Please select an Image.');
		document.add_photo.existing_image_.focus();
		return false;
		exit;	
		}
	}
	if (rad3){
		var new_image = document.add_photo.new_image_.value;
		if (new_image == ''){
			alert('Please browse an Image.');	
			document.add_photo.new_image_.focus();
			return false;
			exit;
		}
	}
	
	
	
	
	var rad1 = document.add_photo.thumb_choice_[0].checked;
	var rad2 = document.add_photo.thumb_choice_[1].checked;
	var rad3 = document.add_photo.thumb_choice_[2].checked;
	if (rad1 == '' && rad2 == '' && rad3 == ''){
		alert('Please select an option for the image');
		return false;
	}
	if (rad2){
	var existing_image = document.add_photo.existing_thumb_.value;
	if (existing_image == ''){
		alert('Please select a Thumbnail.');
		document.add_photo.existing_thumb_.focus();
		return false;
		exit;	
		}
	}
	if (rad3){
		var new_image = document.add_photo.new_thumb_.value;
		if (new_image == ''){
			alert('Please browse a Thumbnail.');	
			document.add_photo.new_thumb_.focus();
			return false;
			exit;
		}
	}
	return true;
}
function listenToJingle(id){
	window.open('/jingles/listen_to_jingle.php?id=' + id, 'Sound', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=150,height=100,top=400,left=200');
	return false;
}
function headerToPage(url){
	location.href=url;
}

function resetGuestbookForm(){
	if (confirm('Are you sure you want to reset the form?')){
		var root = document.sig_form;
		root.name.value = '';
		root.email.value = '';
		root.comments.value = '';
		return false;
	}
	return false;
}

function resetFAQForm(){
	if (confirm('Are you sure you want to reset the form?')){
		var root = document.ask_question;
		root.name.value = '';
		root.question.value = '';
		return false;
	}
	return false;
}

function resetDedicationForm(){
	
	if (confirm('Are you sure you want to reset the form?')){
		var root = document.send_dedication;
		root.name.value = '';
		root.fname.value = '';
		root.email.value = '';
		root.femail.value = '';
		root.comments.value = '';
		return false;
	}
	return false;
}

function validateSendShowForm(){
	
	var root = document.be_on_the_show;
	
	var name = root.name.value;
	var gender = root.name.gender;
	var age = root.age.value;
	var email = root.email.value;
	var country = root.country_id.value;
	var reason = root.reason.value;
	var status = root.status.value;
	var comments = root.comments.value;
	
	if (name == '' || gender == '' || age == '' || email == '' || country == '' || reason == '' || status == '' || comments == ''){
		alert('Please fill up all the requiered fields');
		return false;
	}
}

function listenToAudio(){
	var newEntry = eval('document.send_card.audio_id.value');
	if (newEntry == ''){
		alert('Please select a file.');
		return false;
	}
	window.open('/greetings/listen.php?entry=' + newEntry, 'listen', 'width=220,height=100,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
}
function decrementAccount(){ 
	var fieldValue = document.sig_form.comments.value;
	var fieldNumber = fieldValue.length;
	var left = 255 - fieldNumber;
	if(left == 1){
		vale = document.sig_form.comments.value;
	}
	if(left < 1){
		document.sig_form.number.value = 0;
		document.sig_form.comments.value = vale;
	}
	else if(left >= 0){
	vale2 = document.sig_form.comments.value
	document.sig_form.comments.value = vale2;
	document.sig_form.number.value = left;	
	}
	return;
}