function formgrouplistclose() {
	document.getElementById("formgrouplistwrapper").style.display = 'none';
}
function showformgroups(formgroupid)
{
	// set url value
	var url="/macros/formgroups.php?act=showformgroups&formgroupid=" + formgroupid;
	
	url += '&pageid=' + document.getElementById("formlistpageid").value;
	
	document.getElementById("formgrouplistwrapper").style.display = 'block';
	document.getElementById("formgrouplist").innerHTML='<img src="/images/ajaxloadbluecircle.gif" width="32" height="32" border="0">';
	
	if (window.XMLHttpRequest)
	  {
	  xmlHttp=new window.XMLHttpRequest();
	  }
	else // for older IE 5/6
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	  
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	
	var windowhtml = '';
	windowhtml += xmlHttp.responseText;
	
	document.getElementById("formgrouplist").innerHTML=windowhtml;
}
function showformgroupslists(pageid)
{
	// set url value
	var url="/macros/formgroups.php?act=showformgroupslists&pageid=" + pageid;
	
	document.getElementById("formlistpageid").value = pageid;
	document.getElementById("formgrouplistwrapper").style.display = 'block';
	document.getElementById("formgrouplist").innerHTML='<img src="/images/ajaxloadbluecircle.gif" width="32" height="32" border="0">';
	
	if (window.XMLHttpRequest)
	  {
	  xmlHttp=new window.XMLHttpRequest();
	  }
	else // for older IE 5/6
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	  
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	
	var windowhtml = '';
	windowhtml += xmlHttp.responseText;
	
	document.getElementById("formgrouplist").innerHTML=windowhtml;
}
function heardaboutclose() {
	document.getElementById("heardaboutwrapper").style.display = 'none';
}
function showheardabout()
{
	
	document.getElementById("heardaboutwrapper").style.display = 'block';
	
}
function heardaboutsubs(subtype) {
	if(subtype == 'Radio') {
		document.getElementById('newspaperwrapper').style.display = 'none';
		document.getElementById('televisionwrapper').style.display = 'none';
		document.getElementById('radiowrapper').style.display = 'block';
		return false;
		
	} 
	if(subtype == 'Television') {
		document.getElementById('newspaperwrapper').style.display = 'none';
		document.getElementById('televisionwrapper').style.display = 'block';
		document.getElementById('radiowrapper').style.display = 'none';
		return false;
		
	} 
	if(subtype == 'Newspaper') {
		document.getElementById('newspaperwrapper').style.display = 'block';
		document.getElementById('televisionwrapper').style.display = 'none';
		document.getElementById('radiowrapper').style.display = 'none';
		return false;
		
	} 
	if(subtype == 'none') {
		document.getElementById('newspaperwrapper').style.display = 'none';
		document.getElementById('televisionwrapper').style.display = 'none';
		document.getElementById('radiowrapper').style.display = 'none';
		return false;
	} 
}

function optoutheardabout()
{

	heardaboutclose();
	
	var url="/macros/heardabout.php?act=heardabout&heardabout=optout";
	
	if (window.XMLHttpRequest)
	  {
	  xmlHttp=new window.XMLHttpRequest();
	  }
	else // for older IE 5/6
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	  
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	
}

function submitheardabout()
{
	// set url value
	var url="/macros/heardabout.php?act=heardabout";
	var heardabout = null;
	
	var heardaboutarr = document.heardaboutform.heardabout;
	
	for (i=0; i<heardaboutarr.length; i++) {

	  if (heardaboutarr[i].checked == true) {
	  	var heardabout = heardaboutarr[i].value
	  	url += "&heardabout="+heardabout;
	  }
	
	}
	
	if(heardabout == null) {
		alert('Please select where you heard about us.');
		return false;
	}
	
		
	/* get type pulldown object */
	var selObjIDName = heardabout;
	var selObj = document.getElementById(selObjIDName);
	
	if ( selObj != null ) {

		/* get type pulldown selected index */
		var selectindexvalue = selObj.selectedIndex;
		
		/* get type pulldown selected value */
		var selectvalue = selObj.options[selObj.selectedIndex].value;
		
		if(selectvalue != '') {
			url += "&"+heardabout+"="+selectvalue;
		}
	
	}
	
	
	document.getElementById("heardabout").innerHTML='<img src="/images/ajaxloadbluecircle.gif" width="32" height="32" border="0">';
	
	if (window.XMLHttpRequest)
	  {
	  xmlHttp=new window.XMLHttpRequest();
	  }
	else // for older IE 5/6
	  {
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	  
	xmlHttp.open("GET",url,false);
	xmlHttp.send(null);
	
	var windowhtml = '<!-- <div id="formgrouplistclose"><a href="javascript:heardaboutclose()">Close</a></div> -->';
	windowhtml += xmlHttp.responseText
	
	document.getElementById("heardabout").innerHTML=windowhtml;
	
}
