/**
 * FormAction.js
 *
 * Action for the CD Registration Form (online & print)
 *
 */
var print_win;

function displayRegistrationForm()
{
	var prename = window.document.getElementById('prename_input');
	var surname = window.document.getElementById('surname_input');
	var street  = window.document.getElementById('street_input');
	var no      = window.document.getElementById('no_input');
	var zip     = window.document.getElementById('zip_input');
	var loc		= window.document.getElementById('loc_input');
	var email   = window.document.getElementById('email_input');
	var country = window.document.getElementById('country_input');
	var phone   = window.document.getElementById('phone_input');
	var fax     = window.document.getElementById('fax_input');
	var mobile  = window.document.getElementById('mobile_input');

	print_win = window.open('','_blank');
	var print_doc = print_win.document;
	var doc = '<html><head><title><\/title>';
	if (navigator.appName.indexOf('Internet Explorer') > -1 || navigator.appName.indexOf('Safari') > -1) {
		doc += '<link rel="stylesheet" type="text\/css" href="..\/css\/print.css" media="print">';
		doc += '<link rel="stylesheet" type="text\/css" href="..\/css\/screenform.css" media="screen">';	
	} else {
		doc += '<link rel="stylesheet" type="text\/css" href=".\/css\/print.css" media="print">';
		doc += '<link rel="stylesheet" type="text\/css" href=".\/css\/screenform.css" media="screen">';
	}
	doc += '<meta http-equiv="Content-Type" content="text\/html; charset=utf-8">';
	doc += '<\/head><body>';
	doc += '<address id="toAddress" class="toAddress">[j]karef GmbH<br\/>Helmholzstr. 2-9<br\/>10 587 Berlin<br\/>Germany<\/address>';
	doc += '<address id="fromAddress" class="fromAddress">';
	doc += prename.value + ' ' + surname.value + '<br\/>';
	doc += street.value  + ' ' + no.value + '<br\/>';
	doc += zip.value     + ' ' + loc.value + '<br\/>';
	doc += country.value;	
	doc += '<\/address>';
	doc += '<div class="content_area"><p id="subject" class="print_subject">Registration to the EnigmaSpace<\/p><p id="content" class="print_content">';
	doc += '<div id="prename" class="addr_record"> Prename / Surname: ' + prename.value + ' ' + surname.value + '<\//div><div id="street" class="addr_record">Street / No. ' + street.value + ' ' + no.value + '<\//div><div id="zip" class="addr_record">Zip / Location: ' + zip.value + ' ' + loc.value + '<\//div><div id="country" class="addr_record">Country: ' + country.value + '<\/div><div id="email" class="addr_record">EMail: ' + email.value + '<\/div><div id="phone" class="addr_record">Phone: ' + phone.value + '</div><div  id="fax" class="addr_record">Fax: ' + fax.value + '<\/div><div id="mobile" class="addr_record">Mobile: ' + mobile.value + '<\/div>';
	doc += '<\//p>';
	doc += '<p class="print_thanks">Thanks for registering to the EnigmaSpace.<\//p><\/div>';
	doc += '<a class="print_link" href="" onClick="window.print(); return false;">Print this page<\/a><\/body><\/html>';
	print_doc.writeln(doc);
	print_doc.close();
	print_win.focus();
	
	return false;
}

/**
 *
 */
function timeout() 
{
	print_win.stop();
}