//Set Text Fade Changer Speed
var TextSpeed = 32;

//Set Background Color
var TextColorR = parseInt("00",16);
var TextColorG = parseInt("00",16);
var TextColorB = parseInt("ff",16);

//Set Foreground Color
var TextOffsetR = (parseInt("ff",16)-TextColorR)/TextSpeed;
var TextOffsetG = (parseInt("ff",16)-TextColorG)/TextSpeed;
var TextOffsetB = (parseInt("ff",16)-TextColorB)/TextSpeed;

function ChangeMessage() {
	TextMessageNumber++;

	switch (TextMessageNumber) {
		case 0:
			document.getElementById('swap_text').innerHTML='"Trust Your Car To The Experts"';
			document.getElementById('swap_text').style.fontWeight="bold";
			break;
		case 1:
			document.getElementById('swap_text').innerHTML="Where Quality & Service Comes First!";
			document.getElementById('swap_text').style.fontWeight="bold";
			break;
		case 2:
			document.getElementById('swap_text').innerHTML="Are You Getting The Right Price?";
			document.getElementById('swap_text').style.fontWeight="normal";
			break;
		case 3:
			document.getElementById('swap_text').innerHTML="Don’t be Mislead By Wrong Diagnosis!";
			document.getElementById('swap_text').style.fontWeight="normal";
			TextMessageNumber=-1;
			break;
	}
}

var TextDirection = 1;
var TextDelay = 100;
var LoopCounter = 0;
var TextMessageNumber = 0;
var TextInterval = Object;

TextInterval = setInterval("textFader()",TextDelay);

function textFader() {
	clearInterval(TextInterval);
	TextInterval = setInterval("textFader()",TextDelay);
	TextDelay=100;
			
	LoopCounter = LoopCounter + TextDirection;
			
	if (LoopCounter == TextSpeed || LoopCounter == 0) {
		TextDirection = TextDirection * -1;
		if (LoopCounter == 0) {
			ChangeMessage();
		} else {
			TextDelay = 200;
		}
	} else {
		TextColorR = TextColorR + (TextOffsetR * TextDirection);
		TextColorG = TextColorG + (TextOffsetG * TextDirection);
		TextColorB = TextColorB + (TextOffsetB * TextDirection);

		if (navigator.appName=="Microsoft Internet Explorer") {
		 	document.getElementById('swap_text').style.color = parseInt(HexConvert(TextColorR) + HexConvert(TextColorG) + HexConvert(TextColorB),16);
		} else {
			document.getElementById('swap_text').style.color = HexConvert(TextColorR) + HexConvert(TextColorG) + HexConvert(TextColorB);
		}
	}
}
		
function HexConvert(Number) {
	Hex="00" + parseInt(Number).toString(16);
	return (Hex.substring(Hex.length-2));
}

