//=============================================================================
// Stenocall JavaScript routines
// Note this file must be included in the HTML before any other JavaScript code
// that utilizes the function declarations, or variable declarations, contained
// in it.

// This is a new version of functions.js that omits the display_sales_email_cc
// function (and anything else that references the frame named mailtoframe).
// (Otherwise we have to include mailtoframe in EVERY web page.)
// That function is now in a separate file called functions-cc-mailto.js. Later
// we need to back-migrate these new .js files to the stenocall.com and
// stenocall-call-center.com sites.

//=============================================================================
// NEW functions (June 2006) related to rollover images in the NEW navigation
// bar (after adding the Two-Way button).
// Changed MM prefix to append an (approximate) version number string, so
// Dreamweaver will quit complaining when we update the library(ies) into the
// HTML files. This appears to be a result of our old version of Dreamweaver
// not supporting some of the code used to insert the newer version of these
// routines.
// Dreamweaver normally inserts all this stuff into the HTML, but I moved it
// here to eliminate a multitude of copies (it also is more efficient at page-
// loading time).

function MM_V3_swapImgRestore() { //v3.0
  var i,x,a=document.MM_V3_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_V3_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_V3_p) d.MM_V3_p=new Array();
    var i,j=d.MM_V3_p.length,a=MM_V3_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_V3_p[j]=new Image; d.MM_V3_p[j++].src=a[i];}}
}

function MM_V3_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_V3_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_V3_swapImage() { //v3.0
  var i,j=0,x,a=MM_V3_swapImage.arguments; document.MM_V3_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_V3_findObj(a[i]))!=null){document.MM_V3_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//=============================================================================
// Functions related to rollover images in the navigation bar.
// These were used in the older version of the nav bar -- guess they are
// obsolete now.

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		ContactButton_over = newImage("images/ContactButton-over.gif");
		homebutton_over = newImage("images/homebutton-over.gif");
		CallCenterButton_over = newImage("images/CallCenterButton-over.gif");
		PagerButton_over = newImage("images/PagerButton-over.gif");
		AnswerButton_over = newImage("images/AnswerButton-over.gif");
		CellButtton_over = newImage("images/CellButtton-over.gif");
		preloadFlag = true;
	}
}

//=============================================================================
// Variables related to type of page

// var CallCenterPage = false;

//=============================================================================
// Note: The various Email functions serve to hide our Email addresses from
// spam harvesters.  As far as possible, we don't want an "@" sign to appear
// in the HTML.
//=============================================================================
// Given the two main pieces of an Email address, build the entire address.

function build_email (name,domain){ 
return (name + "@" + domain)
}

//=============================================================================
// Insert the NON CALL CENTER Email address into the recipient field of the
// response form.

function set_email_in_form_ncc (string){
document.response_form.recipient.value = build_email("sales","stenocall.com");
}

//=============================================================================
// Insert the CALL CENTER Email address into the recipient field of the
// response form.

function set_email_in_form_cc (string){
document.response_form.recipient.value = build_email("salescc","stenocall.com");
}

//=============================================================================
// Display the (clickable) CALL CENTER sales Email address and when clicked,
// register a hit on the email-click-cc.html page for tracking.

// This function (display_sales_email_cc) moved to a separate .js file.

//=============================================================================
// Display the (clickable) NON CALL CENTER sales Email address.

function display_sales_email_ncc() {
	var name1 = "sales"
	var name2 = "@"
	var dom1 = "stenoca"
	var dom2 = "ll.com"
	var string = name1 + name2 + dom1 + dom2
	document.write("<a href=" + "mai" + "lto:" + string + ">" + string + "</a>")
}

//=============================================================================
// Transitional function for GENERAL sales Email. Calls to this will be phased
// out and replaced with calls to display_sales_email_cc and
// display_sales_email_ncc.

function display_main_email() {
	display_sales_email_ncc()
}

//=============================================================================
// Display the (clickable) webmaster Email address.

function display_webmaster_email() {
	var name1 = "webmaster2"
	var name2 = "@"
	var dom1 = "stenoca"
	var dom2 = "ll.com"
	var string = name1 + name2 + dom1 + dom2
	document.write("<a href=" + "mai" + "lto:" + string + ">" + string + "</a>")
}

//=============================================================================
// Display the (clickable) employment Email address.

function display_employment_email() {
	var name1 = "hr"
	var name2 = "@"
	var dom1 = "stenoca"
	var dom2 = "ll.com"
	var string = name1 + name2 + dom1 + dom2
	document.write("<a href=" + "mai" + "lto:" + string + ">" + string + "</a>")
}
