function openPopup(url,window_name,width, height, scrollbars){

  if(scrollbars != "yes" && scrollbars != "no" && scrollbars != "auto")
  {
    var scroll = "auto"
  } else {
    var scroll = scrollbars
  }

  popup = window.open(url,window_name,"left=20,top=20,screenX=20,screenY=20,toolbar=no,location=no,status=yes,menubar=no,scrollbars="+scroll+",width="+width+",height="+height+",resizable=yes" );
}

function findElement(name){
  return document.getElementById(name)
}

function displayBlock(element) {
  findElement(element).style.display = "block";
}

function displayNone(element) {
  findElement(element).style.display = "none";
}

/**
* returns a collection of HTML elements with a specific Class-name
*/
function getElementsByClassName(class_name)
{
  var all_obj,ret_obj=new Array(),j=0,teststr;

  if(document.all)all_obj=document.all;
  else if(document.getElementsByTagName && !document.all)
  all_obj=document.getElementsByTagName("*");

  for(i=0;i<all_obj.length;i++)
  {
    if(all_obj[i].className.indexOf(class_name)!=-1)
    {
      teststr=","+all_obj[i].className.split(" ").join(",")+",";
      if(teststr.indexOf(","+class_name+",")!=-1)
      {
        ret_obj[j]=all_obj[i];
        j++;
      }
    }
  }
  return ret_obj;
}


/**
* color switcher for MUS colors
*/
function switch_color(color_object_id, show_text, over_out)
{
  if(over_out == "over")
  {
    document.getElementById(color_object_id).style.border='1px solid #000066';
  } else {
    document.getElementById(color_object_id).style.border='1px solid #BDBFC0';
  }

  if(over_out == "over")
  {
    document.getElementById('musColorText').innerHTML = show_text;
  } else {
    document.getElementById('musColorText').innerHTML = "";
  }
}

// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function handleResponse(documentObject,stringToEvaluate) {
  window.eval(stringToEvaluate);
  if (documentObject.location){ // Should be usefull for IE only .. but I cannot test it
    if(documentObject.location != "") documentObject.location.replace('about:blank');
  }
}

// checking checkboxstate
function checkState(state, string_input_class){
  if(state.checked == true) {
    //            alert("ist true");
    selectAllByClass(string_input_class,1);
  } else {
    //            alert("ist false");
    selectAllByClass(string_input_class,0)
  }
}

//teaser highlinting
function teaser_border(element, color1, color2) {
  if (element.parentNode.className == "productTeaser") {
    element.parentNode.style.borderColor = color1;
  }
  else {
    try {
      var span = element.getElementsByClassName("copy").first();
      span.style.borderColor = color1;
      span.style.borderTopColor = color2;
    }
    catch(e) {
      alert(e);
    }
  }
}

function load_shoppingpixel(pixel, target)
{
  pixel1 = new Image();
  pixel2 = new Image();
  pixel1.src = "http://counterpixel.nivea.de/cgi-bin/PageImp.exe?/" + pixel;
  pixel2.src = "http://counterpixel1.nivea.de/cgi-bin/PageImp.exe?/" + pixel;
  window.open(target);

}
