// JavaScript Document


function unhide(divID) {
  var item = document.getElementById(divID);
  if (item) {
    item.className=(item.className=='hidden')?'unhidden':'hidden';
  }
}



function toggleSet(rad) 
{ 
  var type = rad.value; 
  for(var k=0,elm;elm=rad.form.elements[k];k++) 
    if(elm.className=='item') 
      elm.style.display = elm.id==type? 'inline':''; 
} 


function updateCustomPrice()
{
    var elTotal = document.getElementById('totalcost');
	var elTotal2 = document.getElementById('totalcost2');
    var custom_users = document.getElementById('custom_users');
	var custom_price1 = document.getElementById('custom_price1');
	var custom_price2 = document.getElementById('custom_price2');
    var elSelect = document.getElementById('nUsers');
    var nCost = 0;
    if (elSelect && elSelect.options) {
		nUsers = elSelect.options[elSelect.selectedIndex].getAttribute("users");
        nCost = elSelect.options[elSelect.selectedIndex].getAttribute("price1");
		nCost2 = elSelect.options[elSelect.selectedIndex].getAttribute("price2");
	}
    elTotal.innerHTML = '$' + nCost + '/month';
	elTotal2.innerHTML = '$' + nCost2 + '/year';
	custom_users.value = nUsers;
	custom_price1.value = nCost;
	custom_price2.value = nCost2;
}


function confirmAction()
{
    return confirm("Are you sure you want to perform this action on the selected items?");
}

function confirmDelete()
{
    return confirm("Are you sure you want to delete this category? ANY GOALS AND PROJECTS within it will be DELETED TOO.");
}
function confirmDelGoal()
{
    return confirm("Are you sure you want to delete the selected goals? ANY PROJECTS AND TASKS within will be DELETED TOO.");
}
function confirmDelProj()
{
    return confirm("This will DELETE the PROJECT and all its TASKS and FILES. Are you sure?");
}
function confirmDelFile()
{
    return confirm("Delete file?");
}
function confirmDelTask()
{
    return confirm("Are you sure you want to delete the selected tasks?");
}
function confirmDelContext()
{
    return confirm("The associated tasks will be set to (No context)");
}
function confirmDelChecklist()
{
    return confirm("Are you sure you want to delete this checklist?");
}
function confirmDelSchedule()
{
    return confirm("Are you sure you want to delete the selected schedules?");
}
function confirmDelEntry()
{
    return confirm("Are you sure you want to delete the selected entries?");
}
function confirmDelBlock()
{
    return confirm("Are you sure you want to delete this activity?");
}
function confirmDelContact()
{
    return confirm("Are you sure? You will stop sharing any Projects or Contexts with this contact.");
}
function confirmStopcontext()
{
    return confirm("Are you sure? You will stop sharing the Context with this contact.");
}
function confirmStopproject()
{
    return confirm("Are you sure? You will stop sharing the Project with this contact.");
}
function confirmDelMailbox()
{
    return confirm("Delete this mailbox?");
}
function confirmDelFilter()
{
    return confirm("Delete this filter?");
}