// Pathos Javascript Support Systems var onLoadInits = new Array(); // array of functions function pathosJSinitialize() { for (i = 0; i < onLoadInits.length; i++) { onLoadInits[i](); } } function pathosJSregister(func) { onLoadInits.push(func); } var PATH_RELATIVE = "/bizbox/"; var THEME_RELATIVE = "/bizbox/themes/msmartyleftmenutheme/"; var ICON_RELATIVE = "/bizbox/iconset/"; var SEF_URLS = 0; function pathosGetCookie(name) { cookiestr = document.cookie; var nameIndex = cookiestr.indexOf(name); if (nameIndex != -1) { // found the named cookie var startOffset = nameIndex+name.length+1; var endOffset = cookiestr.indexOf(";",startOffset); if (endOffset == -1) endOffset = cookiestr.length; return cookiestr.substring(startOffset,endOffset); } return ""; } function makeLink() { var link = ""; var link = ""; var args = makeLink.arguments; if (SEF_URLS == 0) { link = PATH_RELATIVE + "index.php?"; for (var i = 0; i < args.length; i+=2) { var v = args[i+1]; if (v != null && v != "") { link += escape(args[i]) + "=" + escape(args[i+1]) + "&"; } } link = link.substr(0,link.length - 1); } else { link = PATH_RELATIVE + "index.php/"; for (var i = 0; i < args.length; i+=2) { var v = args[i+1]; if (v != null && v != "") { link += escape(args[i]) + "/" + escape(args[i+1]) + "/"; } } link = link.substr(0,link.length - 1); } return link; } function openSelector(mod,dest,vmod,vview) { var url = PATH_RELATIVE+"source_selector.php?showmodules="+mod+"&dest="+escape(dest)+"&vmod="+vmod+"&vview="+vview; window.open(url,'sourcePicker','title=no,toolbar=no,width=640,height=480,scrollbars=yes'); } function sourceSelected(hidden,showPreview,src,desc) { var hidden = document.getElementById(hidden); hidden.value = src; if (showPreview){ showPreviewCall(); } } function selectAll(prefix,checked) { elems = document.getElementsByTagName("input"); for (var key in elems) { if (elems[key].type == "checkbox" && elems[key].name.substr(0,prefix.length) == prefix) { elems[key].checked = checked; } } } function isOneSelected(prefix,enabledOnly) { if (typeof enabledOnly == "undefined") { enabledOnly = true; } elems = document.getElementsByTagName("input"); for (var key in elems) { if (elems[key].type == "checkbox" && elems[key].name.substr(0,prefix.length) == prefix) { if (enabledOnly && elems[key].checked && !elems[key].disabled) return true; if (!enabledOnly && elems[key].checked) return true; } } return false; } // Patch the String object, to make string parsing a little easier in Pathos String.prototype.isValid = function (alpha,numeric,others) { for (var i = 0; i < this.length; i++) { if (alpha && this.isAlpha(i)) continue; if (numeric && this.isNumeric(i)) continue; var isGood = false; for (var j = 0; j < others.length; j++) { if (others[j] == this.charAt(i)) { isGood = true; continue; } } if (!isGood) return false; } return true; } String.prototype.isNumeric = function(index) { var charcode = this.charCodeAt(index); return ( (charcode >= 48 && charcode < 48+10) ); } String.prototype.isAlpha = function(index) { var charcode = this.charCodeAt(index); return ( (charcode >= 65 && charcode < 65+26) || (charcode >= 97 && charcode < 97+26) ); } String.prototype.trim = function() { str = this; while (1) { if (str.substring(str.length - 1, str.length) != " ") break; str = str.substr(0,str.length - 1); } while (1 && str.length > 0) { if (str.substring(0,1) != " ") break; str = str.substr(1,str.length - 1); } return str; } // Form Validation //Added By Baworn // Copyright information must stay intact // FormCheck v1.10 // Copyright NavSurf.com 2002, all rights reserved // Creative Solutions for JavaScript navigation menus, scrollers and web widgets // Affordable Services in JavaScript consulting, customization and trouble-shooting // Visit NavSurf.com at http://navsurf.com function formCheck(formobj,objarray,msgarray,fckInstanceName){ // name of mandatory fields //var fieldRequired = Array("email", "Q2", "Q3", "Q4", "Q5"); var fieldRequired = objarray; // field description to appear in the dialog box //var fieldDescription = Array("Out Patient Treatment", "Gasoline Reimbursement","Per Diem","Education Subsidy","Fitness Members" ); var fieldDescription = msgarray; // dialog message var alertMsg = "Please check the following items:\n======================== \n"; //var fckvalue = getEditorValue("body"); //alert(fckvalue); var l_Msg = alertMsg.length; var j=0; for (var i = 0; i < fieldRequired.length; i++){ var obj = formobj.elements[fieldRequired[i]]; if (obj){ //alert(i); //alert(obj.name); //alert(obj.value); switch(obj.type){ case "select-one": if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == "" || obj.selectedIndex == 0){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "select-multiple": if (obj.selectedIndex == -1){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "hidden": if (fckInstanceName){ var fckvalue = getEditorValue("body"); //alert(fckvalue); if(fckvalue == "" || fckvalue == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } } break; case "text": case "textarea": if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; default: } if (obj.type == undefined){ var blnchecked = false; for (var j = 0; j < obj.length; j++){ if (obj[j].checked){ blnchecked = true; } } if (!blnchecked){ alertMsg += " - " + fieldDescription[i] + "\n"; } } } } if (alertMsg.length == l_Msg){ return true; }else{ alert(alertMsg); return false; } } function getEditorValue( instanceName ) { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance( instanceName ) ; // Get the editor contents as XHTML. return oEditor.GetXHTML( true ) ; // "true" means you want it formatted. } function setEditorValue( instanceName, text ) { // Get the editor instance that we want to interact with. var oEditor = FCKeditorAPI.GetInstance( instanceName ) ; // Set the editor contents. oEditor.SetHTML( text ) ; }