/**
 * Global Variable
 *
 */
var tab_change_interbal_ms = 2000;	//2sec
var dom = new Object();
dom.ajax = new Object();
dom.event = new Object();


/**
 * Ajax
 *
 */
dom.ajax.httpGetRequest = function(url, callback, headers) {
	/* Create XMLHttpRequest Object */
	var oHttp = null;
	if(window.XMLHttpRequest) {
		oHttp = new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		try {
			oHttp = new window.ActiveXObject("Msxml2.XMLHTTP.3.0");
		} catch(e) {
			return null;
		}
	}
	if( oHttp != null ) {
		/* HTTP GET Request */
		oHttp.open('GET', url, true);
		/* Set Request Header */
		if( typeof(headers) == 'object' ) {
			for(var name in headers) {
				oHttp.setRequestHeader(name, headers[name]);
			}
		}
		/* Define the Callback Function of the state change evnet */
		oHttp.onreadystatechange = function() {
			if (oHttp.readyState == 4) {
				callback(oHttp);
			}
		};
		/* Send HTTP GET Request*/
		oHttp.send(null);
	}
	/* Return oHttp Object */
	return oHttp;
};


/**
 * Event
 *
 */
dom.event.addEventListener = function(elm, type, func, useCapture) {
	if(! elm) { return false; }
	if(! useCapture) {
		useCapture = false;
	}
	if(elm.addEventListener) {
		elm.addEventListener(type, func, false);
	} else if(elm.attachEvent) {
		elm.attachEvent('on'+type, func);
	} else {
		return false;
	}
	return true;
};

dom.event.target = function(evt) {
	/* W3C DOM browser */
	if(evt && evt.target) {
		/* for Safari 1.3 */
		if(evt.target.nodeType == 3) {
			return evt.target.parentNode;
		} else {
			return evt.target;
		}
	/* Internet Explorer */
	} else if(window.event && window.event.srcElement) {
		return window.event.srcElement;
	/* other */
	} else {
		return null;
	}
};


/**
 * Set EventListener
 *
 */
dom.event.addEventListener(window, 'load', initDocument);
function initDocument() {
	simplePopup();
}


/**
 * Area Menu
 *
 */
function simplePopup() {
	
	var Parent = document.getElementById('areaList').getElementsByTagName('DL');
	var ParentLength = Parent.length;
	
	for(var i = 0; i < ParentLength; i++){	
		Parent[i].onmouseover = function() {
				this.className = "on";
//				this.setAttribute('class','on');
//				this.setAttribute("class", this.getAttribute("class").replace("off", "on"));
			}
		Parent[i].onmouseout = function() {
				this.className = "off";
//				this.setAttribute('class','off');
//				this.setAttribute("class", this.getAttribute("class").replace("on", "off"));
			 }
	}
	
}


/**
 * Count
 *
 */
function ccab (id){
	var url = '/advertisesbannercounts/index/'+id+'/';
	var callback = function(oHttp){};
	var oHttp = dom.ajax.httpGetRequest(url, callback);
	if (!oHttp) {}
}
function ccat (id){
	var url = '/advertisecounts/index/'+id+'/';
	var callback = function(oHttp){};
	var oHttp = dom.ajax.httpGetRequest(url, callback);
	if (!oHttp) {}
}
function ccas (id){
	var url = '/shopcounts/index/'+id+'/';
	var callback = function(oHttp){};
	var oHttp = dom.ajax.httpGetRequest(url, callback);
	if (!oHttp) {}
}
