maxYear){
alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear);
return false;
}
if (dtStr.indexOf(dtCh,pos1+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
alert("Please enter a valid date");
return false;
}
return true
}
function validateURL(myValue) {
var v = new RegExp();
v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
if (!v.test(myValue)) {
//alert("You must supply a valid URL, it will start with http:// ");
return false;
}
return true;
}
function DateUsage(){
var Date=document.getElementById('date');
if (isDate(Date.value)==false){
Date.focus()
return false
}
return true
}
function capitaliseFirstLetter(string)
{
return string.charAt(0).toUpperCase() + string.slice(1);
}
function validateFellowshipForm(){
var Phone=document.fellowship_form.contact_telephone;
var Fax=document.fellowship_form.contact_fax;
var Email=document.fellowship_form.contact_email;
var FellowType=document.fellowship_form.fellowship_type;
var FellowLength=document.fellowship_form.fellowship_length;
var FellowDescr=document.fellowship_form.description;
var FellowStart=document.fellowship_form.fellowship_start;
var EndDisplay=document.fellowship_form.end_display;
var ContactName=document.fellowship_form.contact_name;
var Website=document.fellowship_form.contact_website;
//also validate starting date (MM/YYYY)
if (Phone.value!='' && checkInternationalPhone(Phone.value)==false){
alert("Please Enter a Valid Phone Number: (XXX) XXX-XXXX or no entry at all");
Phone.focus();
return false;
}
if ( (Fax.value!='' && Fax.value!=null) && checkInternationalPhone(Fax.value)==false){
alert("Please enter a Valid Fax Number: (XXX) XXX-XXXX or no entry at all");
Fax.focus();
return false;
}
if (Email.value!='' && validateEmail(Email.value)==false ) {
alert("Please enter an email address: XXXX@YYYY.ZZZ or no entry at all");
Email.focus();
return false;
}
if ( isShortDate(FellowStart.value)==false ){
alert("Please enter a valid fellowship starting date: MM/YYYY");
FellowStart.focus();
return false;
}
if ( isShortDate(EndDisplay.value)==false ){
alert("Please enter a valid listing end date: MM/YYYY");
EndDisplay.focus();
return false;
}
if ( (FellowType.value==null) || (FellowType.value=='') ) {
alert("Please choose a fellowship specialty for this ad");
FellowType.focus();
return false;
}
if ( (FellowLength.value==null) || (FellowLength.value=='') || (isOneTwoThree(FellowLength.value)==false) ) {
alert("Please choose a valid length for this fellowship (1, 2 or 3 years)");
FellowLength.focus();
return false;
}
if ( (FellowDescr.value==null) || (FellowDescr.value=='') ) {
alert("You have to try and enter some sort of description for this ad. Otherwise, what's the point?");
FellowDescr.focus();
return false;
}
if ( (ContactName.value==null) || (ContactName.value=='') ) {
alert("You have to enter a contact name for this fellowship.");
ContactName.focus();
return false;
}
if ( (Website.value!=null && Website.value!='') && validateURL(Website.value)==false ) {
alert("You need enter a valid website (http:// . . . .) or leave it blank.");
Website.focus();
return false;
}
return true
}
function PreviewFellowship() {
if (validateFellowshipForm()==false) {return false;}
var Image=document.fellowship_form.image_url;
var Title=document.fellowship_form.title;
var Phone=document.fellowship_form.contact_telephone;
var Fax=document.fellowship_form.contact_fax;
var Email=document.fellowship_form.contact_email;
var Start=document.fellowship_form.fellowship_start;
var FellowType=document.fellowship_form.fellowship_type;
var FellowLength=document.fellowship_form.fellowship_length;
var Institution = document.fellowship_form.institution;
var Location = document.fellowship_form.fellowship_place;
var FellowDescr=document.fellowship_form.description;
var ContactName=document.fellowship_form.contact_name;
var Title=document.fellowship_form.title;
var Require=document.fellowship_form.requirements;
var Details=document.fellowship_form.application;
var Deadlines=document.fellowship_form.deadlines;
var Salary=document.fellowship_form.salary;
var ConName=document.fellowship_form.contact_name;
var ConAddress=document.fellowship_form.contact_address;
var ConPhone=document.fellowship_form.contact_phone;
var ConFax=document.fellowship_form.contact_fax;
var ConEmail=document.fellowship_form.contact_email;
var Website=document.fellowship_form.contact_website;
var fill;
fill = '';
fill=fill+'Preview of Listing:
';
//image if present
if(Image.value != null && Image.value != '') {
fill = fill+'';
}
//title if present
if(Title.value!=null && Title.value!=''){
fill=fill+''+Title.value.replace(/\n/g, "
")+'
';
}
//figure out all the dates stuff
var start = document.fellowship_form.fellowship_start.value;
var length = document.fellowship_form.fellowship_length.value;
var sep = "/";
var pos1=start.indexOf(sep)
var strMonth=start.substring(0,pos1);
var strYear=parseFloat(start.substring(pos1+1))+parseFloat(length);
var end = strMonth+"/"+strYear;
//Our fellowship heading:
fill=fill+''+capitaliseFirstLetter(FellowType.value)+' Fellowship';
if(Institution.value!=null && Institution.value!=''){
fill=fill+'
'+Institution.value.replace(/\n/g, "
")+'';
}
if(Location.value!=null && Location.value!=''){
fill=fill+'
'+Location.value.replace(/\n/g, "
")+'';
}
fill=fill+'
'+start+' to '+end+'
';
//Description
fill=fill+'Fellowship Description: '+FellowDescr.value.replace(/\n/g, "
")+'
';
if(Require.value!=null && Require.value!=''){
fill=fill+'Fellowship Requirements: '+Require.value.replace(/\n/g, "
")+'
';
}
if(Details.value!=null && Details.value!=''){
fill=fill+'Fellowship Details: '+Details.value.replace(/\n/g, "
")+'
';
}
if(Deadlines.value!=null && Deadlines.value!=''){
fill=fill+'Fellowship Deadlines: '+Deadlines.value.replace(/\n/g, "
")+'
';
}
if(Salary.value!=null && Salary.value!=''){
fill=fill+'Salary/Stipend: '+Salary.value.replace(/\n/g, "
")+'
';
}
//contact info:
fill=fill+'Contact Information:
';
fill=fill+ConName.value.replace(/\n/g, "
")+'
'
if(ConAddress.value!=null && ConAddress.value!=''){
fill=fill+ConAddress.value.replace(/\n/g, "
")+'
';
}
fill=fill+'Phone: '+ConPhone.value+'
'
if(ConFax.value!=null && ConFax.value!=''){
fill=fill+'Fax: '+ConFax.value+'
';
}
fill=fill+'Email: '+ConEmail.value+'
'
if(Website.value!=null && Website.value!=''){
fill=fill+'Website: : '+Website.value+'
';
}
fill=fill+'
';
fill = fill+'End of Listing
';
fill = fill+'';
my_window = window.open("", "Preview", "status=1,resizable=1,scrollbars=yes");
my_window.document.write(fill);
}
function validateJobForm(){
var Phone=document.job_form.contact_telephone;
var Fax=document.job_form.contact_fax;
var Email=document.job_form.contact_email;
var FellowType=document.job_form.fellowship_type;
var FellowDescr=document.job_form.description;
var FellowStart=document.job_form.fellowship_start;
var EndDisplay=document.job_form.end_display;
var ContactName=document.job_form.contact_name;
var Website=document.job_form.contact_website;
//also validate starting date (MM/YYYY)
if (Phone.value!='' && checkInternationalPhone(Phone.value)==false){
alert("Please Enter a Valid Phone Number: (XXX) XXX-XXXX or no entry at all");
Phone.focus();
return false;
}
if ( (Fax.value!='' && Fax.value!=null) && checkInternationalPhone(Fax.value)==false){
alert("Please enter a Valid Fax Number: (XXX) XXX-XXXX or no entry at all");
Fax.focus();
return false;
}
if (Email.value!='' && validateEmail(Email.value)==false ) {
alert("Please enter an email address: XXXX@YYYY.ZZZ or no entry at all");
Email.focus();
return false;
}
if ( isShortDate(FellowStart.value)==false ){
alert("Please enter a valid fellowship starting date: MM/YYYY");
FellowStart.focus();
return false;
}
if ( isShortDate(EndDisplay.value)==false ){
alert("Please enter a valid listing end date: MM/YYYY");
EndDisplay.focus();
return false;
}
if ( (FellowType.value==null) || (FellowType.value=='') ) {
alert("Please choose a fellowship specialty for this ad");
FellowType.focus();
return false;
}
if ( (FellowDescr.value==null) || (FellowDescr.value=='') ) {
alert("You have to try and enter some sort of description for this ad. Otherwise, what's the point?");
FellowDescr.focus();
return false;
}
if ( (ContactName.value==null) || (ContactName.value=='') ) {
alert("You have to enter a contact name for this fellowship.");
ContactName.focus();
return false;
}
if ( (Website.value!=null && Website.value!='') && validateURL(Website.value)==false ) {
alert("You need enter a valid website (http:// . . . .) or leave it blank.");
Website.focus();
return false;
}
return true
}
function PreviewJob() {
if (validateJobForm()==false) {return false;}
var Image=document.job_form.image_url;
var Title=document.job_form.title;
var Phone=document.job_form.contact_telephone;
var Fax=document.job_form.contact_fax;
var Email=document.job_form.contact_email;
var Start=document.job_form.fellowship_start;
var FellowType=document.job_form.fellowship_type;
var Institution = document.job_form.institution;
var Location = document.job_form.location;
var FellowDescr=document.job_form.description;
var ContactName=document.job_form.contact_name;
var Title=document.job_form.title;
var Require=document.job_form.requirements;
var Details=document.job_form.application;
var Salary=document.job_form.salary;
var ConName=document.job_form.contact_name;
var ConAddress=document.job_form.contact_address;
var ConPhone=document.job_form.contact_telephone;
var ConFax=document.job_form.contact_fax;
var ConEmail=document.job_form.contact_email;
var Website=document.job_form.contact_website;
var fill;
fill = '';
fill=fill+'Preview of Listing:
';
//image if present
if(Image.value != null && Image.value != '') {
fill = fill+'';
}
//title if present
if(Title.value!=null && Title.value!=''){
fill=fill+''+Title.value.replace(/\n/g, "
")+'
';
}
//figure out all the dates stuff
var start = document.fellowship_form.fellowship_start.value;
var sep = "/";
var pos1=start.indexOf(sep)
var strMonth=start.substring(0,pos1);
var strYear=parseFloat(start.substring(pos1+1))+parseFloat(length);
var end = strMonth+"/"+strYear;
//Our fellowship heading:
fill=fill+''+capitaliseFirstLetter(FellowType.value)+' Opportunity';
if(Institution.value!=null && Institution.value!=''){
fill=fill+'
'+Institution.value.replace(/\n/g, "
")+'';
}
if(Location.value!=null && Location.value!=''){
fill=fill+'
'+Location.value.replace(/\n/g, "
")+'';
}
fill=fill+'
Starting: '+start+'
';
//Description
fill=fill+'Job Description: '+FellowDescr.value.replace(/\n/g, "
")+'
';
if(Require.value!=null && Require.value!=''){
fill=fill+'Job Requirements: '+Require.value.replace(/\n/g, "
")+'
';
}
if(Details.value!=null && Details.value!=''){
fill=fill+'Job Details: '+Details.value.replace(/\n/g, "
")+'
';
}
if(Salary.value!=null && Salary.value!=''){
fill=fill+'Salary: '+Salary.value.replace(/\n/g, "
")+'
';
}
//contact info:
fill=fill+'Contact Information:
';
fill=fill+ConName.value.replace(/\n/g, "
")+'
'
if(ConAddress.value!=null && ConAddress.value!=''){
fill=fill+ConAddress.value.replace(/\n/g, "
")+'
';
}
fill=fill+'Phone: '+ConPhone.value+'
'
if(ConFax.value!=null && ConFax.value!=''){
fill=fill+'Fax: '+ConFax.value+'
';
}
fill=fill+'Email: '+ConEmail.value+'
'
if(Website.value!=null && Website.value!=''){
fill=fill+'Website: : '+Website.value+'
';
}
fill=fill+'
';
fill = fill+'End of Listing
';
fill = fill+'';
my_window = window.open("", "Preview", "status=1,resizable=1,scrollbars=yes");
my_window.document.write(fill);
}
function validateConferenceForm() {
var ImageURL= document.conference_form.image_url;
var Email= document.conference_form.contact_email;
var StartDate= document.conference_form.date;
var EndDate= document.conference_form.end_display;
var Title= document.conference_form.title;
var Descr= document.conference_form.description;
var Location= document.conference_form.location;
var Website= document.conference_form.contact_website;
if (Email.value=='' || validateEmail(Email.value)==false ) {
alert("Please Enter a valid email address: XXXX@YYYY.ZZZ");
Email.focus();
return false;
}
if ( (ImageURL.value!=null) && (ImageURL.value!='') ) {
if (validateURL(ImageURL.value)==false) {
alert("You need enter a valid image link (http://www.XXX.com/zzz.jpg ).\nOtherwise just link to an image of the brochure.");
Website.focus();
return false;
}
else {
if ( isDate(StartDate.value)==false ){
alert("Please Enter an valid conference starting date: MM/DD/YYYY");
StartDate.focus();
return false;
}
if ( isDate(EndDate.value)==false ){
alert("Please Enter an valid conference ending date: MM/DD/YYYY");
EndDate.focus();
return false;
}
return true;
}
}
else{
if ( isDate(StartDate.value)==false ){
alert("Please Enter an valid conference starting date: MM/DD/YYYY");
StartDate.focus();
return false;
}
if ( isDate(EndDate.value)==false ){
alert("Please Enter an valid conference ending date: MM/DD/YYYY");
EndDate.focus();
return false;
}
if ( Descr.value==null || Descr.value=='' ) {
alert("You have to try and enter some sort of description for this ad.\nOtherwise just link to an image of the brochure.");
Descr.focus();
return false;
}
if ( Title.value==null || Title.value=='' ) {
alert("You need to enter a title for the conference.\nOtherwise just link to an image of the brochure.");
Title.focus();
return false;
}
if ( Location.value==null || Location.value=='' ) {
alert("You need to enter a location for the conference.\nOtherwise just link to an image of the brochure.");
Location.focus();
return false;
}
if ( Website.value==null || Website.value=='' || validateURL(Website.value)==false ) {
alert("You need enter a registration website (http:// . . . ).\nOtherwise just link to an image of the brochure.");
Website.focus();
return false;
}
}
}
function PreviewConference() {
if (validateConferenceForm()==false) {return false;}
var fill;
fill = '';
fill=fill+'Preview of Listing:
';
if(document.conference_form.image_url.value != null && document.conference_form.image_url.value != '') {
if(document.conference_form.image_link.value!=null) { var link=document.conference_form.image_link.value; }
else {var link = 'bboard.php';}
fill = fill+'';
}
else {
var title = document.conference_form.title.value.replace(/\n/g, "
");
fill=fill+''+title+'
';
var start = document.conference_form.date.value;
var end = document.conference_form.end_display.value;
fill=fill+''+start+' to '+end+'
';
var locale = document.conference_form.location.value.replace(/\n/g, "
");
fill=fill+''+locale+'
'
var descr = document.conference_form.description.value.replace(/\n/g, "
");
fill=fill+''+descr+'
';
var website = document.conference_form.contact_website.value
fill=fill+'For registration info, click HERE
';
}
fill = fill+'End of Listing
';
fill = fill+'';
my_window = window.open("", "Preview", "status=1,resizable=1,scrollbars=yes");
my_window.document.write(fill);
}