// on page load
jQuery(window).bind("load", function() {
	jQuery("div#slider1").codaSlider()
});

// for download and contact pop-ups
function OpenDocument(strFileName) 
{
	var iWidth		= 800;
	var iHeight		= 710;
	var iToolbar	= 0;
	var iLocation	= 1;
	var iDirectories= 0; 
	var iStatus		= 0;
	var iMenubar	= 0;
	var iScrollbar	= 1;
	var iResizable	= 1;

	var iLeftPos=screen.width/2 - (iWidth/2);
	var iTopPos=screen.height/2 - (iHeight/2);

	var strWindowName='View' + new String(Math.round(Math.random() * 100000));
	
	window.open(strFileName,strWindowName, "toolbar=" + iToolbar + ",location=" + iLocation + ",directories=" + iDirectories + ",status=" + iStatus + ",menubar=" + iMenubar + ",scrollbars=" + iScrollbar + ",resizable=" + iResizable + ",width=" + iWidth + ",height=" + iHeight + ",left=" + iLeftPos + ",top=" + iTopPos);
}
// end download and contact pop-ups

// newsletter form validation
function validateFormOnSubmit(theForm) {
var reason = "";

  reason += validateEmail(theForm.C_EmailAddress);
  
  if (reason != "") {
    alert("There is a problem with your email address:\n\n" + reason );
    return false;
  }
  return true;
}
function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
                var hotmailEmail = /@hotmail\.com/i;
                var liveEmail = /@live\.com/i;
                var gmailEmail = /@gmail\.com/i;
                var yahooEmail = /@yahoo\.com/i;
   
    if (fld.value == "" || fld.value == "Email Address..") {
        error = "Please enter your email address.\n\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        error = "The email address you entered is not valid.\n\n";
    } else if (fld.value.match(illegalChars)) {
        error = "Your email address contains illegal characters.\n\n";
                } else if (fld.value.match(hotmailEmail)) {
        error = fld.value + ":\n\nPlease use your Business / Office / Work  email address.\n\n";
                } else if (fld.value.match(liveEmail)) {
        error = fld.value + ":\n\nPlease use your Business / Office / Work  email address.\n\n";
                } else if (fld.value.match(gmailEmail)) {
        error = fld.value + ":\n\nPlease use your Business / Office / Work  email address.\n\n";
                } else if (fld.value.match(yahooEmail)) {
        error = fld.value + ":\n\nPlease use your Business / Office / Work  email address.\n\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}
// end newsletter form validation

// pull channelName and pageName for Omniture tracking
var urlCurrent = window.location.pathname;
var urlString = urlCurrent.toString();
var urlSplit = urlString.split("/");
var url1 = urlSplit[1];
var url2 = urlSplit[2];
var url3 = urlSplit[3];
var url4 = urlSplit[4];
var url5 = urlSplit[5];
// check if root folder
	if (url2==undefined) {
		var channelName = "root";
		// check if homepage
		if (url1=="") {
			var pageName = "home"
			}
		// check if .asp page
		else if (url1.match(".asp")) {
			var pageName = url1.replace("\.asp",'');
			}
		else {}
	}
	else if (url2=="") {
		var channelName = url1;
		var pageName = url1+"-home";
	}
	// check if blog
	else if (url1=="blog") {
		var channelName = url1;
		// check if post page
		if (url4=="") {
			var pageName = "post: "+url3;
		}
		// check if category
		else if (url4!="" && url5=="") {
			var pageName = "category: "+url4;
		}
		// check if sub-category
		else if (url5!="") {
			var pageName = "category: "+url5;
		}
	}
	else if (url2!="") {
		var channelName = url1;
		var pageName = url2;
	}

