function setOpacity( value, id) {
	document.getElementById(id).style.opacity = value / 10;
	document.getElementById(id).style.filter = 'Alpha(opacity=' + value * 10 + ')';
  }

function fadeInMyPopup(id) {
	for( var i = 0 ; i <= 100 ; i++ )
		setTimeout( 'setOpacity(' + (i / 10) + ', \''+ id +'\')' , 8 * i );
  }

function fadeOutMyPopup(id) {
	for( var i = 0 ; i <= 100 ; i++ ) {
		setTimeout( 'setOpacity(' + (10 - i / 10) + ', \''+ id +'\')' , 8 * i );
	}
	setTimeout('closeMyPopup(\''+ id +'\')', 800 );
  }

function aisShowMsg(id, aktion){
  switch(aktion){
	case 'cancel':
	case 'claim':
	case 'return':
	  setOpacity( 0, 'msgBox'+id);
	  document.getElementById('msgBox'+id).style.display = 'block';
	  fadeInMyPopup('msgBox'+id);
	  break;

	default:
	  document.getElementById('msgBox'+id).style.display = 'none';
	  break;
	}
  }
  
function aisCloseMsg(id){
	for( var i = 0 ; i <= 100 ; i++ ) {
		setTimeout( 'setOpacity(' + (10 - i / 10) + ', \'msgBox'+ id +'\')' , 8 * i );
	}

	msg = document.getElementById('msg'+id).value;
	msg.length > 0 ? document.getElementById('showMsg'+id).style.display = 'block' : document.getElementById('showMsg'+id).style.display = 'none';

	setTimeout('_aisCloseMsg(\''+ id +'\')', 800 );
  }
  
function _aisCloseMsg(id){
	document.getElementById('msgBox'+id).style.display = 'none';	
  }
  
function aisGetSelect(id){
  return document.getElementById('select'+id).options[document.getElementById('select'+id).selectedIndex].value;
  }

function aisDisableReturn(id, code){
if(code==13){
  aisCloseMsg(id);
  return false;
  }
}

function aisLoadMsg(ids){
  ids = ids.split(',');
  for (i=0; i < ids.length; i++){
	msg = document.getElementById('msg'+ids[i]).value;
	msg.length > 0 ? document.getElementById('showMsg'+ids[i]).style.display = 'block' : false;
	}
  }
