//middle main background (preload)
/*Image1= new Image(150,20)
Image1.src = "../gfx/content_main_bg.png";
*/
function showEffect(type, id, pagetype, lang_id)
{
  new Effect.SlideUp('tekst', { 
        duration:0.2, 
        afterFinish: function()
        {
           setTimeout('updateMain(\''+type+'\', '+id+', '+pagetype+', '+lang_id+')',250);
        }
      });
}

function updateMain(type, id, pagetype, lang_id)
{
  var url = 'http://www.stadiumimpact.com/page.php';
  var pars = 'type='+type+'&id='+id+'&pagetype='+pagetype+'&lang_id='+lang_id;

  var myAjax = new Ajax.Updater(
    'main_content',
    url,
    {
      method: 'get',
      parameters: pars,
      evalScripts: true,
      onComplete: function(){showSecondEffect(type, id)}
    });
  
  if(type != "club" && type != "club_actueel" && type != "actueel" && type != "nieuws")
  {
    updateActueel('actueel', id, lang_id);
  }
}

function addNewsletter(email, lang_id)
{
  var url = 'http://www.stadiumimpact.com/page.php';
  var pars = 'type=newsletter&email='+email+'&lang_id='+lang_id;

  var myAjax = new Ajax.Request(
    url,
    {
      method: 'get',
      parameters: pars,
      evalScripts: true,
      onComplete: function(originalRequest){Element.update('news_msg', ''); new Insertion.Bottom('news_msg', originalRequest.responseText)}
    }); 
}

function updateActueel(type, id, lang_id)
{
  var url = 'http://www.stadiumimpact.com/page.php';
  var pars = 'type='+type+'&id='+id+'&lang_id='+lang_id;

  var myAjax = new Ajax.Updater(
    'actueel',
    url,
    {
      method: 'get',
      parameters: pars,
      evalScripts: true
    }); 
}

function updateClubActueel(type, id, lang_id)
{
  var url = 'http://www.stadiumimpact.com/page.php';
  var pars = 'type='+type+'&id='+id+'&lang_id='+lang_id;

  var myAjax = new Ajax.Updater(
    'actueel',
    url,
    {
      method: 'get',
      parameters: pars,
      evalScripts: true
    }); 
}

/***********************************
 * Wordt vooralsnog niet gebruikt
function updateReferenties(type, id)
{
  var url = 'http://www.stadiumimpact.com/page.php';
  var pars = 'type='+type+'&id='+id;

  var myAjax = new Ajax.Updater(
    'reference_container',
    url,
    {
      method: 'get',
      parameters: pars,
      evalScripts: true,
      onComplete: function(){initLightbox()}
    }); 
}
************************************/

function showSecondEffect(type, id)
{
  new Effect.SlideDown('tekst', { 
        duration:0.2
      });
}


/*function subEffect(waarde)
{
     Element.setStyle('submenu_container', {display:'none'});
     updateSub(waarde);
}*/

function updateSub(waarde, lang_id)
{
  var url = 'http://www.stadiumimpact.com/page.php';
  var pars = 'type=submenu&parent='+waarde+'&lang_id='+lang_id;
  
  var myAjax = new Ajax.Updater(
    'slogan',
    url,
    {
      method: 'get',
      parameters: pars,
      evalScripts: true
    });
}

function sendOfferte(lang_id)
{
  f = $$('FORM#offerte .table_input input', 'FORM#offerte .table_input select', 'FORM#offerte .table_wide textarea');
  pars = 'type=offerte&lang_id='+lang_id+'&';
  for(var i=0; i<f.length; i++){
    pars += f[i].name + '=' + f[i].value + '&';
  }
  
  var url = 'http://www.stadiumimpact.com/page.php';
  
  var myAjax = new Ajax.Updater(
    'offertestatus',
    url,
    {
      method: 'get',
      parameters: pars,
      evalScripts: true
    });
}

function subSecondEffect()
{
  new Effect.SlideDown('submenu_container', {duration:0.5,limit:1});
}

function subWeg()
{
  Element.setStyle('submenu_container', {display:'none'});
}

function rewriteFlash()
{
  var url = 'http://www.stadiumimpact.com/page.php';
  var pars = 'type=flash';
  
  var myAjax = new Ajax.Updater(
    'flash',
    url,
    {
      method: 'get',
      parameters: pars,
      evalScripts: true
    });
}

function expand(menu)
{ 
    var ul = $('submenu_container').getElementsByTagName('ul');
   
    for( var x = 0; x < ul.length; x++ ) 
    {
      Element.hide(ul[x].id);
    }

  Element.show('submenu_container');
  Element.show(menu);
}

function collapse(menu)
{
  Element.hide('submenu_container');
  Element.hide(menu);
}