<!--

// window name, frame and window prevention

self.name = 'fdbwin';
if (window != top){
top.location.href = location.href;
}

defaultStatus="Bay Architects Online"  // status bar text


// left and right functionalities

function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

// Batch View

function bView(bvid, bvtypid) {

if (bvtypid==1){
bvtyp = "aid";
var bvurl = "http://www.bayarchitects.com/db/prg/?"+bvtyp+"="+bvid+"&bat=1";
if (confirm("NOTICE: \r\n When Batch Viewing some noticeable processing time may be required depending on the size and amount of associated files and your connection speed. \r\n Do you want to continue Batch Viewing?")) {
bvwin=window.open(bvurl,"bvwin")
}
}
else if (bvtypid==2){
bvtyp = "said";
var bvurl = "http://www.bayarchitects.com/db/prg/?"+bvtyp+"="+bvid+"&bat=1";
if (confirm("NOTICE: \r\n When Batch Viewing some noticeable processing time may be required depending on the size and amount of associated files and your connection speed. \r\n Do you want to continue Batch Viewing?")) {
bvwin=window.open(bvurl,"bvwin")
}
}
else {
bvtyp = "pid";
var bvurl = "http://www.bayarchitects.com/db/prg/?"+bvtyp+"="+bvid+"&bat=1";
if (confirm("NOTICE: \r\n When Batch Viewing some noticeable processing time may be required depending on the size and amount of associated files and your connection speed. \r\n Additionally, some large projects may fail to Batch View when Batch Viewing by project because of memory limitations. If you are experiencing problems Batch Viewing by project, you can remedy the problem by Batch Viewing by Area or Subarea. \r\n Do you want to continue Batch Viewing?")) {
bvwin=window.open(bvurl,"bvwin")
}
}

}

// protection from duplicate submissions

function disableButton(theButton) {
theButton.value="Processing...";
theButton.disabled = true;
}

// Notice and protection from duplicate my account submissions

function AdisableButton(theButton,aelement) {

if (aelement!=""){

if (aelement=="Password"){

mpwd = document.getElementById('mpwd').value;
cmpwd = document.getElementById('cmpwd').value;
if (mpwd != cmpwd) {
alert("ERROR: \r\n Your " + aelement + " was not modified because the " + aelement + "s that you entered do not match one another.");
document.getElementById('mpwd').value = "";
document.getElementById('cmpwd').value = "";
document.getElementById('mpwd').focus();
return false;
}
else {
if (confirm("Are you sure you want to modify your " + aelement + "?")) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}
}

}

else {

if (confirm("Are you sure you want to modify your " + aelement + "?")) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}

}

}

else {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}

}

// Notice and protection from duplicate delete submissions

function DdisableButton(theButton,delement) {

if (delement!=""){

if (confirm("Are you sure you want to delete this " + delement + "?")) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}

}

else {
if (confirm("Are you sure you want to delete this record?")) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}

}
}

// Notice and protection from duplicate space submissions and unacceptable file types

function SdisableButton(theButton, chkarea) {

mspace = document.getElementById('mspace').value.toLowerCase();
msquan = document.getElementById('msquan').value;
msfeet = document.getElementById('msfeet').value;
mfceilht = document.getElementById('mfceilht').value;
attach1 = document.getElementById('attach1').value.toLowerCase();
attach2 = document.getElementById('attach2').value.toLowerCase();
attach3 = document.getElementById('attach3').value.toLowerCase();
attach4 = document.getElementById('attach4').value.toLowerCase();
attach5 = document.getElementById('attach5').value.toLowerCase();
attach6 = document.getElementById('attach6').value.toLowerCase();

// encoded illegal characters

backslash = unescape('%5C');
forwardslash = unescape('%2F');
colon = unescape('%3A');
asterisk = unescape('%2A');
qmark = unescape('%3F');
quotes = unescape('%22');
lessthan = unescape('%3C');
greaterthan = unescape('%3E');
vbar = unescape('%7C');

// messages

cfma = "\r\n Do you want to continue processing this space?";
nota = "NOTICE: \r\n When submitting files (ie. images, CAD drawings) some noticeable processing time may be required depending on the size of your files (40mb total limit) and your connection speed.";
notb = " \r\n *illegal characters are as follows: " + backslash + ", " + forwardslash + ", " + colon + ", " + asterisk + ", " + qmark + ", " + quotes + ", " + lessthan + ", " + greaterthan + ", " + vbar;
wara = "WARNING: \r\n One or more integer (number) fields (ie. Quantity, Square Feet, Ceiling Height) will not be processed because they have been left blank or do not contain an integer (number) value.";
warb = "WARNING: \r\n One or more files specified for upload will not be processed because it is an unacceptable file type. \r\n *acceptable file type extensions for images are as follows: .gif, .jpg, .jpeg, .png \r\n *acceptable file type extensions for Drawing Source Files are as follows: .dwg";


msg = "";

exterr = "";

exterr = exterr + "a";

if (mspace==""){
exterr = exterr + "u";
}
else if (mspace!="" && mspace.indexOf(backslash)>-1 || mspace.indexOf(forwardslash)>-1 || mspace.indexOf(colon)>-1 || mspace.indexOf(asterisk)>-1 || mspace.indexOf(qmark)>-1 || mspace.indexOf(quotes)>-1 || mspace.indexOf(lessthan)>-1 || mspace.indexOf(greaterthan)>-1 || mspace.indexOf(vbar)>-1){
exterr = exterr + "u";
}
else {
exterr = exterr + "a";
}

if (msquan=="" || isNaN(msquan)==true){
exterr = exterr + "u";
}
else {
exterr = exterr + "a";
}

if (msfeet=="" || isNaN(msfeet)==true){
exterr = exterr + "u";
}
else {
exterr = exterr + "a";
}

if (mfceilht=="" || isNaN(mfceilht)==true){
exterr = exterr + "u";
}
else {
exterr = exterr + "a";
}

if (attach1!="" || attach3!="" || attach4!="" || attach5!="" || attach6!=""){

suberr = "";

if (attach1!=""){
if (attach1==attach3 || attach1==attach4 || attach1==attach5 || attach1==attach6){
suberr = suberr + "u";
}
else {
suberr = suberr + "a";
}
}
else {
suberr = suberr + "a";
}

if (attach3!=""){
if (attach3==attach1 || attach3==attach4 || attach3==attach5 || attach3==attach6){
suberr = suberr + "u";
}
else {
suberr = suberr + "a";
}
}
else {
suberr = suberr + "a";
}

if (attach4!=""){
if (attach4==attach1 || attach4==attach3 || attach4==attach5 || attach4==attach6){
suberr = suberr + "u";
}
else {
suberr = suberr + "a";
}
}
else {
suberr = suberr + "a";
}

if (attach5!=""){
if (attach5==attach1 || attach5==attach3 || attach5==attach4 || attach5==attach6){
suberr = suberr + "u";
}
else {
suberr = suberr + "a";
}
}
else {
suberr = suberr + "a";
}

if (attach6!=""){
if (attach6==attach1 || attach6==attach3 || attach6==attach4 || attach6==attach5){
suberr = suberr + "u";
}
else {
suberr = suberr + "a";
}
}
else {
suberr = suberr + "a";
}

if (suberr!="aaaaa"){
exterr = exterr + "u";
}
else {
exterr = exterr + "a";
}

suberr = "";

}
else {
exterr = exterr + "a";
}

if (attach1!="" || attach2!="" || attach3!="" || attach4!="" || attach5!="" || attach6!=""){

if (attach1!=""){
if (right(attach1, 4)==".gif" || right(attach1, 4)==".jpg" || right(attach1, 5)==".jpeg" || right(attach1, 4)==".png"){
exterr = exterr + "a";
}
else {
exterr = exterr + "u";
}
}
else {
exterr = exterr + "a";
}

if (attach2!=""){
if (right(attach2, 4)==".dwg"){
exterr = exterr + "a";
}
else {
exterr = exterr + "u";
}
}
else {
exterr = exterr + "a";
}

if (attach3!=""){
if (right(attach3, 4)==".gif" || right(attach3, 4)==".jpg" || right(attach3, 5)==".jpeg" || right(attach3, 4)==".png"){
exterr = exterr + "a";
}
else {
exterr = exterr + "u";
}
}
else {
exterr = exterr + "a";
}

if (attach4!=""){
if (right(attach4, 4)==".gif" || right(attach4, 4)==".jpg" || right(attach4, 5)==".jpeg" || right(attach4, 4)==".png"){
exterr = exterr + "a";
}
else {
exterr = exterr + "u";
}
}
else {
exterr = exterr + "a";
}

if (attach5!=""){
if (right(attach5, 4)==".gif" || right(attach5, 4)==".jpg" || right(attach5, 5)==".jpeg" || right(attach5, 4)==".png"){
exterr = exterr + "a";
}
else {
exterr = exterr + "u";
}
}
else {
exterr = exterr + "a";
}

if (attach6!=""){
if (right(attach6, 4)==".gif" || right(attach6, 4)==".jpg" || right(attach6, 5)==".jpeg" || right(attach6, 4)==".png"){
exterr = exterr + "a";
}
else {
exterr = exterr + "u";
}
}
else {
exterr = exterr + "a";
}

}

else {

exterr = exterr + "aaaaaa";

}

// if any required fields are left blank do not process

if (left(exterr, 2)!="aa"){
if (left(exterr, 2)=="uu"){
msg = "ERROR: \r\n This space will not be processed because the required Area and Space fields have been left blank." + notb;
alert(msg);
document.getElementById('msaid').focus();
return false;
}
else if (left(exterr, 2)=="ua"){
msg = "ERROR: \r\n This space will not be processed because the required Area field has been left blank.";
alert(msg);
document.getElementById('msaid').focus();
return false;
}
else{
msg = "ERROR: \r\n This space will not be processed because the required Space field contains illegal characters or has been left blank." + notb;
alert(msg);
document.getElementById('mspace').focus();
return false;
}
}

// if any files are duplicates do not process

if (exterr.charAt(5)!="a"){
msg = "ERROR: \r\n This space will not be processed because one or more files specified for upload are dupilicates with the same name and same file type.";
alert(msg);
return false;
}

if (exterr.substr(2, 3)!="aaa"){
msg = wara;
}

if (attach1!="" || attach2!="" || attach3!="" || attach4!="" || attach5!="" || attach6!=""){
if (right(exterr, 6)!="aaaaaa"){
msg = msg + " \r\n " + warb + " \r\n " + nota;
}
else{
msg = msg + " \r\n " + nota;
}
}

if (exterr!="aaaaaaaaaaaa"){
msg = msg + cfma;
if (confirm(msg)) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}
}
else if (attach1!="" || attach2!="" || attach3!="" || attach4!="" || attach5!="" || attach6!="" && exterr=="aaaaaaaaaaaa"){
msg = msg + cfma;
if (confirm(msg)) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}
}
else {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}

}

// Notice and protection from duplicate note submissions and unacceptable file types

function NdisableButton(theButton) {

mentry = document.getElementById('mentry').value.toLowerCase();
attach7 = document.getElementById('attach7').value.toLowerCase();

vattach = 0;

if (attach7!="") {
if (right(attach7, 4)==".doc" || right(attach7, 4)==".pdf" || right(attach7, 4)==".rtf" || right(attach7, 4)==".txt" || right(attach7, 4)==".wpd" || right(attach7, 4)==".wps") {
vattach = 1;
}
}

if (mentry=="" && attach7=="") {
msg = "ERROR: \r\n This space will not be processed because the Note field has been left blank and no Attachment file has been specified for upload.";
alert(msg);
document.getElementById('mentry').focus();
return false;
}

if (mentry=="" && attach7!="" && vattach==0) {
msg = "ERROR: \r\n This space will not be processed because the Note field has been left blank and the Attachment file specified for upload is an unacceptable file type. \r\n *acceptable file type extensions for Attachments are as follows: .doc, .pdf, .rtf, .txt, .wpd, .wps";
alert(msg);
return false;
}

if (mentry!="" && attach7!="" && vattach==0) {
msg = "WARNING: \r\n The Attachment file specified for upload will not be processed because it is an unacceptable file type.. \r\n *acceptable file type extensions for Attachments are as follows: .doc, .pdf, .rtf, .txt, .wpd, .wps \r\n Do you want to continue processing this space?";
if (confirm(msg)) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}
}

else if (mentry=="" && attach7!="" && vattach==1) {
msg = "NOTICE: \r\n When submitting files (ie. images, CAD drawings) some noticeable processing time may be required depending on the size of your files (40mb total limit) and your connection speed. \r\n Do you want to continue processing this space?";
if (confirm(msg)) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}
}

else if (mentry!="" && attach7!="" && vattach==1) {
msg = "NOTICE: \r\n When submitting files (ie. images, CAD drawings) some noticeable processing time may be required depending on the size of your files (40mb total limit) and your connection speed. \r\n Do you want to continue processing this space?";
if (confirm(msg)) {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}
else {
return false;
}
}

else {
theButton.value="Processing...";
theButton.disabled = true;
return true;
}

}

// -->
