/**
 * @author kyo
 * html util
 */



cc.kyo.javascript.html.includeJS=function(src) {
	HTMLCode = '<script type="text/javascript" src="' + src + '"></script>';
	document.write(HTMLCode);
};

cc.kyo.javascript.html.includeCSS=function(href) {

	var kBengin = href.lastIndexOf("/")+1;
	var kEnd = href.lastIndexOf(".");
	var kTitle = href.substring(kBengin,kEnd);
	HTMLCode = '<link type="text/css" rel="stylesheet" '+ ' href="' + href + '" ></link>';
	document.write(HTMLCode);
};


/**
 * the coordinate data //坐标的数据结构
 */
cc.kyo.javascript.html.Coords = function(x,y){
	if(x){
		this.x = x;
	}
	if(y){
		this.y = y;	
	}
};
cc.kyo.javascript.html.Coords.prototype={
	x:0,
	y:0,
	setX:function(param){
		this.x= param;
	},
	getX:function(){
		return this.x;
	},
	setY:function(param){
		this.y= param;
	},
	getY:function(){
		return this.y;
	}
};


/**
 * the absolute  event coordinates //事件的绝对坐标
 */
cc.kyo.javascript.html.AbsCoords=function(event){
	
	this.x = event.clientX + document.body.scrollLeft;
	this.y = event.clientY + document.body.scrollTop;
	this.coords =  new cc.kyo.javascript.html.Coords(this.x,this.y);
	return this.coords;
};
cc.kyo.javascript.html.AbsCoords.prototype={
	x:0,
	y:0,
	coords:null,
	setX:function(param){
		this.x= param;
	},
	getX:function(){
		return this.x;
	},
	setY:function(param){
		this.y= param;
	},
	getY:function(){
		return this.y;
	},
	setCoords:function(param){
		this.coords= param;
	},
	getCoords:function(){
		return this.coords;
	}
};


/**
 * the RECT data(left,top,width,height) //对象的RECT结构
 */
cc.kyo.javascript.html.RECT=function(left,top,width,height){
	if(left){
		this.left=left;
	}
	if(top){
		this.top=top;
	}
	if(width){
		this.width=width;
	}
	if(height){
		this.height=height;
	}
};
cc.kyo.javascript.html.RECT.prototype={
	left:0,
	top:0,
	width:0,
	height:0,
	setLeft:function(param){
		this.left= param;
	},
	getLeft:function(){
		return this.left;
	},
	setTop:function(param){
		this.top= param;
	},
	getTop:function(){
		return this.top;
	},
	setWidth:function(param){
		this.width= param;
	},
	getWidth:function(){
		return this.width;
	},
	setHeight:function(param){
		this.height= param;
	},
	getHeight:function(){
		return this.height;
	}
};








