function SubmitForm()
{
	document.forms[0].submit();
}

function DoPostBack(Arg)
{
	document.forms[0].Arg.value = Arg;
	document.forms[0].submit();
}

function selected(cal, date) 
{
  cal.sel.value = date; // just update the date in the input field.
  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
    cal.callCloseHandler();
}
function closeHandler(cal) 
{
  cal.hide();
  _dynarch_popupCalendar = null;
}

function showCalendar(id,bt) 
{
	if (document.all)
		var el = document.all[id];
	else
		var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    _dynarch_popupCalendar.hide();
  } else {
    var cal = new Calendar(1, null, selected, closeHandler);
    cal.weekNumbers = false;
    cal.showsOtherMonths = true;
    _dynarch_popupCalendar = cal;
    cal.setRange(2004, 2070);
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat('%m/%d/%Y');
  _dynarch_popupCalendar.parseDate(el.value);
  _dynarch_popupCalendar.sel = el;
  _dynarch_popupCalendar.showAtElement(bt,"Br");
  return false;
}

function DeleteActivityReport(DataID)
{
	if ( window.confirm('Do you really want to delete the Activity Report?') == true ) 
	{
		document.frmActivityReport.operation.value = "delete";
		document.frmActivityReport.DataID.value = DataID;
		document.frmActivityReport.submit();
		return true;
	}
	return false;
}


function DeleteLeadSheet(DataID)
{
	if ( window.confirm('Do you really want to delete the Lead Sheet?') == true ) 
	{
		document.frmLeadSheetReport.operation.value = "delete";
		document.frmLeadSheetReport.DataID.value = DataID;
		document.frmLeadSheetReport.submit();
		return true;
	}
	return false;
}

function DeleteResearchData(DataID)
{
	if ( window.confirm('Do you really want to delete the Research Data?') == true ) 
	{
		document.frmResearchData.operation.value = "delete";
		document.frmResearchData.DataID.value = DataID;
		document.frmResearchData.submit();
		return true;
	}
	return false;
}

function DeleteRecurringCharge(recid)
{
	if ( window.confirm('Do you really want to delete the Recurring Charge?') == true ) 
	{
		document.frmRecList.operation.value = "delete";
		document.frmRecList.recid.value = recid;
		document.frmRecList.submit();
		return true;
	}
	return false;	
}

function LaunchSearch()
{
	objWin1 = window.open("LinkedActivityReport.asp","winName","scrollbars=yes,resizable=no,width=500,height=400");
	objWin1.focus();
}

function DisplayInvoice(InvoiceID)
{
	objWin1 = window.open("DisplayInvoice.asp?InvoiceID="+InvoiceID ,"winName","scrollbars=yes,resizable=no,width=575,height=400");
	objWin1.focus();
}

function DisplayConfirm()
{
	objWin1 = window.open("DisplayInvoice.asp" ,"winName","scrollbars=yes,resizable=no,width=575,height=400");
	objWin1.focus();
}

function DisplaySubscription()
{
	objWin1 = window.open("DisplayInvoice.asp?InvoiceID=subscription" ,"winName","scrollbars=yes,resizable=no,width=575,height=400");
	objWin1.focus();
}


function ExportExcelSheet(datatype)
{
	objWin1 = window.open("ExportExcel.asp?datatype="+datatype ,"winName","scrollbars=yes,resizable=yes,width=500,height=400");
	objWin1.focus();
}

function ExportWord(datatype)
{
	objWin1 = window.open("ExportWord.asp?datatype="+datatype ,"winName","scrollbars=yes,resizable=yes,width=500,height=400");
	objWin1.focus();
}

function ViewData(datatype)
{
	objWin1 = window.open("ViewData.asp?datatype="+datatype ,"winName","scrollbars=yes,resizable=yes,width=500,height=400");
	objWin1.focus();
}

function ExportSubscriber()
{
	objWin1 = window.open("ExportSubscriber.asp" ,"winName","scrollbars=yes,resizable=yes,width=500,height=400");
	objWin1.focus();
}


function SelectActivityReport()
{
	var strdata;
	
	if ( document.frmActivityReport.rdoDataID != null )
	{
		if ( document.frmActivityReport.rdoDataID.length > 1 )
		{
			for (i=0;i<document.frmActivityReport.rdoDataID.length;i++)
			{
				if ( document.frmActivityReport.rdoDataID[i].checked )
				{					
					strdata = document.frmActivityReport.rdoDataID[i].value;
					window.opener.document.frmActivityReport.LinkedTo.value = strdata.substring(0,strdata.indexOf(","));
					window.close();
					return true;
				}
			}
		}
		else
		{
			if ( document.frmLinkedto.rdoDataID.checked )
			{
				window.opener.document.frmActivityReport.LinkedTo.value = document.frmActivityReport.rdoDataID.value;
				window.close();
				return true;
			}
		}
	}
	alert( 'Please select an entry from the list.\n\nTo search for another company, contact, address or city and click the Search button.' );
	return false;
}


function SelectAll(checkboxname,sourcecheckbox)
{
	
	var Ctrlcheckbox 				=	eval("document.frmSubscriber."+checkboxname);
	var Ctrlsourcecheckbox	= eval("document.frmSubscriber."+sourcecheckbox);
		
	if ( Ctrlcheckbox != null )
	{
		if ( Ctrlcheckbox.length > 1 )
		{
			for (i=0;i<Ctrlcheckbox.length;i++)
			{
				Ctrlcheckbox[i].checked = Ctrlsourcecheckbox.checked;
			}
		}
		else
		{
			Ctrlcheckbox.checked = Ctrlsourcecheckbox.checked;
		}
	}
	return true;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
