function add_product_validate()
{
	var msg = '';
	var title = '';
	var p_link = '';
	
	if(document.add_product_form.product_title.value == '') { title = 'Please put the title.\n'; }
	if(document.add_product_form.product_url.value == '') { p_link = 'Please put the link.\n'; }
	
	if(title == '' && p_link == '') { return true; }
	else
	{
		msg = title + p_link;
		
		alert(msg);
		
		return false;
	}
}

function login_validate()
{
	var msg = '';
	var username = '';
	var password = '';
	
	if(document.login_form.username.value == "") { username = "Please put your username.\n"; }	
	if(document.login_form.password.value == "") { password = "Please put your password.\n"; }	
	
	if(username == "" && password == "") { return true; }
	else
	{
		msg = username + password;
		
		alert(msg);
		
		return false;
	}
}

function sign_up_validate()
{
	var msg = '';
	var username = '';
	var username_alphanumeric = '';
	var password = '';
	var confirm_password = '';
	var email = '';
	var email_verify = '';
	var city = '';
	var zip = '';
	var captcha_word = '';
	var captcha_word_validate = '';
	var agree_to_terms = '';
	var over_fifteen = '';
	
	if(document.sign_up_form.username.value == "") { username = "Please put your username.\n"; }	
	if(document.sign_up_form.username.value != '' && !document.sign_up_form.username.value.match(/^[a-zA-Z0-9]+$/)) { username_alphanumeric = "Username must be alphanumeric only.\n"; }	
	if(document.sign_up_form.password.value == "") { password = "Please put your password.\n"; }	
	if(document.sign_up_form.confirm_password.value != document.sign_up_form.password.value) { confirm_password = 'Password\'s do not match.\n'; }	
	if(document.sign_up_form.email.value == '') { email = 'Please put your email.\n'; } 
	if(document.sign_up_form.email.value != '' && !document.sign_up_form.email.value.match(/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/)) { email_verify = 'Email is invalid.\n'; }	
	if(document.sign_up_form.city.value == '') { city = 'Please put your city.\n'; }	
	if(document.sign_up_form.zip.value == '') { zip = 'Please put your zip.\n'; }
	//if(document.sign_up_form.captcha_word.value == '') { captcha_word = 'Please put the captcha.\n'; }
	//if(document.sign_up_form.captcha_word.value != '' && document.sign_up_form.captcha_word.value != 'PNSYJ') { captcha_word_validate = 'Wrong input on captcha.\n'; }
	if(document.sign_up_form.agree_to_terms.value == '') { agree_to_terms = 'You must agree to the terms of use.\n'; }	
	if(document.sign_up_form.over_fifteen.value == '') { over_fifteen = 'You must be atleast fifteen of age.\n'; }	
	
	if(username == "" && password == "" && username_alphanumeric == "" && confirm_password == '' && email == '' && email_verify == '' && city == '' && zip == '' && captcha_word == '' && captcha_word_validate == '' && agree_to_terms == '' && over_fifteen == '') { return true; }
	else
	{
		msg = username + username_alphanumeric + password + confirm_password + email + email_verify + city + zip + captcha_word + captcha_word_validate + agree_to_terms + over_fifteen;
		
		alert(msg);
		
		return false;
	}
}

function contact_validate()
{
	var msg = '';
	var firstname = '';
	var lastname = '';
	var email = '';
	var email_valid = '';
	var comments = '';
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if(document.contact_form.firstname.value == '') { firstname = 'Please put your firstname.\n'; }	
	if(document.contact_form.lastname.value == '') { lastname = 'Please put your lastname.\n'; }	
	if(document.contact_form.email.value == '') { email = 'Please put your email.\n'; }	
	if(reg.test(document.contact_form.email.value) == false && document.contact_form.email.value != '') { email_valid = 'Please put a valid email address.\n'; }	
	if(document.contact_form.comments.value == '') { comments = 'Please put your comments.\n'; }	
	
	if(firstname == ''&& lastname == '' && email == '' && email_valid == '' && comments == '') { return true; }
	else
	{
		msg = firstname + lastname + email + email_valid + comments;
		
		alert(msg);
		
		return false;
	}
}

function video_detail_send_message()
{
	var msg = '';
	var subject = '';
	var message = '';
	
	if(document.video_detail_send_message_form.subject.value == '') { subject = 'Please put the subject.\n'; }
	if(document.video_detail_send_message_form.message.value == '') { message = 'Please put your message.\n'; }
	
	if(subject == '' && message == '') { return true; }
	else
	{
		msg = subject + message;
		
		alert(msg);
		
		return false;
	}
}

function v_d_comment()
{
	var msg = '';
	var comment = '';
	
	if(document.v_d_comment_form.comment.value == '') { comment = 'Please put your comment.\n'; }
	
	if(comment == '') { return true; }
	else
	{
		msg = comment;
		
		alert(msg);
		
		return false;
	}
}

function m_a_change_password()
{
	var msg = '';
	var password = '';
	var password_validate = '';
	
	if(document.m_a_change_password_form.password1.value == '') { password = 'Please put the new password.\n'; }
	if(document.m_a_change_password_form.password2.value != document.m_a_change_password_form.password1.value) { password_validate = 'Password\'s do not match.\n'; }
	
	if(password == '' && password_validate == '') { return true; }
	else
	{
		msg = password + password_validate;
		
		alert(msg);
		
		return false;
	}
}

function cd_Upload()
{
	var msg = '';
	var title = '';
	var file = '';
	var imgpath = document.getElementById('cd_File').value;
	
	if(document.cd_UploadForm.title.value == '') { title = '[ Please put your title ]'; }
	
	if(imgpath != "")	
	{
		var arr1 = new Array;
		arr1 = imgpath.split("\\");
		var len = arr1.length;
		var img1 = arr1[len-1];
		var filext = img1.substring(img1.lastIndexOf(".")+1);
	
		if(filext == "jpg" || filext == "jpeg" || filext == "gif" || filext == "bmp") {}
		else
		{
			file = '[ Wrong file format ]';
			return false;
		}
	}
	
	if(title == '' && file == '') { return true; }
	else
	{
		msg = title + file;
		
		alert(msg);
		
		return false;
	}
}

function show_progress_bar(boxid)
{
   document.getElementById(boxid).style.visibility = "visible";
   document.getElementById(boxid).style.marginBottom = "10px";
   document.getElementById(boxid).style.height = "auto";
   
   return true;
}

function show_message_box(boxid)
{
   document.getElementById(boxid).style.visibility = "visible";
   
   return false;
}

function close_message_box(boxid)
{
   document.getElementById(boxid).style.visibility = "hidden";
   
   return false;
}

function drop_down_menu(boxid, boxid2)
{
   document.getElementById(boxid).style.visibility = "visible";
   document.getElementById(boxid2).style.visibility = "visible";
   
   return false;
}

function drop_down_hide(boxid, boxid2)
{
   document.getElementById(boxid).style.visibility = "hidden";
   document.getElementById(boxid2).style.visibility = "hidden";
   
   return false;
}

function ed_stats_content(boxid1, boxid2)
{	
	document.getElementById(boxid1).style.visibility = "visible";
    document.getElementById(boxid2).style.visibility = "hidden";
}

function ed_stats_content_close(boxid)
{	
	document.getElementById(boxid).style.visibility = "hidden";
}

function ed_moreinfo_content(boxid1, boxid2)
{	
	document.getElementById(boxid1).style.visibility = "visible";
    document.getElementById(boxid2).style.visibility = "hidden";
}

function ed_moreinfo_content_close(boxid)
{	
	document.getElementById(boxid).style.visibility = "hidden";
}
