/********** CONFIGURATION *************/
var ScreenLine = new Array();
//var strDefaultMsg="Engineered Materials, Inc.";		// Default message before the type writer starts
var strDefaultMsg='<img src="images/dotclear.gif">';			// Default message before the type writer starts
var intStartPause=2000;									// Delay before wiping the default message
var intSpeed=80;										// Speed of typing each character
var intBlinkRate=250;									// Cursor blink rate
var intNumBlinks=7;										// Number of times to blink the cursor when at the end of the line before continuing with the next message
var intMsgIndex=1;										// First line to display
var intWidth=430;										// Width of the type writer
var intHeight=40;										// Height of the type writer
var strFont='color:#000000; '+							// Default font style
'background-color:#919183; '+
'font-family:arial,helvetica,sans-serif; '+
'font-size:9pt; '+
'font-weight:bold; '+
'font-style:normal;';
ScreenLine[1] = 'EMI - Supplying custom fabricated products and distributing and selling materials to the industrial marketplace.';
ScreenLine[2] = 'We provide value and meet the needs of our customers.';

/********** DO NOT ALTER ANYTHING BELOW *************/
var strLayer='divTypeWriter';
var TheMsg="";
var intPauseCounter=0;
var intCharIndex=0;
var CursorOn=true;
var isIE=(navigator.appVersion.indexOf("MSIE")>0);		// If true then only work for IE browsers
var isOpera=(navigator.userAgent.toUpperCase().indexOf("OPERA") != -1);
var strCursor='<img src="images/cursor.gif" width=12 height=1 border=0">';

function DisplayMsg() {
	var blnBreak=true;
	if (intCharIndex<=TheMsg.length) { 
		blnBreak=true;
		strBuffer="";
		do {
			if (TheMsg.charAt(intCharIndex)=="<") {
				blnBreak=false;
			} else if (TheMsg.charAt(intCharIndex)==">") {
				blnBreak=true;
			}
			intCharIndex++;
		} while (!blnBreak)
		UpdateTypeWriter(TheMsg.substring(0,intCharIndex)+"_");
		setTimeout("DisplayMsg()",intSpeed);
	} else {
		// Swap messages
		UpdateTypeWriter(TheMsg+((CursorOn)?strCursor:''));
		intMsgIndex++;
		if (intMsgIndex>=ScreenLine.length) { intMsgIndex=1; }
		TheMsg=ScreenLine[intMsgIndex];
		intCharIndex=0;
		intPauseCounter=0;
		setTimeout("DisplayMsg()",5000);
		/*
		UpdateTypeWriter(TheMsg+((CursorOn)?'_':''));
		CursorOn=!CursorOn;
		intPauseCounter++;
		if (intPauseCounter<(intNumBlinks*2)) { setTimeout("DisplayMsg()",intBlinkRate); }
		else {
			// Swap messages
			intMsgIndex++;
			if (intMsgIndex>=ScreenLine.length) { intMsgIndex=1; }
			TheMsg=ScreenLine[intMsgIndex];
			intCharIndex=0;
			intPauseCounter=0;
			DisplayMsg();
		}
		*/
	}
}
function CreateTypeWriterLayer() {
	var strHTML="";
	strDefaultMsg='<font style="'+strFont+'">'+strDefaultMsg+'</font>';
	if (document.layers) { strHTML = "<ilayer ID="+strLayer+"Words WIDTH="+intWidth+" HEIGHT="+intHeight+"><layer id="+strLayer+">"+strDefaultMsg+"</layer></ilayer>"; }
	else if (isOpera) { strHTML = "<iframe name=\""+strLayer+"Words\" id=\""+strLayer+"Words\" marginwidth=0 marginheight=0 frameborder=0 scrolling=\"no\" noresize style=\"border-width:0px;width:"+intWidth+"px;height:"+intHeight+"px;\" src=\"javascript: '<html>"+strDefaultMsg+"<\/html>'\"></iframe>"; }
	else { strHTML = "<div id='"+strLayer+"Words' style='width:"+intWidth+"px;height:"+intHeight+"px'>"+strDefaultMsg+"</div>"; }
	return strHTML;
}
function UpdateTypeWriter(strText) {
	var blnUseLayers=false;
	strText='<font style="'+strFont+'">'+strText+'</font>';
	if (document.getElementById) { blnUseLayers=(document.getElementById(strLayer+"Words").innerHTML=="")?true:false }
	if (isOpera || blnUseLayers) {
		strText='<html><head><link rel="stylesheet" type="text/css" href="stylesheet.css"></head><body>'+strText+'</body></html>';
		with (window.frames[strLayer+"Words"]) {
			document.open();
			document.writeln(strText);
			document.close();
		}
	}
	else if (document.layers) { 
		with (document.layers[strLayer+"Words"].document.layers[strLayer]) {
			document.open();
			document.writeln(strText);
			document.close();
			visibility="show";
		}
	}
	else { document.getElementById(strLayer+"Words").innerHTML=strText; }
}
function Init() { 
	TheMsg=ScreenLine[intMsgIndex];
	setTimeout("DisplayMsg()",intStartPause);
}
if (isIE) { 
	window.onload=Init;
	document.write ( CreateTypeWriterLayer() );
	markMe();
} else { 
	document.write ( strDefaultMsg ); 
	markMe();
}
