﻿function submitForm(input)
{
 var f = getForm(input.form.method, input.form.action); 
f.target ="_blank";
f.name = "ccoptin";
 for (var e in input.data)
 {
 f.appendChild(getHiddenField(e,input.data[e]));
 }
 f.appendChild(getInput());
 // attach form to page dom (after the main form because forms cannot be nested).
 document.getElementById("Body").appendChild(f);
 // call submit() on the form
 f.submit();
}

function getForm(method, action)
{
 var f = document.createElement('form');
 f.setAttribute('method', method);
 f.setAttribute('action', action);
 return f;
}

function getHiddenField(key, value)
{
 var i = document.createElement('input');
 i.setAttribute('type', 'hidden');
 i.setAttribute('name', key);
 i.setAttribute('value', value);
 return i;
}

function getInput()
{
	var ea = document.createElement('input');
	var x = document.getElementById('ea');
	ea.setAttribute('type', 'input');
	ea.setAttribute('name', 'ea');
	ea.setAttribute('value', x.value);
	return ea;
}

