//displays the hover effect of the prod navigation

var orgPaddingBottom = 4;
var hoverPaddingBottom = 16;
var hoverPaddingBottomString, orgPaddingBottomString, scrollDownCounter, FscrollDown, ScollSpeed, obj;
hoverPaddingBottomString = hoverPaddingBottom + 'px';
orgPaddingBottomString = orgPaddingBottom + 'px';
scrollDownCounter = new Array();
FscrollDown = new Array();
ScollSpeed = 6;


//scroll up / clear scroll down
function goUp(prod_nav_id){
  obj = document.getElementById('prod_nav' + prod_nav_id);
  if(obj != null){
    window.clearInterval(FscrollDown[prod_nav_id]);
    obj.style.paddingBottom = orgPaddingBottomString;
  }
}

//Scroll down
function goDown(prod_nav_id){
  obj = document.getElementById('prod_nav' + prod_nav_id);
  if(obj != null){
    scrollDownCounter[prod_nav_id] = orgPaddingBottom;
    FscrollDown[prod_nav_id] = window.setInterval('scrollDown(' + prod_nav_id + ')', ScollSpeed);
  }
}
function scrollDown(prod_nav_id){
  obj.style.paddingBottom = scrollDownCounter[prod_nav_id];
  if(obj.style.paddingBottom == hoverPaddingBottomString){
    window.clearInterval(FscrollDown[prod_nav_id]);
    scrollDownCounter[prod_nav_id] = orgPaddingBottom;
  } else {
    scrollDownCounter[prod_nav_id]++;
  }
}


/**
 * Opens a pop up window
 *
 * @param   string  url
 * @param   integer width
 * @param   integer height
 * @param   string  title
 * @return  boolean
*/
function popup(url) {

  var width = (arguments.length > 1) ? parseInt(arguments[1]) : 620;
  var height = (arguments.length > 2) ? parseInt(arguments[2]) : 380;
  var title = (arguments.length > 3) ? arguments[3] : '';
  var props = "width=" + width + ",height=" + height + ",resizable=yes,menubar=no,locationbar=no,status=no,scrollbars=yes,depend=yes,top=140,left=220";
  var popup;

  if (popup == window.open(url, title, props)) {

    popup.focus();
    return true;
  }

  return false;
} // end function popup

/**
 * Opens a pop up window to show a video
 *
 * @param   string  fileUrl
 * @param   string  language
 * @param   integer width
 * @param   integer height
 * @param   string  title
 * @return  boolean
*/
function tempWindow(fileUrl){
  var language = (arguments.length > 1) ? arguments[1] : 'de';
  var MovieWidth = (arguments.length > 2) ? parseInt(arguments[2]) : 320;
  var MovieHeight = (arguments.length > 3) ? parseInt(arguments[3]) : 260;
  var title = (arguments.length > 4) ? arguments[4] : '';
  var width =  MovieWidth + 60;
  var height = MovieHeight + 100;
  var props = "width=" + width + ",height=" + height + ",resizable=yes,menubar=no,locationbar=no,status=no,scrollbars=yes,depend=yes,top=140,left=220";
  var popup, fileType, softwareText, windowCloseText;

//  fileType = fileUrl.match(/mov$/);
  fileType = fileUrl.slice(fileUrl.length-3,fileUrl.length);

  switch (language){
    case 'en':
        if(fileType == 'mov')
          softwareText = 'In case you cannot view the film, please install <br>the following software: <a href="http://www.quicktime.com" target="_blank" class="smallfont">Quicktime</a>.';
        else
          softwareText = 'In case you cannot view the film, please install <br>the following software: <a href="http://www.microsoft.com" target="_blank" class="smallfont">Windows Media Player</a>.';
        windowCloseText = 'Close window';
      break;
    default:
        if(fileType == 'mov')
          softwareText = 'Sollten Sie den Film nicht sehen können,<br>installieren Sie bitte die nachstehende Software:<br><a href="http://www.quicktime.com" target="_blank" class="smallfont">Quicktime</a>.';
        else
          softwareText = 'Sollten Sie den Film nicht sehen können,<br>installieren Sie bitte die nachstehende Software:<br><a href="http://www.microsoft.de" target="_blank" class="smallfont">Windows Media Player</a>.';
        windowCloseText = 'Fenster schließen';
  }

  popup=window.open("","",props);
  popup.document.open();
  popup.document.write('<html><head><title>BUSCH</title><link rel=stylesheet type="text/css" href="./styles/default.css"><link rel=stylesheet type="text/css" href="./styles/cssmenu.css"><link rel=stylesheet type="text/css" href="./styles/custom.css"></head>');
  popup.document.write('<body>');

  popup.document.write('  <p class="center pad_v"><center>');
  popup.document.write('    <embed src="' + fileUrl + '" width="' + MovieWidth + '" height="' + MovieHeight + '" controller="" loop="" autoplay="" type="">');
  popup.document.write('  </center></p>');
  popup.document.write('  <p class="center smallfont">' + softwareText + '</p>');

  popup.document.write('	<p class="center"><br><a href="javascript:window.close();">' + windowCloseText + '</a></p>');
  popup.document.write('</body></html>');
  popup.document.close();


  return false;
}
