
function colorInfo( item, fgcolor, bgcolor ) {  
	this.item 		= item;
	this.fgcolor 	= fgcolor;
	this.bgcolor 	= bgcolor;
}

var colors = new Array();
colors[0] = new colorInfo('sidebar',  null, null);
colors[1] = new colorInfo('dropdown', null, null);
colors[2] = new colorInfo('navbar',   null, null);

function navOver(e, item, fgcolor, bgcolor){
	var found = 0;
	for (i = 0; i < colors.length; i++) {
		if (colors[i].item == item) {
			if (colors[i].fgcolor == null) {
				colors[i].fgcolor = e.style.color;
				colors[i].bgcolor = e.style.backgroundColor;
				break;
			} 
		}
	}

	if (bgcolor) 
		e.style.backgroundColor = bgcolor;
	if (fgcolor)
		e.style.color = fgcolor;
}

function navOut(e, item) {
	for (i = 0; i < colors.length; i++) {
		if (colors[i].item == item && colors[i].fgcolor != null) {
			e.style.color = colors[i].fgcolor;
			e.style.backgroundColor = colors[i].bgcolor;
			break;
		}
	}
}

var menuArray = new Array(7);

var tempBgColor = '';
var tempFgColor = '';
var isSafari = false;
var app = navigator.userAgent;
if (app.indexOf("Safari") > 0) { 
	isSafari = true;
}


// width, heigh, left, top
function newWindow(file, windowname, w, h, l, t) {

	windowname = (windowname == '') ? 'popup' : windowname;

	w = (!w) ? 640 : w;
	h = (!h) ? 640 : h;

	l = (!l) ? 200 : l;
	t = (!t) ? 80  : t;

    msgWindow=window.open(file,windowname,'resizable=yes,scrollbars=1,width=' + w + ',height=' + h + ',left=' + l + ',top=' + t);
	if (msgWindow.opener == null) msgWindow.opener = self;
	msgWindow.focus();
}                

function helpWindow(file) {
	newWindow(file, 'help',660,550);
}                


function displayDescription(desc){

  var docElement = document.all['description']
  var xPos
  var yPos

  xPos = window.event.clientX + 10
  yPos = window.event.clientY

  if (yPos > 400)
  {
    yPos = 400;
  }
  docElement.style.left = 200;
  docElement.style.top = yPos
  docElement.innerHTML = desc
  if (desc == '')
    docElement.style.display = "none"
  else
    docElement.style.display = ""
  
}

// Javascript function that mimics VB Trim function *********************************
	// **********************************************************************************
	function Trim(strValue) {
	//	remove leading spaces
		while ('' + strValue.charAt(0) == ' ') {
			strValue = strValue.substring(1, strValue.length);
		}
	//	remove trailing spaces
		while ('' + strValue.charAt(strValue.length - 1) == ' ') {
			strValue = strValue.substring(0, strValue.length - 1)	
		}	
		return strValue;
	}

function WaitFor(sObj )
  {
  
    Hide( sObj );
    Show ('WaitFor');
    //fix the body
    var docElement = document.all['main_content'];
    if (docElement != null) {
    	docElement.style.cursor = "wait";
    }
    //
  }



function ReturnCheckedSelectedCSV( sname)
{
	with (document)
	{
		
		var x=1;
		var svalue = '';
		obj = getElementById(sname + x);
		while ( obj != null ) 
		{
   			if (obj.checked) 
   			{
   				if ( Trim(svalue) == '')
   				{
   					svalue = obj.value
   				}
   				else
   				{
   					svalue = svalue + ',' + obj.value
				}	
   			};
   			x++;
			obj = getElementById( sname + x);
			
		}
		//alert(svalue);
		return svalue;

	} 
}


function ProcessRequest( fObj)
//-------------------------------------------------------------------------------
 
{
	try
	{
 	 		
 	with  ( fObj ) 
 		
 		{
 
 			
 
 			if ( Trim( txtfirstname.value) == '' ) 
 			{
    			alert('Please enter the primary contact first name.');
    			txtfirstname.focus();
    			return (false);
 			};
 			
 			if ( Trim( txtlastname.value) == '' ) 
 			{
    			alert('Please enter the primary contact last name');
    			txtlastname.focus();
    			return (false);
 			};
 
    
 			if ( Trim( txtcompanyname.value) == '' ) 
 			{
    			alert('Please enter your company or organization name.');
    			txtcompanyname.focus();
    			return (false);
 			};
 			
 			if ( Trim( txtaddress.value) == '' ) 
 			{
    			alert('Please enter your street address.');
    			txtaddress.focus();
    			return (false);
 			};
 
 		  if ( Trim( txtcity.value) == '' ) 
 			{
    			alert('Please enter your city.');
    			txtcity.focus();
    			return (false);
 			};
 
 
 			if ( Trim( txtstate.value) == '' ) 
 			{
    			alert('Please enter your state.');
    			txtstate.focus();
    			return (false);
 			};
 			
 			if ( Trim( txtzipcode.value) == '' ) 
 			{
    			alert('Please enter your zipcode.');
    			txtzipcode.focus();
    			return (false);
 			};
 
 
 			if ( Trim( txtemail) == '' ) 
 			{
    			alert('Please enter a valid email address.');
    			txtemail.focus();
    			return (false);
 			};
 
 
 			if ( Trim( txtphone.value) == '' ) 
 			{
    			alert('Please enter a phone number where you can be reached.');
    			txtphone.focus();
    			return (false);
 			};
 			
 			//get the products
 			//products.value = ReturnCheckedSelectedCSV( 'txtproducts');
 			
 			
 						
 			
 			submit();
 			return (true);
 		}	//with form

	}
	
	catch ( err )
	{
		alert("Error occurred. Error message: " + err);
	}

}

//----------------------------------------------------------------------------



