// JavaScript Document


function TNCom_getDocumentSize(val)
{
	var xScroll,yScroll,value;
	
	if(window.innerHeight&&window.scrollMaxY)
	{
		xScroll=window.innerWidth+window.scrollMaxX;
		yScroll=window.innerHeight+window.scrollMaxY;
	}
	else if(document.body.scrollHeight>document.body.offsetHeight)
	{
		xScroll=document.body.scrollWidth;
		yScroll=document.body.scrollHeight;
	}
	else{
		xScroll=document.body.offsetWidth;
		yScroll=document.body.offsetHeight;
	}
	
	var windowWidth,windowHeight;
	
	if(self.innerHeight)
	{
		if(document.documentElement.clientWidth){
			windowWidth=document.documentElement.clientWidth;
		}
		else{
			windowWidth=self.innerWidth;
		}
		windowHeight=self.innerHeight;
	}
	else if(document.documentElement&&document.documentElement.clientHeight)
	{
		windowWidth=document.documentElement.clientWidth;
		windowHeight=document.documentElement.clientHeight;
	}
	else if(document.body)
	{
		windowWidth=document.body.clientWidth;
		windowHeight=document.body.clientHeight;
	}
	
	if(yScroll<windowHeight){
		pageHeight=windowHeight;
	}
	else{
		pageHeight=yScroll
	}
	
	if(xScroll<windowWidth){
		pageWidth=xScroll
	}
	else{
		pageWidth=windowWidth
	}
	
	arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)	
	return arrayPageSize[val]
}// end function
/**********/


function showHideIdAuto_headertop() {
    if (document.getElementById('list_name_top').style.display ==''){
        document.getElementById('list_name_top').style.display = 'none';
		document.getElementById('id_select').style.display = '';
		document.getElementById('collap_js').className = 'pic_js';
	}
    else{ 
        document.getElementById('list_name_top').style.display = '';
		document.getElementById('collap_js').className = 'pic_js_up';
		document.getElementById('id_select').style.display = 'none';
		//document.getElementById('menu_theloaianh').style.display = 'none';
		//document.getElementById('id_select').className = 'width_184';
	}

    return;
}
function showHideIdAuto_header_sh() {
    if (document.getElementById('open_js').style.display ==''){
        document.getElementById('open_js').style.display = 'none';
		document.getElementById('collap_sh_js').className = 'pic_sh_down_js';
	}
    else{ 
        document.getElementById('open_js').style.display = '';
		document.getElementById('collap_sh_js').className = 'pic_sh_up_js';
	}
    return;
}


function hide_js(){
	document.getElementById('list_name_top').style.display = 'none'
	document.getElementById('collap_js').className = 'pic_js';
	document.getElementById('id_select').style.display = 'block';
	//document.getElementById('id_select').className = 'width_184';
}

/*function showHide_Theloaianh() {
	if (document.getElementById('menu_theloaianh').style.display ==''){
        document.getElementById('menu_theloaianh').style.display = 'none';
		document.getElementById('id_select').className = 'width_184';
	}
    else{ 
        document.getElementById('menu_theloaianh').style.display = '';
		document.getElementById('id_select').className = 'width_133';
	}
    return;
}
*/


var curentContent="cont1";
var int;
function tommi_active_tab(obj, num){

		var curentTab=obj.id;
		var curentContent_1=curentTab.replace("tab","cont");
		switch(num){
			case 0:
				curentContent=curentTab.replace("tab","cont");
				var tabs=$('#' + curentTab).parent().children();
				var contents=$('#' + curentContent).parent().children();
				window.clearInterval(int)
				int=setInterval("loadPage()",5000);	
				break;
			case 1:
				curentContent_1=curentTab.replace("tab","cont");
				var tabs=$('#' + curentTab).parent().children();
				var contents=$('#' + curentContent_1).parent().children();
				break;
			case 2:
				curentContent_2=curentTab.replace("tab","cont");
				var tabs=$('#' + curentTab).parent().children();
				var contents=$('#' + curentContent_2).parent().children();
				break;
			case 3:
				curentContent_3=curentTab.replace("tab","cont");
				var tabs=$('#' + curentTab).parent().children();
				var contents=$('#' + curentContent_3).parent().children();
				break;
		}
		
		$(tabs).each( function(){								
				$(this).attr('class','');
		});
		$(contents).each( function(){								
				$(this).hide();
		});
		
		$('#' + curentTab).addClass('active_tab');
		switch(num){
			case 0:
				$('#' + curentContent).fadeIn('slow');	
				break;
			case 1:
				$('#' + curentContent_1).fadeIn('slow');	
				break;
			case 2:
				$('#' + curentContent_2).fadeIn('slow');	
				break;
			case 3:
				$('#' + curentContent_3).fadeIn('slow');	
				break;
		}		 	
	}
	
function change_fl(obj){
	clearTimeout(t);
	closeAllTab();
	var idTab = document.getElementById(obj).id;
	var idShowBox = idTab.replace("tab_fl","content_fl");
	document.getElementById(idShowBox).style.display='block';
	document.getElementById(idTab).className='active_fl';
}
function closeAllTab(){
	for(var i=1; i<6; i++){
		document.getElementById('content_fl'+i).style.display='none'
		document.getElementById('tab_fl'+i).className='';
	}
}
var j=1;
var t;	
function auto_change(){		
	if(j<5) j++;
	else j=1;
	var tab_fl= "tab_fl" + j;	
	change_fl(tab_fl);		
	t = setTimeout('auto_change()',3000);
}
window.onload=auto_change;
