if(typeof com == "undefined")
{
	com = function(){};
}


if(typeof com.ixonos == "undefined")
{
	com.ixonos = function(){};
}

com.ixonos.disactiveAnt = function()
{
};

com.ixonos.disactiveAnt.onDeviceReady = function()
{
	//com.ixonos.fsc.addAjaxSend();
	
	com.ixonos.fsc.initBottomBar("");
	com.ixonos.disactiveAnt.initHtml();
	com.ixonos.disactiveAnt.bindEvent();
};

com.ixonos.disactiveAnt.initHtml = function(){
	
	var html =     '<div class="titleBar">';
	html +=        '<div class="logo">';
	html +=          '<img src="img/navigation/logo-header.png"/>';
	html +=        '</div>';
	html +=      '</div>';
	
	html +=      '<div class="subTitle">' + disactiveAnt.disAccountTips + '</div>';
	html +=      '<div id="admob_ad_top"></div>';
	//html +=      '<div class="disAccountTips">' + disactiveAnt.disAccountTips + '</div>';
	html +=      '<div class="disAccountText"> <img src="img/backupIcons/Public/warm.png"></img>' + disactiveAnt.disAccountText;
	html +=         '<a class="deleteShadowButton"><div class="disAccountleftBtn">' + disactiveAnt.leftBtn + '</div></a>' ;
	html +=         '<a class="deleteShadowButton"><div class="disAccountrightBtn">' + public.cancelText + '</div></a>';
	//html +=         '<div id="disactive_admob_ad_bottom"></div>';
	html +=      '</div>';
	


	$('#disactiveAnt').append(html);
};

com.ixonos.disactiveAnt.bindEvent = function(){
	$('.disAccountrightBtn').click(function()
						 {
//						 location.href="editAccount.html";
						 loadPage("html/editAccount.html","com.ixonos.editAccount.onDeviceReady");
						 });
	$('.disAccountleftBtn').click(function(){
						var url = server.serverIp + "rest/signUpServer/deactiveAccount";
						var memberId = window.localStorage.getItem(loginUser.memberId);
						com.ixonos.fsc.loadPage("disactiveAnt", 1);
						
						$.getJSON(url,{memberId:memberId},function(string){
								 
								  if(typeof string == 'undefined')
								  {
								  com.ixonos.fsc.serverErrorAlert();
								  }
								  else if(string.status == -100)
								  {
								  com.ixonos.fsc.requestHeaderError();
								  }
								  else{
								  switch(string.status)
								  {
								  case 1:
								  //alert("account is deactived");
								  //location.href="editAccount.html";
								  com.ixonos.fsc.loginOut();
								  break;
								  com.ixonos.fsc.serverErrorAlert();
								  default:
								  break;
								  }}
								  com.ixonos.fsc.removeLoadPage();	 
								  });
						});
}	


