var opened = 0;
var intID = '';

function opn_btns(objid){

	document.getElementById(objid).style.display = 'block';

}

function close_btns(objid){

	document.getElementById(objid).style.display = 'none';
}


rld = function(){
	document.location.href = document.location.href;
};

function setIntv(){
	if (intID != '') window.clearInterval(intID);
	intID = setInterval("rld()", 60000*1000);
}

//setIntv();

/* title page cross script */
var cur_node = 0;
var ivalCross = null;

var oSwitchImgs = new Array();

oSwitchImgs[0] = 'p-prev-dsbl';
oSwitchImgs[1] = 'p-prev';
oSwitchImgs[2] = 'p-next-dsbl';
oSwitchImgs[3] = 'p-next';

function swtch_ttl_news(direction){

	// back
	if (direction == 0){
		var tmp_node = cur_node-1;
	} else {
	// forward
		var tmp_node = cur_node+1;
	}

	var oTmp = document.getElementById('ttl_news'+tmp_node);
	if (oTmp != undefined){
		cur_node = tmp_node;
		oTmp.style.display = 'block';
		
		var oTtl = false;

		if (cur_node == 0){
			document.getElementById('ttl-prev-img').className=oSwitchImgs[0];

		} else {
			document.getElementById('ttl-prev-img').className=oSwitchImgs[1];
		}
		
		var i = 0;
		while (document.getElementById('ttl_news'+ i) != undefined){
			if (i != cur_node){
				document.getElementById('ttl_news'+ i).style.display = 'none';
			}
			
			i++
		}
		// check next page

		if (document.getElementById('ttl_news'+ (cur_node + 1)) != undefined){
			
			document.getElementById('ttl-next-img').className=oSwitchImgs[3];
		} else {
			document.getElementById('ttl-next-img').className=oSwitchImgs[2];
		}
	}
}

function cross_news(){

	swtch_ttl_news(1);

	var oTmp = document.getElementById('ttl_news'+(cur_node+1));
	if (oTmp == undefined){
		cur_node = -1;
	}

}

function clearIntAndMove(to){
	if (ivalCross != null){
		clearInterval(ivalCross);
	}
	swtch_ttl_news(to);
}

/* function added phrase to the page */
function showPhrase(){

	if (oPhrases != undefined && $_('phCont') != undefined){
		var elem_id = Math.floor(Math.random()*oPhrases.length);
		
		$_('phCont').innerHTML = oPhrases[elem_id].title+'<div>'+oPhrases[elem_id].author+'</div>';
		
	}
}