
//var storage = localStorage;
var storage = sessionStorage;

function getContentWidth() {
	if(_isEmpty(storage.getItem("_TitleW"))){
		storage.setItem("_TitleW", getTitleWidth());
	}
        if(_isEmpty(storage.getItem("_BlockW"))){
                storage.setItem("_BlockW","10");
        }
        if(_isEmpty(storage.getItem("_Block"))){
                storage.setItem("_Block","100");
        }
	return parseInt(storage.getItem("_TitleW")) + parseInt(storage.getItem("_BlockW")) * parseInt(storage.getItem("_Block")) + 60;
}
function getContentVisibleArea() {
	var eleCont = document.getElementById("content");
	var contTop = eleCont.getBoundingClientRect().top;
	var eleCont2 = document.getElementById("content2");
	var cont2Top = eleCont2.getBoundingClientRect().top;
	var visible = cont2Top-contTop+parseInt(Objects.BlockH*1.5);
	var accStr = eleCont.scrollTop;
	var skipTop = parseInt(accStr/Objects.BlockH);	// considering value=0
	var visibleCont = parseInt(visible/Objects.BlockH);	//top +1 bottom +1

	var baseobj=new Object(_getList("db"));

	if(isNaN(skipTop)) skipTop = 1;
	if(isNaN(visibleCont)) visibleCont = baseobj.length - 1;
/*
	if(isNaN(visibleCont)){
		if(visibleCont > baseobj.length){
			visibleCont = baseobj.length - 1;
		} else {
			visibleCont = parseInt(cont2Top/storage.getItem("_BlockH"));
		}
	} else {
		if(visibleCont > baseobj.length){
			visibleCont = baseobj.length - 1;
		} else {
			visibleCont =visibleCont - 1;
		}
	}
*/
	if(skipTop==0) skipTop=1;
//console.log("Test:" + skipTop + ", " + visibleCont);

	return {"top":skipTop, "count":visibleCont};
}
function getTitleWidth() {
	var en=new Object(JSON.parse(storage.getItem("_Env")));
	if(!_isEmpty(en.accession_cvs_width)){
		return parseInt(en.accession_cvs_width);
	} else if(storage.getItem("_Name") == "id"){
		return 180;
	} else {
		return 220;
	}
}
