
//Sets object based on browser, then hides or shows it depending on current state
function toggleLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var obj = document.getElementById(whichLayer).style;
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var obj = document.all[whichLayer].style;
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var obj = document.layers[whichLayer].style;
	}

	if(obj.display == "block"){
		hideLayer(whichLayer);
	}
	else
	{
		showLayer(whichLayer);
	}
}

//Sets object based on browser, then hides it
function hideLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var obj = document.getElementById(whichLayer).style;
		obj.display = "none";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var obj = document.all[whichLayer].style;
		obj.display = "none";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var obj = document.layers[whichLayer].style;
		obj.display = "none";
	}
}

//Sets object based on browser, then shows it
function showLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var obj = document.getElementById(whichLayer).style;
		obj.display = "block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var obj = document.all[whichLayer].style;
		obj.display = "block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var obj = document.layers[whichLayer].style;
		obj.display = "block";
	}
}



function makepopup(wd,ht,myURL){
	var barinfo = 'toolbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no,location=no';
	var myDimensions = 'width='+wd+',height='+ht;
	var LeftPosition = (screen.width) ? (screen.width-wd)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-ht)/2 : 0;
	var myFeatures = barinfo + ',' + myDimensions + ',left=' + LeftPosition + ',top=' + TopPosition;
	var newWin = open(myURL,'myDoc',myFeatures);
	newWin.focus();
}


function insertAtCursor(myField,myValue) {
//			myField = document.reply.txtResponse;
	//IE support
	if (document.selection) {
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	}
	//MOZILLA/NETSCAPE support
	else if (myField.selectionStart || myField.selectionStart == '0') {
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;
		myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
	} else {
		myField.value += myValue;
	}
}

