function isValidEmail(someString) { var filter = /.*@.*\..*/; var isValid = false; if ( filter.test(someString) ) { isValid = true; } return isValid; } // populate a select box with options // target - id of select box // options - array of key,value pairs in the form of dictionary // keyRef - the name of the key in the dictionary. This is the text shown. // valRef - the name of the value in the dictionary function populateSelectOptions(target,options,displayRef,valRef) { Dom.deleteChildren(target); for( var i=0; i function getRadioCheckedValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; } function changeDivDisplay(the_div,the_change) { var the_style = getStyleObject(the_div); if (the_style != false) { the_style.display = the_change; } } // function switchDiv() // this function takes the id of a div // and calls the other functions required // to show that div // function switchDiv(div_id) { var style_sheet = getStyleObject(div_id); if (style_sheet) { hideAll(); changeObjectVisibility(div_id,"visible"); } else { alert("sorry, this only works in browsers that do Dynamic HTML"); } } // function getStyleObject(string) -> returns style object // given a string containing the id of an object // the function returns the stylesheet of that object // or false if it can\'t find a stylesheet. Handles // cross-browser compatibility issues. // function getStyleObject(objectId) { // checkW3C DOM, then MSIE 4, then NN 4. // if(document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) { return document.all(objectId).style; } else if (document.layers && document.layers[objectId]) { return document.layers[objectId]; } else { return false; } } function getObject(objectId) { // checkW3C DOM, then MSIE 4, then NN 4. // if(document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId); } else if (document.all && document.all(objectId)) { return document.all(objectId); } else if (document.layers && document.layers[objectId]) { return document.layers[objectId]; } else { return false; } } function changeObjectVisibility(objectId, newVisibility) { // first get a reference to the cross-browser style object // and make sure the object exists var styleObject = getStyleObject(objectId); if(styleObject) { styleObject.visibility = newVisibility; return true; } else { // we couldn't find the object, so we can't change its visibility return false; } } // this function will switch tabs in a multi-tabbed section like online.shtml // // this function takes two arrays and an integer // alltabs is an array of the names of tabbed areas containing text to hide or display // allbtns is an array of the names of the tabs themsevles, what gets clicked // tabclasson is a string of the name of the \'selected\' class // tabclassoff is a string of the name of the \'unselected\' class // showtab is an integer, 0 thru n, of the tab to show. // 01/28/10 -- skip evans function displayOneTabHideOthers(alltabs,allbtns,tabclasson,tabclassoff,showtab) { for (x = 0; x < alltabs.length; x++) { if (x == showtab) { if (x == 0) tabstyle = "first " + tabclasson; else if (x == (alltabs.length - 1)) tabstyle = "third " + tabclasson; else tabstyle = "second " + tabclasson; document.getElementById(alltabs[x]).style.display="block"; document.getElementById(allbtns[x]).className = tabstyle; } else { if (x == 0) tabstyle = "first " + tabclassoff; else if (x == (alltabs.length - 1)) tabstyle = "third " + tabclassoff; else tabstyle = "second " + tabclassoff; document.getElementById(allbtns[x]).className = tabstyle; document.getElementById(alltabs[x]).style.display="none"; } } } // --> var Dom = { get: function(el) { if (typeof el === 'string') { return document.getElementById(el); } else { return el; } }, add: function(el, dest) { var el = this.get(el); var dest = this.get(dest); dest.appendChild(el); }, remove: function(el) { var el = this.get(el); el.parentNode.removeChild(el); }, deleteChildren: function(el) { var el = this.get(el); while( el.firstChild != null ) { el.removeChild(el.firstChild); } } };