var checkout = {};


/* startup events
-----------------------------------------------------------*/
checkout.init = function(){
	/*
	addEvent("faq10","click",function(e){dom.showModalDialog("faq10_answer",{title:"How do I get E-Mail?"})});
	addEvent("agentAlias","keyup",function(e){
																		console.info((e.srcElement || e.target).value);
																		if (dom.checkFieldFormat("agentAlias")){
																			aliasLookup((e.srcElement || e.target).value);
																		}					
																								
																	},false);
	*/
	//dom.addNode("<img src='" + rootPath + "images/interface/info_icon.gif' style='vertical-align:middle;' />&nbsp; Don't forget: If you want a <b>simplified e-mail address</b>  you need to click above on <b>[add email]</b>. Click <span class='fakeLink' id='emailDomainFAQ'>here</span> to find how e-mails and domains are related.","domainCartNav","div",{id:"__emailempty"},{display:"none",textAlign:"left",backgroundColor:"#efe",color:"#888",border:"1px dotted #888",marginBottom:"5px",padding:"10px"});
	//dom.addNode("<img src='" + rootPath + "images/interface/warning_icon.gif' style='vertical-align:middle;' />&nbsp;Please remember: You only need <b>one domain</b> in order to buy <b>multiple e-mail accounts</b>. You <b>do not</b> need to buy seperate domains for each staff member.","domainCartNav","div",{id:"__emailwarning"},{display:"none",textAlign:"left",backgroundColor:"#ffe",color:"red",border:"1px dotted #888",marginBottom:"5px",padding:"10px"});
	//dom.addNode("","domainCartNav","input",{type:"button",id:"checkoutbutton",value:"Checkout Now »",className:"smallActiveButton"},{});
	//addEvent($("checkoutbutton"),"click",function(){window.location = sslRootPath + "checkout.asp"});
	
	//cart.refresh(true);
};
//addEvent(window,"load",checkout.init,false); //initialize the system



function emailPassword(a,xhrObj){
	//console.info(a);
	//if we're not loaded yet
	if (a && !xhrObj){
		dom.addFormData("__supForm","alias",a,"hidden");
		dom.addFormData("__supForm","func","sup","hidden");		
		var xmlURL = rootPath + "incs/siteXHR.asp"; // base query URL
		xhr.connect(xmlURL,"POST",emailPassword,[null],"__supForm");
	}else if(xhrObj){
		var s = xhr.XMLtoObj(xhrObj.getElementsByTagName("root")[0]).status;
		dom.removeObject("__passwordSentMsg");
		if (s == "success"){	
			dom.addNode("Password Sent - check your mail and when the password arrives use it to finish checking out here.","passwordMessageTD","div",{id:"__passwordSentMsg"},{color:"green",fontSize:"15px;",textAlign:"center"});
		}else{
			dom.addNode("Unable to send your password.  Please contact us at 1-877-828-3131.","passwordMessageTD","div",{id:"__passwordSentMsg"},{color:"red",fontSize:"15px;",textAlign:"center"});
		}
	}else{
		alert("Try a valid alias.");
	}
	dom.removeObject("__supForm");
};




