/**
 *@class Entry
 *@extends Div
 */


var Entry = Class.create();


Entry.prototype = Object.extend(new Div, {


	/**
	 *@constructor initialize
	 */
	initialize: function (id,parentObj,no,entryId) {
		this.id=id;
		this.parentObj=parentObj;
		this.no=no;
		this.entryId=entryId;


		this.createDiv();


//		this.displayLoading();


		this.reqEntry();
	},



	/**
	 *reqEntry
	 *DBからエントリーをリクエスト
	 */
	reqEntry: function(){


		/* Ajax.Request */
		var req = new Ajax.Request("../src/php/request/entry.php",{
			method: "get",
			parameters: "entry_id="+this.entryId,
			onComplete: this.display.bind(this)	//this.display関数呼び出し
		});


	},





	/**
	 *display
	 */
	display: function (request) {


		/* request */
		var json=eval("("+request.responseText+")");


		/* html */
		var html='';


		/* title */
		html+='<div id="'+this.id+'_title">';
			/* newFlg */
			//console.log(json.newFlg);
			if(json.newFlg==1){
				html+='<img src="../style/img/new.jpg" /><br />';
			}
			/* title */
			var func='onOpenBrowse('+this.entryId+','+categoryAll.category_id[this.no]+')';
			var anc='/entry_id='+this.entryId+'/category_id='+categoryAll.category_id[this.no];
			html+='<a href="#mode=browse'+anc+'" onClick='+func+'>';
				html+=json.title;
			html+='</a>';
		html+='</div>';



		html+='<div id="'+this.id+'_top_text">';
			html+='<span class="top_text">';
				html+=json.top_text+'<br clear="all" />';
			html+='<a href="#mode=browse'+anc+'" onClick='+func+'>more ...</a>';
		html+='</span>';
		html+='</div>';

		html+='<div id="'+this.id+'_footer">';
		html+=json.uptime+' | clicked : '+json.log;
		html+='</div>';

		//html+='<hr class="category'+categoryAll.category_id[this.no]+'_hr">';



		$(this.id).innerHTML=html;


		/* setStyle */
		this.setStyle();


		/* onInit */
		onInit();


	},


	/**
	 *displayLoading
	 */
	displayLoading: function () {


		/* html */
		var html='';


		html+='<div id="'+this.id+'_title">';
		html+='loading id:'+this.entryId+'...';
		html+='</div>';
		html+='<div id="'+this.id+'_topText">';
		html+='<span class="top_text">';
		html+='</span>';
		html+='</div>';
		html+='<div id="'+this.id+'_footer">';
		//html+='yyyy-mm-dd hh:mm:ss | clicked : 0';
		html+='</div>';


		$(this.id).innerHTML=html;


		/* setStyle */
		this.setStyle();


		/* onInit */
		onInit();


	},





	/**
	 *setStyle
	 */
	setStyle: function () {
		Element.setStyle($(this.id),{
			backgroundColor	:'#ffffff',


			fontFamily		:'Times, serif',
			fontSize		:'11px',
			lineHeight		:'18px',


			marginLeft		:'0px',
			marginRight		:'0px',
			marginTop		:'10px',
			marginBottom	:'20px',


			position		:'static',	//配置方式:static(default),relative,absolute,fixed,inherit
			overflow		:'hidden'	//スクロールバー制御:visible,hidden,scroll,auto,inherit
		});



		Element.setStyle($(this.id+"_title"),{
			//backgroundColor	:"rgb(255,255,255)",
			color			:categoryAll.category_color[this.no],
			fontFamily		:"Osaka, sans-serif",
			fontSize		:"12px",
			lineHeight		:"20px",
			fontWeight		:"bold",


			marginLeft		:"0px",
			marginRight		:"0px",
			marginTop		:"0px",
			marginBottom	:"0px",
			paddingLeft		:"6px",
			paddingRight	:"0px",
			paddingTop		:"0px",
			paddingBottom	:"0px",


			borderColor			:categoryAll.category_color[this.no],
			borderLeftWidth		:"4px",
			borderRightWidth	:"0px",
			borderTopWidth		:"0px",
			borderBottomWidth	:"0px",
			borderStyle			:"solid"


		});


		//alert($(category.id).getWidth());


		Element.setStyle($(this.id+"_top_text"),{
			//width			:$(category[0].id).getWidth()+"px",
			fontFamily		:"Osaka, sans-serif",
			fontSize		:"11px",
			lineHeight		:"19px",
			marginLeft		:"0px",
			marginRight		:"0px",
			marginTop		:"0px",
			marginBottom	:"0px",
			paddingLeft		:"10px",
			paddingRight	:"10px",
			paddingTop		:"10px",
			paddingBottom	:"10px",


			overflow		:'hidden'	//スクロールバー制御:visible,hidden,scroll,auto,inherit


		});


		Element.setStyle($(this.id+"_footer"),{
			//backgroundColor	:categoryAll.category_color[this.no],
			color			:categoryAll.category_color[this.no],
			fontFamily		:"Helvetica, sans-serif",
			fontSize		:"11px",
			lineHeight		:"16px",

			marginLeft		:"0px",
			marginRight		:"0px",
			marginTop		:"0px",
			marginBottom	:"0px",
			paddingLeft		:"6px",
			paddingRight	:"0px",
			paddingTop		:"0px",
			paddingBottom	:"20px",

			borderColor			:categoryAll.category_color[this.no],
			borderLeftWidth		:"0px",
			borderRightWidth	:"0px",
			borderTopWidth		:"0px",
			borderBottomWidth	:"1px",
			borderStyle			:"dotted"
		});

		/*
		Element.setStyle($(this.id+"_footer"),{
			color			:categoryAll.category_color[this.no],
			fontFamily		:"Helvetica, sans-serif",
			fontSize		:"11px",
			lineHeight		:"16px",
			marginLeft		:"0px",
			marginRight		:"0px",
			marginTop		:"0px",
			marginBottom	:"0px",
			paddingLeft		:"10px",
			paddingRight	:"10px",
			paddingTop		:"0px",
			paddingBottom	:"0px"
		});
		*/

	}





});
