// JavaScript Document
function openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
  return false;
}

function openWindow_NOIE_large(theURL,winName,features,width,height) {
  if (((width + 12) > screen.width) || ((height + 30) > screen.height)) {
  	if ((width + 12) > screen.width) {
  		height = height + 15;
  		width = screen.width - 12; }
  	if ((height + 30) > screen.height) {
  		width = width + 15;
  		height = screen.height - 50; }
  	features = features+"scrollbars=yes,resizable=yes,width="+width+",height="+height;
  	window.open(theURL,winName,features);
  	return false; }
  else {
  	features = features+"scrollbars=no,resizable=no,width="+width+",height="+height;
  	window.open(theURL,winName,features);
  	return false; }
}

function openWindow_IE_large(theURL,winName,features,width,height) {
  if (((width + 12) > screen.width) || ((height + 30) > screen.height)) {
  	if ((width + 12) > screen.width) {
  		height = height + 17;
  		width = screen.width - 12; }
  	if ((height + 30) > screen.height) {
  		width = width + 17;
  		height = screen.height - 50; }
  	features = features+"scrollbars=yes,resizable=yes,width="+width+",height="+height;
  	window.open(theURL,winName,features);
  	return false; }
  else {
  	features = features+"scrollbars=no,resizable=no,width="+width+",height="+height;
  	window.open(theURL,winName,features);
  	return false; }
}

function JS_jump(my_select){
	eval('location='+'\''+my_select.options[my_select.selectedIndex].value+'\'');
}

function addsmiley(smiley) {
	document.add_comment.comment.value += " "+smiley+" ";
	document.add_comment.comment.focus();
	return;	
}

function addstyle(style) {
	if (style == 'bold') {
		var mytext = prompt("Enter the text you wish to display as bold", "");
		if ((mytext == "") || (mytext == null)) { return; }
		document.add_comment.comment.value += " <strong>"+mytext+"<\/strong> ";
		document.add_comment.comment.focus();
		return;
	}

	if (style == 'italic') {
		var mytext = prompt("Enter the text you wish to display as italic", "");
		if ((mytext == "") || (mytext == null)) { return; }
		document.add_comment.comment.value += " <em>"+mytext+"<\/em> ";
		document.add_comment.comment.focus();
		return;
	}

	if (style == 'underline') {
		var mytext = prompt("Enter the text you wish to display as underline", "");
		if ((mytext == "") || (mytext == null)) { return; }
		document.add_comment.comment.value += " <u>"+mytext+"<\/u> ";
		document.add_comment.comment.focus();
		return;
	}

	if (style == 'break') {
		document.add_comment.comment.value += " <br \/>";
		document.add_comment.comment.focus();
		return;
	}
}

var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function enlarge(which, e, position, imgwidth, imgheight, addhtml){
if (ie||ns6){
	crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
	if (position=="center"){
		pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
		horzpos=ie? ietruebody().scrollLeft+ietruebody().clientWidth/2-imgwidth/2 : pageXOffset+window.innerWidth/2-imgwidth/2
		vertpos=ie? pgyoffset+ietruebody().clientHeight/2-imgheight/2 : pgyoffset+window.innerHeight/2-imgheight/2
		if (window.opera && window.innerHeight) //compensate for Opera toolbar
		vertpos=pgyoffset+window.innerHeight/2-imgheight/2
		vertpos=Math.max(pgyoffset, vertpos)
	}
	else{
		var horzpos=ie? ietruebody().scrollLeft+event.clientX : pageXOffset+e.clientX
		var vertpos=ie? ietruebody().scrollTop+event.clientY : pageYOffset+e.clientY
	}
	crossobj.style.left=horzpos+"px"
	crossobj.style.top=vertpos+"px"

	crossobj.innerHTML='<div align="right" id="dragbar" style="width:' + (imgwidth - 2) + 'px;"><span id="closetext" onClick="closepreview()">Close</span> </div><img src="'+which+'">'
	crossobj.style.visibility="visible"
//	enlargeShowSelects();
	return false
	}
else //if NOT IE 4+ or NS 6+, simply display image in full browser window
	return true
}

function closepreview(){
crossobj.style.visibility="hidden"
//enlargeHideSelects();
}

function drag_drop(e){
if (ie&&dragapproved){
	crossobj.style.left=tempx+event.clientX-offsetx+"px"
	crossobj.style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
	crossobj.style.left=tempx+e.clientX-offsetx+"px"
	crossobj.style.top=tempy+e.clientY-offsety+"px"
}
return false
}

function initializedrag(e){
if (ie&&event.srcElement.id=="dragbar"||ns6&&e.target.id=="dragbar"){
	offsetx=ie? event.clientX : e.clientX
	offsety=ie? event.clientY : e.clientY

	tempx=parseInt(crossobj.style.left)
	tempy=parseInt(crossobj.style.top)

	dragapproved=true
	document.onmousemove=drag_drop
}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")
