var footer_dlgTOU;
var footer_dlgPP;
var footer_dlgCredits;
var footer_dlgContactUs;
var footer_dlgWait;
var footer_dlgErr;

function footer_dlgCUCBSuccess(o)
{
	footer_dlgWait.hide();
	try
	{
		result = eval("("+o.responseText+")");
	}
	catch(e)
	{
		alert(o.responseText);
		return;
	}
	switch(result.status)
	{
	case 0:
		msg = "Thank You.  Your message has been sent.  An ETAS employee will contact you regarding your inquiry.";
		hdr = "Information";
		icon = YAHOO.widget.SimpleDialog.ICON_INFO;
		break;
	case -1:
		msg = "Your message was NOT sent.  Please resubmit your request or contact us at 212-213-5436.";
		hdr = "Error";
		icon = YAHOO.widget.SimpleDialog.ICON_ALARM;		
		break;
	default: break;
	}
	footer_dlgMsg = new YAHOO.widget.SimpleDialog("footer_dialogMsg", { width:"20em", fixedcenter:true, modal:true, draggable:false});
	footer_dlgMsg.setHeader(hdr);
	footer_dlgMsg.setBody(msg);
	footer_dlgMsg.cfg.setProperty("icon",icon);
	footer_dlgMsg.cfg.queueProperty("buttons", [{text:"OK",handler:function(){this.hide();},isDefault:true}]); 
	footer_dlgMsg.render(document.body);	
}

function footer_dlgCUCBFailure(o)
{
	footer_dlgWait.hide();
	footer_dlgErr = new YAHOO.widget.SimpleDialog("footer_dialogErr", { width:"20em", fixedcenter:true, modal:true, draggable:false});
	footer_dlgErr.setHeader("Error");
	footer_dlgErr.setBody("Communication failure to server.");
	footer_dlgErr.cfg.setProperty("icon",YAHOO.widget.SimpleDialog.ICON_ALARM);
	footer_dlgErr.cfg.queueProperty("buttons", [{text:"OK",handler:function(){this.hide();},isDefault:true}]); 
	footer_dlgErr.render(document.body);
}

function footer_initialize()
{
	if (document.getElementById("footer-wrap") && document.getElementById("footer-content"))
	{
//		footer_dlgTOU = new YAHOO.widget.Dialog("dialogTermsOfUse", { zIndex:5000, modal:true, width:"600px", height:"275px", visible:false, fixedcenter:true, constraintoviewport:true, draggable:true });
//		footer_dlgTOU.cfg.queueProperty("buttons", [{text:"Close", handler:function(){this.hide();}, isDefault:true}]);	
//		footer_dlgTOU.render();
		
//		footer_dlgPP = new YAHOO.widget.Dialog("dialogPrivacyPolicy", { modal:true, width:"600px", height:"275px", visible:false, fixedcenter:true, constraintoviewport:true, draggable:true });
//		footer_dlgPP.render();

//		footer_dlgCredits = new YAHOO.widget.Dialog("dialogCredits", { modal:true, width:"600px", height:"275px", visible:false, fixedcenter:true, constraintoviewport:true, draggable:true });
//		footer_dlgCredits.render();

		footer_dlgContactUs = new YAHOO.widget.Dialog("dialogContactUs", { modal:true, /*width:"600px", height:"275px",*/ visible:false, fixedcenter:true, constraintoviewport:true, draggable:true });
		footer_dlgContactUs.callback.success = footer_dlgCUCBSuccess;
		footer_dlgContactUs.callback.failure = footer_dlgCUCBFailure;
		footer_dlgContactUs.render();
		
		footer_dlgWait = new YAHOO.widget.Panel("footerDialogWait", { width:"240px", fixedcenter:true, close:false, draggable:false, zindex:4, modal:true, visible:false});
		footer_dlgWait.setHeader("Please wait, submitting information...");
		footer_dlgWait.setBody('<img src="http://us.i1.yimg.com/us.yimg.com/i/us/per/gr/gp/rel_interstitial_loading.gif" />');
		footer_dlgWait.render(document.body);		
	}
}

function footer_dlgTOUShow(base_url)
{
			window.open(base_url+"templates/dialog_terms_of_use.html", "", "width=600,height=350,resizeable=yes,scrollbars=yes,toolbar=no,address=no,location=no,directories=no,status=no,menubar=no");

}

function footer_dlgPPShow(base_url)
{
			window.open(base_url+"templates/dialog_privacy_policy.html", "", "width=600,height=350,resizeable=yes,scrollbars=yes,toolbar=no,address=no,location=no,directories=no,status=no,menubar=no");

}

function footer_dlgCreditsShow(base_url)
{
			window.open(base_url+"templates/dialog_credits.html", "", "width=600,height=350,resizeable=yes,scrollbars=yes,toolbar=no,address=no,location=no,directories=no,status=no,menubar=no");

}

// Chain the onload event to call the function to build the page footer.
YAHOO.util.Event.addListener(window, "load", footer_initialize);

