var where = {
  landestheater:  'neustrelitz', 
  schauspielhaus: 'neubrandenburg', 
  konzertkirche:  'neubrandenburg', 
  schlossgarten:  'neustrelitz', 
  unterwegs:      ''
};

for (o in where) {
  img1 = new Image(); img1.src="/img/orte/"+o+"_klein.gif";
  img3 = new Image(); img3.src="/img/orte/blink-"+o+".gif";
}

function mov1(who){
  $('img_spielort').src = "/img/orte/"+who+"_klein.gif";
  if (where[who])  $('img_'+where[who]).src = '/img/orte/blink-'+who+'.gif';
}

function mou1(who){
  $('img_spielort').src = "/img/1x1_trans.gif";
  if (where[who]) $('img_'+where[who]).src    = "/img/1x1_trans.gif";
}

function mov2(nr,who){
  if (who == 'heute') $('img_service').src = "/img/"+who+".gif";
  else $('div_servicetext').innerHTML = who.replace(/ /g,'&nbsp;&nbsp;&nbsp;&nbsp;');
  $('sebox'+nr).src = "/img/sebox-a.gif";
}

function mou2(nr){
  $('img_service').src           = "/img/1x1_trans.gif";
  $('div_servicetext').innerHTML = '';
  $('sebox'+nr).src = "/img/sebox.gif";
}

reswarning = function(){
  var windowHeight  = window.innerHeight || document.body.offsetHeight;
  var windowWidth   = window.innerWidth  || document.body.offsetWidth;
  if (parseInt(windowWidth)<800 || parseInt(windowHeight)<600) {
    document.getElementById('reswarning').style.display = '';
  } else {
    document.getElementById('reswarning').style.display = 'none';
  }
}

init = function(){
  var ort;
  Common.initRolloverImgs();

  for (ort in where){
    $('a_'+ort).onmouseover  = function(o){ return function(){mov1(o);} }(ort);
    $('a_'+ort).onmouseout   = function(o){ return function(){mou1(o);} }(ort);
  }

  setTimeout(function(){var button; if (button = $('navi_service_heute')) button.onclick(); }, 2500);

  reswarning();

  $('newsletter').onclick = function(){
    $('newsletter_popup').toggle();
  }
  
  function sendForm(event){  
    // we stop the default submit behaviour  
    Event.stop(event);  
    var oOptions = {  
        method:       "POST",  
        parameters:   Form.serialize("newsletter_form"),  
        asynchronous: true,  
        onFailure: function (oXHR) {  
          $('feedback').update(oXHR.statusText);  
        },  
        onLoading: function (oXHR) {  
          $('feedback').update('Ihre Anmeldung wird versandt.');  
        },                            
        onSuccess: function(oXHR) {  
          $('feedback').update(oXHR.responseText);
          setTimeout(function(){ $('newsletter_popup').toggle(); }, 2000);
        }                 
    };  
    new Ajax.Updater({success: oOptions.onSuccess.bindAsEventListener(oOptions)}, "processNewsletterForm.php", oOptions);             
  }  
  Event.observe('newsletter_button', 'click', sendForm, false);  
            
}                                                      

window.onresize = reswarning;
