// ***** --------------- ***** // ***** putfocus.js ***** // ***** --------------- ***** //************************************************************************* //* //* Title: putFocus() //* Category: //* Program Name: putfocus.js //* WEB URL: //* Created By: Chad Kuehn & TAKE //* Created Date: 2005-12-09 //* Language: JavaScript //* Description: //* //* Example: /example/putfocus.js //* //* Version: 2.02 //* //* Compatibility: //* //* Win IE6 - O //* Win NS7 - O //* Win NS4 - O //* Win FF1 - O //* Mac IE5 - O //* Mac NS7 - O //* Mac SF1 - O //* //************************************************************************* function putFocus(param1, param2){ // --- if param 1 is less than 0, just return <2008-05-16 TAKE> --- if (param1 < 0) { return 0; } // --- putFocus(id) type <2007-07-03 TAKE> --- if (isNaN(arguments[0])) { document.getElementById(arguments[0]).focus(); return 0; } // --- validate arguments --- arg = parseInt(arguments[1]); if(arg && isNaN(arg)){ alert('Second argument is invalid!'); return false; } // --- find form & element index --- switch(arguments.length){ case 2: var frmIndex = parseInt(arguments[0]); var elmIndex = parseInt(arguments[1]); break; case 1: var frmIndex = 0; var elmIndex = parseInt(arguments[0]); break; default: var frmIndex = 0; var elmIndex = 0; break; } // --- adjustment for the redface skin <2009-02-06 TAKE> --- var oSearchForm = document.getElementById('skinSearchForm'); if (oSearchForm) { frmIndex += 1; } // --- check if form tag exists --- if(!document.forms[frmIndex]){ return false; } // --- check if input tag exists --- if(!document.forms[frmIndex].elements[elmIndex]){ return false; } // --- put focus in the form element --- var el = document.forms[frmIndex].elements[elmIndex]; if(((el.type=='text')||(el.type=='textarea')||(el.type=="password")||(el.type=="file"))&&(!el.disabled)){ el.focus(); return true; } return false; } // ***** ---------------- ***** // ***** psusubmit.js ***** // ***** ---------------- ***** // ********************************************************************* // // Title: psusubmit() // Category: function // Created By: J.Burns & TAKE // Created Date: 2005-09-01 // Language: JavaScript // Description: This function can be used instead of the submit() // to submit the form with the button values. // There are four purposes to use this function. // // 1. Allow users to submit only if JavaScript is enabled. // 2. Disable enter key to submit. // 3. Submit form by clicking on image or something. // // Example: https://go.pittstate.edu/example/js.submit // https://go.pittstate.edu/example/psusubmit // // Usage: (ez) onclick="psusubmit(obj, [value])" // obj is usually "this" // (adv)onclick="psusubmit(id, [value]) // * for MacIE5 is also // requred. Otherwise, the form will be submitted by // enter key. // // Example: /example/psusubmit // // Compatibility: // // Win IE6 : O // Win NS4 : X // Win NS7 : O // Win FF1 : O // Mac NS7 : O // Mac IE5 : O // Mac SF1 : O // // ********************************************************************* function psusubmit(param1, param2){ // ----- check to see if an argment is sent ----- if(!param1){ alert("Missing Arguments"); return 0; } // ----- check to see if the id is an illigal name ----- if(param1 == 'submit'){ alert('"submit" cannot be used as an id'); return 0; } // ----- create object depended on the argument ----- var oSubmit; if (typeof(param1)=='string'){ oSubmit = element(param1); } else { oSubmit = param1; } var ENV_OS = getOS(); var ENV_BROWSER = getBrowser(); var oForm = oSubmit.form; // --------------------------------------------------------- // If browser is MacIE5, using GET method to send Submit // because on MacIE oElement.type="hidden" does not work. // --------------------------------------------------------- if(ENV_OS == "MAC" && ENV_BROWSER == "IE"){ var sDelim = '&'; if(oForm.action.indexOf('?')==-1){ sDelim = '?' } if (param2) { oForm.action += sDelim + oSubmit.name + "=" + param2; } else { oForm.action += sDelim + oSubmit.name + "=" + oSubmit.value; } //if(oForm.onsubmit)oForm.onsubmit(); oForm.submit(); } else { if (oSubmit.type == "button" || oSubmit.type == "submit") { var oElement = window.document.createElement("input"); // ----- set attribute ----- oElement.name = oSubmit.name; oElement.type = "hidden"; if (param2){ oElement.value = param2; } else { oElement.value = oSubmit.value; } // ----- append element to the form ----- oForm.appendChild(oElement); } else { if (param2) { oSubmit.value = param2; } } // ----- submit ----- oForm.submit(); } } // ***** -------------------- ***** // ***** commonScripts.js ***** // ***** -------------------- ***** // isValidSSN.js // isValidEmail.js var im = String.fromCharCode(255); var fm = String.fromCharCode(254); var vm = String.fromCharCode(253); var sm = String.fromCharCode(252); var tm = String.fromCharCode(251); function numbersOnly(e, exceptions){ // in the commonScripts.js file /* Some common exceptions: 36 = $ 44 = , 45 = - 46 = . THEY ARE DELIMITED BY COMMAS */ var key = ''; if(window.event){ key = e.keyCode; }else if(e.which){ key = e.which; } if(key == '')return true; var ASCII = new Array(); ASCII[0] = 48; //0 ASCII[1] = 49; //1 ASCII[2] = 50; //2 ASCII[3] = 51; //3 ASCII[4] = 52; //4 ASCII[5] = 53; //5 ASCII[6] = 54; //6 ASCII[7] = 55; //7 ASCII[8] = 56; //8 ASCII[9] = 57; //9 ASCII[11] = 8; //BACKSPACE - so you can edit your number (DELETE WORKS ANYWAY) ASCII[12] = 13; //CARRIAGE RETURN - so form can be submitted by pressing RETURN within the textbox if (exceptions){ var res = exceptions.split(","); var cnt = res.length; for (var x = 0; x < cnt; x++){ ASCII = ASCII.concat(res[x]); //, } } var found = false; var cnt = ASCII.length; for (var x = 0; x < cnt; x++) { if(key == ASCII[x]){ found = true; break; } } if(found){ return true; }else{ return false; } /* Sample: Limitations: You can bypass it if you paste text into the field. */ } function trim(str){ // in the commonScripts.js file return str.replace(/^\s+/,'').replace(/\s+$/,''); } function getOS(){ // in the commonScripts.js file var ENV_OS; // ----- check operating system ----- if(navigator.userAgent.indexOf("Mac")>-1){ ENV_OS = 'MAC'; } else if(navigator.userAgent.indexOf("Win")>-1){ ENV_OS = 'WIN'; } else if(navigator.userAgent.indexOf("Linux")>-1){ ENV_OS = 'LIN'; } return ENV_OS; } function getBrowser(){ // in the commonScripts.js file var ENV_BROWSER; // ----- check browser ----- if (navigator.userAgent.indexOf("Opera")>-1){ ENV_BROWSER = 'OP' } else if(navigator.userAgent.indexOf("Safari")>-1){ ENV_BROWSER = 'SF' } else if(navigator.userAgent.indexOf("MSIE")>-1){ ENV_BROWSER = 'IE'; } else if(navigator.userAgent.indexOf("Netscape")>-1){ ENV_BROWSER = 'NS'; } else if(navigator.userAgent.indexOf("Firefox")>-1){ ENV_BROWSER = 'FF'; } return ENV_BROWSER; } function element(id){ // in the commonScripts.js file // ----- all except IE4 & NS4 ----- if(document.getElementById != null){ return document.getElementById(id); } // ----- just for IE ----- if(document.all != null){ return document.all[id]; } // ----- for netscape 4 ----- if(document.layers != null){ return document.layers[id]; } return 0; } function isNumeric(strString){ // in the commonScripts.js file /* Check for valid numeric strings! A second argument is optional. It is boolean and states whether or not to use digits (0-9) only. Default is false, allowing periods and negative signs. */ var strValidChars; var digitsOnly = false; if(arguments.length > 1){ digitsOnly = arguments[1]; } if(digitsOnly){ strValidChars = "0123456789"; }else{ strValidChars = "0123456789.-"; } var strChar; var blnResult = true; if (strString.length == 0) return false; // test strString consists of valid characters listed above for (i = 0; i < strString.length && blnResult == true; i++){ strChar = strString.charAt(i); if (strValidChars.indexOf(strChar) == -1){ blnResult = false; } } return blnResult; } // ********************************************************************* // Created: TAKE <2006-11-22> // // int getMouseX(e) // - return mouse's x position // ********************************************************************* function getMouseX(e){ // in the commonScripts.js file if(window.opera){ return e.clientX; } else if(document.all){ return document.body.scrollLeft + event.x; } else if(document.layers||document.getElementById){ return e.pageX; } return 0; } // ********************************************************************* // Created: TAKE <2006-11-22> // // int getMouseY(e) // - return mouse's y position // ********************************************************************* function getMouseY(e){ // in the commonScripts.js file if(window.opera){ return e.clientY; } else if(document.all){ return document.body.scrollTop + event.y; } else if(document.layers||document.getElementById){ return e.pageY; } return 0; } // ====================================================================== // Created: TAKE <2006-11-27> // // str addUrlQuery(sUrl, sQuery) // // sUrl - URL // sQuery - Query (Server Request by GET method) // // ====================================================================== function addUrlQuery(sUrl, sQuery){ // in the commonScripts.js file // ----- if query is empty, just return ----- if (!sQuery) { return sUrl; } // ----- remove after '#' ----- var sJumper = ''; var iLoc = sUrl.indexOf('#'); if (iLoc != -1) { sJumper = sUrl.substr(iLoc); sUrl = sUrl.substr(0, iLoc); } // ----- add query to the url ----- if (sUrl.indexOf('?') == -1) { sUrl += '?' + sQuery; } else { sUrl += '&' + sQuery; } // ----- add '#~' after the url ----- sUrl += sJumper; return sUrl; } // ***** --------------- ***** // ***** menulink.js ***** // ***** --------------- ***** /************************************************************************ * * Title: menulink.js * Category: * Program Name: menulink.js * WEB URL: * Created By: TAKE * Created Date: 2006-07-17 * Language: JavaScript * Description: To make the menu selection area whole menu width. * ************************************************************************/ var sOrgMenuColor; var sOrgMenuBgColor; /************************************************************************ * function (menulinkMouseOver) ************************************************************************/ function menulinkMouseOver(Obj){ // ----- save the currnt setting ----- sOrgMenuColor = Obj.style.color; sOrgMenuBgColor = Obj.style.backgroundColor; // ----- change color ----- x = Obj.parentNode; Obj.style.color = "#000000"; x.style.backgroundColor = "#cccccc"; x.style.cursor = 'pointer'; } /************************************************************************ * function (menulinkMouseOver) for redface skin ************************************************************************/ function appmenuMouseOver(oTr){ sOrgMenuBgColor = oTr.style.backgroundColor; oTr.style.backgroundColor = '#f5efd9'; oTr.style.linkColor = '#990000'; oTr.style.cursor = 'pointer'; } /************************************************************************ * function (menulinkMouseOut) ************************************************************************/ function menulinkMouseOut(Obj){ x = Obj.parentNode; x.style.backgroundColor = sOrgMenuBgColor; } /************************************************************************ * function (menulinkMouseOut) for redface skin ************************************************************************/ function appmenuMouseOut(oTr){ oTr.style.backgroundColor = sOrgMenuBgColor; } /************************************************************************ * function (menulinkMouseDown) for all ************************************************************************/ function menulinkMouseDown(sUri){ location.href = sUri; } // ***** ------------ ***** // ***** smoke.js ***** // ***** ------------ ***** // ******************************************************************** // // Created By: TAKE // Created Date: 2008-04-15 // Language: JavaScript // Program Name: smoke.js // Description: function to make smoke screen with message. // Loading is the default for the message. // // Usage:
// or // call showSmoke([targetid]) and hideSmoke() in your JavaScript // // hideSmoke() to remove smoke screen // // Win IE 8: O // Win IE 7: O // Win IE 6: O // Win FX 3: O // Win FX 2: O // Win SF 3: - (not tested yet) // MAC FX 2: O // MAC SF 3: O // // ******************************************************************** // ******************************************************************** // showSmoke() // - this is the function actually called by page. // ******************************************************************** function showSmoke(sElementId, sMessage) { // --- set default (sElementId) --- if (!sElementId) { sElementId = ''; } // --- set default (sMessage) --- if (!sMessage) { sMessage = ''; } // ------------------------------------------------------- // The form will not be submitted without setTimeout(). // ------------------------------------------------------- var sFuncCall = 'buildSmokeScreen("' + sElementId + '", "' + sMessage + '")'; setTimeout(sFuncCall, 0); } var SMOKE_aSmokeState = 0; var SMOKE_bPageLoaded = false; var SMOKE_cDiv = Array(); var SMOKE_cMessage = Array(); var SMOKE_bHide = false; var SMOKE_cBase = Array(); function buildSmokeScreen(sElementId, sMessage){ if (!SMOKE_aSmokeState) { SMOKE_aSmokeState = 0; } switch(SMOKE_aSmokeState) { case 0: // element ready for smoke SMOKE_aSmokeState = 1; break; case 1: // element should already be smoked return; break; case 2: // element was unsmoked with being smoked SMOKE_aSmokeState = 0; return; break; } // --- set default message --- if (!sMessage) { sMessage = ''; sMessage += ''; sMessage += ''; sMessage += ''; sMessage += ''; sMessage += ''; sMessage += '
'; sMessage += ''; sMessage += ''; sMessage += ' Loading...'; sMessage += '
'; } // --- get base object --- var oBase = Object(); if (sElementId) { oBase = document.getElementById(sElementId); } else { oBase = document.body; } // --- find width & height --- var aPageSize = Object(); var sBoxWidth = '0px'; var sBoxHeight = '0px'; if (sElementId) { // --- partial box --- if (!oBase.clientHeight) { // --------------------------------------- // this is needed for IE to have LAYOUT // --------------------------------------- oBase.style.display = 'inline-block'; } sBoxWidth = oBase.clientWidth; sBoxHeight = oBase.clientHeight; } else { // --- entire page --- aPageSize = getPageSize(); sBoxWidth = aPageSize[0]; sBoxHeight = aPageSize[1]; } // --- apend smoke screen layer to the body tag --- var oDiv = document.createElement('div'); oDiv.id = 'smokescreen'; oDiv.style.backgroundColor = '#ffffff'; oDiv.style.position = 'absolute'; oDiv.style.width = sBoxWidth + 'px'; oDiv.style.height = sBoxHeight + 'px'; oDiv.style.left = getObjPos(oBase).x + 'px'; oDiv.style.top = getObjPos(oBase).y + 'px'; oDiv.style.opacity = '0.35'; oDiv.style.MozOpacity = '0.35'; oDiv.style.KhtmlOpacity = '0.35'; oDiv.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=35);'; // --- adjust message location --- var sHtmlMessage = ''; sHtmlMessage += ''; sHtmlMessage += ''; sHtmlMessage += ''; sHtmlMessage += ''; sHtmlMessage += '
'; sHtmlMessage += sMessage; sHtmlMessage += '
'; // --- append message layer to the body tag --- var oMessage = document.createElement('div'); oMessage.id = 'smokescreenmessage'; oMessage.innerHTML = sHtmlMessage; oMessage.style.position = 'absolute'; if ((getBrowser() == 'FF')||(SMOKE_bPageLoaded == true)) { // --- append message layer to the body tag --- oMessage.style.width = oBase.clientWidth + 'px'; oMessage.style.height = oBase.clientHeight + 'px'; oMessage.style.left = getObjPos(oBase).x + 'px'; oMessage.style.top = getObjPos(oBase).y + 'px'; document.body.appendChild(oDiv); document.body.appendChild(oMessage); } else { SMOKE_cDiv.push(oDiv); SMOKE_cMessage.push(oMessage); SMOKE_cBase.push(oBase); } } // ********************************************************************* // // wait for putting smoke untill page is completed. // because of the IE issue. // // See details about this issue. // http://weblogs.asp.net/infinitiesloop/archive/2006/11/02/Dealing-with-IE-_2600_quot_3B002E00_-Or_2C00_-how-to-Crash-IE.aspx // // ********************************************************************* if (getBrowser() == 'IE') { window.attachEvent('onload', x); function x(){ if (SMOKE_bHide == true) { return 0; } for (var i in SMOKE_cDiv) { SMOKE_cMessage[i].style.width = SMOKE_cBase[i].clientWidth + 'px'; SMOKE_cMessage[i].style.height = SMOKE_cBase[i].clientHeight + 'px'; SMOKE_cMessage[i].style.left = getObjPos(SMOKE_cBase[i]).x + 'px'; SMOKE_cMessage[i].style.top = getObjPos(SMOKE_cBase[i]).y + 'px'; document.body.appendChild(SMOKE_cDiv[i]); document.body.appendChild(SMOKE_cMessage[i]); } SMOKE_bPageLoaded = true; } } function hideSmoke() { if (!SMOKE_aSmokeState) { SMOKE_aSmokeState = 0; } switch (SMOKE_aSmokeState) { case 0: // element is not currently smoked SMOKE_aSmokeState = 2; return; break; case 1: // element should be smoked let's unsmoke it SMOKE_aSmokeState = 0; break; case 2: // element is being unsmoked with being smoked return; break; } var oSmokeScreen = document.getElementById('smokescreen'); var oSmokeScreenMessage = document.getElementById('smokescreenmessage'); if (oSmokeScreen) { document.body.removeChild(oSmokeScreen); document.body.removeChild(oSmokeScreenMessage); } SMOKE_bHide = true; } // ********************************************************************* // obj getObjPos(obj) - reusable // ********************************************************************* function getObjPos(oElement){ var pos = {x:oElement.offsetLeft, y:oElement.offsetTop}; while(oElement = oElement.offsetParent){ pos.x += oElement.offsetLeft; pos.y += oElement.offsetTop; } return pos; } // ********************************************************************* // // array getPageSize() - reusable // // Original code is created by // Lokesh Dhakar of http://www.huddletogether.com // // Win IE 8: O // Win IE 7: O // Win IE 6: O // Win FX 3: O // Win FX 2: O // Win SF 3: - (not tested yet) // MAC FX 2: O // MAC SF 3: O - width part needs to be review // // ********************************************************************* function getPageSize() { // --- get scroll page size --- var scrollX, scrollY; if (window.innerHeight && window.scrollMaxY) { // Firefox scrollX = window.innerWidth + window.scrollMaxX; scrollY = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // IE6,7 scrollX = document.body.scrollWidth; scrollY = document.body.scrollHeight; } else { // --- Mac IE, IE6 strict, Mozilla and Safari --- scrollX = document.body.offsetWidth; scrollY = document.body.offsetHeight; } // --- get viewable size --- var windowWidth, windowHeight; if (self.innerHeight) { // --- all except IE --- if (document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // --- IE6 Strict Mode --- windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // --- other IE --- windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // --- choose the larger width --- if (scrollX > windowWidth){ pageWidth = scrollX; } else { pageWidth = windowWidth; } // --- choose the larger height --- if (scrollY > windowHeight){ pageHeight = scrollY; } else { pageHeight = windowHeight; } return [pageWidth, pageHeight]; }