function if_enter_ltg_redirect() {
	if (event.keyCode == 13) {
		ltg_redirect();
	}
}

function checkEnter(e){
	var characterCode
	if(e && e.which){
		e = e
		characterCode = e.which
	}
	else{
		e = event
		characterCode = e.keyCode
	}
	if(characterCode == 13){
		return true
	}
	else{
		return false
	}
}

function ltg_redirect_index (e, url) {
	
	var code;
	if (!e) var e = window.event;
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	// var character = String.fromCharCode(code);
	// alert('Character was ' + code + " url is: " + url);
	
	if(code == 13) {
	  var browser_type = navigator.appName;
	  var browser_version = parseInt(navigator.appVersion);
	  var recno = document.workorder.recno.value;
	  var form_url = url + recno;
	
		//alert('Character was ' + code + " url is: " + form_url);

	  //if NS 4+
	  if (browser_type == "Netscape" && browser_version >= 4) {
	      window.location.replace(form_url);
	  //if IE 4+
	  } else if (browser_type == "Microsoft Internet Explorer" && browser_version >= 4) {
	      window.location.replace(form_url);
	  //Default goto page (NOT NS 4+ and NOT IE 4+)
	  } else {
	      window.location=form_url;
	  }
	}
}

function confirm_delete(url) {
	var yn = window.confirm("Delete this record?");
	if(yn) {
		window.location=url;
	}
}

function confirm_delete_msg(url, msg) {
	var yn = window.confirm(msg);

	if(yn) {
		window.location=url;
	}
	
	return false;
}

function confirm_msg_delete(url) {
	var yn = window.confirm("Clear messages?");
	if(yn) {
		window.location=url;
	}
}

function confirm_delete_item(description, url) {
  var yn = window.confirm(description + "?");
                                                                                
  // window.alert(url);
                                                                                
  if(yn) {
    window.location=url;
  }
                                                                                
}

function popit(url) {
	window.open(url,'','width=335,height=215,left=50,top=50,scrollbars=yes')
}

function popitsize(url, hsize, vsize) {
	size = 'width=' + hsize + ',' + 'height=' + vsize;
	features = ',left=50,top=50,scrollbars=yes,resizable=yes';
	features = size + features;
	window.open(url,'',features);
	return false;
}

/*
	tableruler()
	written by Chris Heilmann for alistapart.
	enables a rollover of rows for each table with the classname "hlrows"
*/

function tableruler() {
	if (document.getElementById && document.createTextNode) {
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++) {
			if(tables[i].className=='ruler') {
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++) {
					if(trs[j].parentNode.nodeName=='TBODY') {
						trs[j].onmouseover=function(){this.className='ruled';return false}
						trs[j].onmouseout=function(){this.className='';return false}
					}
				}
			}
		}
	}
}

	//
	// Javascript function to display / remove the secondary query table
	// and toggle the +/- sign...
	//
	function expand_row(row_id, the_plus) {
		// window.alert(row_id);
		row_id = 'row:' + row_id;
		my_browser = navigator.appName;

		if(my_browser == "Netscape") {
			my_display = "table-row";
		} else if(my_browser == "Microsoft Internet Explorer") {
			my_display = "block";
		}

		if(document.getElementById) {
			the_row = document.getElementById(row_id);
		} else {
			the_row = document.all.row_id;
		}
		
		// window.alert(the_plus.innerHTML);
		

		// current_class = the_row.getAttribute("class");
		current_display = the_row.style.display;

		if(current_display == my_display) {
			// window.alert(row_id);
			// the_row.setAttribute("class", "collapsed");
			the_row.style.display = "none";
			the_plus.innerHTML = "<h3>+</h3>";
		} else {
			// window.alert(row_id);
			// the_row.setAttribute("class", "expanded");
			// the_row.style.display = "block";
			the_row.style.display = my_display;
			// the_plus.text = "-";
			the_plus.innerHTML = "<h3>-</h3>";
		}

	}

// stuffContent("myscript.php", "field=1&field1=3", "#mydiv");
function stuffContent(url, data, container){
	$.ajax({
		method: "get",url: url,data: data,
		success: function(html){
			$(container).html(html);
		}
	});
}



