var show_payonline;
var payrequired;
payrequired=0;

function popup(url,width,height){
	show_popup=window.open(url,'','width='+width+',height='+height+',left='+eval((window.screen.width/2)-(width/2))+',top='+eval((window.screen.height/2)-(height/2))+',toolbar=no,menubar=no,resizable=no,status=no,alwaysRaised=yes,scrollbars=yes');
	show_popup.focus();
}

function popupmeeting(url,width,height){
	show_popup=window.open(url,'meeting','width='+width+',height='+height+',screenX=1,screenY=1,menubar=no,alwaysRaised=yes,dependent=yes,status=no,resizable=no,toolbar=no,scrollbars=yes');
	show_popup.focus();
}

function openSmWindow(theURL,winName,features){
	window.open(theURL,winName,features);
}

function frmsubmit(frmName){
	if (document.getElementById(frmName)) {
		document.forms[frmName].submit();
	}
}

function frmreset(frmName){
	if (document.getElementById(frmName)) {
		document.forms[frmName].reset();
	}
}

function setFieldValue(frmName, fldName, sValue){
	if (document.getElementById(frmName) && document.getElementById(fldName)) {
		document.forms[frmName][fldName].value = sValue;
	}
}

function setGroups(setEmpty){
	if (document.frm_contacts.srchpar4){
		if (document.frm_contacts.srchpar3.value!=''){
			if (setEmpty){
				document.frm_contacts.srchpar4.selectedIndex=0;
			}
			document.frm_contacts.srchpar4.disabled = false;
		}else{
			document.frm_contacts.srchpar4.selectedIndex=0;
			document.frm_contacts.srchpar4.disabled = true;
		}
	}
}

function setSrchPar1(){
	if (document.frm_contacts.srchpar1.value!=''){
		document.frm_contacts.srchtxt1.disabled = false;
	}else{
		document.frm_contacts.srchtxt1.value = '';
		document.frm_contacts.srchtxt1.disabled = true;
	}
}
function setSrchPar2(){
	if (document.frm_contacts.srchpar2.value!=''){
		document.frm_contacts.srchtxt2.disabled = false;
	}else{
		document.frm_contacts.srchtxt2.value = '';
		document.frm_contacts.srchtxt2.disabled = true;
	}
}

function setAllCheckboxes(frmName, fldName, bChecked){
	for (i=0;i<document.forms[frmName].length; i++)	{
		if (document.forms[frmName].elements[i].type == 'checkbox' && document.forms[frmName].elements[i].name == fldName)	{
			if (bChecked) {
				document.forms[frmName].elements[i].checked = true;
			}else{
				document.forms[frmName].elements[i].checked = false;
			}
		}
	}
}

function BeforeSubmit(){
	if (document.frm_mailing.selectedgroups){
		SaveSelectedItems('RM', document.frm_mailing.selectedgroups, document.frm_mailing.savedgroups);
	}
	if (document.frm_mailing.selectedissues){
		SaveSelectedItems('RM', document.frm_mailing.selectedissues, document.frm_mailing.savedissues);
	}
}

function ShowMonth(iMonth, iYear){
	var form = document.getElementById("formsel");
	form.selmonth.value = iMonth;
	form.selyear.value = iYear;
	form.submit();
}

function Show3Month(iMonth, iYear){
	var form = document.getElementById("formsel");
	form.sel3month.value = iMonth;
	form.sel3year.value = iYear;
	form.submit();
}

function ShowDay(url){
	document.location = url;
}

function ShowMonthFromDayview(url){
	document.location = url;
}

function GetRadioValue(formname, elname){
	var el = eval('document.' + formname + '.' + elname);
	for (var i=0; i<el.length; i++){
		if (el[i].checked){
			return el[i].value;
		}
	}
	return '';
}
function payonline(customer, meeting, contact){
	show_payonline=window.open('/meetingogone.asp?cust='+customer+'&meeting='+meeting+'&contact='+contact,'payonline','width=700,height=600,top=50,left=50,menubar=no,alwaysRaised=yes,dependent=yes,status=no,resizable=no,toolbar=no,scrollbars=yes');
	show_payonline.focus();
	checkWindow();
}
function checkWindow()
  {
    if(!show_payonline.closed){
      setTimeout("checkWindow()", 500);
    }
    else
    {
      window.document.frm_registermeeting.action.value='PAYCHECK';
      window.document.frm_registermeeting.submit();
    }
  }
function setPayNotRequired(nVal)
{
	payrequired=payrequired+nVal;	
}