function putTriggersInPlace()
{  
	 var physicalSet = document.getElementById('physicalSet')
	 var emailSet = document.getElementById('emailSet')
	 var radioEmail = document.getElementById('radioEmail');
	 var radioPhysical = document.getElementById('radioPhysical')
	 var physicalChildren = physicalSet.childNodes;
	 for(i = 0; i < physicalChildren.length; i++)
	 {
	 		if(physicalChildren[i].nodeType == 1) // if the child is an ELEMENT
				physicalChildren[i].onclick = function() {disableEnableChildFields(emailSet, physicalSet, radioPhysical);}
	 }
	 
	 var emailChildren = emailSet.childNodes;
	 for(i = 0; i < emailChildren.length; i++)
	 {
	 		if(emailChildren[i].nodeType == 1) // if the child is an ELEMENT
				emailChildren[i].onclick = function() {disableEnableChildFields(physicalSet, emailSet, radioEmail);}
	 }
	 
	 switchDisabledProperty(physicalSet, true);
	 switchDisabledProperty(emailSet, false);
	 
	 radioPhysical.onclick = function() {disableEnableChildFields(emailSet, physicalSet, radioPhysical);}
 	 radioEmail.onclick = function() {disableEnableChildFields(physicalSet, emailSet, radioEmail);}
}

function disableEnableChildFields(fieldSetDisable, fieldSetEnable, radioOn)
{
	 switchDisabledProperty(fieldSetDisable, true);
 	 switchDisabledProperty(fieldSetEnable, false);
	 
	 radioOn.checked = true;
}

function switchDisabledProperty(fieldSet, disableValue)
{
 	 var children = fieldSet.childNodes;
	 for(i = 0; i < children.length; i++)
	 {  
	 		if(children[i].nodeType == 1) // if the child is an ELEMENT
  		{	if(children[i].nodeName == "INPUT")
				{  if(disableValue == true)					 
					 {   children[i].style.backgroundColor="#BBBBBB";
					 		 children[i].style.color="#555555";
					 }else
					 {   children[i].style.backgroundColor="#FFFFFF";
					 		 children[i].style.color="#000000";
					 }	  
				}
			}
	 }
}

function submitForm()
{
 	 var physicalIndex = 0;
 	 if(document.mainform.submissionType[0].value=="physical")
	 {
	 	physicalIndex = 0;
	 }else
	 {
	 	physicalIndex = 1;
	 }
	 
   if(document.mainform.submissionType[physicalIndex].checked)
	 {
	    document.email.email.value = document.mainform.p_email.value;
			document.email.information.value = 
						"\nName: " + document.mainform.p_firstname.value + 
						" " + document.mainform.p_lastname.value + 
						"\nStudio Name: " + document.mainform.p_studioname.value + 
						"\nAddress: " + document.mainform.p_street.value +
						"\nCity: " + document.mainform.p_city.value +
						"\nState: " + document.mainform.p_state.value +
						"\nZip-Code: " + document.mainform.p_zip.value;
	 }else
	 {
	    document.email.email.value = document.mainform.e_email.value;
			document.email.information.value =
			      "\nName: " + document.mainform.e_firstname.value + 
						" " + document.mainform.e_lastname.value + 
						"\nStudio Name: " + document.mainform.e_studioname.value;
	 }
	 
	 var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(document.email.email.value) == false) {
      document.email.email.value="";
   }
	 
   document.email.submit();
}