/* 
Personnel Display
Displays contact information for personnel
*/

/* VARS */

var basic,DShipman,PBoaz,CShipman,JCuevas,JGaida,JGarcia,JRodriguez,RCortez,DCuevas,HKeen,LGarrett,ACastillo,ACrippen,MClaxton,RPichardo,MPrestjohn,ESmith,TReed,PByers,JCutlip,Various;

basic		= '<p>Ranger Fire, Inc.<br />920 South Main, Suite 200<br />Grapevine, Texas 76051</p><p>Metro Phone: 817.410.9070&nbsp;|&nbsp;Metro Fax: 817.410.9050</p>';
DShipman	= '<p><strong>Chief Executive Officer</strong></p>';
PBoaz		= '<p><strong>Chairman of the Board</strong></p>';
CShipman	= '<p><strong>President</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x220)<br /><strong>Secondary Phone</strong>:&nbsp;469-853-0400<br /><strong>Expertise</strong>:&nbsp;NICET Level III<br />CERTIFIED FIRE ALARM TECHNICIAN</p>';
JCuevas		= '<p><strong>Vice President/RME</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x233)<br /><strong>Secondary Phone</strong>:&nbsp;214-952-3337<br /><strong>Expertise</strong>:&nbsp;NICET Level III<br />Estimating/Sales</p>';
JGaida		= '<p><strong>Estimator</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x230)<br /><strong>Secondary Phone</strong>:&nbsp;214-663-7429</p>';
JRodriguez	= '<p><strong>Estimating/Sales</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x235)<br /><strong>Secondary Phone</strong>:&nbsp;972-672-9769</p>';
RCortez		= '<p><strong>Estimating/Sales</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x234)<br /><strong>Secondary Phone</strong>:&nbsp;214-724-6810</p>';
ESmith		= '<p><strong>Eastern Regional Sales Manager</strong><br /><strong>Primary Phone</strong>:&nbsp;404-775-4087</p>';
JJones		= '<p><strong>Purchasing Manager</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x226)<br /><strong>Fax</strong>:&nbsp;817-410-9051</p>';
APayable	= '<p><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x225)</p>';
LGarrett	= '<p><strong>Billings/Accounts Receivable Manager</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x222)<br /><strong>Fax</strong>:&nbsp;817-410-9052</p>';
ADelaney	= '<p><strong>Human Resources Manager</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x258)<br /><strong>Fax</strong>:&nbsp;817-410-9053</p>';
ACastillo	= '<p><strong>Service &amp; Inspection Manager</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x260)<br /><strong>Secondary Phone</strong>:&nbsp;817-889-1897</p>';
BLewis		= '<p><strong>Director, Service &amp; Inspections</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x260)<br /><strong>Secondary Phone</strong>:&nbsp;214-534-8475</p>';
LWerner		= '<p><strong>Service Billings/Accounts Receivable Administrator</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x260)</p>';
MClaxton	= '<p><strong>Senior Design/Project Manager</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x229)<br /><strong>Certification</strong>: NICET Level III</p>';
TReed		= '<p><strong>Engineering/Project Inspections</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070<br /><strong>Certification</strong>: NICET Level III</p>';
PByers		= '<p><strong>Engineering/Project Managing</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x228)</p>';
DAnderson	= '<p><strong>Engineering/Project Managing</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x264)</p>';
JCutlip		= '<p><strong>Assistant Estimator</strong><br /><strong>Primary Phone</strong>:&nbsp;817-410-9070 (x227)</p>';
MMoreno		= '<p><strong>Project Superintendent</strong><br /><strong>Quality &amp; Safety Control Manager</strong><br /><strong>Primary Phone</strong>:&nbsp;956-367-2422</p>';
Various		= '<p>Approximately 240 employees. Call office for names and numbers.</p>';

/* FUNCTIONS */

function add_onload(myfunc)		// allows multiple onload events to be loaded and used
{
	if(window.addEventListener)
		window.addEventListener('load', myfunc, false);
	else if(window.attachEvent)
		window.attachEvent('onload', myfunc);
}

function add_event(obj, evType, fn)
{ 
	if (obj.addEventListener)
	{ 
		obj.addEventListener(evType, fn, true); 
		return true; 
	} 
	else if (obj.attachEvent)
	{ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	} 
	else 
	{ 
		return false; 
	} 
}


function replace_text(e,text)
{
	// check for Firefox DOM and use it if it's on, otherwise use IE DOM (innertext)
	var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
	if (hasInnerText)
		e.innerText = text;
	else
		e.textContent = text;
}

function init()
{
	var info = document.getElementById('contact-info');		// contact info element
	if (info == undefined || info === null) return null;	// skip if element not defined
	var p = document.getElementById('personnel');
	
	p.onchange = function(e) 
	{ 
		var b = eval(this.value);
		info.innerHTML = b;
	};														// select action
	info.innerHTML = basic;									// put text into element
}

function strip_spaces(x) 
{
    while (x.substring(0,1) == ' ') 
    	x = x.substring(1);
    return x;
} 

function empty(x) 
{ 
	if (x.length > 0) 
		return false; 
	else 
		return true; 
}


function ValidateContactForm() 
{
	var errorNum = 0;
	var errorMsg = "";
	var reminder = "Thanks for your interest!";
	errorMsg  = "____________________________________\n\n";
	errorMsg += "           ERROR - ERROR - ERROR          \n";
	errorMsg += "      Please correct these errors\n";
	errorMsg += "____________________________________\n\n";
	errorMsg += "These are the errors on your form:\n";
	var contact_form = document.getElementById('contact_form');

	if (contact_form.name.value == "") 
	{
		errorNum += 1;
		errorMsg += "    - No name provided                        \n";
	}		
	if (contact_form.email.value == "") 
	{
		errorNum += 1;
		errorMsg += "    - No e-mail provided                      \n";
	}
	if (contact_form.interest.selectedIndex == 0) 
	{
		errorNum += 1;
		errorMsg += "    - No interest selected                      \n";
	}
	
	if (empty(strip_spaces(contact_form.comments.value))) {
		errorNum += 1;
		errorMsg += "    - No comments provided                  \n";
	}

	if (errorNum > 0) 
	{
		contact_form.jsvalidated.value = false;
		alert(errorMsg);
		return ( false );
	} 
	else 
	{
		contact_form.jsvalidated.value = true;
		return ( true );
	}
}


//----------------------------------------------------
add_onload(init);

