
//jes
var jes={};
jes.$=function(s) { return document.getElementById(s) };
jes.getEl=function(e){var E=jes.getE(e);return E.target || E.srcElement}
jes.getE=function(e){return e || window.event}
jes.addEvent=function(object, type, listener) {	
	if(object.addEventListener) {if(type=='mousewheel')type='DOMMouseScroll'; object.addEventListener(type, listener, false)}
	else { object.attachEvent("on"+type, listener); }
};
jes.stopEvent=function(event) {
	var e=event || window.event;
	if(e.preventDefault) {e.preventDefault(); e.stopPropagation(); }
	else {e.returnValue = false; e.cancelBubble = true;}
};
jes.FlashAjax = function(options) {
	this.options={
		url:'',
		method:'GET',
		contentType: 'application/x-www-form-urlencoded',
		encoding:'UTF-8',
		param:null,
		timeout:1000
	}
	Object.extend(this.options, options);
	this.data=[];
	this.send();
}
jes.FlashAjax.swf_url = "http://photo-section.daum-img.net/out/FlashAjax.swf";
jes.FlashAjax.prototype={
	send:function(){
		this.data=this.options.param;
		var swf=(navigator.appName.indexOf("Microsoft")!=-1)?window['JESFlashAjax']:document['JESFlashAjax'];
		swf.httpRequest(this);
	}
};
jes.FlashAjax.print=function(){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="0" height="0" id="JESFlashAjax"><param name="allowScriptAccess" value="always" /><param name="movie" value="'+jes.FlashAjax.swf_url+'" /><embed src="'+jes.FlashAjax.swf_url+'" width="0" height="0" name="JESFlashAjax" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');	
};

//--------------------------------------------------------------------

var xy={};

xy.key = (typeof(xy_page_key) == "undefined") ? encodeURIComponent(location.href.split("?")[0]):xy_page_key;

xy.chkAtag=function(a){
	return a.tagName=="A" && a.href!="" && a.href!="#";
};
xy.getNodeIndex=function(el){
	if(el && el.parentNode)
	{
		var childs = el.parentNode.childNodes;

		for(var i=0,j=0; i<childs.length; i++)
		{
			if(childs[i].nodeType!=1) continue; //ff
			if(childs[i] == el )return j;
			j++;
		}
	}
	return -1;
};
xy.getPath=function(el){
	var node = el;

	var s='';
	var index=-1;
	var id='';
	while(node && node.nodeType==1 && node.tagName!="BODY" && node.tagName!="HTML")
	{
		index=xy.getNodeIndex(node);
		id=(node.id && node.className.indexOf("xy")==-1) ? '@'+node.id:'';
		s+=node.tagName+':'+index+id+'/';
		node = node.parentNode;
	}	
	return s;
};
xy.click=function(event){	
	//var timer=(new Date().getTime());
	var e=jes.getE(event);
	var el=jes.getEl(event);
	
	//일반 a태그 ,링크있는 이미지
	if( xy.chkAtag(el) || el.tagName=="IMG" && xy.chkAtag(el.parentNode))
	{
		xy.call(el);		
	}
	//jes.stopEvent(event);
};
//--------------------------------------------------------------------
if(typeof(xy_page_key)!='undefined')
{
	jes.FlashAjax.print();
	jes.addEvent(document ,'click', xy.click);
}