/* Go to URL */ function goTo(url) { showLoader(); window.location = url; } /* Submit form */ function submitForm(formId,submitButton) { if (submitButton) { submitButton.className = 'clicked'; submitButton.disabled = true; } var thisForm = document.getElementById(formId); thisForm.submit(); } /* Submit form and show loader animation */ function submitLoaderForm(formId,submitButton) { showLoader(); submitForm(formId,submitButton); } // Show Loader Animation function showLoader() { activateOverlay(); var yScroll = getYScroll(); var arrayPageSize = getPageSize(); document.getElementById('mainLoader').style.display = 'block'; document.getElementById('mainLoader').style.width = arrayPageSize[0] + 'px'; document.getElementById('mainLoader').style.height = arrayPageSize[1] + 'px'; document.getElementById('mainLoader').style.opacity = '0.5'; document.getElementById('mainLoader').style.filter = 'alpha(opacity=50)'; document.getElementById('loader').style.margin = (yScroll + 100) + 'px auto 0 auto'; } // Show News function showNews(newsId,showLink) { textbox('overlayNews'); document.getElementById('overlayNewsTime').innerHTML = document.getElementById('newsId' + newsId + 'time').innerHTML; document.getElementById('overlayNewsSubject').innerHTML = document.getElementById('newsId' + newsId + 'subject').firstChild.innerHTML; document.getElementById('overlayNewsText').innerHTML = document.getElementById('newsId' + newsId + 'text').innerHTML; if (showLink == true) document.getElementById('overlayNewsLink').className = 'submit'; } // Show textbox function textbox(name) { activateOverlay(); document.getElementById(name).style.display = 'block'; } // Go to screenshot image function screenshot(image) { var url = 'http://www.servage.net/img/newWebsite/modern/pageContent/screenshots/'; goTo(url + image); } // Close Overlay function closeOverlay(name) { if(document.getElementById('frontAd')) showFlashMovie('frontAd','http://www.servage.net/img/newWebsite/modern/frontContent/front.swf') document.getElementById('mainOverlay').style.display = 'none'; document.getElementById('mainOverlay').style.width = '0px'; document.getElementById('mainOverlay').style.height = '0px'; document.getElementById('mainOverlayBg').style.display = 'none'; document.getElementById('mainOverlayBg').style.width = '0px'; document.getElementById('mainOverlayBg').style.height = '0px'; document.getElementById('overlayBox').style.display = 'none'; document.getElementById('overlayBox').style.margin = '0'; document.getElementById(name).style.display = 'none'; } // Activate Overlay function activateOverlay() { if(document.getElementById('frontAd')) document.getElementById('frontAd').innerHTML = document.getElementById('frontAdAlternate').innerHTML var yScroll = getYScroll(); var arrayPageSize = getPageSize(); document.getElementById('mainOverlayBg').style.display = 'block'; document.getElementById('mainOverlayBg').style.width = arrayPageSize[0] + 'px'; document.getElementById('mainOverlayBg').style.height = arrayPageSize[1] + 'px'; document.getElementById('mainOverlayBg').style.opacity = '0.8'; document.getElementById('mainOverlayBg').style.filter = 'alpha(opacity=80)'; document.getElementById('mainOverlay').style.display = 'block'; document.getElementById('mainOverlay').style.width = arrayPageSize[0] + 'px'; document.getElementById('mainOverlay').style.height = arrayPageSize[1] + 'px'; document.getElementById('mainOverlay').style.opacity = '0.9'; document.getElementById('mainOverlay').style.filter = 'alpha(opacity=90)'; document.getElementById('overlayBox').style.margin = (yScroll + 50) + 'px auto 0 auto'; document.getElementById('overlayBox').style.display = 'block'; document.getElementById('overlayBox').style.wordwrap = 'break-word'; } // Get Current Y position function getYScroll() { var yScroll; if (self.pageYOffset) { yScroll = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict yScroll = document.documentElement.scrollTop; } else if (document.body) {// all other Explorers yScroll = document.body.scrollTop; } return yScroll; } // // getPageSize() // Returns array with page width, height and window width, height // Core code from - quirksmode.com // Edit for Firefox by pHaez // function getPageSize(){ var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = window.innerWidth + window.scrollMaxX; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; // console.log(self.innerWidth); // console.log(document.documentElement.clientWidth); if (self.innerHeight) { // all except Explorer if(document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = self.innerWidth; } windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ var pageHeight = windowHeight; } else { var pageHeight = yScroll; } // console.log("xScroll " + xScroll) // console.log("windowWidth " + windowWidth) // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ var pageWidth = xScroll; } else { var pageWidth = windowWidth; } // console.log("pageWidth " + pageWidth) var arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) return arrayPageSize; } // ----------------------------------------------------------------------------------- // Mouseover table row function selectTableMouseover(id) { if (!document.getElementById('radio' + id).checked) document.getElementById('tr' + id).className = 'colored'; } // Mouseout table row function selectTableMouseout(id) { if (!document.getElementById('radio' + id).checked) document.getElementById('tr' + id).className = 'none'; } // Onclick table row function selectTableClick(id,formName,radioName) { for (var i = 0; i < document.getElementById(formName)[radioName].length; i++) { var currentRadioId = document.getElementById(formName)[radioName][i].getAttribute('id'); document.getElementById(currentRadioId).checked = false; var currentTrId = 'tr' + currentRadioId.substring(5,currentRadioId.length) document.getElementById(currentTrId).className = 'none'; } document.getElementById('radio' + id).checked = true; document.getElementById('tr' + id).className = 'dark'; } // Select input field function selectField(field) { field.className = field.className + " selected" } // Deselect input field function deselectField(field) { if (field.className.substring(0,8) == 'selected') { field.className = field.className.substring(8,field.className.length); } field.className = field.className.replace(" selected","") } // Deselect siblings of element function deselectSiblings(field) { var siblings = field.parentNode.childNodes; for (var i = 0; i < siblings.length; i++) { var currentSibling = siblings[i]; deselectField(currentSibling); } } // Mouse over this function mouseoverField(field) { field.className = field.className + " mouseover" } // Mouse out this function mouseoutField(field) { field.className = field.className.replace(" mouseover","") } // Set default value for... function setDefault(varValue,varDefault) { if (varValue == null) varValue = varDefault return varValue } // Set mouse cursor function setCursor(type) { type = setDefault(type,'default') document.body.style.cursor = type; } // Show Flash element (front ad) function showFlashMovie(targetId,flashUrl) { var so = new SWFObject(flashUrl, targetId + "flash", "575", "122", "6", "#ffffff"); so.write(targetId); targetElement = document.getElementById(targetId) if (targetElement.innerHTML.substr(0,6) == ''; html = html + ''; html = html + ''; html = html + ''; html = html + ''; targetElement.innerHTML = html; } } // Go to field (in form) function goToFieldByLength(currentField,triggerLength,nextFieldId) { if (currentField.value.length == triggerLength) { document.getElementById(nextFieldId).focus(); } } function CheckMultiple5(frm, name) { for (var i=0;i