// download
var Download = {
	go:function()
	{
		xpi = {
			'phootr': 'phootr/phootr.xpi'
		}; 
		InstallTrigger.install(xpi);		
	}
}

// download
var Pending = {
	// variables
	panels:{
		error:"error",
		confirm:"confirm",
		message:"message"
	},
	// service
	services:{
		server:"",
		path:"services/",
		email:"email.wsdl.php"
	},	
	// methods
	init:function(post)
	{
		this.post	= post
		$("." + this.panels.error).show();
		$("#" + this.panels.confirm).hide();		
	},
	confirm:function()
	{
		post		= {
			email:this.post.email,
			screenname:this.post.screenname,
			type:"confirm"
		}
		
		// call email wsdl
		var service	= this.services.server + this.services.path + this.services.email;
		$.ajax(
			{
				url:service,
				cache:false,
				data:post,
				dataType:"json",
				type:"POST",
				success:function(response)
				{
					// show the message
					confirm	= "#" + Pending.panels.confirm;					
					message	= "." + Pending.panels.message;
					error	= "." + Pending.panels.error;					
					$(error).hide();
					$(confirm).hide();
					$(message).html(response.message);					
					$(confirm).show('slow');					
				},
				error:function()
				{
					console.log("failed:" + service);
				}
			}
		);			
	}	
}

// logout
var Logout	= {
	// service
	services:{
		server:"",
		path:"services/",
		logout:"logout.wsdl.php"
	},
	go:function()
	{
		var service	= this.services.server + this.services.path + this.services.logout;
		$.ajax(
			{
				url:service,
				cache:false,
				data:{},
				dataType:"json",
				type:"POST",
				success:function()
				{
					window.location	= "index.php";					
				},
				error:function()
				{
					window.location	= "index.php";
				}
			}
		);					
	}
}
