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

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

//package name
com.ixonos.editProfile = function(){};


com.ixonos.editProfile.initHtml = function()
{
	
	//initialize morepage 
	var html = '';
	html += '<div class="titleBar">';
	html +=		'<div class="logo"><img src="img/navigation/logo-header.png"/></div>';
	html +=		'<a class="deleteShadowButton"><div class="points">';
	html +=			'<div class="pointsNum"></div>';
	html +=			'<div class="pointsUnit">PTS</div>';
	html +=		'</div></a>';
	html += '</div>';
	html +=      '<a class="deleteShadowButton"><div class="backButton" id="editProfileBtn">' + public.backText + '</div></a>';
//	html +=      '<div class="doneButton" id="editProfileDoneBtn">' + public.doneText + '</div>';
	html +=      '<div class="subTitle">' + editProfile.editTips + '</div>';
	html += '<div class = "editProfileContent" >';
	html +=		'<div class = "editProfileItems">';
	
	html +=			'<div class = "editProfileItem basicItem">';
	html +=				'<div class="editProfileWord">' + editProfile.basics + '</div>';
	html +=			'</div>';
	html +=			'<div class = "editProfileItem physicalItem">';
	html +=				'<div class="editProfileWord">' + editProfile.physical + '</div>';
	html +=			'</div>';	
	html +=			'<div class = "editProfileItem lifestyleItem">';
	html +=				'<div class="editProfileWord">' + editProfile.lifestyle + '</div>';
	html +=			'</div>';
	html +=			'<div class = "editProfileItem moreAboutMe">';
	html +=				'<div class = "editProfileIcon"></div>';
	html +=				'<div class="editProfileWord">' + editSettings.AboutMe + '</div>';
	html +=			'</div>';
	html +=		'</div>';
	html += '</div>';
	
	$("#editProfilePage").html(html);

};

com.ixonos.editProfile.initLifeStyleHtml = function(){
	var html = '';
	html += '<div class="titleBar">';
	html +=		'<div class="logo"><img src="img/navigation/logo-header.png"/></div>';
	html += '</div>';
	html +=      '<a class="deleteShadowButton"><div class="cancelButton" id="lifestyleBtn">' + public.cancelText + '</div></a>';
	html +=      '<a class="deleteShadowButton"><div class="doneButton" id="lifestyleDoneBtn">' + public.doneText + '</div></a>';
	html +=      '<div class="subTitle">' + editProfile.lifestyleTitle + '</div>';
	html +=      '<div id="lifestyleContent">';
    html +=        '<ul class="ProfileUl">';
	html +=           '<li class="arrowProfileUl" >' + editProfile.Sexual;
	html +=             '<select class="editProfilegeneralText" id="sexualId" >';
	html +=                 '<option value="">Select</option>';
	html +=             '</select>';
	html +=           '</li>';
	html +=           '<li class="arrowProfileUl" >' + editProfile.Smokes;
	html +=             '<select class="editProfilegeneralText" id="smokeId" >';
	html +=                 '<option value="">Select</option>';
	html +=              '</select>';
	html +=           '</li>';
	html +=          '<li class="arrowProfileUl" >' + editProfile.RelationShip;  
	html +=            '<select class="editProfilegeneralText" id="relationShipId" >';
	html +=                 '<option value="">Select</option>';
	html +=             '</select>';
	html +=           '</li>';
	html +=           '<li class="arrowProfileUl" >' + editProfile.Drinks;
	html +=             '<select class="editProfilegeneralText" id="drinkId" >';
	html +=                 '<option value="">Select</option>';
	html +=              '</select>';
	html +=           '</li>';
	html +=           '<li class="arrowProfileUl" >' + editProfile.Education;
	html +=              '<select class="editProfilegeneralText editProfileeducationSelect" id="educationId" >';
	html +=                 '<option value="">Select</option>';
	html +=               '</select>';
	html +=           '</li>';
	html +=          '</ul>';
	html +=         '</div>';
	$("#lifestylePageContent").html(html);
}

com.ixonos.editProfile.initPhysicalHtml = function(){
	var html = '';
	html += '<div class="titleBar">';
	html +=		'<div class="logo"><img src="img/navigation/logo-header.png"/></div>';
	html += '</div>';
	html +=      '<a class="deleteShadowButton"><div class="cancelButton" id="physicalBtn">' + public.cancelText + '</div></a>';
	html +=      '<a class="deleteShadowButton"><div class="doneButton" id="physicalDoneBtn">' + public.doneText + '</div></a>';
	html +=      '<div class="subTitle">' + editProfile.physicalTitle + '</div>';
	html +=      '<div id="physicalContent">';
    html +=        '<ul class="ProfileUl">';
	html +=          '<li class="arrowProfileUl" >' + editProfile.bodytype;	
	html +=             '<select id="bodytypeId" class="editProfilegeneralText" >';
	html +=               '<option value="">Select</option>';
	html +=             '</select>';
	html +=          '</li>';
	html +=          '<li class="arrowProfileUl" >' + editProfile.ethinicity;	
	html +=             '<select id="ethinicityId" class="editProfilegeneralText" >';
	html +=                 '<option value="">Select</option>';
	html +=             '</select>';
	html +=          '</li>';
	
	var imperial = window.localStorage.getItem(loginUser.imperial);
	if(imperial == "true")
	{
		html +=          '<li class="arrowProfileUl" >' + editProfile.height;
		html +=              ' <select type="text" class="editProfilegeneralText editProfiletext4 editProfileposition7" id="feetId" >';
		html +=                  ' <option value=""></option>';
		html +=              '</select>';
		html +=               '<font class="editProfileposition9">' + editProfile.feet + '</font>';
		html +=              '<select type="text" class="editProfilegeneralText editProfiletext4 editProfileposition8" id="inchesId" >';
		html +=                  ' <option value=""></option>';
		html +=              '</select>';
		html +=               '<font class="editProfileposition10">' + editProfile.inches + '</font>';
		html +=          '</li>';
	}
	else
	{
		html +=          '<li class="arrowProfileUl" >' + editProfile.yourHeight + '<input type="tel" class="editProfilegeneralText editProfileyourHeight" id="yourHeightId" ></input><font class="editProfilepositionYourHeight">cm</font></li>';
	}
	
	
	html +=          '</ul>';
	html +=         '</div>';
	$("#physicalPageContent").html(html);
}

com.ixonos.editProfile.initBasicHtml = function(){
	var html = '';
	html += '<div class="titleBar">';
	html +=		'<div class="logo"><img src="img/navigation/logo-header.png"/></div>';
	html += '</div>';
	html +=      '<a class="deleteShadowButton"><div class="cancelButton" id="basicBtn">' + public.cancelText + '</div></a>';
	html +=      '<a class="deleteShadowButton"><div class="doneButton" id="basicDoneBtn">' + public.doneText + '</div></a>';
	html +=      '<div class="subTitle">' + editProfile.basicsTitle + '</div>';
	html +=      '<div id="basicContent">';
    html +=        '<ul class="ProfileUl">';
	html +=          '<li class="arrowProfileUl" >' + editProfile.FirstName + '<input type="text" class="editProfilegeneralText" id="firstNameId" autocapitalize="off" autocorrect="off" ></input></li>';
	html +=          '<li class="arrowProfileUl" >' + editProfile.LastName + '<input type="text" class="editProfilegeneralText" id="lastNameId" autocapitalize="off" autocorrect="off" ></input></li>';
	html +=          '<li class="arrowProfileUl" >' + editProfile.Gender;	
	html +=             '<select id="editSelectGender" class="editProfilegeneralText" tabindex="3" >';
	html +=                '<option value="MALE">' + editProfile.Male + '</option>';
	html +=                '<option value="FEMALE">' + editProfile.Female + '</option>';
	html +=             '</select>';
	html +=          '</li>';
	html +=          '<li class="arrowProfileUl" >' + editProfile.zipCode + '<input type="number" class="editProfilegeneralText editProfiletext1" id="zipcodeId" ></input></li>';
	html +=          '<li class="arrowProfileUl" >' + editProfile.cityName + '<input type="text" class="editProfilegeneralText" id="cityNameId" autocapitalize="off" autocorrect="off" ></input></li>';
	html +=          '<li class="arrowProfileUl" >' + editProfile.Birth;
	html +=              '<select type="text" class="editProfilegeneralText editProfiletext2 editProfileposition1" id="monthId" ></select>';
	html +=               '<font class="editProfileposition4">M</font>';
	html +=              ' <select type="text" class="editProfilegeneralText editProfiletext2 editProfileposition2" id="dayId" >';
	html +=              '</select>';
	html +=               '<font class="editProfileposition5">D</font>';
	html +=              '<select type="text" class="editProfilegeneralText editProfiletext3 editProfileposition3" id="yearId" ></select>';
	html +=              '<font class="editProfileposition6">Y</font></li>';
	html +=          '</ul>';
	html +=         '</div>';
	
	$("#basicPageContent").html(html);
}

com.ixonos.editProfile.getBasicInfo = function(){
	var url = server.serverIp + "rest/profileServer/getProfileBasics";
	var memberIdStr = window.localStorage.getItem(loginUser.memberId);
	
	dayId = document.getElementById("dayId");
	monthId = document.getElementById("monthId");
	yearId = document.getElementById("yearId");
	com.ixonos.fsc.loadPage("basicPage",1);
	$.getJSON(url,{memberId:memberIdStr},function(string){
			  if(string.status == -100)
			  {
			  com.ixonos.fsc.removeLoadPage();
			  com.ixonos.fsc.requestHeaderError();
			  }
			  else if(string.status == 1)
			  {
				for(i = 0; i < 13; i++)
					{
					dayId.options[i] = new Option(i, i);
					if(i == string.day)
						{
						if(string.day != "")
							{
							dayId.options[parseInt(string.day)].selected = true;//setAttribute("selected", true);
							} 
						}
			  
					monthId.options[i] = new Option(i, i);
					if(i == string.month)
						{
						if(string.month != "")
							{
							monthId.options[parseInt(string.month)].selected = true;//selected = true;
							}
						}
					}
			  	
			 
			  			  
				for(i= 13; i < 32; i++)
					{
					dayId.options[i] = new Option(i,i);
					if(i == string.day)
					{
						if(string.day != "")
							{
							dayId.options[parseInt(string.day)].selected = true;//setAttribute("selected", true);
							}
					}
					}
			  			  
				var years = string.years;
				$.each(years, function(index){
					   yearId.options[index] = new Option(years[index], years[index]);
								
					   if(years[index] == string.year)
					   {
						yearId.options[index].selected = true;//selected = true;	
					   }
				});
			  
			  document.getElementById("firstNameId").defaultValue = string.firstName;
			  document.getElementById("lastNameId").defaultValue = string.lastName;
			  document.getElementById("zipcodeId").defaultValue = string.zipCode;
			  document.getElementById("cityNameId").defaultValue = string.cityName;
			  $('#editSelectGender').val(string.gender);
			  }
			  com.ixonos.fsc.removeLoadPage();
			  });
	
}

com.ixonos.editProfile.getPhysicalInfo = function(){
	var url = server.serverIp + "rest/profileServer/getProfilePhysical";
	var memberIdStr = window.localStorage.getItem(loginUser.memberId);
	var imperial = window.localStorage.getItem(loginUser.imperial);
	
	bodytypeId = document.getElementById("bodytypeId");
	ethinicityId = document.getElementById("ethinicityId");
	
	$('#yourHeightId').keypress(function(event){
								return /\d/.test(String.fromCharCode(event.keyCode));
								});
	
	com.ixonos.fsc.loadPage("physicalPage",1);
	$.getJSON(url,{memberId:memberIdStr},function(string){
			  if(string.status == -100)
			  {
			  com.ixonos.fsc.removeLoadPage();
			  com.ixonos.fsc.requestHeaderError();
			  }
			  else if(string.status == 1)
			  {
				var bodytypeStr = string.buildGroupList;
			  
			    if(string.build != "")
			    {
			      $.each(bodytypeStr, function(index){
						 bodytypeId.options[index] = new Option(bodytypeStr[index].value, bodytypeStr[index].id);
						 });
			  
			      $('#bodytypeId').val(string.build);
			    }
				else
			    {
			      $.each(bodytypeStr, function(index){
					 bodytypeId.options[index + 1] = new Option(bodytypeStr[index].value, bodytypeStr[index].id);
					 });		      
			    }
			  			  			  
				var ethinicityStr = string.ethnicityGroupList;
			  
			    if(string.ethnicity != "")
			    {
			       $.each(ethinicityStr, function(index){
					 ethinicityId.options[index] = new Option(ethinicityStr[index].value, ethinicityStr[index].id);
						  });
			       
			       $('#ethinicityId').val(string.ethnicity);			      
			    }
				else
			    {
			        $.each(ethinicityStr, function(index){
					 ethinicityId.options[index + 1] = new Option(ethinicityStr[index].value, ethinicityStr[index].id);
					 });			     
			    }

			  
			  if(imperial == "true")
			  {
			  feetId = document.getElementById("feetId");
			  inchesId = document.getElementById("inchesId");
			  
			  var index = 0;
			  if(string.hightFeet == "")
				  {
				  index = 1;
				  }
			  
			  for(i = 0; i < 5; i++)
			  {
			  feetId.options[index + i] = new Option(i+3, i+3);
			  if((i+3) == string.hightFeet)
			  {
			  if(string.hightFeet != ""){
			  feetId.options[index + i].selected = true;//("selected", "true");
			  }
			  }
			  }
			  
			  index = 0;
			  if(string.hightInche == "")
				  {
				  index = 1;
				  }
			  for(i = 0; i < 12; i++)
			  {
			  inchesId.options[i + index] = new Option(i, i);
			  if(i == string.hightInche)
			  {
			  if(string.hightInche != "")
			  {
			  inchesId.options[parseInt(string.hightInche)].selected = true;//selected = true;
			  }
			  }
			  }
			  }
			  
			  else
			  {
			  if(typeof string.memberHight != "undefined")
			  {
			  if(string.memberHight != "")
			  {
			  document.getElementById("yourHeightId").defaultValue = string.memberHight;
			  }
			  }
			  
			  }
			  }
			  
			  com.ixonos.fsc.removeLoadPage();
			  });
}

com.ixonos.editProfile.getLifeStyleInfo = function(){
	var url = server.serverIp + "rest/profileServer/getProfileLifestyle";
	var memberIdStr = window.localStorage.getItem(loginUser.memberId);
	
	sexualId = document.getElementById("sexualId");
	smokeId = document.getElementById("smokeId");
	relationShipId = document.getElementById("relationShipId");
	drinkId = document.getElementById("drinkId");
	educationId = document.getElementById("educationId");
	
	com.ixonos.fsc.loadPage("lifestylePage",1);
	$.getJSON(url,{memberId:memberIdStr},function(string){
			  if(string.status == -100)
			  {
			  com.ixonos.fsc.removeLoadPage();
			  com.ixonos.fsc.requestHeaderError();
			  }
			  else if(string.status == 1)
			  {
				var sexualityStr = string.sexualityGroupList;
			   
			    if(string.sexuality != "")
			    {
			      $.each(sexualityStr, function(index){
						 sexualId.options[index] = new Option(sexualityStr[index].value, sexualityStr[index].id);
						 });
			  
			      $('#sexualId').val(string.sexuality);
				}
			    else
			    {
			      $.each(sexualityStr, function(index){
					 sexualId.options[index + 1] = new Option(sexualityStr[index].value, sexualityStr[index].id);
					 });			  
			    }
//				$.each(sexualityStr, function(index){
//						sexualId.options[index] = new Option(sexualityStr[index].value, sexualityStr[index].id);
//								
//						//if(sexualityStr[index].id == string.sexuality)
////						{
////							sexualId.options[index].selected = true;	
////						}
//					});
			  						  
				var smokeStr = string.smokesGroupList;
			  
			    if(string.smokes != "")
			    {
			      $.each(smokeStr, function(index){
						 smokeId.options[index] = new Option(smokeStr[index].value, smokeStr[index].id);
						 });
			      $('#smokeId').val(string.smokes);
			    }
			    else
			    {
			       $.each(smokeStr, function(index){
					 smokeId.options[index + 1] = new Option(smokeStr[index].value, smokeStr[index].id);
					 });
			    }
				//$.each(smokeStr, function(index){
//						smokeId.options[index] = new Option(smokeStr[index].value, smokeStr[index].id);
//			  					 
//						if(smokeStr[index].id == string.smokes)
//						{
//							smokeId.options[index].selected = true;	
//						}
//					});
									
				var relationShipStr = string.statusGroupList;
			  
			    if(string.statusMember != "")
			    {
			       $.each(relationShipStr, function(index){
			         relationShipId.options[index] = new Option(relationShipStr[index].value, relationShipStr[index].id);
						  });
			       $('#relationShipId').val(string.statusMember);
			    }
			    else
			    {
			       $.each(relationShipStr, function(index){
			         relationShipId.options[index + 1] = new Option(relationShipStr[index].value, relationShipStr[index].id);
					 });
			    }
			   
				//$.each(relationShipStr, function(index){
//						relationShipId.options[index] = new Option(relationShipStr[index].value, relationShipStr[index].id);
//			  					 
//						if(relationShipStr[index].id == string.statusMember)
//						{
//							relationShipId.options[index].selected = true;	
//						}
//					});
			  			  
				var drinkStr = string.drinksGroupList;
			  
			    if(string.drinks != "")
			    {
			       $.each(drinkStr, function(index){
						  drinkId.options[index] = new Option(drinkStr[index].value, drinkStr[index].id);
						  });
			  
			       $('#drinkId').val(string.drinks);
			    }
			    else
			    {
			       $.each(drinkStr, function(index){
					 drinkId.options[index + 1] = new Option(drinkStr[index].value, drinkStr[index].id);
					 });
			    }
				//$.each(drinkStr, function(index){
//						drinkId.options[index] = new Option(drinkStr[index].value, drinkStr[index].id);
//								
//						if(drinkStr[index].id == string.drinks)
//						{
//							drinkId.options[index].selected = true;
//						}
//					});
			  			  
				var educationStr = string.educationGroupList;
			  
			    if(string.education != "")
			    {
				   $.each(educationStr, function(index){
						educationId.options[index] = new Option(educationStr[index].value, educationStr[index].id);
				        });
			       $('#educationId').val(string.education);
			    }
			    else
			    {
			      $.each(educationStr, function(index){
					 educationId.options[index + 1] = new Option(educationStr[index].value, educationStr[index].id);
					 });
			    }
			    
			  }
			  com.ixonos.fsc.removeLoadPage();
			  });
			  
}

com.ixonos.editProfile.bindLifeStyleEvent = function()
{
	$('#lifestyleBtn').click(function(){
							 loadPage("html/editProfile.html","com.ixonos.editProfile.onDeviceReady");
							 });
	$('#lifestyleDoneBtn').click(function(){
								 var url = server.serverIp + "rest/profileServer/setProfileLifstyle";
								 var memberIdStr = window.localStorage.getItem(loginUser.memberId);
								 com.ixonos.fsc.loadPage("lifestylePage", 1);
								 
								 $.post(url,{ memberId:memberIdStr,selectedEducation:$('#educationId').val(),selectedStatus:$('#relationShipId').val(),selectedSmoke:$('#smokeId').val(),selectedDrink:$('#drinkId').val(),
										selectedSexuality:$('#sexualId').val()}, 
										function(string){
										//alert(string.status);
										if(typeof string == 'undefined')
										{
										com.ixonos.fsc.serverErrorAlert();
										}
										else if(string.status == -100)
										{
										com.ixonos.fsc.requestHeaderError();
										}
										else{
										switch(string.status)
										{
										case 1:
										loadPage("html/editProfile.html","com.ixonos.editProfile.onDeviceReady");
										break;
										default:
										com.ixonos.fsc.serverErrorAlert();
										break;
										}}
										
										com.ixonos.fsc.removeLoadPage();
										}, "json");
								 
								 
								 });
	
}

com.ixonos.editProfile.bindPhysicalEvent = function()
{
	$('#physicalBtn').click(function(){

							loadPage("html/editProfile.html","com.ixonos.editProfile.onDeviceReady");
							});
	
	$('#physicalDoneBtn').click(function(){
								var url = server.serverIp + "rest/profileServer/setProfilePhysical";
								var memberIdStr = window.localStorage.getItem(loginUser.memberId);
								com.ixonos.fsc.loadPage("physicalPage", 1);
								var feetStringStr, incheStringStr, memberHeightStr;
								
								var imperial = window.localStorage.getItem(loginUser.imperial);
								if(imperial == "true")
								{
								memberHeightStr = "";
								feetStringStr = $('#feetId').val();
								incheStringStr = $('#inchesId').val();
								}
								else
								{																	   
								memberHeightStr = $('#yourHeightId').val();
								feetStringStr = "";
								incheStringStr = "";	
								}
								
								$.post(url,{ memberId:memberIdStr,selectedBuild:$('#bodytypeId').val(),selectedEthnicity:$('#ethinicityId').val(),feetString:feetStringStr,incheString:incheStringStr, selectedHair:"", selectedEye:"",memberHeight: memberHeightStr}, 
									   function(string){
									   //alert(string.status);
									   if(typeof string == 'undefined')
									   {
									   com.ixonos.fsc.serverErrorAlert();
									   }
									   else if(string.status == -100)
									   {
									   com.ixonos.fsc.requestHeaderError();
									   }
									   else{
									   // alert(string.status);
									   switch(string.status)
									   {
									   case 1:
									   loadPage("html/editProfile.html","com.ixonos.editProfile.onDeviceReady");
									   break;
									   case 5:
									   com.ixonos.fsc.alert(editProfile.statusPhysical5, function(){}, public.errTitle, public.okText);
									   break;
									   default:
									   com.ixonos.fsc.serverErrorAlert();
									   break;
									   }}
									com.ixonos.fsc.removeLoadPage();
									   }, "json");
															
								});
	
}

com.ixonos.editProfile.bindBasicEvent = function()
{
	$('#basicBtn').click(function(){
				
						 loadPage("html/editProfile.html","com.ixonos.editProfile.onDeviceReady");
						 });

	
	$('#basicDoneBtn').click(function(){
							 var url = server.serverIp + "rest/profileServer/setProfileBasics";
							 var memberIdStr = window.localStorage.getItem(loginUser.memberId);
							 com.ixonos.fsc.loadPage("basicPage", 1);
							 
							 var dt = new Date();
							 
							 if((dt.getFullYear() - $('#yearId').val()) < 19)
							 {
							 com.ixonos.fsc.removeLoadPage();
							 com.ixonos.fsc.alert(signUpExtra.status10, function(){}, public.errTitle, public.okText);
							 }
							 
							 else if($('#firstNameId').val() == "")
							 {
							 com.ixonos.fsc.removeLoadPage();
							 com.ixonos.fsc.alert(editProfile.statusNullFirstN, function(){}, public.errTitle, public.okText);
							 }
							 else{
							 $.post(url,{ memberId:memberIdStr,firstName: $('#firstNameId').val(), lastName: $('#lastNameId').val(), gender:$('#editSelectGender').val(),
									day:$('#dayId').val(),month:$('#monthId').val(),year:$('#yearId').val(),ZIPCode:$('#zipcodeId').val(),location:$('#cityNameId').val()}, 
									function(string){
									//alert(string.status);
									var errMsg="";
									if(typeof string == 'undefined')
									{
									com.ixonos.fsc.serverErrorAlert();
									}
									else if(string.status == -100)
									{
									com.ixonos.fsc.requestHeaderError();
									}
									else{
									switch(string.status)
									{
									case 1:
									loadPage("html/editProfile.html","com.ixonos.editProfile.onDeviceReady");
									break;
									case 3:
									com.ixonos.fsc.alert(editProfile.status3, function(){}, public.errTitle, public.okText);
									break;
									case 5:
									com.ixonos.fsc.alert(editProfile.status5, function(){}, public.errTitle, public.okText);
									break;
									case 6:
									case 7:
									com.ixonos.fsc.alert(editProfile.status67, function(){}, public.errTitle, public.okText);
									break;
									case 8:
									com.ixonos.fsc.alert(editProfile.status8, function(){}, public.errTitle, public.okText);
									break;
									default:
									com.ixonos.fsc.serverErrorAlert();
									break;
									}}

									
									com.ixonos.fsc.removeLoadPage();
									}, "json");
							 }
							 
							 
							 });
	
	
}

com.ixonos.editProfile.bindEvent =  function()
{
	$('.editProfilecontentText').focus(function(){
							$('.editProfilecontentText').css("color", "#000");
							});
	
	$('.moreAboutMe').click(function(){
	 
							loadPage("html/aboutMe.html","com.ixonos.aboutme.onDeviceReady");
							});
	$('.basicItem').click(function(){
						  loadPage("html/basicProfile.html","com.ixonos.editProfile.basicProfileDeviceReady");
	
						  });
	$('.physicalItem').click(function(){
							 loadPage("html/physicalProfile.html","com.ixonos.editProfile.physicalProfileDeviceReady");
							 });
	$('.lifestyleItem').click(function(){
							  loadPage("html/lifestyleProfile.html","com.ixonos.editProfile.lifestyleProfileDeviceReady");
							  });
	
	
	
	
	$('.points').click(function(){
					   window.localStorage.setItem(buyPointsPage.previousPage,"html/editProfile.html");
					   window.localStorage.setItem(buyPointsPage.previousPageDeviceReadyFunc,"com.ixonos.editProfile.onDeviceReady");
					   loadPage("html/buyPoints.html","com.ixonos.buyPoints.onDeviceReady");

					   });
	
		
		
		
	$('#editProfileBtn').click(function(){
							   loadPage("html/more.html","com.ixonos.more.onDeviceReady");
							   });
						};

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

com.ixonos.editProfile.basicProfileDeviceReady = function()
{
	com.ixonos.editProfile.initBasicHtml();
	//com.ixonos.fsc.addAjaxSend();
	com.ixonos.fsc.initBottomBar("");
	
//	fromTop= $("#firstNameId")[0].offsetTop + $("ul li")[0].offsetTop;
//	fromLeft=$("#firstNameId")[0].offsetLeft + $("ul li")[0].offsetLeft;
//	height= $("#firstNameId")[0].offsetHeight;
//	width= $("#firstNameId")[0].offsetWidth;
//	
//	$('#firstNameIdFrame').css("position","absolute");
//	$('#firstNameIdFrame').css("top",fromTop);
//	$('#firstNameIdFrame').css("height",height);
//	$('#firstNameIdFrame').css("width",width);
//	$('#firstNameIdFrame').css("left",fromLeft);
//	$('#firstNameIdFrame').css("display","block");
//	
//	fromTop= $("#lastNameId")[0].offsetTop + $("ul li")[1].offsetTop;
//	fromLeft=$("#lastNameId")[0].offsetLeft + $("ul li")[1].offsetLeft;
//	height= $("#lastNameId")[0].offsetHeight;
//	width= $("#lastNameId")[0].offsetWidth;
//	
//	$('#lastNameIdFrame').css("position","absolute");
//	$('#lastNameIdFrame').css("top",fromTop);
//	$('#lastNameIdFrame').css("height",height);
//	$('#lastNameIdFrame').css("width",width);
//	$('#lastNameIdFrame').css("left",fromLeft);
//	$('#lastNameIdFrame').css("display","block");
//	
//	fromTop= $("#zipcodeId")[0].offsetTop + $("ul li")[3].offsetTop;
//	fromLeft=$("#zipcodeId")[0].offsetLeft + $("ul li")[3].offsetLeft;
//	height= $("#zipcodeId")[0].offsetHeight;
//	width= $("#zipcodeId")[0].offsetWidth;
//	
//	$('#zipcodeIdFrame').css("position","absolute");
//	$('#zipcodeIdFrame').css("top",fromTop);
//	$('#zipcodeIdFrame').css("height",height);
//	$('#zipcodeIdFrame').css("width",width);
//	$('#zipcodeIdFrame').css("left",fromLeft);
//	$('#zipcodeIdFrame').css("display","block");
//	
//	fromTop= $("#cityNameId")[0].offsetTop + $("ul li")[4].offsetTop;
//	fromLeft=$("#cityNameId")[0].offsetLeft + $("ul li")[4].offsetLeft;
//	height= $("#cityNameId")[0].offsetHeight;
//	width= $("#cityNameId")[0].offsetWidth;
//	
//	$('#cityNameIdFrame').css("position","absolute");
//	$('#cityNameIdFrame').css("top",fromTop);
//	$('#cityNameIdFrame').css("height",height);
//	$('#cityNameIdFrame').css("width",width);
//	$('#cityNameIdFrame').css("left",fromLeft);
//	$('#cityNameIdFrame').css("display","block");
//	
//	com.ixonos.fsc.addCover($('#firstNameIdFrame')[0], $("#firstNameId")[0]);
//	com.ixonos.fsc.addCover($('#lastNameIdFrame')[0], $("#lastNameId")[0]);
//	
//	com.ixonos.fsc.addCover($('#zipcodeIdFrame')[0], $("#zipcodeId")[0]);
//	com.ixonos.fsc.addCover($('#cityNameIdFrame')[0], $("#cityNameId")[0]);
	
	com.ixonos.editProfile.bindBasicEvent();
	com.ixonos.editProfile.getBasicInfo();				  
};


com.ixonos.editProfile.physicalProfileDeviceReady = function()
{
	//com.ixonos.fsc.addAjaxSend();
	com.ixonos.editProfile.initPhysicalHtml();
	com.ixonos.fsc.initBottomBar("");
	com.ixonos.editProfile.bindPhysicalEvent();
	com.ixonos.editProfile.getPhysicalInfo();
};


com.ixonos.editProfile.lifestyleProfileDeviceReady = function()
{
	//com.ixonos.fsc.addAjaxSend();
	com.ixonos.editProfile.initLifeStyleHtml();
	com.ixonos.fsc.initBottomBar("");
	com.ixonos.editProfile.bindLifeStyleEvent();
	com.ixonos.editProfile.getLifeStyleInfo();
};

