﻿/* to use talkToMe just give anything on the page, where you want the content to appear an Id. Once it has
 * an Id using something like onmouseover="talkToMe('blah', 'yeah'). This will find the Id 'yeah' and print
 * 'blah' in the content area of the tag and erase anything that was there. If you want to make a long and 
 * complicated command through this, just give the talk command a 3 digit code and make the same
 * code appear in one of the case statements below. This way it will keep the web page from getting to
 * complicated.		onmouseout="toros = setTimeout('hideMe(\'rotatingservices\')', 1000)"
 */
 function talkToMe(talk, voice) {
    debi = document.getElementById(voice)
	if (talk.length != 3) {
		debi.innerHTML = talk;
	}
	else{
		switch (talk) {
			case "REC":
			    debi.innerHTML='<div class="inline" onmouseover="showMe(\'products\')" onmouseout="hideMe(\'products\')">'+
                '<a class="button" href="http://www.rotatingequipment.com/rotatingequipment/products.aspx" title="products list">Products</a>'+
                '<div id="products" class="DropDownMenu">'+
                '<a href="http://www.rotatingequipment.com/rotatingequipment/rec/" title="in stock parts and equipment">Equipment & Parts</a>'+
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/easylaser/" title="easylaser alignment systems">Easy-Laser</a>'+
				'<a href="http://www.rotatingequipment.com/rotatingequipment/fscurtis/" title="fs curtis compressors">FS Curtis</a>'+
				'<a href="http://www.rotatingequipment.com/rotatingequipment/liquiddynamics/" title="liquidynamics">LiquiDynamics</a>'+
				'<a href="http://www.rotatingequipment.com/rotatingequipment/manchester/" title="manchester tanks">Manchester Tanks</a>' +
				'<a href="https://ecom.radiator.com" title="find the radiator you are looking for"><img src="http://www.rotatingequipment.com/rotatingequipment/images/1800.bmp" width="15" height="15" style="border: 0" />1-800 Radiator</a>' +
                '<a href="https://wizmo.radiator.com/login.php" title="Wizmo">Wizmo</a>'+
                '<a href="http://www.rotatingequipment.com/rotatingequipment/reading/" title="reading technologies">Reading Technology</a>' +
				'<a href="http://www.rotatingequipment.com/rotatingequipment/rmhoist/" title="r&amp;m material handling equipment">R&M</a>' +
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/sullivan/" title="sullivan-palatek">Sullivan-Palatek</a>'+
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/summit/" title="summit industrial">Summit</a>'+
                '<a href="http://www.rotatingequipment.com/inq1338/powerplant.aspx" title="24Mw powerplant details">Power Plant</a>'+
                '</div></div>';
            break;
            case "PRO":
                debi.innerHTML='<div class="inline" onmouseover="showMe(\'rotatingservices\')" onmouseout="hideMe(\'rotatingservices\')">'+
                '<a class="button" href="http://www.rotatingequipment.com/Default.aspx" title="rotatingservices home page">Rotating&nbsp;Services</a>'+
                '<div id="rotatingservices" class="DropDownMenu">'+
                '<a href="http://www.rotatingequipment.com/rotatingequipment/rotatingequipment.aspx" title="rotatingequipment.com home page">RotatingEquipment.com</a>'+
			    '<a href="http://www.rotatingequipment.com/continuingeducation/education.aspx" title="training and courses offered">Continuing Education</a>'+
//			    '<a href="Default.aspx">Engineering</a>'+
                '</div></div>';
            break;
		}
	}
}


/*  showMe(reveal) will find any id that you give it and show it if it is not shown.
 *  Note: that it only displays using block. This is also part of the drop down 
 *  menu handlers, it will display the menu and stop the setTimeout event that
 *  closes them, if it is running.
 */
var stopro = null;	// acronym S-et T-ime O-ut PRO-duct
var storsn = null;	// acronym S-et T-ime O-ut R-otating S-ervice. N-et
var stayPut = 1000;	// how long the menues stay up. milliseconds.

function showMe(reveal){
    var debi = document.getElementById(reveal); // acronym D-ocument.get-E-lement-B-y-I-d
	switch (reveal) {
		case "products":
			debi.style.display='block';
			if (stopro != null) {clearTimeout(stopro); stopro = null;}		
		break;
		case "rotatingservices":
			debi.style.display='block';
			if (storsn != null) {clearTimeout(storsn); storsn = null;}
		break;
		case reveal:
			debi.style.display='block';
		break;
	}
}


/*  hideMe(hide) will find any id that you give it and hide it, if it is not hidden.
 *  It is also the other half of the drop down menu handlers. It starts the
 *  setTimeout command that will hide the menues after stayPut has counted down to
 *  zero.
 */
 function hideMe(hide){
	switch (hide) {
		case "products":
			stopro = setTimeout("document.getElementById('products').style.display='none'", stayPut);
		break;
		case "rotatingservices":
			storsn = setTimeout("document.getElementById('rotatingservices').style.display='none'", stayPut);
		break;
		case hide:
			document.getElementById(hide).style.display='none';
		break;
	}
}


/* This function was found at http://brainerror.net/scripts/javascript/blendtrans/ on 6/3/2008 */
function opacity(id, opacStart, opacEnd, millisec) { 
//speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

//determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++;
			setTimeout("document.getElementById('" + id + "').style.display='none'", (millisec + 50 ));
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++; 
        }
    }
}

//This function was found at http://brainerror.net/scripts/javascript/blendtrans/ on 6/3/2008, change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}