if(typeof caseinc === "undefined") caseinc = {};
var hostName = location.hostname;
/**
 * Script: net.js
 * Class: caseinc.ajax
 * Copyright (c) 2011 [CASE Inc. (http://caseinc.jp/)]
*/
caseinc.ajax = function()
{
	/**
	 * Ajax通信成功時の処理
	 */
	this.handleSuccess = function(response_data, dataType){};
	
	/**
	 * Ajax通信失敗時の処理
	 */
	this.handleError = function(XMLHttpRequest, textStatus, errorThrown){};
	
	/**
	 * Ajax通信終了時の処理
	 */
	this.handleComplete = function(XMLHttpRequest, textStatus){};
	
	/**
	 * Ajax通信処理
	 * @param url  
	 * @param data POSTデータ（連想配列）
	 * @param method POST/GET
	 * @param data_type default:json
	 */
	this.sendData = function(url, data, method, data_type)
	{
		if(method === undefined) method = "POST";
		if(data_type === undefined) data_type = "json";
		new $.ajax({
			type: method,
			url: url,
			data: data,
			dataType: data_type,
			success: this.handleSuccess,
			error: this.handleError,
			complete: this.handleComplete
		});
		return false;
	};
};
