/* 
GLOBALE VARIABLER
*/
var dingz_default_X = -20;
var dingz_default_Y = 80;
var current_ad;

var dest_X;
var dest_Y;
var win_dest_X;
var win_dest_Y
var dingz_dest_X;
var dingz_dest_Y;
var landing_dest_X;
var landing_dest_Y;
var wrapper_dest_X;
var wrapper_dest_Y;
var sURL;
var is_home = true;


/* 
FUNKSJONER SOM BRUKES Å FLYTTE/VISE/SKJULE ELEMENTER
*/

function dingz_slide() {
  xSlideTo(document.getElementById('dingz'), dingz_dest_X, dingz_dest_Y, 400)
}

function win_scroll() {
  xWinScrollTo(window, win_dest_X, win_dest_Y, 400)
}

function wrapper_slide() {
  xSlideTo(document.getElementById('wrapper'), wrapper_dest_X, wrapper_dest_Y, 400)
}

function hide_current_ad () {  // Kopiert
  current_ad.style.display = 'none';
}

function hide_all_ad_modules () {  // Kopiert
  document.getElementById('landingW').style.display = 'none';
  document.getElementById('landingE').style.display = 'none';
  document.getElementById('landingNW').style.display = 'none';
  document.getElementById('landingN').style.display = 'none';
  document.getElementById('landingNE').style.display = 'none'; 
}



function show_current_ad() {  // Kopiert
  l = getPos(document.getElementById('dingz'),'Left');
  rl = document.getElementById('dingz').offsetLeft;
  
  t = getPos(document.getElementById('dingz'),'Top');
  rt = document.getElementById('dingz').offsetTop;
  
  if (reload_module == true || current_ad.src == 'about:blank') {
    //alert (sURL);
    current_ad.src = sURL;
  }
  current_ad.style.left = (rl + 200) + 'px';
  current_ad.style.top  = rt + 'px';
  current_ad.style.display = 'block';
}



/* 
MAIN
*/





function go_home() {

  is_home = true;

  dest_X         = 0;
  dest_Y         = 0;
  dingz_dest_X   = dingz_default_X;
  dingz_dest_Y   = dingz_default_Y;
  wrapper_dest_X = 0;
  wrapper_dest_Y = 0;
  
  dingz_opp();
  setTimeout(hide_current_ad,  100);
  setTimeout(win_scroll,       200);
  setTimeout(dingz_slide,      200);
  setTimeout(wrapper_slide,    800); 
  setTimeout(dingz_ned,       1500);
  setTimeout(dingz_pulse_off, 2000);
  
  //xSlideTo(document.getElementById('dingz'), , 500);
  //xSlideTo(document.getElementById('wrapper'), 0, 0, 500);
  //xWinScrollTo(window, 0, 0, 500);
  
  //return false;
}

function home() {
  go_home(); 
}


//setInterval(go, 50);
//var lock = true;




function dingz_opp()  {
  flashProxy.call('jsTrigger', 'opp');
}


function dingz_ned()  {
  flashProxy.call('jsTrigger', 'ned');
}

function dingz_pulse_on() {
  flashProxy.call('homeTrigger', 'borte');
}

function dingz_pulse_off() {
  flashProxy.call('homeTrigger', 'home');
}

function scroll() {
  lock = false;
  document.getElementById('annonse_hoyre').style.display = 'block';
  
  //setTimeout("document.getElementById('dingz').style.left = '1000px'", 200);
  //setTimeout("window.scrollTo (1000,0);", 200);

  xSlideTo(document.getElementById('dingz'), 1110, 10, 500);
  xWinScrollTo(window, 1000, 0, 1000);
  return false;
}


document.write('<img id="klikkteller" src="/grafikk/pixel.gif" alt="" width="0" height="0">');