/* add onLoad event */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		if (oldonload) {
			oldonload();
		}
			func();
		}
	}
}

/* leave this in default.js, it is used in the header box */
function dealerLocatorBoxSwitch(el, type)
{
	if(type)
	{
		el.value = "";
		el.maxLength = 5;
		el.style.backgroundColor = "#ddf5ff";
	} else{
		el.maxLength = 10;
		el.style.backgroundColor = "";
	}
}

/* get style of an element */
function getElementStyle(oElm, strCssRule){
	var strValue = "";
	if(document.defaultView && document.defaultView.getComputedStyle){
		strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
	}
	else if(oElm.currentStyle){
		strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
				return p1.toUpperCase();
			});
		strValue = oElm.currentStyle[strCssRule];
	}
	return strValue;
}

var text_size_increment = 2;

function text_resize(sign) {
	var content = document.getElementById("content-body");
	var current = getElementStyle(content, "font-size");
	current = current.replace(/^([0-9]+)(.*)?$/,"$1");
	
	if (sign)
		current = current*1 + text_size_increment
	else
		current -= text_size_increment
	
	content.style.fontSize = current + 'px';
}


//Super Flash Variable Passer
function flashPassVar(varName, varValue, movieName){
	var flashMovie = getFlashMovieObject(movieName)
	if (flashMovie)
		flashMovie.SetVariable(varName, varValue);
}
	
function flashGetVar(varName, movieName) {
	var flashMovie = getFlashMovieObject(movieName);
	return flashMovie.GetVariable(varName);
}

function getFlashMovieObject(movieName)
{
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1) {
		if (document.embeds && document.embeds[movieName]) {
			return document.embeds[movieName]; 
		}
	} else { // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
		return document.getElementById(movieName);
	}
}