/****************************************
Globals
****************************************/
var formContainer;
var formArea;
var formBtnOpen;
var formBtnClose;



$(document).ready(function(){

	/****************************************
	Initialize Bottom Form
	****************************************/
	formContainer = $(".bottom .swColumns");
	formArea = $(".bottom .swColumns form");
	formBtnOpen = formContainer.find(".swAfsnit img").eq(0);
	formBtnClose = formContainer.find(".swAfsnit img").eq(1);
	formError = formContainer.find(".form-error#errormsg345053");
	
	//console.log(formError.length);
	//formBtnOpen.attr("useMap", "#Map")
	//formBtnClose.attr("useMap", "#Map")
	
	formContainer.addClass("formContainer");
	//$("#swPageDiv").append(formContainer);
	initForm();
	
	formBtnOpen.click(revealForm);
	formBtnClose.click(hideForm);
	
	if(formError.length > 0) {
		formBtnOpen.click();
	}
});


/****************************************
functions for Bottom Form
****************************************/

function revealForm() {
	//alert("reveal");
	formArea.show("slow");
	formBtnOpen.fadeOut();
	formBtnClose.fadeIn();
}

function hideForm() {
	//alert("hide");
	formArea.hide("fast");		
	formBtnOpen.fadeIn();
	formBtnClose.fadeOut();
}

function initForm() {
	//alert("init");
	formArea.hide();		
	formBtnOpen.fadeIn();
	formBtnClose.fadeOut();
}
