function Popup(aurl, aname) {
	if (aname == '') aname = 'defpop';
	var nw;
	nw = window.open(aurl, aname, "height=300,width=550,status=no,toolbar=no,menubar=no,location=no");
	nw.focus();
}


function SetTagContent(tagid, content) {	
  if (document.getElementById) {
    document.getElementById(tagid).innerHTML=content;
    return;
  }

  if (document.all) {
    document.all[tagid].innerHTML=content
    return;
  }

  if (document.layers) {
    document.layers[tagid].innerHTML=content
    return;
  }	
}


function HoverDetails(bannerid, show) {
  if (document.getElementById) {
    document.getElementById(bannerid).style.display=show;
    return;
  }

  if (document.all) {
    document.all[bannerid].style.display=show;
    return;
  }

  if (document.layers) {
    document.layers[bannerid].display=show;
    return;
  }
}


function SetCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


function DeleteCookie(name, path, domain) {
  document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}


function SwitchDetails(sender, bannerid) {
  var state;
  if (document.getElementById) {
    if (document.getElementById(bannerid).style.display == "none")
      document.getElementById(bannerid).style.display="block";
    else
      document.getElementById(bannerid).style.display="none";
    state=document.getElementById(bannerid).style.display;
  }

  else if (document.all) {
    if (document.all[bannerid].style.display == "none")
      document.all[bannerid].style.display="block";
    else
      document.all[bannerid].style.display="none";
    state = document.all[bannerid].style.display;
  }

  else if (document.layers) {
    if (document.layers[bannerid].display == "none")
      document.layers[bannerid].display="block";
    else
      document.layers[bannerid].display="none";
    state = document.layers[bannerid].display;
  }

  if (state == "none") {
    //document.cookie = bannerid + "=" + state;
    if (sender)
      sender.style.color = "#AAAAAA";
    SetCookie(bannerid, state, '', '/', '');

  }
  else {
    //document.cookie = bannerid + "=";
    if (sender)
      sender.style.color = "#FFFFFF";
    DeleteCookie(bannerid, '/', '');

  }
}


function SetPriceStyle(optionstring, active) {
  var arr;
  var i;
  var o;
  var color;
  var lis;

  if (active) {
    color = "#E3972C";
    lis   = "disc";
  }
  else {
    color = "#32546D";
    lis   = "circle";
  }

  arr = optionstring.split("_");
  for (i=0; i<optioncount; i++) {
    o = "opt"+i+"_"+arr[i + 1];
    document.getElementById(o).style.color = color;
    document.getElementById(o).style.listStyleType = lis;
  }
}


function ChangePriceOption(bannerid) {
  var arr;
  var s;
  var w;
  var i;
  var o;

  s = Number(bannerid.substring(4, bannerid.indexOf('_', 1)));
  w = bannerid.substring(bannerid.indexOf('_', 1) + 1, bannerid.length)
  arr = activeoptions.split("_");
  arr[s + 1] = w;
  activeoptions = arr.join("_");
  //document.write(s + "<br>" + w + "<br>" + activeoptions + "<br>"+ arr);

  return activeoptions;
}


function SwitchPrice(sender, bannerid) {
  var state;

  SetPriceStyle(activeoptions, false);
  HoverDetails(activeoptions, "none"); // Altes Fenster schliessen

  if (bannerid.charAt(0) == "_")
    bannerid = ChangePriceOption(bannerid);

  SetPriceStyle(activeoptions,true);

  if (document.getElementById) {
    if (document.getElementById(bannerid).style.display == "none")
      document.getElementById(bannerid).style.display="block";
    else
      document.getElementById(bannerid).style.display="none";
    state=document.getElementById(bannerid).style.display;
  }

  else if (document.all) {
    if (document.all[bannerid].style.display == "none")
      document.all[bannerid].style.display="block";
    else
      document.all[bannerid].style.display="none";
    state = document.all[bannerid].style.display;
  }

  else if (document.layers) {
    if (document.layers[bannerid].display == "none")
      document.layers[bannerid].display="block";
    else
      document.layers[bannerid].display="none";
    state = document.layers[bannerid].display;
  }

  /*
  if (sender) {
    if (state == "none") {
      sender.style.color = "#AAAAAA";
    }
    else {
      sender.style.color = "#111111";
    }
  }
  */
}