// JavaScript Document function newWin(url){ window.open(url); return false; } function closeWindow() { window.close(); } function popup(url){ window.open( url, 'window', 'width=600, height=600, resizable=yes, scrollbars=yes, location=no, toolbar=no, menubar=no, status=no' ); } function openWindow(url,w,h,shortcut){ if ( shortcut ) { url += "?shortcut=" + shortcut + "&"; newWindow=window.open(url,'thewindow','width=' + w + ',height=' + h); newWindow.focus(); } else { newWindow=window.open(url,'_blank','width=' + w + ',height=' + h); newWindow.focus(); } } // Date functions function GetMonth(nMonth) { var Months = new Array("January","February","March","April","May","June", "July","August","September","October","November","December"); return Months[nMonth] } function GetDay(nDay) { var Days = new Array("Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"); return Days[nDay] } function dateString() { var Today = new Date(); var suffix = "th"; switch (Today.getDate()) { case 1: case 21: case 31: suffix = "st"; break; case 2: case 22: suffix = "nd"; break; case 3: case 23: suffix = "rd"; break; }; var strDate = GetDay(Today.getDay()) + ", " + GetMonth(Today.getMonth()) + " " + Today.getDate() + suffix + ", " + Today.getFullYear(); return strDate } function yearString(publishedYear){ var Today = new Date(); var strYear = Today.getFullYear(); if (!publishedYear) { publishedYear = strYear; } if (strYear == publishedYear) { return strYear } else { strObject = publishedYear + "-" + strYear; return strObject; } } //form valiation // trim functions function trim(str) { return rtrim(ltrim(str)); } function rtrim(str) { return str.replace(/\s+$/, ''); } function ltrim(str) { return str.replace(/^\s+/, ''); } // determines whether or not the element has anything in it function hasContent(el) { return el.value!=''; } function hasCheck(el) { return el.checked; } function hasSelectionValue(el) { for(var i = 0; i < el.length; i++) { if(el.options[i].selected) { if(el.options[i].value.length) { return true; } } } return false; } function anyWithCheck(ss) { for(var i = 0; i < ss.length; i++) { if(ss[i].checked) { return true; } } return false; } // special validation functions function validEmail(str) { return str.match(/^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}$/i); } function validSSN(str) { return str.match(/^\d{3}-*\d{2}-*\d{4}$/); } function validDate(str) { return str.match(/^\d{1,2}[-\/]+\d{1,2}[-\/]+(\d{2}|\d{4})$/); } function validPhone(str) { return str.match(/^[\+1\( -]*\d{3}[ -\.\)]*\d{3}[ -\.]*\d{4}.*\d*$/); } function validZip(str) { return str.match(/^\d{5}-*($|\d{4}$)/); } // massage functions function massageSSN(el) { el.value=el.value.replace(/[^\d]/g,''); } function massagePhone(el) { el.value=el.value.replace(/[^\d]/g,'').replace(/^1/,''); } function massageZip(el) { el.value=el.value.replace(/[^\d]/g,''); } // functions that talk directly to or are called directly from the form function resetForm() { return confirm("Are you sure you want to undo all your changes?"); } function confirmDelete() { return confirm("Are you sure you want to delete this item?"); } // Flash Javascript function putFlash(src, width, height, FlashVars) { var strObject = "" + " " + " "; if (FlashVars && FlashVars != "") { strObject += " "; } strObject += "" + " " + ""; document.write(strObject); } //Calling Flash Header function putHeader(FlashVars) { FlashVars = "logo=3PLservice&" + FlashVars; putFlash("/flash/header.swf", 766, 215, FlashVars); } //Main Nav dropdowns function showMenu(id) { if (document.getElementById) { var show_menu=document.getElementById(id); show_menu.style.display="block"; } } function hideMenu(id) { if (document.getElementById) { var hide_menu=document.getElementById(id); hide_menu.style.display="none"; } }