function StartupEvents(strPageID)  {
	// ----- initialize global variables -----//
	objBtn_pcservices = document.getElementById('Btn_pcservices');
	objBtn_htservices = document.getElementById('Btn_htservices');
	objBtn_intservices = document.getElementById('Btn_intservices');
	objBtn_whoweare = document.getElementById('Btn_whoweare');
	objBtn_faqs = document.getElementById('Btn_faqs');
	objBtn_contact = document.getElementById('Btn_contact');
	objLabelBtn_pcservices = document.getElementById('lblBtn_pcservices');
	objLabelBtn_htservices = document.getElementById('lblBtn_htservices');
	objLabelBtn_intservices = document.getElementById('lblBtn_intservices');
	objLabelBtn_whoweare = document.getElementById('lblBtn_whoweare');
	objLabelBtn_faqs = document.getElementById('lblBtn_faqs');
	objLabelBtn_contact = document.getElementById('lblBtn_contact');
	strCurrentPage = strPageID;
		
	// ----- call startup functions -----//
	SetImageDefaults(strCurrentPage);
	return true;
}

function SetImageDefaults(strCurrentPage)  {
	// ----- replace text with image buttons ----- //
	objLabelBtn_pcservices.style.display = "soluções";
	objLabelBtn_htservices.style.display = "wireless";
	objLabelBtn_intservices.style.display = "clientes";
	objLabelBtn_whoweare.style.display = "empresa";
	objLabelBtn_faqs.style.display = "faq";
	objLabelBtn_contact.style.display = "contato";
	var intPageGroup = 0;
	
	switch(strCurrentPage)  {
		case 'PC_Serve':
			intPageGroup = 1;
			break;
		case 'PC_Main':
			intPageGroup = 1;
			break;			
		case 'PC_Protection':
			intPageGroup = 1;
			break;
		case 'HT_Install':
			intPageGroup = 2;
			break;
		case 'HT_Main':
			intPageGroup = 2;
			break;
		case 'INT_Convergence':
			intPageGroup = 3;
			break;
		case 'INT_Main':
			intPageGroup = 3;
			break;
		case 'FD_AndYou':
			intPageGroup = 4;
			break;
		case 'FD_Careers':
			intPageGroup = 4;
			break;
		case 'FD_Commitment':
			intPageGroup = 4;
			break;
		case 'FD_Employees':
			intPageGroup = 4;
			break;
		case 'FD_Main':
			intPageGroup = 4;
			break;
		case 'FD_People':
			intPageGroup = 4;
			break;
		case 'FD_Solution':
			intPageGroup = 4;
			break;
		case 'FD_Story':
			intPageGroup = 4;
			break;
		case 'FD_Teams':
			intPageGroup = 4;
			break;
		case 'FD_Testimonials':
			intPageGroup = 4;
			break;
		case 'FD_WhatWorks':
			intPageGroup = 4;
			break;
		case 'FAQ_1':
			intPageGroup = 5;
			break;
		case 'FAQ_2':
			intPageGroup = 5;
			break;
		case 'FAQ_HT':
			intPageGroup = 5;
			break;
		case 'FAQ_INT':
			intPageGroup = 5;
			break;
		case 'FAQ_Main':
			intPageGroup = 5;
			break;
		case 'FAQ_PCS':
			intPageGroup = 5;
			break;
		case 'FAQ_Who':
			intPageGroup = 5;
			break;
		case 'CON_Form':
			intPageGroup = 6;
			break;
		case 'CON_Main':
			intPageGroup = 6;
			break;
		case 'CON_Unsub':
			intPageGroup = 6;
			break;
		case 'CON_UnsubConf':
			intPageGroup = 6;
			break;
		default:
			intPageGroup = 0;
			break;		
	}
	
	switch(intPageGroup)  {
		case 1:
			//the current page is a pc_services page
			objBtn_pcservices.style.background = "#444041 url('image/mainnav/pcserve_on.gif') no-repeat top center";
			objBtn_htservices.style.background = "#444041 url('image/mainnav/hometheater_off.gif') no-repeat top center";
			objBtn_intservices.style.background = "#444041 url('image/mainnav/integrated_off.gif') no-repeat top center";
			objBtn_whoweare.style.background = "#444041 url('image/mainnav/who_off.gif') no-repeat top center";
			objBtn_faqs.style.background = "#444041 url('image/mainnav/faq_off.gif') no-repeat top center";
			objBtn_contact.style.background = "#444041 url('image/mainnav/contact_off.gif') no-repeat top center";
			break;
		case 2:
			//the current page is a home theater page
			objBtn_pcservices.style.background = "#444041 url('image/mainnav/pcserve_off.gif') no-repeat top center";
			objBtn_htservices.style.background = "#444041 url('image/mainnav/hometheater_on.gif') no-repeat top center";
			objBtn_intservices.style.background = "#444041 url('image/mainnav/integrated_off.gif') no-repeat top center";
			objBtn_whoweare.style.background = "#444041 url('image/mainnav/who_off.gif') no-repeat top center";
			objBtn_faqs.style.background = "#444041 url('image/mainnav/faq_off.gif') no-repeat top center";
			objBtn_contact.style.background = "#444041 url('image/mainnav/contact_off.gif') no-repeat top center";
			break;
		case 3:
			//the current page is an integrated services page
			objBtn_pcservices.style.background = "#444041 url('image/mainnav/pcserve_off.gif') no-repeat top center";
			objBtn_htservices.style.background = "#444041 url('image/mainnav/hometheater_off.gif') no-repeat top center";
			objBtn_intservices.style.background = "#444041 url('image/mainnav/integrated_on.gif') no-repeat top center";
			objBtn_whoweare.style.background = "#444041 url('image/mainnav/who_off.gif') no-repeat top center";
			objBtn_faqs.style.background = "#444041 url('image/mainnav/faq_off.gif') no-repeat top center";
			objBtn_contact.style.background = "#444041 url('image/mainnav/contact_off.gif') no-repeat top center";
			break;
		case 4:
			//the current page is a company information page
			objBtn_pcservices.style.background = "#444041 url('image/mainnav/pcserve_off.gif') no-repeat top center";
			objBtn_htservices.style.background = "#444041 url('image/mainnav/hometheater_off.gif') no-repeat top center";
			objBtn_intservices.style.background = "#444041 url('image/mainnav/integrated_off.gif') no-repeat top center";
			objBtn_whoweare.style.background = "#444041 url('image/mainnav/who_on.gif') no-repeat top center";
			objBtn_faqs.style.background = "#444041 url('image/mainnav/faq_off.gif') no-repeat top center";
			objBtn_contact.style.background = "#444041 url('image/mainnav/contact_off.gif') no-repeat top center";
			break;
		case 5:
			//the current page is a faq page
			objBtn_pcservices.style.background = "#444041 url('image/mainnav/pcserve_off.gif') no-repeat top center";
			objBtn_htservices.style.background = "#444041 url('image/mainnav/hometheater_off.gif') no-repeat top center";
			objBtn_intservices.style.background = "#444041 url('image/mainnav/integrated_off.gif') no-repeat top center";
			objBtn_whoweare.style.background = "#444041 url('image/mainnav/who_off.gif') no-repeat top center";
			objBtn_faqs.style.background = "#444041 url('image/mainnav/faq_on.gif') no-repeat top center";
			objBtn_contact.style.background = "#444041 url('image/mainnav/contact_off.gif') no-repeat top center";
			break;
		case 6:
			//the current page is a contact us page
			objBtn_pcservices.style.background = "#444041 url('image/mainnav/pcserve_off.gif') no-repeat top center";
			objBtn_htservices.style.background = "#444041 url('image/mainnav/hometheater_off.gif') no-repeat top center";
			objBtn_intservices.style.background = "#444041 url('image/mainnav/integrated_off.gif') no-repeat top center";
			objBtn_whoweare.style.background = "#444041 url('image/mainnav/who_off.gif') no-repeat top center";
			objBtn_faqs.style.background = "#444041 url('image/mainnav/faq_off.gif') no-repeat top center";
			objBtn_contact.style.background = "#444041 url('image/mainnav/contact_on.gif') no-repeat top center";
			break;
		default:
			//the current page is the homepage, sitemap, EULA, or other non-sectional page.
			objBtn_pcservices.style.background = "#444041 url('image/mainnav/pcserve_off.gif') no-repeat top center";
			objBtn_htservices.style.background = "#444041 url('image/mainnav/hometheater_off.gif') no-repeat top center";
			objBtn_intservices.style.background = "#444041 url('image/mainnav/integrated_off.gif') no-repeat top center";
			objBtn_whoweare.style.background = "#444041 url('image/mainnav/who_off.gif') no-repeat top center";
			objBtn_faqs.style.background = "#444041 url('image/mainnav/faq_off.gif') no-repeat top center";
			objBtn_contact.style.background = "#444041 url('image/mainnav/contact_off.gif') no-repeat top center";
			break;
	}
	
	return true;
}

function HightlightButton(strButtonID)  {
	// ----- Declare Variables -----//
	var objBtn_pcservices;
	var objBtn_htservices;
	var objBtn_intservices;
	var objBtn_whoweare;
	var objBtn_faqs;
	var objBtn_contact;
		
	// ----- Initialize Variables -----//
	objBtn_pcservices = document.getElementById('Btn_pcservices');
	objBtn_htservices = document.getElementById('Btn_htservices');
	objBtn_intservices = document.getElementById('Btn_intservices');
	objBtn_whoweare = document.getElementById('Btn_whoweare');
	objBtn_faqs = document.getElementById('Btn_faqs');
	objBtn_contact = document.getElementById('Btn_contact');

	switch(strButtonID)  {
		case 'Btn_pcservices':
			objBtn_pcservices.style.background = "#444041 url('image/mainnav/pcserve_on.gif') no-repeat top center";
			break;
		case 'Btn_htservices':
			objBtn_htservices.style.background = "#444041 url('image/mainnav/hometheater_on.gif') no-repeat top center";
			break;
		case 'Btn_intservices':	
			objBtn_intservices.style.background = "#444041 url('image/mainnav/integrated_on.gif') no-repeat top center";
			break;
		case 'Btn_whoweare':
			objBtn_whoweare.style.background = "#444041 url('image/mainnav/who_on.gif') no-repeat top center";
			break;
		case 'Btn_faqs':	
			objBtn_faqs.style.background = "#444041 url('image/mainnav/faq_on.gif') no-repeat top center";
			break;
		case 'Btn_contact':	
			objBtn_contact.style.background = "#444041 url('image/mainnav/contact_on.gif') no-repeat top center";
			break;
//		default:
//			alert('Default case fired.');
	}
	return true;
}


// Email Validation Javascript
// copyright 23rd March 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function validateEmail(addr,man,db) {
	if (addr == 'you@email.com') {
		addr='';
	}
	if (addr == '' && man) {
 		if (db) alert('email address is mandatory');
 		return false;
	}
	
	var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';
	for (i=0; i<invalidChars.length; i++) {
 		if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
		if (db) alert('email address contains invalid characters');
 		return false;
 		}
	}
	
	for (i=0; i<addr.length; i++) {
 		if (addr.charCodeAt(i)>127) {
 		if (db) alert("email address contains non ascii characters.");
 		return false;
 		}
	}

	var atPos = addr.indexOf('@',0);
	if (atPos == -1) {
 		if (db) alert('email address must contain an @');
 		return false;
	}

	if (atPos == 0) {
 		if (db) alert('email address must not start with @');
 		return false;
	}

	if (addr.indexOf('@', atPos + 1) > - 1) {
 		if (db) alert('email address must contain only one @');
 		return false;
	}

	if (addr.indexOf('.', atPos) == -1) {
 		if (db) alert('email address must contain a period in the domain name');
 		return false;
	}

	if (addr.indexOf('@.',0) != -1) {
 		if (db) alert('period must not immediately follow @ in email address');
 		return false;
	}

	if (addr.indexOf('.@',0) != -1){
 		if (db) alert('period must not immediately precede @ in email address');
 		return false;
	}

	if (addr.indexOf('..',0) != -1) {
 		if (db) alert('two periods must not be adjacent in email address');
 		return false;
	}

	var suffix = addr.substring(addr.lastIndexOf('.')+1);
	//if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
	// if (db) alert('invalid primary domain in email address');
	// return false;
	//}
	
	//verify that the TLD contains at least two characters
	if (suffix.length < 2)  {
		if (db) alert('invalid primary domain in email address');
		return false;
	}

	return true;
}

function signup_form_verify()
{
  var answer = true;
  answer = validateEmail(document.signup_form.email.value,true,true);
  if (answer == true)
    document.signup_form.submit();
  return answer;
}

function email_button()
{
  var email_address=" ";
  var new_window = window.open("mailto:" + email_address + "?subject= firedog - unleashing technology&body=See how technology can change your life: " + location.href, "replace");
  new_window.close();
}
