// JavaScript Document commonJavaFuncs.js function initPage() { var xSty = getCookie('textsize') if (xSty && xSty!=0) { xSty = parseInt(xSty); incdec = xSty; loadCss(xSty); } } function loader(msg, vis, typ){ var tp = ''; var img = ''; if(typ){ tp = 'errorMsg'; msg = 'ERROR: '+msg; img = ''; } else { tp = 'loaderLabel'; img = '
'; } if(vis){ document.getElementById("infoDisplay").innerHTML = '
'+img+''+msg+'
'; } else { document.getElementById("infoDisplay").innerHTML = ''; } } /* ---------------------------------------------------------------------------------------------------------------------------------------------- */ //UPDATE INFORMATION DISPLAY IN POPUP DIALOG BOXES function updatDisplay(msg, vis, typ, disp){ var tp = ''; var img = ''; if(typ){ tp = 'errorMsg'; //msg = 'ERROR: '+msg; img = ''; } else { tp = 'loaderLabel'; img = ''; } if(vis){ document.getElementById(disp).innerHTML = ''+img+' '+msg+''; } else { document.getElementById(disp).innerHTML = ''; } } // END OF updatDisplay() FUNCTION /* ---------------------------------------------------------------------------------------------------------------------------------------------- */ function whichBrs() { var v_agt=navigator.userAgent.toLowerCase(); if (v_agt.indexOf("opera") != -1) return 'Opera'; if (v_agt.indexOf("staroffice") != -1) return 'Star Office'; if (v_agt.indexOf("webtv") != -1) return 'WebTV'; if (v_agt.indexOf("beonex") != -1) return 'Beonex'; if (v_agt.indexOf("chimera") != -1) return 'Chimera'; if (v_agt.indexOf("netpositive") != -1) return 'NetPositive'; if (v_agt.indexOf("phoenix") != -1) return 'Phoenix'; if (v_agt.indexOf("firefox") != -1) return 'Firefox'; if (v_agt.indexOf("safari") != -1) return 'Safari'; if (v_agt.indexOf("skipstone") != -1) return 'SkipStone'; if (v_agt.indexOf("msie") != -1) return 'Internet Explorer'; if (v_agt.indexOf("netscape") != -1) return 'Netscape'; if (v_agt.indexOf("mozilla/5.0") != -1) return 'Mozilla'; if (v_agt.indexOf('\/') != -1) { if (v_agt.substr(0,v_agt.indexOf('\/')) != 'mozilla') { return navigator.userAgent.substr(0,v_agt.indexOf('\/')); } else { return 'Netscape';} } else if (v_agt.indexOf(' ') != -1) return navigator.userAgent.substr(0,v_agt.indexOf(' ')); else return navigator.userAgent; } function rollOver(obj, img){ document.getElementById(obj).src='Images/layout/buttons/'+img; } //VAVIDATE THAT A STING HAS NO SPACES OR SPECIAL CHARACTERS function strChk(daString, allowSpaces){ var r = 0; var r_msg = ''; var iChars = "!@#$%^&*()+=-[]\';,./{}|\":<>?"; var carcnt = 0; if(!allowSpaces){if(daString.indexOf(' ') > -1){r_msg += 'Spaces'; r++;}} for (var i = 0; i < daString.length; i++) {if (iChars.indexOf(daString.charAt(i)) != -1) {carcnt++;}} if(carcnt > 0){if(r > 0){r_msg += ' and special characters'; r++;}else{r_msg += 'Special characters'; r++;}} if(r > 0){r_msg += ' are not allowed.
Please remove them and try again.';} return r+''+r_msg; } //CREATE A SCRIPT TAG TO INCLUDE A JS PAGE function include(filename) { var head = document.getElementsByTagName('head')[0]; script = document.createElement('script'); script.src = filename; script.type = 'text/javascript'; head.appendChild(script) } // FUNCTION getCookie(cname) - CALLED THROUGHOUT WEBSITE TO CREATE READ COOKIE INFORMATION AS WELL AS CREATE COOKIE INFORMATION. function getCookie(cname) { var a_all_cookies = document.cookie.split( ';' ); var a_temp_cookie = ''; var cookie_name = ''; var cookie_value = ''; var b_cookie_found = false; // set boolean t/f default f for ( i = 0; i < a_all_cookies.length; i++ ){ a_temp_cookie = a_all_cookies[i].split( '=' ); cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); if ( cookie_name ==cname){ b_cookie_found = true; if ( a_temp_cookie.length > 1 ){ cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') ); } // note that in cases where cookie is initialized but no value, null is returned //if ((cookie_name == 'CS')&&(v_sPage.substring(0,10) == 'webcontact')){createCookie('CS',cookie_value)} return cookie_value; break; } a_temp_cookie = null; cookie_name = ''; } if ( !b_cookie_found ){ return null; } } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function eraseCookie(name) { createCookie(name,"",-1); } function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } } function tdOver(obj) { obj.style.background='#9FECFF'; } function tdOut(obj) { obj.style.background=''; } function addRow(theTbl){ /* A quick example on how to add and delete table rows. Enjoy coding! */ var _table = document.getElementById(theTbl).insertRow(0); var cell0 = _table.insertCell(0); var cell1 = _table.insertCell(1); cell0.innerHTML = 'New Cell1'; cell1.innerHTML = 'New Cell2'; } function removeRow(rows){ var _row = rows.parentElement.parentElement; document.getElementById('table1').deleteRow(_row.rowIndex); } function setSession(p, v, a) { var request = new Ajax.Request("http://spider.cpcuiia.org/includes/functions/callFuncs.php?p="+p+"&v="+v+"&action="+a+"", { onSuccess: function(request){alert(request.responseText); }, onException: function(req,exception) { alert("The request had a fatal exception thrown.\n\n" +exception); return true; }, onFailure: function(request) { return reloadPage(); alert('onFailure'); } }); } var incdec = 0; var headID = document.getElementsByTagName("head")[0]; var cssNode = document.createElement("style"); cssNode.type = 'text/css'; cssNode.id="resizingText"; function loadCss(x){ try{ var cssStr = '.content {font-size:' + (12+x) +'px;} .bold {font-size:' + (12+x) +'px;} .content_link {font-size:' + (12+x) +'px;}'; if(cssNode.styleSheet){ cssNode.styleSheet.cssText = cssStr; // for IE } else { var cssText = document.createTextNode(cssStr); cssNode.appendChild(cssText); // breaks ie //cssNode.innerHTML = cssStr; // breaks saffari } if(!document.getElementById("resizingText"))headID.appendChild(cssNode); }catch(err){ // some debugging code } } function increaseFontSize() { if(incdec < 5){ incdec++; loadCss(incdec); createCookie('textsize',incdec,1); } } function decreaseFontSize() { if(incdec > 0){ incdec--; loadCss(incdec); createCookie('textsize',incdec,1); } } function convert_It(str) { //var a = escape(form1.first.value); var a = str; var b = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ%@#$^&*()-_=+.:"; var c = "zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA +=_-)(*&^$#@:."; var d; var h; var i; var j = ""; var f = a.length; var e = 0; var g = 1; while (e != f) { d = a.substring(e,g); h = b.indexOf(d); i = c.charAt(h); e++; g++; j += i; } return j; } function unconvert_It(str) { var aa = str; var bb = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ @#$^&*()-_=+.:"; var cc = "zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA +=_-)(*&^$#@:."; var dd; var hh; var ii; var jj = ""; var ff = aa.length; var ee = 0; var gg = 1; while (ee != ff) { dd = aa.substring(ee,gg); hh = cc.indexOf(dd); ii = bb.charAt(hh); ee++; gg++; jj += ii; } jj = jj.replace(/CCCC/gi,'"'); jj = jj.replace(/BBBB/gi,','); return jj; } /* ---------------------------------------------------------------------------------------------------------------------------------------------- */ //GET PAGE CONTENT function getPgContent(url, target) { loader('Loading Page Information', true, false); new Ajax.Request(url, { method:'get', onSuccess: function(transport){ document.getElementById(target).innerHTML = transport.responseText; loader('', false, false); }, onFailure: function(){loader('There was a problem loading this page.', true, true);} }); } // END OF getPgContent() FUNCTION /* ---------------------------------------------------------------------------------------------------------------------------------------------- */ function validate_email(field,alerttxt){ with (field){ apos=value.indexOf("@"); dotpos=value.lastIndexOf("."); if (apos<1||dotpos-apos<2) {alert(alerttxt);return false;} else {return true;} } } function validate_required(field,alerttxt){ with (field){ if (value==null||value==""){alert(alerttxt);return false;} else {return true;} } } function validate_form(thisform){ with (thisform){if (validate_email(P_EMAIL,"Please enter a valid email address.")==false){P_EMAIL.focus();return false;}} with (thisform){if (validate_required(P_NAME2,"Please enter your first name.")==false){P_NAME2.focus();return false;}} with (thisform){if (validate_required(P_NAME1,"Please enter your last name.")==false){P_NAME1.focus();return false;}} } function ClearAll(){ {p_name1.value=""} {p_name2.value=""} {p_company.value=""} {p_phone.value=""} {p_ext.value=""} {p_email.value=""} } function pause(m) { var snooze = new Date(new Date().getTime() + m); while (new Date() < snooze) { //napping } } function alertSize(which) { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } var toRet = (which=='H') ? myHeight : myWidth; return toRet; } var newPopWin; function popDemWin() { newPopWin=window.open('http://topclass.aicpcu.org/sw/websiteflash/acctmgrlogin_demo.swf', '', 'height=400,width=550'); if (window.focus) {newPopWin.focus()} }