// JavaScript Document

// VALIDATE LINKS
// VALIDATE LINKS
function validate_links() {
var title = document.myForm.title.value;
var link = document.myForm.link.value;
var tomatch= /[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
var description = document.myForm.description.value;

if (title == '' ) {
alert('Please enter a Title');
return false;
}

if (link == '' ) {
alert('Please enter a Link.');
return false;
}

// if (description == '' ) {
// alert('Please enter a Description.');
// return false;
// }
	
if (tomatch.test(link))
{
window.alert("Your URL is formatted correctly.");
return true;
}
else
{
window.alert("URL invalid. Try again.");
return false; 
}
	}
	
// END VALIDATE LINKS
// END VALIDATE LINKS

// VALIDATE CATEGORIES
// VALIDATE CATEGORIES
function validate_categories() {

var category = document.myForm.category.value;
var category_image = document.myForm.category_image.value;
var category_desc = document.myForm.category_desc.value;
var orientation = document.myForm.orientation.value;

if (category == '' ) {
alert('Please enter a Category.');
return false;
}

if (category_image == '' ) {
alert('Please upload a Category Image.');
return false;
}

//if (category_desc == '' ) {
//alert('Please enter a Description.');
//return false;
//}

if (orientation == '' ) {
alert('Please select the Image Orientation.');
return false;
}

	}
// END VALIDATE CATEGORIES
// END VALIDATE CATEGORIES

// VALIDATE UPLOAD
// VALIDATE UPLOAD
function validate_upload() {

var name_image = document.myForm.name_image.value;
var name_thumb = document.myForm.name_thumb.value;
var name_video = document.myForm.name_video.value;
var orientation = document.myForm.orientation.value;

if (name_image == '' ) {
alert('Please upload an Image for this video.');
return false;
}

if (name_thumb == '' ) {
alert('Please upload a Thumbnail for this video.');
return false;
}

if (name_video == '' ) {
alert('Please upload a Video.');
return false;
}

if (orientation == '' ) {
alert('Please select the Image Orientation.');
return false;
}

	}
// END VALIDATE UPLOAD
// END VALIDATE UPLOAD

// DOCUMENT UPLOAD
// DOCUMENT UPLOAD
function validate_document_upload() {

var name_document = document.myForm.name_document.value;

if (name_document == '' ) {
alert('Please select a Document to upload.');
return false;
}
	}
// END DOCUMENT UPLOAD
// END DOCUMENT UPLOAD

// TEMPLATE UPLOAD
// TEMPLATE UPLOAD
function validate_template_upload() {

var name_template = document.myForm.name_template.value;

if (name_template == '' ) {
alert('Please select a Template to upload.');
return false;
}
	}
// END TEMPLATE UPLOAD
// END TEMPLATE UPLOAD

// VALIDATE LOGIN
// VALIDATE LOGIN
function validate_login() {

var nickname = document.myForm.nickname.value;
var password = document.myForm.password.value;

if (nickname == '' ) {
alert('Please your Username.');
return false;
}

if (password == '' ) {
alert('Please your Password.');
return false;
}
	}
// END VALIDATE LOGIN
// END VALIDATE LOGIN

// VALIDATE TESTIMONIAL
// VALIDATE TESTIMONIAL
function validate_testimonial() {

var title = document.myForm.title.value;
var person = document.myForm.person.value;
var description = document.myForm.description.value;


if (title == '' ) {
alert('Please enter a Title for your Testimonial.');
return false;
}

if (person == '' ) {
alert('Please tell us who you are.');
return false;
}

// if (description == '' ) {
// alert('Please enter your Testimonial text.');
// return false;
// }
	}
// END VALIDATE TESTIMONIAL
// END VALIDATE TESTIMONIAL
	
	
