//      PointSpace(R) Content Platform
//      All code Copyright (c) 2007 IT4 Group, Inc. All rights reserved.

        //ADD SLASHES TO DATES
        function ValidateDate(obj) 
        { 
            var keyCode = window.event.keyCode; 
            if (keyCode > 57 || keyCode < 48) 
                window.event.returnValue = false; 
            else
            {
                if (obj.value.length == 2)
                    obj.value += "/";
                if (obj.value.length == 5)
                    obj.value += "/";
            }
        } 



var submitcount=0;
function reset() {
}
function checkMilestone() {
if ( (document.rrform.first_name.value=="")  ||
(document.rrform.email.value=="")  ||
(document.rrform.comments.value=="")  ||
    (document.rrform.last_name.value=="")  )
   {
   alert("You must enter your First Name, Last Name and Email Address, and Comments.");
   return false;
   }
else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}


var submitcount=0;
function reset() {
}
function checkSelfReg() {
if ( (document.regForm1.email.value=="")  )
   {
   alert("You must enter your Email Address.");
   return false;
   }
else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}


function GEWin(url) {
launch = open(url, 'gewin', 'status, left=5, screenX=5, top=5, screenY=5, width=770, height=550, scrollbars=1, resizable'); 
return false 
}

function filterInput (input) {
s = input.value;
filteredValues = "<>~#^|}{,.:''()@&*+=[]\/%_"; 
var i;
var returnString = "";
for (i = 0; i < s.length; i++) {  
var c = s.charAt(i);
if (filteredValues.indexOf(c) == -1) returnString += c;
}
input.value = returnString;
}


function sendCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var firstChars=validChars
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom="(" + firstChars + validChars + "*" + ")"
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	alert("You must supply valid email addresses in the 'TO' and 'FROM' areas.")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
    alert("The username doesn't seem to be valid.")
    return false
}
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.")
    return false
}
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

if (domArr[domArr.length-1].length==3 && len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}
return true;
}



function charCount(field, textmax) {
if (field.value.length > textmax) // if too long...trim it!
field.value = field.value.substring(0, textmax);
}





var submitcount=0;
function reset() {
}
function checkLogin() {
if ( (document.loginform.username.value=="")  ||
     (document.loginform.password.value=="") )
   {
   alert("Please enter your Username and Password.");
   return false;
   }
else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}



function Rsearch(inForm) {
  var noText = /^\s?$/
  for (var i = 0; i < inForm.elements.length; i++) 	{
    var formField = inForm.elements[i]
    var fieldValue = formField.value
	var fieldID = formField.id
	if ( (document.searchform.sTerm.value=="search"))
   {
   alert("Please enter a search word or phrase.");
   return false;
   }
	 if (fieldID == "required") {
      if (noText.test(fieldValue)) {
        alert("Please enter a search word or phrase.")
        return false
      } 
} 
}
}


function filterSearch (input) {
s = input.value;
filteredValues = "<>~#^|}{,.:''()@&*+=[]\/%_";     // Characters stripped out
var i;
var returnString = "";
for (i = 0; i < s.length; i++) {  // Search string, append to unfiltered values to returnString
var c = s.charAt(i);
if (filteredValues.indexOf(c) == -1) returnString += c;
}
input.value = returnString;
}


function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}
function launchRemote(file,name) {
myRemote = launch(file, name, "height=350, width=150, alwaysLowered=0, alwaysRaised=1, channelmode=0, dependent=0, directories=0, fullscreen=0, hotkeys=1, location=0, menubar=0, resizable=1, scrollbars=1, status=0, titlebar=1, toolbar=0, z-lock=0, left=1, screenX=1, top=1, screenY=1", "mWindow");
}



function launchEC1(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}


function EC1(file,name) {
if (screen.width<820) {
  ECwin = launchEC1(file, name, "channelmode=0, dependent=0, directories=0, fullscreen=0, location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0, height=500, width=780, top=0, left=0", "oWin");
}
else {
  ECwin = launchEC1(file, name, "channelmode=0, dependent=0, directories=0, fullscreen=0, location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0, height=600, width=900, top=0, left=0", "oWin");
}
}

function launchEC(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}


function C8(file,name) {
eRemote = launchEC(file, name, "height=480, width=720, location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=1, toolbar=0, left=5, top=5", "adminPSC");
}




//if (screen.width<820) {

function EC8(file,name) {
eRemote = launchEC(file, name, "height=570, width=760, location=0, menubar=0, resizable=0, scrollbars=0, status=0, titlebar=1, toolbar=0, left=1, top=1", "adminPS");
}

function SG8(file,name) {
eRemote = launchEC(file, name, "height=480, width=720, location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=1, toolbar=0, left=10, top=20", "adminPSsg");
}


function G8(file,name) {
eRemote = launchEC(file, name, "height=480, width=720, location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=1, toolbar=0, left=20, top=40", "adminPSg");
}

function U8(file,name) {
eRemote = launchEC(file, name, "height=480, width=720, location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=1, toolbar=0, left=30, top=60", "adminPSu");
}

function L8(file,name) {
eRemote = launchEC(file, name, "height=480, width=720, location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=1, toolbar=0, left=50, top=30", "adminPSu");
}

function NC8(file,name) {
eRemote = launchEC(file, name, "height=250, width=360, location=0, menubar=0, resizable=0, scrollbars=0, status=0, titlebar=1, toolbar=0, left=2, top=2", "NC8");
}

function H8(file,name) {
hRemote = launchEC(file, name, "height=500, width=750, location=0, menubar=0, resizable=0, scrollbars=1, status=0, titlebar=1, toolbar=0, left=10, top=10", "helpPS");
}

//}
//else {
//}

var submitcount=0;
function reset() {
}
function checkRptDate() {
if ( (document.rptform.bdate.value=="")  ||
     (document.rptform.edate.value=="") )
   {
   alert("Please enter a valid begin date and end date.");
   return false;
   }
else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}



var submitSGcount=0;
function reset() {
document.selectsg.supergroup.value="";
}
function checkSelSupergroup() {                       
if ( (document.selectsg.supergroup.value=="") ) 
   {
   alert("You must select a Community from the list, or create a new Community. ");
   return false;
   }
else 
   {
   if (submitSGcount == 0)
      {
      submitSGcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}


var submitSGAcount=0;
function reset() {
document.addsg.supergroup_name.value="";
}
function checkAddSupergroup() {                       
if ( (document.addsg.supergroup_name.value=="") ) 
   {
   alert("You must enter a name. ");
   return false;
   }
else 
   {
   if (submitSGAcount == 0)
      {
      submitSGAcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}


var submitGcount=0;
function reset() {
document.selectg.group_id.value="";
}
function checkSelGroup() {                       
if ( (document.selectg.group_id.value=="") ) 
   {
   alert("You must select a Group. ");
   return false;
   }
else 
   {
   if (submitGcount == 0)
      {
      submitGcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}


var submitGAcount=0;
function reset() {
document.selectg.group_name.value="";
}
function checkAddGroup() {                       
if ( (document.addgroup.group_name.value=="") ) 
   {
   alert("You must enter a group name. ");
   return false;
   }
else 
   {
   if (submitGAcount == 0)
      {
      submitGAcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}



var submitUcount=0;
function reset() {
document.selectu.user_id.value="";
}
function checkSelUser() {                       
if ( (document.selectu.user_id.value=="") ) 
   {
   alert("You must select a user. ");
   return false;
   }
else 
   {
   if (submitUcount == 0)
      {
      submitUcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}




var submitcount=0;
function reset() {
}
function checkUserForm() {
if ( (document.userForm.username.value=="")  ||
    (document.userForm.password.value=="")  )
   {
   alert("You must enter a username and password.");
   return false;
   }
else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}


var submitcount=0;
function reset() {
}
function checkCommunityForm() {
if ( (document.communityForm.supergroup_name.value=="") )
   {
   alert("You must enter a community name.");
   return false;
   }
else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}


var submitcount=0;
function reset() {
}
function checkGroupForm() {
if ( (document.groupForm.group_name.value=="") )
   {
   alert("You must enter a group name.");
   return false;
   }
else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}






var submitcount=0;
function reset() {
}
function checkStatNameSrch() {
if ( (document.statName.sName.value=="") )
   {
   alert("Please enter a last name, or partial last name.");
   return false;
   }
else 
   {
   if (submitcount == 0)
      {
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted.  Thanks!");
      return false;
      }
   }
}






