function cfmDel(){
	return window.confirm('Are you sure you want to delete record.');
}
function cfmStatus(){
	return window.confirm('Are you sure you want to change status.');
}
function cfmContactStatus(){
	return window.confirm('Are you sure you want to change Contact status.');
}
var mychecked=false;
function checkedAll(checkall) {
	var frm = checkall.form;
	if( checkall.checked == true ){
		mychecked = true;
	}else{
		mychecked = false;
	}
	for (var i =0; (i < frm.elements.length) && (frm.elements[i].type == 'checkbox') ; i++) {
	 	frm.elements[i].checked = mychecked;
	}
}
function multiactionForm(multi){
	var frm = multi.form;
	var checked = 0;
	if( multi.selectedIndex != 0 ){
		for(i=0; frm.elements[i].type == 'checkbox';i++ ){
			if(frm.elements[i].checked == true){ checked++; break; }
		}
		if( checked == 0 ){
			alert('Please check atleast one record.');
			return false;
		}else {
			frm.submit();
		}
	}
}

function insertOptions(theSel, newText, newValue)
{
  alert();		
  if (theSel.length == 0) {
    var newOpt1 = new Option(newText, newValue);
    theSel.options[0] = newOpt1;
    theSel.selectedIndex = 0;
  } else if (theSel.selectedIndex != -1) {
    var selText = new Array();
    var selValues = new Array();
    var selIsSel = new Array();
    var newCount = -1;
    var newSelected = -1;
    var i;
    for(i=0; i<theSel.length; i++)
    {
      newCount++;
      if (newCount == theSel.selectedIndex) {
        selText[newCount] = newText;
        selValues[newCount] = newValue;
        selIsSel[newCount] = false;
        newCount++;
        newSelected = newCount;
      }
      selText[newCount] = theSel.options[i].text;
      selValues[newCount] = theSel.options[i].value;
      selIsSel[newCount] = theSel.options[i].selected;
    }
    for(i=0; i<=newCount; i++)
    {
      var newOpt = new Option(selText[i], selValues[i]);
      theSel.options[i] = newOpt;
      theSel.options[i].selected = selIsSel[i];
    }
  }
}

function removeOptions(theSel)
{
  var selIndex = theSel.selectedIndex;
  if (selIndex != -1) {
    for(i=theSel.length-1; i>=0; i--)
    {
      if(theSel.options[i].selected)
      {
        theSel.options[i] = null;
      }
    }
    if (theSel.length > 0) {
      theSel.selectedIndex = selIndex == 0 ? 0 : selIndex - 1;
    }
  }
}