<!--
//*** THIS STUFF HAPPENS ON LOAD ***

var num_pages = 7 //number of pages in nav menu, minus sample page
pages = new Array(num_pages)
for(var i=0; i<=num_pages-1; i++)
	pages[i] = new Array(2) //create 2d array

//current_page =  "<%= strPage %>"; //rightOf( "/", document.location.href); //file name of active page
current_page = rightOf( "/", document.location.href);
if(current_page=="") 
	current_page="default.asp";


//load pages array
// ---- ADD NEW PAGES HERE ---
pages[0][0] = "index.asp"; pages[0][1] = "Home";
pages[1][0] = "products.asp"; pages[1][1] = "Products";
pages[2][0] = "services.asp"; pages[2][1] = "Services";
pages[3][0] = "news.asp"; pages[3][1] = "News and Events";
pages[4][0] = "about.asp"; pages[4][1] = "About TTI";
pages[5][0] = "none.asp"; pages[5][1] = "None";
pages[6][0] = "capabilities.asp"; pages[6][1] = "capabilities";

function rightOf(smstring,lrgstring) {
	//returns the rightmost characters of lrgstring back to smstring.
	//If user passes an empty string, change that to a space.
	if (smstring == ""){smstring = " "}
	strlen1 = smstring.length
	strlen2 = lrgstring.length
	foundat = 0
	for (i=strlen2;i>=0;i--) {
		comp=lrgstring.substring(i-1,strlen2)
		comp = comp.substring(0,strlen1)		
		if (comp == smstring) {
			foundat = i
			break
		}
	}
	return lrgstring.substring(foundat,255)
}//end rightOf


//validate form, then if everything is okay
function ValidateNewsletterForm(form){

	var email = form.NewsEmail.value;
	
	if (email === "Enter email address")
	{
		alert("Please enter a valid email address!");
		return false;
	}
		
	if(isEmail(email))
	{
		return true;
	}
	else{
		alert("Please enter a valid email address!");
		return false;
	}
}

function isEmail (s)
{   
	s = trim(s);
	
	if (isEmpty(s)) 
       return (isEmail.arguments[1] == true);
       
    if (hasSpace(s)) 
		return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

// Check whether string s is empty.

function isEmpty(s)
{   return ((s == null) || (s.length == 0));
}


// Returns true if string s is empty or 
// whitespace characters only.

// whitespace characters
var whitespace = " \t\n\r";

function isWhitespace (s)

{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function hasSpace(s)
{
	var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        if (s.charAt(i) == " ")
			return true;
    }
    return false;
}

function trim(str) { 
    str.replace(/^\s*/, '').replace(/\s*$/, ''); 

   return str;
} 


//-->