/*COPYRIGHT 2004 PLD PRODUCTIONS - MAY NOT BE RE-USED OR COPIED WITHOUT WRITTEN PERMISSION*/

var regExpURL=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;

function formcheck_site(){
text=document.site_text.text;
if(text.value==""){
alert("Please enter some text for display");
text.focus();
return false;
}
}

function pageSet(page,width,height){
var scr;
scr=screen.width;
posWinL=(scr/2)-(width/2)+"px";
var newWindow;
newWindow=window.open(page,"Display","width="+width+",height="+height+",left="+posWinL+",top=120px,resizable=no,scrollbars=yes");
}

function closer(){
window.close();
}

function formcheck_pwd(){
form_username=document.log_in.username;
form_password=document.log_in.password;
if(form_username.value==""){
alert("Please complete the username field before attempting log in");
form_username.focus();
return false;
}
if(form_password.value==""){
alert("Please complete the password field before attempting log in");
form_password.focus();
return false;
}
}

function formcheck_pwd_recall(){
username=document.lost_password.username;
if(username.value==""){
alert("Please insert your username. If you have forgotten your username, please contact the administrator");
username.focus();
return false;
}
}


function formcheck_create_organisation(){
org_name=document.org_details.name;
if(org_name.value==""){
alert("Please complete the name field");
org_name.focus();
return false;
}
}

function formcheck_create_venue(){
venue_name=document.venue_details.name;
if(venue_name.value==""){
alert("Please complete the name field");
venue_name.focus();
return false;
}
}

function formcheck_create_conference(){
conf_name=document.conf_details.name;
venue_name=document.conf_details.venue;
if(conf_name.value==""){
alert("Please complete the name field");
conf_name.focus();
return false;
}
}

function formcheck_profile(){
email=document.user_details.email;
first_time=document.user_details.first_time;

if(document.user_details.terms){
terms=document.user_details.terms;
if(terms[1].checked==true){
alert("You have not yet accepted the terms and conditions of use. \n\nYou will not be able to proceed until you have accepted these terms.");
terms[0].focus;
return false;
}
if(terms[0].checked==true){
document.user_details.first_time.value=2;
}
}
if(email.value==""){
alert("Please add your e-mail address so you can receive community communications");
email.focus();
return false;
}
if(!regExpURL.test(email.value)){
alert("It is essential that you add a valid, functional, e-mail address so you can receive community communications, please correct.");
email.focus();
email.select();
return false;
}
}

function formcheck_create_member(){
member_first_name=document.user_details.firstname;
member_last_name=document.user_details.lastname;
member_organisation=document.user_details.organisation;
member_username=document.user_details.username;
member_password=document.user_details.password;
member_conference=document.user_details.conference;

if(member_first_name.value==""){
alert("Please complete the first name field");
member_first_name.focus();
return false;
}
if(member_last_name.value==""){
alert("Please complete the last name field");
member_last_name.focus();
return false;
}
if(member_username.value==""){
alert("Please complete the username field");
member_username.focus();
return false;
}
if(member_username.value.length<5 || member_username.value.length>20){
alert("Usernames must be between 5 and 20 characters in length");
member_username.select();
return false;
}
if(member_password.value.length<6 || member_password.value.length>8){
alert("Passwords must be between 6 and 8 characters in length");
member_password.select();
return false;
}

if(member_password.value==""){
alert("Please complete the password field");
member_password.focus();
return false;
}
}

function formcheck_update_member(){
member_first_name=document.user_details.firstname;
member_last_name=document.user_details.lastname;
member_username=document.user_details.username;
member_password=document.user_details.password;

if(member_first_name.value==""){
alert("Please complete the first name field");
member_first_name.focus();
return false;
}
if(member_last_name.value==""){
alert("Please complete the last name field");
member_last_name.focus();
return false;
}
if(member_password.value==""){
alert("Please complete the password field");
member_password.focus();
return false;
}
if(member_password.value.length<6 || member_password.value.length>8){
alert("Passwords must be between 6 and 8 characters in length");
member_password.select();
return false;
}
}


function formcheck_password(){
current_password=document.change_password.current_password;
new_password=document.change_password.new_password;
pwd_test=new_password.value.length;
password_check=document.change_password.password_check;
if(current_password.value==""){
alert("Please complete the current password");
current_password.focus();
return false;
}
if(new_password.value==""){
alert("Please complete the new password field");
new_password.focus();
return false;
}
if(password_check.value==""){
alert("Please complete the password check field");
password_check.focus();
return false;
}
if(new_password.value != password_check.value){
alert("Your new and check passwords are not the same. Please check and re-enter.");
new_password.focus();
new_password.select();
return false;
}
if(pwd_test<6){
alert("You have used too few characters in your new password. It should be between 6 and 8 characters long");
new_password.focus();
new_password.select();
return false;
}
if(pwd_test>8){
alert("You have used too many characters in your new password. It should be between 6 and 8 characters long");
new_password.focus();
new_password.select();
return false;
}
}

function formcheck_upload_form(){
upload_doc=document.document_details.docu;
if(upload_doc.value==""){
alert("Please select a document to upload");
upload_doc.focus();
return false;
}
if(upload_doc.value!=""){
img_str=upload_doc.value;
str_len=img_str.length;
str_len=parseInt(str_len);
img_str1=img_str.substring(str_len-3);
if(img_str1=="doc"||img_str1=="pdf"||img_str1=="rtf"||img_str1=="ppt"||img_str1=="jpg"||img_str1=="gif"){
return true;
}
else{
alert("Please check the file type you are uploading.\n\nOnly file extensions of \"doc\",\"pdf\",\"rtf\",\"ppt\",\"pot\",\"pps\",\"jpg\",\"gif\" permitted.");
upload_doc.focus();
upload_doc.select();
return false;
}
}
}

function formcheck_library_edit(){
docname=document.document_details.name;
if(docname.value==""){
alert("Please enter a name for the document");
docname.focus();
return false;
}
}

function formcheck_upload_image(){
upload_img=document.document_details.img_name;
if(upload_img.value==""){
alert("Please select an image to upload");
upload_img.focus();
return false;
}
if(upload_img.value!=""){
img_str=upload_img.value;
str_len=img_str.length;
str_len=parseInt(str_len);
img_str1=img_str.substring(str_len-3);
if(img_str1=="gif"||img_str1=="png"||img_str1=="jpg"){
return true;
}
else{
alert("Please check the file type you are uploading.\n\nOnly file extensions of \"gif\", \"png\", or \"jpg\" permitted.");
upload_img.focus();
upload_img.select();
return false;
}
}
}

function formcheck_board_topic(){
topic_title=document.create_topic.topic_title;
text=document.create_topic.text;
if(topic_title.value==""){
alert("Please create a topic title");
topic_title.focus();
return false;
}
if(text.value==""){
alert("Please create topic related text before submitting");
text.focus();
return false;
}
}

function formcheck_forum_create(){
forum_title=document.create_forum.forum_title;
if(forum_title.value==""){
alert("Please specify a forum title");
forum_title.focus();
return false;
}
}

function formcheck_forum_edit(){
forum_title=document.forum_details.forum_title;
if(forum_title.value==""){
alert("Please specify a forum title");
forum_title.focus();
return false;
}
}

function formcheck_search_conference(){
conf=document.search_form_4.search;
if(conf.value=="testa"){
alert("Please select a conference to use this search");
conf.focus();
return false;
}
}

function formcheck_board_message(){
//var reg_exp_hlink=/\b(([h][t][t][p][:][/][/])?([w]{3}[.])?([a-z]*[-]?[a-z]*[_]?[a-z]*)[.][a-z]*[.]?[a-z]*[.]?[a-z?]*[/?#]?[\w]*[/]?[\w]*)/gi;
//var reg_exp_hlink_www=/[\s][w]{3}[.]/gi;
text=document.create_message.text;
if(text.value==""){
alert("Please create text before submitting");
text.focus();
return false;
}
}

function reply(){
if (window.location.search){
alert("The password has been e-mailed to the registered e-mail address");
}
}

function formcheck_blank(formname){
regExpURL=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
form_element=eval("document.forms[formname]");
elements_len=form_element.elements.length;
counter=0;
while(counter<elements_len){
if(form_element.elements[counter].value==""){
alert("Please complete the field to proceed");
form_element.elements[counter].focus();
form_element.elements[counter].style.backgroundColor="#FFE79D";
return false;
}
if(form_element.elements[counter].name=="email" || form_element.elements[counter].name=="email_check"){
if(!regExpURL.test(form_element.elements[counter].value)){
alert("The e-mail address entered is not valid, please correct.");
form_element.elements[counter].focus();
form_element.elements[counter].select();
return false;
}
if(form_element.elements["email"].value != form_element.elements["email_check"].value){
alert("Your e-mail address must appear in both e-mail fields and be exactly the same to proceed");
form_element.elements["email"].focus();
form_element.elements["email"].select();
return false;
}
}
counter++;
}
}

function confirm_delete(){
if(confirm("Are you sure you wish to proceed with the deletion? There will be no way to \"undo\" this action")){
return true;
}
else{
return false;
}
}