function getParentByClassName(element, className) { var parent = element; if (className) { while (parent && parent.className != className) { parent = parent.parentNode; } } return parent; } function getFirstChildByClassRegex(element, tagName, classRegex, stopClassRegex) { var match; var child = element.firstChild; while (child != null && (!child.className || !child.className.match(stopClassRegex))) { if (child.tagName && child.tagName == tagName && child.className && child.className.match(classRegex)) { match = child; break; } else { match = getFirstChildByClassRegex(child, tagName, classRegex, stopClassRegex); if (match) { break; } } child = child.nextSibling; } return match; } function addEventToElement(target, eventType, func, useCapture) { var result = false; if (target.addEventListener) { target.addEventListener(eventType, func, useCapture); result = true; } else if (target.attachEvent) { result = target.attachEvent("on" + eventType, func); } else { alert("Handler could not be attached"); } return result; } function addEventToElements(targets, eventType, func, useCapture) { var result = true; for (var i = 0; i < targets.length; i++) { result &= addEventToElement(targets[i], eventType, func, useCapture); } return result; } function removeEventFromElement(target, eventType, func, useCapture) { var result = false; if (target.removeEventListener) { target.removeEventListener(eventType, func, useCapture); result = true; } else if (target.detachEvent) { result = target.detachEvent("on" + eventType, func); } else { alert("Handler could not be removed"); } return result; } function removeEventFromElements(targets, eventType, func, useCapture) { var result = true; for (var i = 0; i < targets.length; i++) { result &= removeEventFromElement(targets[i], eventType, func, useCapture); } return result; } function getEvent(event) { if (!event) { var event = window.event; } return event; } function getEventSource(event) { if (event.srcElement) { var source = event.srcElement; } else if (event.currentTarget) { var source = event.currentTarget; } else { alert("Event source not found!"); } return source; } var console = Console(); function Console() { this.canvas = null; this.println = consolePrintln; this.show = consoleShow; } function consolePrintln(object) { if (!this.canvas) { this.canvas = window.open("about:blank", "Console", "toolbar = no, width = 640, height = 480, directories = no, status = no, scrollbars = yes, resize = no, menubar = no"); } this.canvas.document.write(object); this.canvas.document.write("
"); } function consoleShow(object) { this.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); for (property in object) { this.println(property + " = " + eval("object." + property)); } this.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); } // Wind tunnel pop-up function openWindTunnel() { window.open('/portal/DynamicContent/en_US/home/wind_tunnel_video.jsp','mywindow','width=300,height=250,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,top=200,left=200'); } //Generic popup function openPopup(url) { window.open(url,'mywindow','width=300,height=250,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,top=200,left=200'); } //Generic popup function openPopup(url, width, height) { window.open(url,'mywindow','width='+width+',height='+height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,top=200,left=200'); } //Generic scrolling, resizeable popup function openScrollingResizeablePopup(url, width, height) { window.open(url,'mywindow','width='+width+',height='+height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,top=200,left=200'); } // Simulator directions pop-up function openSimDirections() { window.open('/portal/DynamicContent/en_US/home/simulator_directions.jsp','mywindow','width=500,height=475,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,top=200,left=200'); } function doChanges(imgIndex,text) { //document.images['marketRollover'].src=CachedRolloverImages[imgIndex-1]; //document.getElementById("rollText").innerHTML=text; } function random() { var xRand = Math.round(5*Math.random()); document.images['random'].src = CachedImageNames[xRand]; } 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 handleLangForm() { var langCodesSelect = document.langForm.languageCodes; var si = langCodesSelect.selectedIndex; var selectedLanguage = langCodesSelect[si].value; var screenOut = "ko_KR"; screenOut = ""; if ( selectedLanguage == screenOut ) { document.location.href="http://www.korea.modine.com/"; } else { createCookie('prefLang',selectedLanguage,60); document.langForm.submit(); } } function openHVACWindow( pathEnd ) { window.open('/portal/DynamicContent' + pathEnd,'HVACWindow','width=600,height=565,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no,top=75,left=200').focus(); } //Form validation methods function isNumeric(sText) { var ValidChars = "-0123456789."; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; } function trim(str){ return str.replace(/^\s+|\s+$/g, '') }