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 resetFaq(){
	document.ask_question.name.value = '';
	document.ask_question.question.value = '';
	return false;
}

function validateContactUs(){
	var root = document.contact;
	var firstname = root.firstname.value;
	var lastname = root.lastname.value;
	var age = root.age.value;
	var email = root.email.value;
	var sex = root.sex.value;
	var country_id = root.country_id.value;
	var address = root.address.value;
	var phone = root.phone.value;
	var contact_type = root.contact_type.value;
	var message = root.message.value;
	
	if (firstname == ''){
		alert ('Please enter your first name.');
		document.contact.firstname.focus();
		return false;
	}
	if (lastname == ''){
		alert ('Please enter your last name.');
		document.contact.lastname.focus();
		return false;
	}
	if (age == '' || isNaN(age)){
		alert ('Please enter a valid age.');
		document.contact.age.focus();
		return false;
	}
	if (email == ''){
		alert('Please enter your email address.');
		document.contact.email.focus();
		return false;
	}
	if (country_id == ''){
		alert ('Please select a country.');
		document.contact.country_id.focus();
		return false;
	}
	if (address == ''){
		alert('Please enter your address.');
		document.contact.address.focus();
		return false;
	}
	if (contact_type == ''){
		alert ('Please select a contact type.');
		document.contact.contact_type.focus();
		return false;
	}
	if (message == ''){
		alert('Please enter your message.');
		document.contact.message.focus();
		return false;
	}
	return true;
	
}
function previewWallpaper1(choice,page,folder){
	var newEntry = eval('document.'+page+'.existing_image'+choice+'.value');
	if (newEntry == ''){
		alert('Please select an image.');
		return false;
	}
	window.open('/common/view_wallpaper.php?entry=' + newEntry + '&folder=' + folder, 'view_image', 'width=800,height=600,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
}
	
function validateAddWallpaper(){
	var comments = document.add_wallpaper.description.value;
	var rad1 = document.add_wallpaper.image_choice1[0].checked;
	var rad2 = document.add_wallpaper.image_choice1[1].checked;
		
	if (comments == ''){
		alert('Please insert your comments.');
		document.add_wallpaper.description.focus();
		return false;	
	}
		
	var rad1 = document.add_wallpaper.image_choice1[0].checked;
	var rad2 = document.add_wallpaper.image_choice1[1].checked;
	if (rad1 == '' && rad2 == ''){
		alert('Please select an option for the Wallpaper');
		return false;	
	}
	if (rad1){
		var existing_image = document.add_wallpaper.existing_image1.value;
		if (existing_image == ''){
			alert('Please select an Image for the wallpaper.');
			document.add_wallpaper.existing_image1.focus();
			return false;
			exit;	
		}
	}
	if (rad2){
		var new_image = document.add_wallpaper.new_image1.value;
		if (new_image == ''){
			alert('Please browse an Image.');	
			document.add_wallpaper.new_image1.focus();
			return false;
			exit;
		}
	}

	var rad1 = document.add_wallpaper.image_choice2[0].checked;
	var rad2 = document.add_wallpaper.image_choice2[1].checked;
	if (rad1 == '' && rad2 == ''){
		alert('Please select an option for the Wallpaper of the resolution 640x480');
		return false;	
	}
	if (rad1){
		var existing_image = document.add_wallpaper.existing_image2.value;
		if (existing_image == ''){
			alert('Please select a Wallpaper for the resolution 640x480.');
			document.add_wallpaper.existing_image2.focus();
			return false;
			exit;	
		}
	}
	if (rad2){
		var new_image = document.add_wallpaper.new_image2.value;
		if (new_image == ''){
			alert('Please browse a Wallpaper for the resolution 640x480.');	
			document.add_wallpaper.new_image2.focus();
			return false;
			exit;
		}
	}

	var rad1 = document.add_wallpaper.image_choice3[0].checked;
	var rad2 = document.add_wallpaper.image_choice3[1].checked;
	if (rad1 == '' && rad2 == ''){
		alert('Please select an option for the Wallpaper of the resolution 800x600');
		return false;	
	}
	if (rad1){
		var existing_image = document.add_wallpaper.existing_image3.value;
		if (existing_image == ''){
			alert('Please select a Wallpaper for the resolution 800x600.');
			document.add_wallpaper.existing_image3.focus();
			return false;
			exit;	
		}
	}
	if (rad2){
		var new_image = document.add_wallpaper.new_image3.value;
		if (new_image == ''){
			alert('Please browse a Wallpaper for the resolution 800x600.');	
			document.add_wallpaper.new_image3.focus();
			return false;
			exit;
		}
	}

	var rad1 = document.add_wallpaper.image_choice4[0].checked;
	var rad2 = document.add_wallpaper.image_choice4[1].checked;
	if (rad1 == '' && rad2 == ''){
		alert('Please select an option for the Wallpaper of the resolution 1024x768');
		return false;	
	}
	if (rad1){
		var existing_image = document.add_wallpaper.existing_image4.value;
		if (existing_image == ''){
			alert('Please select a Wallpaper for the resolution 1024x768.');
			document.add_wallpaper.existing_image4.focus();
			return false;
			exit;	
		}
	}
	if (rad2){
		var new_image = document.add_wallpaper.new_image4.value;
		if (new_image == ''){
			alert('Please browse a Wallpaper for the resolution 1024x768.');	
			document.add_wallpaper.new_image4.focus();
			return false;
			exit;
		}
	}

	return true;
}

function previewWall(path,folder){
	window.open('/common/view_wallpaper.php?entry=' + path + '&folder=' + folder, 'view_image', 'width=350,height=350,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
}

function viewAlbumThumb(img){
	window.open('/photo_albums/admin/view_album_thumb.php?img=' + img , 'view_image', 'width=200,height=200,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
}

function validateEditWallpaper(){
	var comments = document.modify_wallpaper.description.value;	
	if (comments == ''){
		alert('Please give a comment.');
		document.modify_wallpaper.description.focus();
		return false;	
	}
	var rad1 = document.modify_wallpaper.image_choice1[1].checked;
	var rad2 = document.modify_wallpaper.image_choice1[2].checked;
	var rad3 = document.modify_wallpaper.image_choice1[0].checked;
	if (rad1 == '' && rad2 == '' && rad3 == ''){
		alert('Please select an option for the image.');
		return false;
	}
	else if (rad1){
		var existing_image = document.modify_wallpaper.existing_image1.value;
		if (existing_image == ''){
			alert('Please select an image.');
			document.modify_wallpaper.existing_image1.focus();
			return false;
			exit;	
		}
	}
	else if (rad2){
		var new_image = document.modify_wallpaper.new_image1.value;
		if (new_image == ''){
			alert('Please browse an image.');	
			document.modify_wallpaper.new_image1.focus();
			return false;
			exit;
		}
	}
	var rad1 = document.modify_wallpaper.image_choice2[1].checked;
	var rad2 = document.modify_wallpaper.image_choice2[2].checked;
	var rad3 = document.modify_wallpaper.image_choice2[0].checked;
	if (rad1 == '' && rad2 == '' && rad3 == ''){
		alert('Please select an option for the Wallpaper of the resolution 640x480.');
		return false;
	}
	else if (rad1){
		var existing_image = document.modify_wallpaper.existing_image2.value;
		if (existing_image == ''){
			alert('Please select a Wallpaper for the resolution 640x480.');
			document.modify_wallpaper.existing_image2.focus();
			return false;
			exit;	
		}
	}
	else if (rad2){
		var new_image = document.modify_wallpaper.new_image2.value;
		if (new_image == ''){
			alert('Please browse a Wallpaper for the resolution 640x480.');	
			document.modify_wallpaper.new_image2.focus();
			return false;
			exit;
		}
	}
	var rad1 = document.modify_wallpaper.image_choice3[1].checked;
	var rad2 = document.modify_wallpaper.image_choice3[2].checked;
	var rad3 = document.modify_wallpaper.image_choice3[0].checked;
	if (rad1 == '' && rad2 == '' && rad3 == ''){
		alert('Please select an option for the Wallpaper of the resolution 640x480.');
		return false;
	}
	else if (rad1){
		var existing_image = document.modify_wallpaper.existing_image3.value;
		if (existing_image == ''){
			alert('Please select a Wallpaper for the resolution 800x600.');
			document.modify_wallpaper.existing_image3.focus();
			return false;
			exit;	
		}
	}
	else if (rad2){
		var new_image = document.modify_wallpaper.new_image3.value;
		if (new_image == ''){
			alert('Please browse a Wallpaper for the resolution 800x600.');	
			document.modify_wallpaper.new_image3.focus();
			return false;
			exit;
		}
	}
	var rad1 = document.modify_wallpaper.image_choice4[1].checked;
	var rad2 = document.modify_wallpaper.image_choice4[2].checked;
	var rad3 = document.modify_wallpaper.image_choice4[0].checked;
	if (rad1 == '' && rad2 == '' && rad3 == ''){
		alert('Please select an option for the Wallpaper of the resolution 640x480.');
		return false;
	}
	else if (rad1){
		var existing_image = document.modify_wallpaper.existing_image4.value;
		if (existing_image == ''){
			alert('Please select a Wallpaper for the resolution 1024x768.');
			document.modify_wallpaper.existing_image4.focus();
			return false;
			exit;	
		}
	}
	else if (rad2){
		var new_image = document.modify_wallpaper.new_image4.value;
		if (new_image == ''){
			alert('Please browse a Wallpaper for the resolution 1024x768.');	
			document.modify_wallpaper.new_image4.focus();
			return false;
			exit;
		}
	}
	return true;
}

function validateAddJingle(){
	var title = document.add_jingle.title.value;
	var rad1 = document.add_jingle.image_choice[0].checked;
	var rad2 = document.add_jingle.image_choice[1].checked;
	var hour = document.add_jingle.hour.value;
	var minute = document.add_jingle.minute.value;
	var second = document.add_jingle.second.value;
	if (title == ''){
		alert('Please give a Title');
		document.add_jingle.title.focus();
		return false;
	}
	if (rad1 == '' && rad2 == ''){
		alert('Please select an option for the Jingle.');
		return false;
	}
	else if (rad1 != ''){
		var existing_image = document.add_jingle.existing_image.value;
		if (existing_image == ''){
			alert('You chose to select an existing Jingle, please do so.');
			document.add_jingle.existing_image.focus();
			return false;
		}
	}
	else if (rad2 != ''){
		var new_image = document.add_jingle.new_image.value;
		if (new_image == ''){
			alert('You chose to upload a new Jingle, please browse one.');
			document.add_jingle.new_image.focus();
			return false;
		}	
	}
	if (hour == '' || minute == '' || second == ''){
		alert('Please select a full time.');
		return false;	
	}
	else if (hour == 0 && minute == 0 && second == 0){
		alert('Please select a valid time.');
		return false;	
	}
		return true;
}
function confirmDelete(name){
	return confirm('Are you sure you want to delete the '+ name);
}
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  e-mail 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 previewImage(page,folder){
	var newEntry = eval('document.'+page+'.existing_image.value');
	if (newEntry == ''){
		alert('Please select an image.');
		return false;
	}
	window.open('/common/view_image.php?entry=' + newEntry + '&folder=' + folder, 'view_image', 'width=350,height=350,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
}

function previewThumbanilForPressRealease(page){
	var newEntry = eval('document.'+page+'.existing_image.value');
	if (newEntry == ''){
		alert('Please select an image.');
		return false;
	}
	window.open('/press_releases/admin/preview_press_thumb.php?name=' + newEntry, 'view_image', 'width=350,height=350,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
}

function previewAlbumThumb(page,folder){
	var newEntry = eval('document.'+page+'.existing_image.value');
	if (newEntry == ''){
		alert('Please select an image.');
		return false;
	}
	window.open('/photo_albums/view_album_thumb.php?entry=' + newEntry + '&folder=' + folder, 'view_image', 'width=350,height=350,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
}


function validateAddNews(){
	var title = document.add_vip_news.title.value;
	var description = document.add_vip_news.description.value;
	var year = document.add_vip_news.year1.value;
	var month = document.add_vip_news.month1.value;
	var day = document.add_vip_news.day1.value;
	if (title == ''){
		alert('Please give a Title.');
		document.add_vip_news.title.focus();
		return false;
	}
	if (description == ''){
		alert('Please give a Description.');
		document.add_vip_news.description.focus();
		return false;
	}
	if (year == '' || month == '' || day == ''){
		alert('Please give a valid Date');
		return false;
	}
	var rad1 = document.add_vip_news.image_choice[0].checked;
	var rad2 = document.add_vip_news.image_choice[1].checked;
	if (rad1 == '' && rad2 == ''){
		alert('Please select an option for the image');
		return false;
	}
	if (rad1){
		var existing_image = document.add_vip_news.existing_image.value;
		if (existing_image == ''){
			alert('Please select an image.');
			document.add_vip_news.existing_image.focus();
			return false;
			exit;	
		}
	}
	if (rad2){
		var new_image = document.add_vip_news.new_image.value;
		if (new_image == ''){
			alert('Please browse an image.');	
			document.add_vip_news.new_image.focus();
			return false;
			exit;
		}
	}
	return true;
}
function validateEditNews(){
	var title = document.add_vip_news.title.value;
	var description = document.add_vip_news.description.value;
	var year = document.add_vip_news.year1.value;
	var month = document.add_vip_news.month1.value;
	var day = document.add_vip_news.day1.value;
	if (title == ''){
		alert('Please give a Title.');
		document.add_vip_news.title.focus();
		return false;
	}
	if (description == ''){
		alert('Please give a Description.');
		document.add_vip_news.description.focus();
		return false;
	}
	if (year == '' || month == '' || day == ''){
		alert('Please give a valid Date');
		return false;
	}
	var rad1 = document.add_vip_news.image_choice[0].checked;
	var rad2 = document.add_vip_news.image_choice[1].checked;
	var rad3 = document.add_vip_news.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_vip_news.existing_image.value;
		if (existing_image == ''){
			alert('Please select an image.');
			document.add_vip_news.existing_image.focus();
			return false;
			exit;	
		}
	}
	if (rad3){
		var new_image = document.add_vip_news.new_image.value;
		if (new_image == ''){
			alert('Please browse an image.');	
			document.add_vip_news.new_image.focus();
			return false;
			exit;
		}
	}
	return true;
}

function openPopUpWindow(path){
	window.open(path, 'view_image', 'width=320,height=260,status=0;toolbar=0,history=0,left=100,top=100');
	return false;
}

function openNewsInPopup(id){
	window.open('/news/view_news.php?id=' + id, 'view_image', 'width=500,height=400,status=0;toolbar=0,history=0,left=100,top=100');
	return false;
}

function validateOrderForm(num){
	var root = document.order;
	var fullname = root.fullname.value;
	var email = root.email.value;
	var address = root.address.value;
	var phone = root.phone.value;
	var fax = root.fax.value;
	var year = root.year.value;
	var month = root.month.value;
	var day = root.day.value;
	var country = root.country_id.value;
	
	if (fullname == ''){
		alert('Please give a fullname');
		root.fullname.focus();
		return false;
	}
	if (email == ''){
		alert('Please give your email');
		root.email.focus();
		return false;
	}
	if (address == ''){
		alert('Please give an address');
		root.address.focus();
		return false;
	}
	if (phone == ''){
		alert('Please give your phone number');
		root.phone.focus();
		return false;
	}
	if (year == '' || month == '' || day == ''){
		alert('Please give a valid Birth Date');
		root.year.focus();
		return false;
	}
	if (country == ''){
		alert('Please select a country.');
		root.country_id.focus();
		return false;
	}
	var totalBooks = 0;
	
	for (i=1;i<=num;i++){
		var book = eval('root.book_' + i + '.checked');
		if (book == true){
			number = eval('root.quantity_' + i + '.value');
			if (number != ''){
				totalBooks = parseInt(totalBooks) + parseInt(number);
			}
		}
	}
	if (totalBooks == 0){
		alert('Please select al least one book.');
		return false;
	}
	return confirm('You are ordering ' + totalBooks + ' Book(s). Do you want to proceed?')
}

function listenToJingle(id){
	window.open('/downloads/listen_to_jingle.php?id=' + id, 'Sound', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=320,height=240,top=400,left=200');
	return false;
}

function validateAddDream(){
	var root = document.add_dream;
	var title = root.title.value;
	var description = root.description.value;
	if (title == ''){
		alert('Please give a title.');
		root.title.focus();
		return false;
	}
	if (description == ''){
		alert('Please give a description.');
		root.description.focus();
		return false;
	}
	return true;
}

function validateAddScreensaver(){
		
		var comments = document.add_screensaver.description.value;
		
		if (comments == ''){
			alert('Please insert your Description.');
			document.add_screensaver.description.focus();
			return false;	
		}
		
		var rad1 = document.add_screensaver.image_choice[0].checked;
		var rad2 = document.add_screensaver.image_choice[1].checked;
		if (rad1 == '' && rad2 == ''){
			alert('Please select an option for the Screensaver');
			return false;	
		}
		if (rad1){
			var existing_image = document.add_screensaver.existing_image.value;
			if (existing_image == ''){
				alert('Please select a Screensaver.');
				document.add_screensaver.existing_image.focus();
				return false;
				exit;	
			}
		}
		if (rad2){
			var new_image = document.add_screensaver.new_image.value;
			if (new_image == ''){
				alert('Please browse a Screensaver.');	
				document.add_screensaver.new_image.focus();
				return false;
				exit;
			}
		}
		return true;
	}
	
	function validateEditScreensaver(){
		
		
		var comments = document.modify_screensaver.description.value;	
		if (comments == ''){
			alert('Please give a Description.');
			document.modify_screensaver.description.focus();
			return false;	
		}
		var rad1 = document.modify_screensaver.image_choice[1].checked;
		var rad2 = document.modify_screensaver.image_choice[2].checked;
		var rad3 = document.modify_screensaver.image_choice[0].checked;
		if (rad1 == '' && rad2 == '' && rad3 == ''){
			alert('Please select an option for the Screensaver.');
			return false;
		}
		else if (rad1){
			var existing_image = document.modify_screensaver.existing_image.value;
			if (existing_image == ''){
				alert('Please select a Screensaver.');
				document.modify_screensaver.existing_image.focus();
				return false;
				exit;	
			}
		}
		else if (rad2){
			var new_image = document.modify_screensaver.new_image.value;
			if (new_image == ''){
				alert('Please browse a Screensaver.');	
				document.modify_screensaver.new_image.focus();
				return false;
				exit;
			}
		}
		
		
		return true;
	}
	
	function validateEditJingle(){
		
		var title = document.add_jingle.title.value;
		var hour = document.add_jingle.hour.value;
		var minute = document.add_jingle.minute.value;
		var second = document.add_jingle.second.value;
		if (title == ''){
			alert('Please give a Title');
			document.add_jingle.title.focus();
			return false;
		}
		if (hour == '' || minute == '' || second == ''){
			alert('Please select a full time.');
			return false;	
		}
		else if (hour == 0 && minute == 0 && second == 0){
			alert('Please select a valid time.');
			return false;	
		}
		var rad1 = document.add_jingle.image_choice[0].checked;
		var rad2 = document.add_jingle.image_choice[1].checked;
		var rad3 = document.add_jingle.image_choice[2].checked;
		if (rad1 == '' && rad2 == '' && rad3 == ''){
			alert('Please select an option for the Jingle');
			return false;
		}
		if (rad2){
			var existing_image = document.add_jingle.existing_image.value;
			if (existing_image == ''){
				alert('Please select a Jingle.');
				document.add_jingle.existing_image.focus();
				return false;
				exit;	
			}
		}
		if (rad3){
			var new_image = document.add_jingle.new_image.value;
			if (new_image == ''){
				alert('Please browse a Jingle.');	
				document.add_jingle.new_image.focus();
				return false;
				exit;
			}
		}
		return true;
	}
	
	function validateAddBook(){
		
		var root = document.add_book;
		var title = root.title.value;
		var description = root.description.value;
		var price = root.price.value;
		if (title == ''){
			alert('Please give a title');
			root.title.focus();
			return false;
		}
		if (description == ''){
			alert('Please give a description');
			root.description.focus();
			return false;
		}
		if (price == '' || isNaN(price)){
			alert('Please give a numeric Price');
			root.price.focus();
			return false;
		}
		var rad1 = document.add_book.image_choice[0].checked;
		var rad2 = document.add_book.image_choice[1].checked;
		if (rad1 == '' && rad2 == ''){
			alert('Please select an option for the Book Image.');
			return false;
		}
		else if (rad1 != ''){
			var existing_image = document.add_book.existing_image.value;
			if (existing_image == ''){
				alert('Please select an Image.');
				document.add_book.existing_image.focus();
				return false;
			}
		}
		else if (rad2 != ''){
			var new_image = document.add_book.new_image.value;
			if (new_image == ''){
				alert('Please browse an Image');
				document.add_book.new_image.focus();
				return false;
			}	
		}
		return true;
	}
	
	function validateEditBook(){
		var root = document.edit_book;
		var title = root.title.value;
		var description = root.description.value;
		var price = root.price.value;
		if (title == ''){
			alert('Please give a title');
			root.title.focus();
			return false;
		}
		if (description == ''){
			alert('Please give a description');
			root.description.focus();
			return false;
		}
		if (price == '' || isNaN(price)){
			alert('Please give a numeric Price');
			root.title.focus();
			return false;
		}
		var rad1 = document.edit_book.image_choice[1].checked;
		var rad2 = document.edit_book.image_choice[2].checked;
		var rad3 = document.edit_book.image_choice[0].checked;
		if (rad1 == '' && rad2 == '' && rad3 == ''){
			alert('Please select an option for the image.');
			return false;
		}
		else if (rad1){
			var existing_image = document.edit_book.existing_image.value;
			if (existing_image == ''){
				alert('Please select an image.');
				document.edit_book.existing_image.focus();
				return false;
				exit;	
			}
		}
		else if (rad2){
			var new_image = document.edit_book.new_image.value;
			if (new_image == ''){
				alert('Please browse an image.');	
				document.edit_book.new_image.focus();
				return false;
				exit;
			}
		}
		return true;
	}
	
	function viewBookImage(id){
		window.open('/books/admin/view_book_image.php?id=' + id, 'view_book_image', 'width=300,height=200,status=0;toolbar=0,history=0,left=100,top=100');
		return false;
	}
	
	function validateAddPhotoAlbum(){
		
		var root = document.add_album;
		var title = root.title.value;
		var comments = root.comments.value;
		if (title == ''){
			alert('Please give a title');
			root.title.focus();
			return false;
		}
		if (comments == ''){
			alert('Please give your comments');
			root.comments.focus();
			return false;
		}
		var rad1 = document.add_album.image_choice[0].checked;
		var rad2 = document.add_album.image_choice[1].checked;
		if (rad1 == '' && rad2 == ''){
			alert('Please select an option for the Thumbnail.');
			return false;
		}
		else if (rad1 != ''){
			var existing_image = document.add_album.existing_image.value;
			if (existing_image == ''){
				alert('Please select a Thumbnail.');
				document.add_album.existing_image.focus();
				return false;
			}
		}
		else if (rad2 != ''){
			var new_image = document.add_album.new_image.value;
			if (new_image == ''){
				alert('Please browse a Thumbnail');
				document.add_album.new_image.focus();
				return false;
			}	
		}
		return true;
	}
	
	function validateEditPhotoAlbum(){
		
		var root = document.add_album;
		var title = root.title.value;
		var comments = root.comments.value;
		if (title == ''){
			alert('Please give a title');
			root.title.focus();
			return false;
		}
		if (comments == ''){
			alert('Please give your comments');
			root.comments.focus();
			return false;
		}
		var rad1 = document.add_album.image_choice[1].checked;
		var rad2 = document.add_album.image_choice[2].checked;
		var rad3 = document.add_album.image_choice[0].checked;
		if (rad1 == '' && rad2 == '' && rad3 == ''){
			alert('Please select an option for the Thumbnail.');
			return false;
		}
		else if (rad1){
			var existing_image = document.add_album.existing_image.value;
			if (existing_image == ''){
				alert('Please select a Thumbanil.');
				document.add_album.existing_image.focus();
				return false;
				exit;	
			}
		}
		else if (rad2){
			var new_image = document.add_album.new_image.value;
			if (new_image == ''){
				alert('Please browse a Thumbnail.');	
				document.add_album.new_image.focus();
				return false;
				exit;
			}
		}
		return true;
	}
	
	function validateAddPhotosToAlbum(){
	var ok = 0;
	for(i=1;i<=5;i++){
		var title_f = "title_"+i;
		var comments_f = "comments_"+i;
		var title = eval('document.add_photos.'+title_f+'.value');
		var comments = eval('document.add_photos.'+comments_f+'.value');
		if (title != '' && comments != ''){
			ok++;
		}
		if (ok == 0){
			alert('Please fill up the fields for one photo at least');
			return false;
		}
		else {
			return true;
		}
		
	}
	
}

function previewThumb1(page,folder,i){

	var newEntry = eval('document.'+page+'.existing_thumb_'+i+'.value');
	//alert(newEntry);
	//exit;
		
	//var newEntry = document.add_portfolio.preview_image[document.add_portfolio.preview_image.selectedIndex].value;
	if (newEntry == ''){
		alert('Please select a Thumbnail.');
		return false;
	}
	window.open('/common/view_thumb.php?entry=' + newEntry + '&folder=' + folder, 'view_image', 'width=350,height=350,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
			
	}
	
function previewImage1(page,folder,i){
//alert(page);
	var newEntry = eval('document.'+page+'.existing_image_'+i+'.value');
	//alert(newEntry);
	//exit;
		
	//var newEntry = document.add_portfolio.preview_image[document.add_portfolio.preview_image.selectedIndex].value;
	if (newEntry == ''){
		alert('Please select an image.');
		return false;
	}
	window.open('/common/view_image.php?entry=' + newEntry + '&folder=' + folder, 'view_image', 'width=350,height=350,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
			
	}
	
	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 validateAddVipNews(){
		
		var title = document.add_vip_news.title.value;
		var description = document.add_vip_news.description.value;
		if (title == ''){
			alert('Please give a Title.');
			document.add_vip_news.title.focus();
			return false;
		}
		if (description == ''){
			alert('Please give a Description.');
			document.add_vip_news.description.focus();
			return false;
		}
		var rad1 = document.add_vip_news.image_choice[0].checked;
		var rad2 = document.add_vip_news.image_choice[1].checked;
		if (rad1 == '' && rad2 == ''){
			alert('Please select an option for the image');
			return false;
		}
		if (rad1){
			var existing_image = document.add_vip_news.existing_image.value;
			if (existing_image == ''){
				alert('Please select an image.');
				document.add_vip_news.existing_image.focus();
				return false;
				exit;	
			}
		}
		if (rad2){
			var new_image = document.add_vip_news.new_image.value;
			if (new_image == ''){
				alert('Please browse an image.');	
				document.add_vip_news.new_image.focus();
				return false;
				exit;
			}
		}
		return true;
	}
	
	function validateEditVipNews(){
		
		var title = document.add_vip_news.title.value;
		var description = document.add_vip_news.description.value;
		if (title == ''){
			alert('Please give a Title.');
			document.add_vip_news.title.focus();
			return false;
		}
		if (description == ''){
			alert('Please give a Description.');
			document.add_vip_news.description.focus();
			return false;
		}
		var rad1 = document.add_vip_news.image_choice[0].checked;
		var rad2 = document.add_vip_news.image_choice[1].checked;
		var rad3 = document.add_vip_news.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_vip_news.existing_image.value;
			if (existing_image == ''){
				alert('Please select an image.');
				document.add_vip_news.existing_image.focus();
				return false;
				exit;	
			}
		}
		if (rad3){
			var new_image = document.add_vip_news.new_image.value;
			if (new_image == ''){
				alert('Please browse an image.');	
				document.add_vip_news.new_image.focus();
				return false;
				exit;
			}
		}
		return true;
	}
	
	function validateChooseFolder(nb){

	var i;
	for (i=0;i<nb;i++){
		var rad = document.delete_images.folder[i].checked;
		if (rad == true){
			
			return true;
		}
	}
	alert('Please choose a folder');
	return false;
}

function validateDeleteImages(nb){
	var i;
	for (i=0;i<nb;i++){
	var check = document.delete_image.elements[i].checked;
	if (check == true){
		return confirm('Are you sure you want to delete the selected image(s)?');
	}
	}
	alert('Please choose the images you want to delete.')
	return false;
}

function resetOrderForm(){
	
	var root = document.order;
	root.fullname.value = '';
	root.email.value = '';
	root.address.value = '';
	root.phone.value = '';
	root.fax.value = '';
	root.year.value = '';
	root.month.value = '';
	root.day.value = '';
	root.quantity.value = '';
	return false;
}

function viewSignCaracteristics(id){
	window.open('/signs/view_sign_caracteristics.php?id=' + id, 'view_sign', 'width=420,height=400,status=0,toolbar=0,scrollbars=1,history=0,left=100,top=100');
	return false;
}

function previewPressThumb(name){
	window.open('/press_releases/admin/preview_press_thumb.php?name=' + name, 'view_thumb', 'width=200,height=200,status=0,toolbar=0,scrollbars=0,history=0,left=100,top=100');
	return false;
}

function validateAddInterview(){
	var root = document.add_interview;
	var magazine = root.magazine.value;
	var title = root.title.value;
	var year = root.year.value;
	var month = root.month.value;
	var day = root.day.value;
	var comments = root.comments.value;
	var image1 = root.image1.value;
	var image2 = root.image2.value;
	var image3 = root.image3.value;
	var image4 = root.image4.value;
	var image5 = root.image5.value;
	
	if (magazine == ''){
		alert('Please select a magazine.');
		root.magazine.focus();
		return false;
	}
	if (title == ''){
		alert('Please insert a title.');
		root.title.focus();
		return false;
	}
	if (year == '' || month == '' || day == ''){
		alert('Please give a valid date.');
		return false;
	}
	if (comments == ''){
		alert('Please give your comments.');
		root.comments.focus();
		return false;
	}
	var rad1 = root.image_choice[0].checked;
	var rad2 = root.image_choice[1].checked;
	if (rad1 == '' && rad2 == ''){
		alert('Please select an option for the Thumbnail.');
		return false;
	}
	else if (rad1 != ''){
		var existing_image = root.existing_image.value;
		if (existing_image == ''){
			alert('Please select a Thumbnail.');
			root.existing_image.focus();
			return false;
		}
	}
	else if (rad2 != ''){
		var new_image = root.new_image.value;
		if (new_image == ''){
			alert('Please browse a Thumbnail');
			root.new_image.focus();
			return false;
		}	
	}
	if (image1 == '' && image2 == '' && image3 == '' && image4 == '' && image5 == ''){
		alert('Please browse at least one Image');
		root.image1.focus();
		return false;
	}
	return true;
}

function validateEditInterview(){
	
	var root = document.update_interview;
	var magazine = root.magazine.value;
	var title = root.title.value;
	var year = root.year.value;
	var month = root.month.value;
	var day = root.day.value;
	var comments = root.comments.value;
	
	if (magazine == ''){
		alert('Please select a magazine.');
		root.magazine.focus();
		return false;
	}
	if (title == ''){
		alert('Please insert a title.');
		root.title.focus();
		return false;
	}
	if (year == '' || month == '' || day == ''){
		alert('Please give a valid date.');
		return false;
	}
	if (comments == ''){
		alert('Please give your comments.');
		root.comments.focus();
		return false;
	}
	return true;
}

function resetContactForm(){
	
	var root = document.contact;
	root.firstname.value = '';
	root.lastname.value = '';
	root.age.value = '';
	root.email.value = '';
	root.country_id.value = '';
	root.address.value = '';
	root.phone.value = '';
	root.message.value = '';
}

function validateAddMagazine(){
	
	var name = document.add_magazine.name.value;
	if (name == ''){
		alert('Please give a magazine name.');
		document.add_magazine.name.focus();
		return false;
	}
	return true;
}

function validateEditMagazine(){
	
	var name = document.update_magazine.name.value;
	if (name == ''){
		alert('Please give a magazine name.');
		document.update_magazine.name.focus();
		return false;
	}
	return true;
}

function verifyAddress(){
	var name = document.add.name.value;
	var email = document.add.email.value;
	if(name == ""){
		alert('please enter a name');
		document.add.name.focus();
		return false;
	}
	if(email == ""){
		alert('please enter an email');
		document.add.email.focus();
		return false;
	}
	document.add.submit();
	return true;
}

function validateUpdateSign(){
	var description = document.sign.description.value;
	if (description == '') {
		alert('Please give the Sign description.');
		document.sign.description.focus();
		return false;
	}
	return true;
}
