function closeLayer(){
	$('overlay_div').hide();
	$('layerPopup').hide();
}
function openLayerNonMember(event_id){
	var arrayPageSize = getPageSize();
	$('overlay_div').style.width = arrayPageSize[0]+'px';
	$('overlay_div').style.height = arrayPageSize[1]+'px';
	$('overlay_div').style.top = '0px';
	$('overlay_div').style.left= '0px';
	hideSelectBoxes();
	$('layerPopup').innerHTML='';
	$('overlay_div').show();
	$('layerPopup').show();
	sub_event=event_id;sub_uName='';sub_pass='';emptySelectedCompany();
	ser_frm_1='';ser_frm_2='';ser_frm_person_2='';ser_frm_3='';ser_frm_4='';
	new Ajax.Updater('layerPopup', 'jax/non_member_step_1.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+event_id});
}

var sub_uName='';var sub_pass='';var sub_event='';var old_company_name='';


var sub_company_id=-1;var sub_f_name='';var sub_l_name='';var sub_company_name='';var sub_id_land=0;var sub_id_bundesland=0;var sub_street='';var sub_zip='';
var sub_city='';var sub_tel='';var sub_fax='';var sub_web='';var ser_frm_1='';var ser_frm_2='';var ser_frm_person_2='';var ser_frm_3='';var ser_frm_4='';




function verify_Step1NonMember(frm){
	$('status').className='';
	$('status').innerHTML='';
	frm.emailAddress.className='';
	frm.pass.className='';
	frm.verify_pass.className='';
	ser_frm_1=Form.serialize(frm);
	new Ajax.Updater('status', 'jax/non_member_step_1_do.jax.php', {evalScripts:true, method:'post', postBody:Form.serialize(frm)+'&frm='+frm.name});
	return false;
}
function Step1NonMemberBack(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_1.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1});
}

function Step2NonMember_Person(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_2_person.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_1+'&'+ser_frm_person_2});
}

function verify_Step2NonMember_Person(frm){
	$('status').className='';
	$('status').innerHTML='';
	ser_frm_person_2=Form.serialize(frm);
	new Ajax.Updater('status', 'jax/non_member_step_2_person_do.jax.php', {evalScripts:true, method:'post', postBody:Form.serialize(frm)+'&frm='+frm.name+'&'+ser_frm_1});
	return false;
}


function Step2NonMember_Person_Back(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_2_person.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_1+'&'+ser_frm_person_2});	
	
	
}

function Step2NonMember_NEW(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_2_new.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_2});
}

function verify_Step2NonMember_New(frm){
	emptySelectedCompany();
	$('status').className='';
	$('status').innerHTML='';
	ser_frm_2=Form.serialize(frm);
	new Ajax.Updater('status', 'jax/non_member_step_2_new_do.jax.php', {evalScripts:true, method:'post', postBody:Form.serialize(frm)+'&frm='+frm.name});
	return false;
}

function Step3NonMember_NEW(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_3.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_3+'&'+ser_frm_1});
	//return false;
}

function verify_Step3NonMember_New(frm){
	$('status').className='';
	$('status').innerHTML='';
	ser_frm_3=Form.serialize(frm);
	new Ajax.Updater('layerPopup', 'jax/non_member_step_3_do.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+Form.serialize(frm)});
	return false;
}

function Step2NonMember_New_Back(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_2_new.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_2+'&'+ser_frm_1});	
	
	
}

function Step3NonMember_New_Back(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_3.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_person_2});
	
	
}

function Step4NonMember_NEW(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_4.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_person_2});
	//return false;
}

function verify_Step4NonMember_New(frm){
	ser_frm_4=Form.serialize(frm);
	$('status').className='';
	$('status').innerHTML='';
	new Ajax.Updater('status', 'jax/non_member_step_4_do.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_4+'&'+ser_frm_person_2});
	return false;
}

function Step5NonMember_NEW(){
	new Ajax.Updater('layerPopup', 'jax/non_member_step_5.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_4+'&'+ser_frm_person_2});
	//return false;
}

function printHTML_NonMember(){
	var WinPrint =window.open('print_non_member.php?'+ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_4+'&'+ser_frm_person_2,'print_non_member_subscribing','left=0,top=0,width=760px,height=500px,toolbar=0,scrollbars=1,status=0');

}

function printPDF_NonMember(){
	var WinPrint =window.open('pdf_non_member.php?'+ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_4+'&'+ser_frm_person_2,'print_non_member_subscribing','left=0,top=0,width=760px,height=500px,toolbar=0,scrollbars=1,status=0,resizable=1');
}

/* Member Subscribing*/





function openLayerBVLMember(event_id){
	var arrayPageSize = getPageSize();
	$('overlay_div').style.width = arrayPageSize[0]+'px';
	$('overlay_div').style.height = arrayPageSize[1]+'px';
	$('overlay_div').style.top = '0px';
	$('overlay_div').style.left= '0px';
	hideSelectBoxes();
	$('layerPopup').innerHTML='';
	$('overlay_div').show();
	$('layerPopup').show();
	sub_event=event_id;sub_uName='';sub_pass='';emptySelectedCompany();
	ser_frm_1='';ser_frm_2='';ser_frm_3='';ser_frm_4='';
	new Ajax.Updater('layerPopup', 'jax/member_step_1.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+event_id});
}

function verify_Step1Member(frm){
	$('status').className='';
	$('status').innerHTML='';
	frm.emailAddress.className='';
	frm.pass.className='';
	ser_frm_1=Form.serialize(frm);
	new Ajax.Updater('status', 'jax/member_step_1_do.jax.php', {evalScripts:true, method:'post', postBody:Form.serialize(frm)+'&frm='+frm.name});
	return false;
}


function Step1BVLMemberBack(){
	new Ajax.Updater('layerPopup', 'jax/member_step_1.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&emailAddress='+sub_uName});
}

function Step2BVLMember(){
	new Ajax.Updater('layerPopup', 'jax/member_step_2.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_1});
}

function Step1MemberBack(){
	new Ajax.Updater('layerPopup', 'jax/member_step_1.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&emailAddress='+sub_uName});
}


function verify_Step2Member(frm){
	$('status').className='';
	$('status').innerHTML='';
	ser_frm_2=Form.serialize(frm);
	new Ajax.Updater('status', 'jax/member_step_2_do.jax.php', {evalScripts:true, method:'post', postBody:Form.serialize(frm)+'&frm='+frm.name+'&'+ser_frm_1});
	return false;
	
}



function Step2BVLAUXMember(){
	new Ajax.Updater('layerPopup', 'jax/member_step_2_aux.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_1});
}

function verify_Step2AUX_Member(frm){
	$('status').className='';
	$('status').innerHTML='';
	ser_frm_2=Form.serialize(frm);
	new Ajax.Updater('status', 'jax/member_step_2_aux_do.jax.php', {evalScripts:true, method:'post', postBody:Form.serialize(frm)+'&frm='+frm.name+'&'+ser_frm_1});
	return false;
	
}


function Step3BVLMember(){
	new Ajax.Updater('layerPopup', 'jax/member_step_3.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event});
}

function Step2Member_Back(){
	if (sub_company_id==-1){
		new Ajax.Updater('layerPopup', 'jax/member_step_2_aux.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1+'&'+ser_frm_2});	
	}else{
		new Ajax.Updater('layerPopup', 'jax/member_step_2.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1+'&'+ser_frm_2});	
	}
	
	
}

function verify_Step3Member(frm){
	$('status').className='';
	$('status').innerHTML='';
	ser_frm_3=Form.serialize(frm);
	new Ajax.Updater('status', 'jax/member_step_3_do.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+Form.serialize(frm)});
	return false;
}


function Step3Member_Back(){
	new Ajax.Updater('layerPopup', 'jax/member_step_3.jax.php', {evalScripts:true, method:'post', postBody:'event_id='+sub_event+'&'+ser_frm_3});	
	
	
}


function Step4Member(){
	new Ajax.Updater('layerPopup', 'jax/member_step_4.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3});
	//return false;
}

function verify_Step4Member(frm){
	ser_frm_4=Form.serialize(frm);
	$('status').className='';
	$('status').innerHTML='';
	new Ajax.Updater('status', 'jax/member_step_4_do.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_4});
	return false;
}


function Step5Member(){
	new Ajax.Updater('layerPopup', 'jax/member_step_5.jax.php', {evalScripts:true, method:'post', postBody:ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_4});
	//return false;
}

function printHTML_Member(){
	var WinPrint =window.open('print_member.php?'+ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_4,'print_member_subscribing','left=0,top=0,width=760px,height=500px,toolbar=0,scrollbars=1,status=0');

}

function printPDF_Member(){
	var WinPrint =window.open('pdf_member.php?'+ser_frm_1+'&'+ser_frm_2+'&'+ser_frm_3+'&'+ser_frm_4,'print_member_subscribing','left=0,top=0,width=760px,height=500px,toolbar=0,scrollbars=1,status=0,resizable=1');
}



/**/

var set_int_company;

function searchCompany(company_name){
	window.clearInterval(set_int_company);
	if (company_name.length>4){
		new Ajax.Updater('search_company', 'jax/search_company.jax.php', {evalScripts:true, method:'post', postBody:'company_name='+company_name});
	}
}

function getCompanyInfo(company_id,frm){
	new Ajax.Updater('search_company', 'jax/get_company_detail.jax.php', {evalScripts:true, method:'post', postBody:'company_id='+company_id+'&frm='+frm});
}
function emptyCompanyDetail(frm){
		frm.street.disabled=false;frm.plz.disabled=false;frm.ort.disabled=false;frm.id_bundesland.disabled=false;frm.id_land.disabled=false;frm.telefon.disabled=false;frm.fax.disabled=false;frm.web.disabled=false;frm.street.value='';frm.plz.value='';frm.ort.value='';frm.id_bundesland.value=0;
		frm.id_land.value=0;frm.telefon.value='';frm.fax.value='';frm.web.value='';frm.company_email.value='';frm.street.className='error';frm.plz.className='error';frm.ort.className='error';frm.id_bundesland.className='error';frm.id_land.className='error';
		frm.company_email.disabled=false;
		frm.company_id.value=-1;						
}
function setDisabledCompanyStatus(frm,type){
	frm.street.disabled=type;frm.plz.disabled=type;frm.ort.disabled=type;frm.id_bundesland.disabled=type;
	frm.id_land.disabled=type;frm.telefon.disabled=type;frm.fax.disabled=type;frm.web.disabled=type;
	frm.company_email.disabled=false;
}


function emptySelectedCompany(){
	sub_company_id=-1;sub_f_name='';sub_l_name='';sub_company_name='';sub_id_land=0;sub_id_bundesland=0;sub_street='';sub_zip='';sub_city='';sub_tel='';sub_fax='';sub_web='';
}

function change_land(id_land,obj_id){
	var xmlhttp = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP"): new XMLHttpRequest();
	 var response;
	  url="jax/search_bundesland.php?id_land="+id_land;
	  xmlhttp.open("GET",url,true);

	  xmlhttp.onreadystatechange=function() {
		   if (xmlhttp.readyState==4) {
				var response=xmlhttp.responseText;
				//alert(response);
				for (i=document.getElementById(obj_id).length-1;i>=0;i--){
					document.getElementById(obj_id).remove(i);
				}
				var arrayList=Array();
				arrayList=response.split("::::");
				
				if (arrayList.length!=1){
					for (i=0;i<arrayList.length;i++){
						document.getElementById(obj_id).options[document.getElementById(obj_id).options.length]=new Option(arrayList[i+1],trim(arrayList[i]));
						i=i+1;
					}
				}else{
					document.getElementById(obj_id).options[document.getElementById(obj_id).options.length]=new Option('--------','0');
				}
		   }
	  }
	 xmlhttp.send(null);
	 return false
	
}
function import_place(text, li)
{
	
	document.getElementById('layer_zip_code').value=li.id.substr(6);
	document.getElementById('layer_city').value=Element.collectTextNodesIgnoreClass(li, 'informal');/*li.innerHTML*/;
	document.getElementById('layer_zip_code').className='ok';
	document.getElementById('layer_city').className='ok';
	
}


function Step2NonMember_Existent(){
	
}


// -----------------------------------------------------------------------------------
//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.com
// Edit for Firefox by pHaez
//
function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
	pageWidth = windowWidth;
	}
//	console.log("pageWidth " + pageWidth)
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
function showSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "visible";
	}
}
// ---------------------------------------------------

function hideSelectBoxes(){
	var selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) {
		selects[i].style.visibility = "hidden";
	}
}
// ---------------------------------------------------

function showFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "visible";
	}
	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "visible";
	}
}

// ---------------------------------------------------



function hideFlash(){
	var flashObjects = document.getElementsByTagName("object");
	for (i = 0; i < flashObjects.length; i++) {
		flashObjects[i].style.visibility = "hidden";
	}
	var flashEmbeds = document.getElementsByTagName("embed");
	for (i = 0; i < flashEmbeds.length; i++) {
		flashEmbeds[i].style.visibility = "hidden";
	}
}
function LTrim( value ) {var re = /\s*((\S+\s*)*)/; return value.replace(re, "$1");}
function RTrim( value ) {var re = /((\s*\S+)*)\s*/; return value.replace(re, "$1");}
function trim( value ) {return LTrim(RTrim(value));}

var sDir = 5;
var tId;
var runDelay = 20;
var scrollVar;
var stillScroll;

function showMe(text, ev) {
	var theDiv = document.getElementById('showMeDiv');
	theDiv.scrollTop = 0;
	theDiv.style.left = (ev.clientX + 15 + document.documentElement.scrollLeft)+ "px";
	theDiv.style.top = (ev.clientY + document.documentElement.scrollTop)+ "px";
	theDiv.innerHTML = text;
	theDiv.style.visibility = 'visible';
	theDiv.style.width = "250px";
	var wid, hei, dWid, dHei;
	if (window.innerWidth) {
		wid = window.innerWidth;
		hei = window.innerHeight;
	}
	else {
		wid = document.body.clientWidth;
		hei = document.body.clientHeight;
	}
	wid -= 15;
	
	dWid = theDiv.clientWidth;
	dHei = theDiv.clientHeight;
	if (ev.clientX + dWid > wid)
		theDiv.style.left = (parseInt(theDiv.style.left+document.documentElement.scrollTop) - dWid - 30) + "px";
	if (ev.clientY + dHei > hei)
		theDiv.style.top = (parseInt(theDiv.style.top+document.documentElement.scrollTop) - dHei) + "px";
}

function hideMe() {
	var theDiv = document.getElementById('showMeDiv');
	theDiv.style.visibility = 'hidden';
	stillScroll = false;
	if (tId)
		clearTimeout(tId);
}

function moveMe(ev) {
	var theDiv = document.getElementById('showMeDiv');
	theDiv.style.left = (ev.clientX + 15 + document.documentElement.scrollLeft)+ "px";
	theDiv.style.top = (ev.clientY + document.documentElement.scrollTop)+ "px";
	var wid, hei, dWid, dHei;
	if (window.innerWidth) {
		wid = window.innerWidth;
		hei = window.innerHeight;
	}
	else {
		wid = document.body.clientWidth;
		hei = document.body.clientHeight;
	}
	wid -= 15;
	
	dWid = theDiv.clientWidth;
	dHei = theDiv.clientHeight;
	
	if (ev.clientX + dWid > wid)
		theDiv.style.left = (parseInt(theDiv.style.left) - dWid - 30) + "px";
		
	if (ev.clientY + dHei > hei)
		theDiv.style.top = (parseInt(theDiv.style.top) - dHei) + "px";
}

function sizeMe(x) {
	var theDiv = document.getElementById('showMeDiv');
	if (x != '')
		theDiv.style.width = x + 'px';
	else
		theDiv.style.width = '';
	theDiv.style.height = '';
}

function scrollMe() {
	scrollVar = 0;
	stillScroll = true;
	sDir = 5;
	nextScrollStep();	
	var theDiv = document.getElementById('showMeDiv');
}

function nextScrollStep() {
	var theDiv = document.getElementById('showMeDiv');
		
	runDelay = 20;
	
	theDiv.scrollTop = scrollVar;
	scrollVar += sDir;
	
	if (scrollVar <= 0) {
		scrollVar = 0;
		sDir = -sDir;
		runDelay = 1500;
	}
	
	if (scrollVar >= theDiv.scrollHeight - parseInt(theDiv.style.height) +25 ) {
		scrollVar = theDiv.scrollHeight - parseInt(theDiv.style.height) + 25;
		sDir = -sDir;
		runDelay = 1500;
	}
	
	if (stillScroll)
		tId = setTimeout('nextScrollStep()', runDelay);
}
function getInfo(text_value){
	new Ajax.Updater('showMeDiv','jax/return_img_text.php',{method:'post',postBody:'text_value='+text_value});
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
function make_focus(obj){
		obj.focus();	
	}
function clearModulePreview() {
	popUp.style.visibility = 'hidden';
	popUp.innerHTML = 'Wait...';
	}	
function view_description(path, ev) {
		popUp = document.getElementById('messageBox');	
		popUp.className = 'articlePreview';
		popUp.style.left = (document.body.scrollLeft + ev.clientX)+ "px";
		popUp.style.top = (document.body.scrollTop + ev.clientY)+ "px";
	
		popUp.style.visibility = 'visible';
		popUp.innerHTML = 'pls w8...';
		new Ajax.Updater('messageBox', 'jax/get_info.jax.php', {method:'post', postBody:'sid=&f='+path});
	}	
	
	
function openLayerUsernameAndPasswordReminder()
{
	var arrayPageSize = getPageSize();
	$('overlay_div').style.width = arrayPageSize[0]+'px';
	$('overlay_div').style.height = arrayPageSize[1]+'px';
	$('overlay_div').style.top = '0px';
	$('overlay_div').style.left= '0px';
	hideSelectBoxes();
	$('layerPopup').innerHTML='';
	$('overlay_div').show();
	$('layerPopup').show();
	new Ajax.Updater('layerPopup', 'jax/remember_username_and_password.jax.php', {evalScripts:true, method:'post', postBody:'event_id='});
}

function usernameAndPasswordReminder_do(frm)
{
	new Ajax.Updater('status', 'jax/remember_username_and_password_do.jax.php', {evalScripts:true, method:'post', postBody:Form.serialize(frm)+'&frm='+frm.name});
	return false;
}

var delay_close_form;
function delayedRunFunctions(f_name){
	clearInterval(delay_close_form);
	eval(f_name);
}