/***********************************************************************************
* f_c_getJSONObj  
* By Lim Sung Hyun
* input : 
* output : json obj
***********************************************************************************/
function f_c_getJSONObj(xmlDoc){

	var node = xmlDoc.getElementsByTagName("JSON");
	var jsonText = node.item(0).firstChild.nodeValue;
	var obj = jsonText.evalJSON(true); 
	
	return obj;
}

function getIsLoggedInAjax() {
	var isLoggedIn = 'false';
	var myAjax = new Ajax.Request(
		'web.member.loggedInAjax.dev',
		{
			method : 'POST',
			onComplete : function(request) {
				var obj = f_c_getJSONObj(request.responseXML);
				isLoggedIn	= obj.body.isLoggedIn;
			},
			onFailure : function() {
				var str = '';
				str += 'getIsLoggedInAjax(web.member.loggedInAjax.dev)' + '\n';
				str += 'Failuer' + '\n';
				//f_c_messageDiv_open(str,'');
			},
			asynchronous : false
		}
	);
	this.isLoggedIn	= isLoggedIn;
}

function getIsPurchaseAjax(applId) {
	var isPurchase = 'false';
	var myAjax = new Ajax.Request(
		'web.member.purchaseAjax.dev',
		{
			method : 'POST',
			parameters : {'applId' : applId},
			onComplete : function(request) {
				var obj = f_c_getJSONObj(request.responseXML);
				isPurchase = obj.body.isPurchase;
			},
			onFailure : function() {
				var str = '';
				str += 'getIsPurchaseAjax(web.member.purchaseAjax.dev)' + '\n';
				str += 'Failuer' + '\n';
				//f_c_messageDiv_open(str,'');
			},
			asynchronous : false
		}	
	);
	this.isPurchase = isPurchase;
}

function getIsChargeFreeItemAjax(applId, ip) {
	var isChargeFreeItem = 'false';
	var myAjax = new Ajax.Request(
		'web.member.chargeFreeItemAjax.dev',
		{
			method : 'POST',
			parameters : {'applId' : applId, 'ip' : ip},
			onComplete : function(request) {
				var obj = f_c_getJSONObj(request.responseXML);
				isChargeFreeItem = obj.body.isChargeFreeItem;
			},
			onFailure : function() {
				var str = '';
				str += 'getIsChargeFreeItemAjax(web.member.chargeFreeItemAjax.dev)' + '\n';
				str += 'Failuer' + '\n';
				//f_c_messageDiv_open(str,'');
			},
			asynchronous : false
		}	
	);
	this.isChargeFreeItem = isChargeFreeItem;
}

function getAccountTypeAjax(applId) {
	var accountType = '';
	var myAjax = new Ajax.Request(
		'web.member.accountTypeAjax.dev',
		{
			method : 'POST',
			parameters : {'applId' : applId},
			onComplete : function(request) {
				var obj = f_c_getJSONObj(request.responseXML);
				accountType = obj.body.accountType;
			},
			onFailure : function() {
				var str = '';
				str += 'getAccountTypeAjax(web.member.accountTypeAjax.dev)' + '\n';
				str += 'Failuer' + '\n';
				//f_c_messageDiv_open(str,'');
			},
			asynchronous : false
		}
	);
	this.accountType = accountType;
}

function getWishListAjax(mncd1, applId) {
	var result = '';
	var myAjax = new Ajax.Request(
		'web.common.CreateWingWishAjax.dev',
		{
			method : 'POST',
			parameters : {'applId' : applId,
			              'mncd1' : mncd1   
			},
			onComplete : function(request) {
				var obj = f_c_getJSONObj(request.responseXML);
				wishList = obj.body.result;
			},
			onFailure : function() {
				var str = '';
				str += 'getWishListAjax(web.common.CreateWingWishAjax.dev)' + '\n';
				str += 'Failuer' + '\n';
				//f_c_messageDiv_open(str,'');
			},
			asynchronous : false
		}
	);
	this.result = wishList;
}

function getAgeYnAjax(applId) {
	var ageYn = '';
	var applName = '';
	var myAjax = new Ajax.Request(
		'web.member.AgeYnAjax.dev',
		{
			method : 'POST',
			parameters : {'applId' : applId},
			onComplete : function(request) {
				var obj = f_c_getJSONObj(request.responseXML);
				ageYn = obj.body.ageYn;
				applName = obj.body.applName;
			},
			onFailure : function() {
				var str = '';
				str += 'getAgeYnAjax(web.member.AgeYnAjax.dev)' + '\n';
				str += 'Failuer' + '\n';
				//f_c_messageDiv_open(str,'');
			},
			asynchronous : false
		}
	);
	this.ageYn = ageYn;
	this.applName = applName;
}

function getIsSupportPhoneAjax(applId) {
	var modelCode = '';
	var platformCheck = '';
	var myAjax = new Ajax.Request(
		'web.member.IsSupportPhoneAjax.dev',
		{
			method : 'POST',
			parameters : {'applId' : applId},
			onComplete : function(request) {
				var obj = f_c_getJSONObj(request.responseXML);
				modelCode = obj.body.modelCode;
				platformCheck = obj.body.platformCheck;
			},
			onFailure : function() {
				var str = '';
				str += 'getIsSupportPhoneAjax(web.member.IsSupportPhoneAjax.dev)' + '\n';
				str += 'Failuer' + '\n';
				//f_c_messageDiv_open(str,'');
			},
			asynchronous : false
		}
	);
	this.modelCode = modelCode;
	this.platformCheck = platformCheck;
}
