// Form Builder v2.4 (Feb. 2007) - FormAssembly.com
// Copyright (c) 2007 Veer West LLC
// All Rights Reserved - do not reuse without permission.
// For licensing information visit: http://www.formassembly.com/about-form-builder.php

// Form Builder customization file

function notifySaveError(obj) {

	switch(obj.req.status) {
		case 401: 
		case 403:								
			// authentication/not logged in error
			loadHTML(BuilderConfig.AUTHENTICATION_FORM_URL, function(html) { 
				document.getElementById('placeholder_properties').innerHTML  = "<p>Please login first</p>" + html;					
				switchTab('tabProperties');
				wFORMS.addBehaviors('placeholder_properties'); 	
				document.getElementById('wf_TFA20Registration').style.display = 'none';
				wFORMS.helpers.addEvent(document.getElementById('registrationLink'), "click", function(){ 
					document.getElementById('wf_TFA20Login').style.display		  = 'none';
					document.getElementById('wf_TFA20Registration').style.display = 'block'; } );
				wFORMS.helpers.addEvent(document.getElementById('loginLink'), "click", function(){ 
					document.getElementById('wf_TFA20Login').style.display		  = 'block';
					document.getElementById('wf_TFA20Registration').style.display = 'none'; } );	
			 });
			break;
		default:
			alert("The following error occured while saving the form:\nError "+ obj.req.status+ ":  " + obj.req.responseText);
	}
}