 function doEmailTagInsert(tagValue, target)
 { 
	var TagValue = document.getElementById(tagValue);
	for( var i=0; i < TagValue.options.length; i++ ){
		if (TagValue.options[i].selected){
			if (document.getElementById(target).value == ""){
				document.getElementById(target).value += "["+TagValue.options[i].value+"]";
			} else {
				document.getElementById(target).value += ",["+TagValue.options[i].value+"]";
			}
		}
	}
} 

function clickButton(e, buttonid)
{ 
	var bt = document.getElementById(buttonid); 
	if (typeof bt == 'object')
	{ 
		if(navigator.appName.indexOf("Netscape")>(-1))
		{ 
			if (e.keyCode == 13)
			{ 
				bt.click(); return false; 
			} 
		} 
		if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
		{ 
			if (event.keyCode == 13)
			{ bt.click(); return false; } 
		} 
	}
} 

 function doTagInsert(tagValue, target)
 { 
	var TagValue = document.getElementById(tagValue);
	for( var i=0; i < TagValue.options.length; i++ ){
		if (TagValue.options[i].selected){
				document.getElementById(target).value += " ["+TagValue.options[i].value+"] ";
		}
	}
} 

function confirm_Archive()
{
if (confirm("Are you sure you want to Archive this campaign?\n\nDoing so will prevent users from taking your survey,\nand you will NOT have any way to reactivate it. However,\nyour reporting will still be available.")==true)
	return true;
else
	return false;
}

function confirm_MassiveDelete()
{
if (confirm("Are you sure you want to delete this campaign?\n\nDoing so will DELETE ALL of the data below it, including \nall of the lists, surveys, questions, and survey\nresponses.\n\nNo reports will be available for this campaign and\nyou will NOT be able to recover any of this data after\nyou delete it.\n\nClick 'OK' to continue.")==true)
	return true;
else
	return false;
}

function confirm_delete()
{
if (confirm("Are you sure you want to delete this item?")==true)
	return true;
else
	return false;
}

function confirm_ControlDelete()
{
if (confirm("Are you sure you want to delete this control?\n\nAll instances of this control on any pages throughout the website will be permanently deleted.")==true)
	return true;
else
	return false;
}

function confirm_LinkItemFolderDelete()
{
if (confirm("Are you sure you want to delete this folder?\n\nAll folders and files within it will be permanently deleted.")==true)
	return true;
else
	return false;
}

function confirm_sendnewsletter()
{
if (confirm("Are you sure you want to send this newsletter/bulletin?")==true)
	return true;
else
	return false;
}

function confirm_archiveitem()
{
if (confirm("Are you sure you want to archive this item?")==true)
	return true;
else
	return false;
}


function confirm_deactivate()
{
if (confirm("Are you sure you want to deactivate this item?")==true)
	return true;
else
	return false;
}

function confirm_deleteJobOpeningType()
{
if (confirm("Are you sure you want to delete this item?\nBy removing this item, you will be removing all\njob openings assigned to this type.")==true)
	return true;
else
	return false;
}

function textCounter(field, maxlimit) {
	if (field.value.length > maxlimit){
		field.value = field.value.substring(0, maxlimit);
	}else{
		document.getElementById(field.id+"_maxChar").value = maxlimit - field.value.length;
	}
} 

function OpenWin( location )
{

  var ieDHTML = document.all !=null;
  var nsDHTML = document.layers;

  if (ieDHTML) {
    var xWidth = document.body.clientWidth;
    var yHeight = document.body.clientHeight;
  }
  if (nsDHTML) {
    var xWidth = window.innerWidth;
    var yHeight = window.innerHeight;
  }

  if (xWidth >= 1000) {
    xWidth = 800;
  } else if (xWidth >= 800) {
    xWidth = 750;
  } else {
    xWidth = 650;
  }

  if (yHeight >= 1000) {
    yHeight = 900;
  } else if (yHeight >= 750) {
    yHeight = 700;
  } else {
    yHeight = 600;
  }
  if (window.name == "popup") {
    if (ieDHTML) {
      window.open(location, "newPopup",
        "width=" + xWidth +",height=" + yHeight +",toolbar=no,status=no,menubar=no,top=60,left=135,scrollbars=yes,resizable=yes");
    } else {
      window.open(location, 'newPopup',
        'menubar=yes,scrollbars=yes,toolbar=yes,status=yes,width=' + xWidth + ',height=' + yHeight +',top=60,left=135');
    }
  } else {
    if (ieDHTML) {
      window.open(location, "popup",
        "width=" + xWidth +",height=" + yHeight +",toolbar=no,status=no,menubar=no,top=45,left=120,scrollbars=yes,resizable=yes");

    } else {
      window.open(location, 'popup',
        'width=' + xWidth + ',height=' + yHeight +',menubar=no,toolbar=no,scrollbars=no,status=no,top=45,left=120');
    }
  }
}
<!-- Used by the SetDefaultButton Function -->
function fnTrapKD(btn, event)
{
	if (document.all){
		if (event.keyCode == 13){
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
	else if (document.getElementById){
		if (event.which == 13){
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
	else if(document.layers){
		if(event.which == 13){
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
}

function SetUniqueRadioButton(nameregex, current)
{
   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
}
    
function toggleDisplay(me)
{
    if (me.style.display=="none"){
	    me.style.display="block";
    }
    else {
	    me.style.display="none";
    }
}
   
// This function sets Background color on mouse over.
var HoldRowColor;   
function setMouseOverColor(element, passedcolor) {
	HoldRowColor = element.style.backgroundColor;
    element.style.backgroundColor=passedcolor;
}

function setMouseOutColor(element) {
	element.style.backgroundColor= HoldRowColor;

}
//-------------------------------------------------------------------    

//Function to Show/Hide layer based on the style of the layer
function showHideLayers(LayerName, imageOpen, imageClose) {
    var myLayer = document.getElementById(LayerName);
    var imageOpen = document.getElementById(imageOpen);    
    var imageClose = document.getElementById(imageClose);
       
    if (myLayer.style.display == "none"){
        myLayer.style.display = "inline";
        imageOpen.style.display = "none";
        imageClose.style.display = "inline";
    }
    else {
        myLayer.style.display = "none";
        imageOpen.style.display = "inline";
        imageClose.style.display = "none";
    }
}
