/* Functions */
function ToggleElement(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none") 
   if (visible) {
	 obj.style.display="none";
   } else {
	  obj.style.display="block";
   }
}
function ToggleElementInline(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")  
   if (visible) {
	 obj.style.display="none";
   } else {
	  obj.style.display="inline";
   }
}
function ToggleElementVisibility(item) {
   obj=document.getElementById(item);
   visible=(obj.style.visibility!="hidden") 
   if (visible) {
	 obj.style.visibility="hidden";
   } else {
	  obj.style.visibility="visible";
   }
}
function Show(item) {
   obj=document.getElementById(item);
   obj.style.display="block";
}
function ShowInline(item) {
   obj=document.getElementById(item);
   obj.style.display="inline";
}
function Hide(item) {
   obj=document.getElementById(item);
   obj.style.display="none";
}

function confirm_deletion(which,id,page,label,vars){
	var input_box=confirm("Are you sure you want to delete this "+label+"?");
	if (input_box==true){
		if(vars)
		 	window.location = page+"&d"+which+"="+id;
		else
			window.location = page+"?d"+which+"="+id;
	} else {
		//do nothing
	}
}

function maskEmail(user,site,message){
	document.write('<a href=\"mailto:'+ user + '@' + site + '\">'); 
	document.write(message+'</a>');
}
function forceMaxLength(obj, maxlength){
	if (obj.value.length > maxlength)
		obj.value = obj.value.substring(0,maxlength)
}

function clearInput(obj){
	obj.value = "";
}
function checkInput(obj,value){
	if(obj.value == "")
		obj.value = value;
}

function get_radio_value(element){
for (var i=0; i < element.length; i++)
   {
   if (element[i].checked)
      {
      return element[i].value;
      }
   }
}