function openPopupWindow( popupName, url, width, height, scrollbars )
{
  popupWindow = window.open( url, popupName, 'left=0,top=0,width='+width+',height='+height+',resizable=yes,menubar=no,scrollbars='+scrollbars );
  popupWindow.focus();
}

function openPopuInFullScreen( popupName_n, url_n, scrollbars_n )
{
	popupWindow_new = window.open( url_n, popupName_n, 'resizable=yes,menubar=no,fullscreen=yes,scrollbars='+scrollbars_n );
	popupWindow_new.focus();
}
function openPopup( url, type )
{
  popupName = type + '_popup';

  switch( type )
  {
  case 'homework_help':
    openPopupWindow( popupName, url, 800, 600, 'yes' );
    break;
  case 'stest_practice':
    openPopupWindow( popupName, url, 750, 550, 'yes' );
    break;
  case 'lesson_video':
    openPopupWindow( popupName, url, 750, 560, 'no' );
    break;
  case 'homework_help_quiz':
    openPopupWindow( popupName, url, 680, 555, 'no' );
    break;
  case 'hotmath':
    openPopupWindow( popupName, url, 550, 600, 'yes' );
    break;
  case 'tool':
    openPopupWindow( popupName, url, 800, 600, 'no' );
    break;
  case 'techkey':
    openPopupWindow( popupName, url, 625, 540, 'no' );
    break;
  case 'interactivity':
    openPopupWindow( popupName, url, 850, 500, 'no' );
    break;
  case 'destination_math':
    openPopuInFullScreen( popupName, url, 'no' );
    break;
  case 'electronic_library':
	openPopuInFullScreen( popupName, url, 'yes' );
	break;
  case 'ti_nspire':
	openPopuInFullScreen( popupName, url, 'yes' );
	break;
  case 'games':
    openPopupWindow( popupName, url, 600, 480, 'no' );
    break;
  default:
    openPopupWindow( popupName, url, 800, 600, 'no' );
    break;
  }
}

function openTool( name )
{
  var popupName = name + '_tool_popup';

  switch( name )
  {
  case 'algebra_tiles':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/Algebra_Tiles/Algebra_Tiles.html', 800, 600, 'no' );
    break;
  case 'decimal_fractions':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/Decimal_Fractions/Decimal_Fractions.html', 800, 600, 'no' );
    break;
  case 'fraction_bars':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/Func_Bars/Func_Bars.html', 800, 600, 'no' );
    break;
  case 'graphing_calculator':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/Graph_Calculator/graphCalc.html', 800, 600, 'no' );
    break;
  case 'integer_chips':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/Integer_Chips/Integer_Chips.html', 800, 450, 'no' );
    break;
  case 'scientific_calculator':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/Sci_Calculator/Sci_Calculator.html', 640, 600, 'no' );
    break;
  case 'statistics_calculator':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/Stat_Calculator/Stat_Calculator.html', 800, 600, 'no' );
    break;
  case 'multilingual_glossary':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/glossary/aga/glossary.html', 720, 500, 'no' );
    break;
  case 'multilingual_glossary_msm':
    openPopupWindow( popupName, '/math06_07/nsmedia/tools/glossary/msm/glossary.html', 720, 500, 'no' );
    break;
  case 'electronic_library':
	openPopuInFullScreen( popupName, 'http://www.classzone.com/cz/books/pre_alg/resources/htmls/efl/EFL.html', 'yes' );
	break;
  default:
    alert( "Unknown tool: " + name );
    break;
  }
}

function openResource( url )
{
  openPopup( url, 'resource' );
}

function openResourceURL( url )
{
  openResource( url );
}

