﻿  /* 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">Rotating Eqp. in stock Parts</a>'+
                '<a href="http://www.rotatingequipment.com/rotatingequipment/rec/scales.aspx" title="list of in stock scales parts">Phillips Parts List</a>'+
                '<a href="http://www.rotatingequipment.com/rotatingequipment/cm/" title="Columbus Mckinnon - Hoists and accessories">Columbus McKinnon Hoists</a>'+
                '<a href="http://www.rotatingequipment.com/rotatingequipment/commtest/" title="commtest - diagnose vibration and alignment issues">Commtest Analysis Tools</a>'+
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/conductix/" title="conductix - accessories for materials handling">Conductix Materials Handling</a>'+
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/deltech/" title="SPX Deltech Hankison filters for compressed air">Deltech Hankison Air Filters</a>'+
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/drivecon/" title="Drivecon - hoists and materials handling accessories">Drivecon Motor Drives and Controls</a>'+
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/easylaser/" title="easylaser alignment systems">Easy-Laser Alignment</a>'+
				'<a href="http://www.rotatingequipment.com/rotatingequipment/fscurtis/" title="fs curtis compressors">FS Curtis Compressors</a>'+
				'<a href="http://www.rotatingequipment.com/rotatingequipment/liquiddynamics/" title="liquidynamics - lubrication handling equipment">LiquiDynamics Lubrication</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 Website</a>' +
                '<a href="https://wizmo.radiator.com/login.php" title="Wizmo dealer website">Wizmo</a>'+
                '<a href="http://www.rotatingequipment.com/rotatingequipment/reading/" title="reading technologies - compressed air filters">Reading Technologies Filters</a>' +
				'<a href="http://www.rotatingequipment.com/rotatingequipment/rmhoist/" title="r&m material handling equipment">R&M Materials Handling</a>' +
				'<a href="http://www.rotatingequipment.com/rotatingequipment/saylor/" title="saylor-beall">Saylor-Beall Compressors</a>'+
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/sullivan/" title="sullivan-palatek">Sullivan-Palatek Compressors</a>'+
			    '<a href="http://www.rotatingequipment.com/rotatingequipment/summit/" title="summit industrial lubricants and cleaners">Summit Lubricants</a>'+
                '<a href="http://www.rotatingequipment.com/inq1338/powerplant.aspx" title="24Mw powerplant details">Power Plant</a>'+
                '<a href="http://www.rotatingequipment.com/rotatingequipment/rec/generators.aspx" title="Used Equipment">Used Equipment for Sale</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="http://www.rotatingequipment.com/employment.aspx" title="employment opportunities">Employment Opportunities</a>'+
			    '<a href="http://sharepoint/default.aspx" title="Employee Web">Employee Website</a>'+
			    '<a href="https://sharepoint.rotatingservices.com" title="Remote">Techs Remote</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 + ")"; 
}
