// ******* application script for jaeck-ag.ch *******
// ******* © by nexbyte gmbh, switzerland *******
// ******* create: 16.07.2001 - tbruederli *******
// ******* modify: 07.02.2003 - tbruederli *******

// global vars
img_pas_markup = '_pas';
img_act_markup = '_act';
img_sel_markup = '_sel';



// startup function (onload)
function init(sel)
  {

  // check for correct parent frameset
  // if(bw.div && (top.location && (String(top.location).indexOf('jaeck')<0 || top.location==self.location)) || !top.location)
  //   top.location.replace('../../home.html?page='+escape(window.location));

  // init reference scripts
  if(bw.dhtml && window.ref_script) init_ref();
  else if(!bw.dhtml) alert('Diese Seiten enhalten Dynamic HTML!\nBitte benutzen Sie einen Browser ab Version 4.');
  
  // preload rollover images
  preload_img();
  loaded = true;

  // set active chapter
  select_nav(sel);

  }

// make the navigation button look selected
function select_nav(sel)
  {
  var elm = nex_get_object(sel);
  if(!elm) return;
  elm.src = switch_img_path(elm.src, 'sel');
  a_sel_img['default'] = sel;

  }


// check the given path and changes it with act/pas
function switch_img_path(my_source,mode)
  {
  var pos_pas = my_source.indexOf(img_pas_markup+'.');
  var pos_act = my_source.indexOf(img_act_markup+'.');
  var pos_sel = my_source.indexOf(img_sel_markup+'.');
  var suffix  = my_source.substring(my_source.lastIndexOf('.'),my_source.length);

  var pos = (pos_sel>0) ? pos_sel : (pos_act>0) ? pos_act : pos_pas;
  var end = (mode=='sel') ? img_sel_markup : (mode=='act') ? img_act_markup : img_pas_markup;

  var new_source = my_source.substring(0,pos)+end+suffix;
  if(new_source==my_source) return false;
  return new_source;
  }



// set window status text
function wst(a)
  {
  window.status = a;
  return true;
  }

// set new message string for form check
form_msg_pre = "Bitte erg\u00E4nzen Sie die folgenden Angaben auf Ihrer Anfrage\nund dr\u00FCcken Sie nochmals auf 'abschicken'.\n\n";
