1 //Reusable Asset Library - CSS Positioning Version (v3.3)
2 //Release Date: 1/26/07
5 //begin: quick help =======================================
11 //sets cookie value and qhId
12 qhCookie=document.cookie;
13 var pos=qhCookie.indexOf("qhId=");
16 document.cookie="qhId=0";
18 qhCookie=document.cookie;
19 pos=qhCookie.indexOf("qhId=");
21 //reads cookie if value is present and sets qhId accordingly
23 var end=qhCookie.indexOf(";", start);
24 if (end==-1) end=qhCookie.length;
25 uitmpl_cookieVal=qhCookie.substring(start,end);
26 if(uitmpl_cookieVal!=0){
33 //loops through all qh divs and toggles display based on qhId
34 function uitmpl_qhPageInit(){
35 var getTag = document.getElementsByTagName("div");
36 for (i=0;i<getTag.length;i++){
37 if (getTag[i].className=="mQH"){
38 getTag[i].style.display=(uitmpl_qhId!="0")?"block":"none";
39 //getTag[i].onmouseover="alert('foo')";
42 //changes instruction in help menu if menu exists
43 if (uitmpl_qhId==1&&document.getElementById("shHd")){
44 document.getElementById("shHd").innerHTML = "Hide";
48 function uitmpl_qhPageToggle(){
49 //change instruction in help menu
50 var getCurrent = document.getElementById("shHd").innerHTML;
51 var setCurrent = (getCurrent=="Show")?"Hide":"Show";
52 document.getElementById("shHd").innerHTML = setCurrent;
54 document.cookie = (setCurrent=="Show")?"qhId=0":"qhId=1";
56 uitmpl_qhId = (setCurrent=="Show")?"0":"1";
61 //individual quick help toggle
62 function uitmpl_qh(obj){
63 var state = document.getElementById(obj).style.display;
64 document.getElementById(obj).style.display=(state!="block")?"block":"none";
67 //end: quick help =======================================
69 //begin: error validation =======================================
71 function uitmpl_errStrVal(obj, errId){
74 number:/(^\d+$)|(^\d+\.\d+$)/,
75 email:/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
76 //phone:/(^\d+$)|(^\d+\.\d+$)/,
77 //time:/(^\d+$)|(^\d+\.\d+$)/
81 number:"Please input a valid number!",
82 email:"Please input a valid email address!",
83 date:"That date is invalid. Please try again."
84 //phone:"Please input a valid phone number!",
85 //time:"Please input a valid time!"
88 var getReg = eval("regExp."+errId);
89 var getAlrt = eval("alrtStr."+errId);
91 //Number----------------------------------------------------------
92 if (errId=="number"&&!x.match(getReg)){
97 //Email-----------------------------------------------------------
98 else if (errId=="email"&&!x.match(getReg)){
103 //Date------------------------------------------------------------
104 if (errId=="date"&&!uitmpl_chkdate(obj)){
111 //supplemental date check function
112 function uitmpl_chkdate(objName) {
113 var strDatestyle = "US"; //United States date style
114 //var strDatestyle = "EU"; //European date style
123 var booFound = false;
125 var datefield = objName;
126 var strSeparatorArray = new Array("-"," ","/",".");
129 var strMonthArray = new Array(12);
130 strMonthArray[0] = "Jan";
131 strMonthArray[1] = "Feb";
132 strMonthArray[2] = "Mar";
133 strMonthArray[3] = "Apr";
134 strMonthArray[4] = "May";
135 strMonthArray[5] = "Jun";
136 strMonthArray[6] = "Jul";
137 strMonthArray[7] = "Aug";
138 strMonthArray[8] = "Sep";
139 strMonthArray[9] = "Oct";
140 strMonthArray[10] = "Nov";
141 strMonthArray[11] = "Dec";
142 strDate = datefield.value;
143 if (strDate.length < 1) {
146 for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
147 if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
148 strDateArray = strDate.split(strSeparatorArray[intElementNr]);
149 if (strDateArray.length != 3) {
154 strDay = strDateArray[0];
155 strMonth = strDateArray[1];
156 strYear = strDateArray[2];
161 if (booFound == false) {
162 if (strDate.length>5) {
163 strDay = strDate.substr(0, 2);
164 strMonth = strDate.substr(2, 2);
165 strYear = strDate.substr(4);
168 if (strYear.length == 2) {
169 strYear = '20' + strYear;
172 if (strDatestyle == "US") {
177 intday = parseInt(strDay, 10);
182 intMonth = parseInt(strMonth, 10);
183 if (isNaN(intMonth)) {
184 for (i = 0;i<12;i++) {
185 if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
187 strMonth = strMonthArray[i];
191 if (isNaN(intMonth)) {
196 intYear = parseInt(strYear, 10);
197 if (isNaN(intYear)) {
201 if (intMonth>12 || intMonth<1) {
205 if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
209 if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
218 if (LeapYear(intYear) == true) {
231 //if (strDatestyle == "US") {
232 //datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
235 //datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
239 function LeapYear(intYear) {
240 if (intYear % 100 == 0) {
241 if (intYear % 400 == 0) { return true; }
244 if ((intYear % 4) == 0) { return true; }
250 function uitmpl_errRangeVal(obj, minNum, maxNum){
251 if (obj.value>=minNum&&obj.value<=maxNum||obj.value==""){
254 alert("Please input a number within the range of "+minNum+" and "+maxNum+"!");
260 //end: error validation =======================================
261 //begin: popup windows =======================================
262 function uitmpl_popUpReg(url) {
265 function uitmpl_popUpConfig(url, name, w, h, sc, rsz) {
266 var features = "width="+w+",height="+h+",scrollbars="+sc+",resizable="+rsz+"menubar=0,status=1";
267 var newWin = window.open(url, name, features);
269 //popups from nav links:
273 function uitmpl_contact(){
276 function uitmpl_bizDirect(){
280 //function uitmpl_closeApp(){
281 //if(window.confirm("You did NOT save your data. Do you want to close 'application name' without saving your data?")) {
284 function uitmpl_closeApp(name){
289 var cAppName="the current application";
291 if(window.confirm("You did NOT save your data. Do you want to close\n" + cAppName + " without saving your data?")) {
295 //end: popup windows =======================================
301 //Select all checkboxes on a form=====================================
302 function uitmpl_chkBoxSelect(formName,btnOn,btnOff) {
304 document.getElementById(btnOff).style.display = "block";
305 document.getElementById(btnOn).style.display = "none";
308 for (i=0; i < f.elements.length; i++) {
309 if (f.elements[i].type=="checkbox") {
310 var e = f.elements[i];
317 //Clear all checkboxes on a form======================================
318 function uitmpl_chkBoxClear(formName,btnOn, btnOff) {
320 document.getElementById(btnOff).style.display = "none";
321 document.getElementById(btnOn).style.display = "block";
324 for (i=0; i < f.elements.length; i++) {
325 if (f.elements[i].type=="checkbox") {
326 var e = f.elements[i];