//layer hiddener
function shSec(id)
{
	if(!document.getElementById) return;
	var o=document.getElementById(id);
	if(o)
	{
		if(o.style.display=="block")
			o.style.display="none";
		else
			o.style.display="block";
	}
}

//show a layer
function hideL(id)
{
	if(!document.getElementById) return;
	var o=document.getElementById(id);
	o.style.display="none";
}

//hide a layer
function showL(id)
{
	if(!document.getElementById) return;
	var o=document.getElementById(id);
	o.style.display="block";
}

//popup opener
function go(wintype,w,h,command)
{
  st=new String("toolbar=no,directories=no,status=no,scrollbars=no,menubar=no,width="+w+",height="+h);
  picture=window.open(wintype+command,"picture",st);
  picture.window.focus();
}

//layer hiddener with iconchanger
function FShow(id,icono,iconc)
{
	if(!document.getElementById) return;
	var o=document.getElementById(id);
	var i=document.getElementById('b'+id);
	if(o)
	{
		if(o.style.display=="block")
		{
			o.style.display="none";
			i.src=iconc;
		}
		else
	 {
			o.style.display="block";
			i.src=icono;
	 }
	}
}


function lineBrowse(prefix,me,maxn)
{
	for(i=0; i < maxn; i++)
	{
	  o = document.getElementById(prefix+String(i));
	  o.style.display="none";
	}
	o = document.getElementById(prefix+String(me));
	o.style.display="block";
}

function exxiteTab(prefix,me,maxn)
{
	for(i=0; i < maxn; i++)
	{
	  o = document.getElementById(prefix+String(i));
	  o.className='tab';
	  o = document.getElementById('t'+prefix+String(i));
	  o.className='tabpanel';
	}
	o = document.getElementById(prefix+String(me));
	o.className='seltab';
	o = document.getElementById('t'+prefix+String(me));
	o.className='seltabpanel';
}

// Leap year detector for date scripts
function exxiteLeapYear(year)
{
	if(year%4 == 0)
	{
		if(year%100 != 0)
		{
			return(true);
		}
		else
		{
			if(year%400 == 0){return(true);}else{return(false);}
		}
	}
  return(false);
}


function exxiteDateToUnixtime(oyear,omonth,oday,ohour,ominute)
{
		var humDate = new Date(Date.UTC(oyear,(omonth-1),oday,ohour,ominute,0));
		return(humDate.getTime()/1000.0);
}

//Date control javascript----------------------------
function exxiteDateControl(mid,control,syear,eyear)
{
	if(!document.getElementById) return;
	oyear=document.getElementById(mid+'_year');
	omonth=document.getElementById(mid+'_month');
	oday=document.getElementById(mid+'_day');
	ohour=document.getElementById(mid+'_hour');
	ominute=document.getElementById(mid+'_minute');
	ostamp=document.getElementById(mid+'_stamp');
	myear=parseInt(oyear.value);
	mmonth=parseInt(omonth.value);
	mday=parseInt(oday.value);
	mhour=parseInt(ohour.value);
	mminute=parseInt(ominute.value);
	leap=exxiteLeapYear(myear);
	if(control=='y')
	{
		oyear.options.length=0;
		for(i=syear; i<=eyear; i++)
		{
			  oyear.options[i-syear]=new Option(i,i);
			  if(i==myear) oyear.selectedIndex=i-syear;
		}
	}
	if(control=='m' || (control=='y'))
	{
		if((mmonth==4) || (mmonth==6) || (mmonth==9) || (mmonth==11)) max=30;
	  if((mmonth==1) || (mmonth==3) || (mmonth==5) || (mmonth==7)  || (mmonth==8) || (mmonth==10)  || (mmonth==12)) max=31;
	  if(mmonth==2)
	  {
	  	max=28;
	  	if(leap) max=29;
	  }
	  oday.options.length=0;
	  for(i=0; i < max; i++)
		{
      	oday.options[i]=new Option(String(i+1),String(i+1));
		}
		if(mday>max) mday=2;
		oday.selectedIndex=mday-1;
	}
	var humDate = new Date(Date.UTC(myear,mmonth,mday,mhour,mminute,0));
	;
	ostamp.value=humDate.getTime()/1000.0;
}