      
      
// this function is needed to work around 
// a bug in IE related to element attributes
function hasClass(obj) {
    var result = false;
    if (obj.getAttributeNode("class") != null) {
        result = obj.getAttributeNode("class").value;
    }
    return result;
}


function createBookmark(){
document.write('<a class="bm" href="javascript:addToFavorites()">bookmark page</a>');
}

function createPrintLink(){
document.write('<a class="pr" href="javascript:window.print()">print page</a>');
}

function createEmailLink(){
document.write('<a href="javascript:window.emailPage(document.title)">email page</a>');
}

function emailPage(docTitle){
	location.href = 'mailto:?subject=Please Visit \'' + docTitle + '\', at ' + location.href + '&body=' + location.href;
}


/* colors tables in a striped fashion */
function stripe() {
	var even = false;

	var evenColor = arguments[1] ? arguments[1] : "#FEFAF0";
	var oddColor = arguments[2] ? arguments[2] : "#ffffff";

	var table = document.getElementsByTagName("table");
	if (! table) { return; }

	for(var g=0; g<table.length; g++){  //for all tables
   		var tbodies = table[g].getElementsByTagName("tbody"); //get child tags
		for (var h = 0; h < tbodies.length; h++) {
			var trs = tbodies[h].getElementsByTagName("tr");
			for (var i = 0; i < trs.length; i++) {
        		// avoid rows that have a class attribute
        		// or backgroundColor style
        		if (! hasClass(trs[i]) && ! trs[i].style.backgroundColor) {  // get all the cells in this row...
      	    		var tds = trs[i].getElementsByTagName("td");
        	  		for (var j = 0; j < tds.length; j++) {         // and iterate through them...
            			var mytd = tds[j];
            			// avoid cells that have a class attribute
           		 		// or backgroundColor style
            			if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
              				mytd.style.backgroundColor =
                			even ? evenColor : oddColor;
            			}
          			}
        		}
        		// flip from odd to even, or vice-versa
        		even =  ! even;
      		}
		}
	}
}

function clearItemFull(obj){

	obj.value = "";
}

function clearItem(obj, val){

	if(obj.value == val)
		obj.value = "";

}

function externalLinks() {
	$("a[rel=external]").attr("target","_blank").each(function(){
		var title = $(this).attr("title");
		if(title == null || title.length==0)
			title = "Opens in a new window";
		else
			title += " (opens in a new window)";
		$(this).attr("title",title);
	});
}
	
$().ready(init);

function init()
{
	externalLinks();
}

