moving=setTimeout('null',1);

tblname = 'email';
tblOutname = 'Viewpoint';
CrtName = 'crtEmail';
function TblVisible()
{
	aBox.style.display="block";
	if (parseInt(aBox.style.height)<146)
	{
		clearTimeout(moving);
		moving = setTimeout('TblVisible()', 1);
		slideMenu(5);
	}
	else
	{
		if(document.all[tblOutname].style.display=="block")
			document.all[tblOutname].style.display="none"
		document.all[tblname].style.display="block";
	}
}
function slideMenu(num)
{
	aBox.style.height = parseInt(aBox.style.height) + num ;
}
function TblVisibleBack()
{

	document.all[tblname].style.display="none";
		clearTimeout(moving);
		moving = setTimeout('TblVisibleBack2()', 1);

}
function TblVisibleBack2()
{
	if (parseInt(aBox.style.height)>0)
	{
		clearTimeout(moving);
		moving = setTimeout('TblVisibleBack2()', 1);
		slideMenu(-5);
	}
	else
	{
		aBox.style.display="none";
	}

}
function CrtMenu()
{
	if (crtEmail.onmouseout=='' || CrtVot.onmouseout=='')
	{
		crtEmail.onmouseout = TblVisibleBack;
		CrtVot.onmouseout = TblVisibleBack;
	}
	else
	{
		crtEmail.onmouseout = "";
		CrtVot.onmouseout = "";

	}
}

function moveDualList( srcList, destList, moveAll ) 
{
  if (  ( srcList.selectedIndex == -1 ) && ( moveAll == false )   )
  {
    return;
  }
  newDestList = new Array( destList.options.length );
  var len = 0;
  for( len = 0; len < destList.options.length; len++ ) 
  {
    if ( destList.options[ len ] != null )
    {
      newDestList[ len ] = new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );
    }
  }
  for( var i = 0; i < srcList.options.length; i++ ) 
  { 
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )

    {
       newDestList[ len ] = new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );
       len++;
    }
  }
  newDestList.sort( compareOptionValues );   // BY VALUES
  for ( var j = 0; j < newDestList.length; j++ ) 
  {
    if ( newDestList[ j ] != null )
    {
      destList.options[ j ] = newDestList[ j ];
    }
  }
  for( var i = srcList.options.length - 1; i >= 0; i-- ) 
  { 
    if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) )

    {
       srcList.options[i]       = null;
    }
  }
}
function compareOptionValues(a, b) 
{ 
  var sA = parseInt( a.value, 36 );  
  var sB = parseInt( b.value, 36 );  
  return sA - sB;
}
function MovePanel(FirstP, SecondP)
{
	down = 1
	col = FirstP;
	sl = document.fm[FirstP].selectedIndex;
	if (sl != -1 && document.fm[FirstP].options[sl].value > "") 
	{
		document.fm[FirstP].insertBefore
	    oText = document.fm[FirstP].options[sl].text;
	    oValue = document.fm[FirstP].options[sl].value;
	    if (document.fm[FirstP].options[sl].value > "" && sl > 0 && down == 0) 
	    {
	      document.fm[FirstP].options[sl].text = document.fm[col].options[sl-1].text;
	      document.fm[FirstP].options[sl].value = document.fm[col].options[sl-1].value;
	      document.fm[FirstP].options[sl-1].text = oText;
	      document.fm[FirstP].options[sl-1].value = oValue;
	      document.fm[FirstP].selectedIndex--;
	    } 
 	}
	return false;
}
function orderModule(down, col) 
{
  sl = document.fm[col].selectedIndex;
  if (sl != -1 && document.fm[col].options[sl].value > "") {
    oText = document.fm[col].options[sl].text;
    oValue = document.fm[col].options[sl].value;
    if (document.fm[col].options[sl].value > "" && sl > 0 && down == 0) {
      document.fm[col].options[sl].text = document.fm[col].options[sl-1].text;
      document.fm[col].options[sl].value = document.fm[col].options[sl-1].value;
      document.fm[col].options[sl-1].text = oText;
      document.fm[col].options[sl-1].value = oValue;
      document.fm[col].selectedIndex--;
    } else if (sl < document.fm[col].length-1 && document.fm[col].options[sl+1].value > "" && down == 1) {
      document.fm[col].options[sl].text = document.fm[col].options[sl+1].text;
      document.fm[col].options[sl].value = document.fm[col].options[sl+1].value;
      document.fm[col].options[sl+1].text = oText;
      document.fm[col].options[sl+1].value = oValue;
      document.fm[col].selectedIndex++;
    }
  }
  return false;
}

function doSub() 
{
	var mycars=new Array("DLeft","DRight")
  num = 2;

for (i = 0; i < num; i++) {
	document.fm[mycars[i] + "_List"].value = makeList(mycars[i]);
}
  return true;
}

function makeList(col) 
{

  val = "";
  for (j=0; j<document.fm[col].length; j++) {
    if (val > "") { val += ","; }
    if (document.fm[col].options[j].value > "") val += document.fm[col].options[j].value;
  } 


  return val;
}
function BackMain()
{
		if(document.all['MainPage2'].style.display=="none")
		{
			document.all['BackMainT1'].style.display="none";
			document.all['BackMainT2'].style.display="block";

			document.all['MainPage1'].style.display="none";
			document.all['MainPage2'].style.display="block";

			document.all['BackMainB1'].style.display="none";
			document.all['BackMainB2'].style.display="block";
		}
		else
		{
			document.all['BackMainT2'].style.display="none";
			document.all['BackMainT1'].style.display="block";

			document.all['MainPage2'].style.display="none";
			document.all['MainPage1'].style.display="block";

			document.all['BackMainB2'].style.display="none";
			document.all['BackMainB1'].style.display="block";

		}
}