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 = new 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("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
}
// Added by AJB on 01/25/2005
// Declare rotation images array
var CachedImageNames = new Array(6);
// Fill the rotation array with images
function fillImageNamesCache( countryCode )
{
CachedImageNames[0] = "images/home/rotation/" + countryCode + "/CFD 2 Pic - " + countryCode + ".gif";
CachedImageNames[1] = "images/home/rotation/" + countryCode + "/Control Room Pic - " + countryCode + ".gif";
CachedImageNames[2] = "images/home/rotation/" + countryCode + "/CFD Pic - " + countryCode + ".gif";
CachedImageNames[3] = "images/home/rotation/" + countryCode + "/EU Wind tunnel Pic - " + countryCode + ".gif";
CachedImageNames[4] = "images/home/rotation/" + countryCode + "/Fuel Cell Pic - " + countryCode + ".gif";
CachedImageNames[5] = "images/home/rotation/" + countryCode + "/Product Pic - " + countryCode + ".gif";
}
var linkArray = new Array(
'void()',
'void()',
'void()',
'void()',
'void()',
'void()');
var old = 0;
var current = 0;
function rotate()
{
if (!document.images) return
current++;
if ( current >= CachedImages.length )
{
current = 0;
}
document.images['rotation'].src = CachedImages[current];
setTimeout('rotate()',8000);
}
// Surround img tag with if linked
// images desired
function sendPage()
{
location.href = linkArray[current];
}
// 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');
}
// Declare rollover images array
//var CachedRolloverImages = new Array(8);
// Fill the rollover array with images
//CachedRolloverImages[0] = new Image().src = "images/home/rollover/rollover auto.gif";
//CachedRolloverImages[1] = new Image().src = "images/home/rollover/rollover truck.gif";
//CachedRolloverImages[2] = new Image().src = "images/home/rollover/rollover off-highway.gif";
//CachedRolloverImages[3] = new Image().src = "images/home/rollover/rollover engine.gif";
//CachedRolloverImages[4] = new Image().src = "images/home/rollover/rollover CHVACR.gif";
//CachedRolloverImages[5] = new Image().src = "images/home/rollover/rollover electronics.gif";
//CachedRolloverImages[6] = new Image().src = "images/home/rollover/rollover fuel cell.gif";
//CachedRolloverImages[7] = new Image().src = "images/home/rollover/rollover cooling coils.gif";
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, '')
}