/**************************************************
 *  showEbook()
**************************************************/
function showEbook(page_number) {
  breite = screen.width - 20;
  hoehe = screen.height - 20;
  
  pos_x = 10;
  pos_y = 20;
  winprops = new String('width='+breite+',outerWidth='+breite+',height='+hoehe+',outerHeight='+hoehe+',top='+pos_y+',left='+pos_x+',toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes');

  url_abs = "http://www.grundig.de/eBook/HomeAppliances2010-2011/#/" + page_number;
  
  var NewWindow = window.open(url_abs,"eBook",winprops);
  NewWindow.focus();

}

function showEbookNew(page_number) {
  breite = screen.width - 20;
  hoehe = screen.height - 20;
  
  pos_x = 10;
  pos_y = 20;
  winprops = new String('width='+breite+',outerWidth='+breite+',height='+hoehe+',outerHeight='+hoehe+',top='+pos_y+',left='+pos_x+',toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes');

  url_abs = "http://www.grundig.de/eBook/HomeAppliances2011-2012/#/" + page_number;
  
  var NewWindow = window.open(url_abs,"eBook",winprops);
  NewWindow.focus();

}

function showEbookBSD(page_number) {
  breite = screen.width - 20;
  hoehe = screen.height - 20;
  
  pos_x = 10;
  pos_y = 20;
  winprops = new String('width='+breite+',outerWidth='+breite+',height='+hoehe+',outerHeight='+hoehe+',top='+pos_y+',left='+pos_x+',toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes');

  url_abs = "http://www.grundig.de/eBook/BestSelectionDE/#/" + page_number;
  
  var NewWindow = window.open(url_abs,"eBook",winprops);
  NewWindow.focus();

}

function showEbookBSE(page_number) {
  breite = screen.width - 20;
  hoehe = screen.height - 20;
  
  pos_x = 10;
  pos_y = 20;
  winprops = new String('width='+breite+',outerWidth='+breite+',height='+hoehe+',outerHeight='+hoehe+',top='+pos_y+',left='+pos_x+',toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes');

  url_abs = "http://www.grundig.de/eBook/BestSelectionEN/#/" + page_number;
  
  var NewWindow = window.open(url_abs,"eBook",winprops);
  NewWindow.focus();

}
/*********************************************************/


function callFromFlash_hideLayer()
{
  var hovered_menu = document.getElementById('hovered_menu');
  if(hovered_menu) {hovered_menu.removeAttribute('id')}
      
  var produkt_menu_wrapper_toggler = document.getElementById('produkt_menu_wrapper_toggler');
  if(produkt_menu_wrapper_toggler) {
    $('#produkt_menu_wrapper').css('display','none');
  }

}

function showHideLayer(div_id){

  if(document.getElementById(div_id).style.display == "block")
     document.getElementById(div_id).style.display = "none";
  else{
     window.location.href = "#top";
     document.getElementById(div_id).style.display = "block";  
     
  }
}

function checkBrowserName(name){  
   var agent = navigator.userAgent.toLowerCase();  
   if (agent.indexOf(name.toLowerCase())>-1) {  
     return true;  
   }  
   return false;  
} 

function showIFLogo(){
  document.getElementById("IFLogo").style.display = 'block';
}

function startingMP3(){
  var so4 = new SWFObject("fileadmin/audiorama/musikPlayer.swf", "intro", "17" , "16", "8", "#ffffff");
  so4.addParam("scale", "noscale");
  so4.addParam("wmode", "transparent");
  so4.addParam("menu", "true");
  so4.addVariable("soundObj", "fileadmin/audiorama/Mozart_Symphony_41.mp3");
  so4.write("flashcontent4");
}


function loadOekoPage(url,h,w){

var val= 'scrollbars=yes,'+h+','+w;
//alert("hier: "+val);
var url_abs = "http://www.grundig.de/" + url;
  window.open(url_abs,'OekoPage',val);

}
//********************** Weihnachtspromotion Aufruf, soll temporär eingebunden werden ! *******************/
function loadPopup(url,mode_value)
{
  
  var arr_url;
  arr_url = window.location.search.split("&");

  for(i=0;i<arr_url.length;i++)
  {
    split = arr_url[i].split("=");
    
    if(split[0] == "mode")
    {
      if(split[1] == mode_value)
      {
         //window.open(url,'Grundig','scrollbars=no,width=750,height=530');
         window.open(url,'Grundig','scrollbars=no,width=980,height=620');

      }
    }
  }
}

loadPopup('http://www.grundig.de/fileadmin/Christmas/indexDE.php','christmas');
loadPopup('http://www.grundig.com/fileadmin/Christmas/indexEN.php','christmas_en');

//************ EM Microsite ***************************/
loadPopup('http://www.grundig.de/em/','em');
loadPopup('http://www.grundig.com/em/index.php?lang=en','em_en');

//*********************************************************************************************


function ShowHideProdPics(elemID,maxCount)
{
    
    var currentZIndex;
    var newZIndex; 
    
    for(i = 0;i < maxCount; i++)
    {
      var picid;
      picid = "add_pic_" + i;
      if(elemID == picid)
        document.getElementById(picid).style.display = "block";
      else
        document.getElementById(picid).style.display = "none";
    
    }
    
}



function openPopup(path,w,h){
  
  window.open(path,"newWin","width=" + w + ",height=" + h + ",left=50,top=20,resizable=yes");
  
}

function showMenu() {
  var nav_main = document.getElementById('nav_main');
  nav_main.style.display = 'block';

  var nav_innen = document.getElementById('nav_innen');
  nav_innen.style.height = "450px"

}
function hideMenu() {
  var nav_main = document.getElementById('nav_main');
  nav_main.style.display = 'none';

  var nav_innen = document.getElementById('nav_innen');
  nav_innen.style.height = "0px"
}

function showSWF(img,wsize,hsize,idname,wmode,bgcolor){
  document.write("<object id=\"" + idname + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" align=\"middle\" width=\"" + wsize + "\" height=\"" + hsize + "\">");
  document.write("<param name=\"movie\" value=\"" + img + "\">");
  document.write("<param name=\"quality\" value=\"high\">");
  document.write("<param name=\"wmode\" value=\"" + wmode + "\">");
  document.write("<param name=\"bgcolor\" value=\"" + bgcolor + "\">");
  document.write("<embed wmode=\"" + wmode + "\" bgcolor=\"" + bgcolor + "\" src=\"" + img + "\" name=\"" + idname + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + wsize + "\" height=\"" + hsize + "\"></embed>");
  document.write("</object>");
}

function showLayer(elemID){
  document.getElementById(elemID).style.display = "block";
}
function hideLayer(elemID){
  document.getElementById(elemID).style.display = "none";
}

function printZoom(filepath,w,h){

  var nw = window.open(filepath, "nw", "width=" + w + ",height=" + h + ",left=200,top=200");
  nw.print();

  return;
}

function showResultsProducts(){
  document.getElementById("search_products").style.display = 'block';
  document.getElementById("search_news").style.display = 'none';
  document.getElementById("search_content").style.display = 'none';

  document.getElementById("navi_products").className = 'navi_pro_hl';
  document.getElementById("text_pro").className = 'navi_hl';

  document.getElementById("navi_pages").className = 'navi_pages';
  document.getElementById("navi_news").className = 'navi_news';
  document.getElementById("text_page").className = 'navi';
  document.getElementById("text_news").className = 'navi';

}

function showResultsContent(){

  document.getElementById("search_products").style.display = 'none';
  document.getElementById("search_news").style.display = 'none';
  document.getElementById("search_content").style.display = 'block';


  document.getElementById("navi_pages").className = 'navi_pages_hl';
  document.getElementById("text_page").className = 'navi_hl';

  document.getElementById("navi_products").className = 'navi_pro';
  document.getElementById("navi_news").className = 'navi_news';
  document.getElementById("text_pro").className = 'navi';
  document.getElementById("text_news").className = 'navi';
}

function showResultsNews(){
  document.getElementById("search_products").style.display = 'none';
  document.getElementById("search_content").style.display = 'none';
  document.getElementById("search_news").style.display = 'block';

  document.getElementById("navi_news").className = 'navi_news_hl';
  document.getElementById("text_news").className = 'navi_hl';

  document.getElementById("navi_pages").className = 'navi_pages';
  document.getElementById("navi_products").className = 'navi_pro';
  document.getElementById("text_pro").className = 'navi';
  document.getElementById("text_page").className = 'navi';
}

function init()
{
  var arr_url;
  arr_url = window.location.search.split("&");
  show_products = true;
  show_news = false;
  show_pages = false;

  for(i=0;i<arr_url.length;i++)
  {
    split = arr_url[i].split("=");

    if(split[0] == "mode")
    {
      if(split[1] == "p") {
        show_products = true;
        show_news = false;
        show_pages = false;
      }
      else if(split[1] == "n") {
        show_products = false;
        show_news = true;
        show_pages = false;
      } else {
        show_products = false;
        show_news = false;
        show_pages = true;      
      }

    }
  }
  //alert("pages: " + show_pages + ", products: " + show_products + ", news: " + show_news);
  
  if(show_pages)
    showResultsContent();
  if(show_products)
    showResultsProducts();
  if(show_news)
    showResultsNews();
    
}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 &&
navigator.userAgent.indexOf("Windows 3.1") == -1) 
{
  document.write('<script type="text/vbscript"> \n');
  document.write('on error resume next \n');
  document.write('Sub Kampagnenwechsler_1_FSCommand(ByVal Befehl, ByVal Modus)\n');
  document.write('  call Kampagnenwechsler_1_DoFSCommand(Befehl, Modus)\n');
  document.write('end sub\n');
  document.write('</script\> \n');
  
  document.write('<script type="text/vbscript"> \n');
  document.write('on error resume next \n');

  document.write('Sub button_ovation_FSCommand(ByVal Befehl, ByVal Modus)\n');
  document.write('  call button_ovation_DoFSCommand(Befehl, Modus)\n');
  document.write('end sub\n');
  document.write('</script\> \n');

    
  // button_cashback
  document.write('<script type="text/vbscript"> \n');
  document.write('on error resume next \n');

  document.write('Sub button_cashback_FSCommand(ByVal Befehl, ByVal Modus)\n');
  document.write('  call button_cashback_DoFSCommand(Befehl, Modus)\n');
  document.write('end sub\n');
  document.write('</script\> \n');

  // button_Grundig2plus1
  document.write('<script type="text/vbscript"> \n');
  document.write('on error resume next \n');
  
  document.write('Sub Grundig2plus1_FSCommand(ByVal Befehl, ByVal Modus)\n');
  document.write('  call Grundig2plus1_DoFSCommand(Befehl, Modus)\n');
  document.write('end sub\n');
  document.write('</script\> \n');
    
  // HDEvolution
  document.write('<script type="text/vbscript"> \n');
  document.write('on error resume next \n');
    
  document.write('Sub HDEvolution_FSCommand(ByVal Befehl, ByVal Modus)\n');
  document.write('  call HDEvolution_DoFSCommand(Befehl, Modus)\n');
  document.write('end sub\n');
  document.write('</script\> \n');

  // Audiorama
  document.write('<script type="text/vbscript"> \n');
  document.write('on error resume next \n');
    
  document.write('Sub Audiorama_FSCommand(ByVal Befehl, ByVal Modus)\n');
  document.write('  call Audiorama_DoFSCommand(Befehl, Modus)\n');
  document.write('end sub\n');
  document.write('</script\> \n');

}

function button_ovation_DoFSCommand(Befehl, Modus){
/* Modus getauscht!!! nach einsetzen korrigierten Teaser die Modus-Kennnummer wieder tauschen!!! */
  if(Modus == '2'){
    window.open("fileadmin/highlights/ovation_DE/index.html","OvationSpecial","width=800,height=565,left=10,top=10,resizable=yes");
  }
  if(Modus == '1'){
    window.open("fileadmin/highlights/ovation_EN/index.html","OvationSpecial","width=800,height=565,left=10,top=10,resizable=yes");
  }
}

function HDEvolution_DoFSCommand(Befehl, Modus){
  if(Modus == '1')  {  
    window.open("fileadmin/highlights/hd_evol/index.html","HDEvolution","width=910,height=600,left=50,top=20,resizable=yes");
  }else if(Modus == '2')  {
    window.open("fileadmin/highlights/hd_evol_en/index.html","HDEvolutionEN","width=910,height=600,left=50,top=20,resizable=yes");
  }else if(Modus == '3')  {
    window.open("index.php?id=1048","HDEvolution","scrollbars=yes,height=641,width=829,scrollbars=no");
  }else if(Modus == '4')  {
    window.open("index.php?id=1048&L=1","HDEvolutionEN","scrollbars=yes,height=641,width=829,scrollbars=no");
  }
}

function Audiorama_DoFSCommand(Befehl, Modus){
  if(Modus == '1')  {  
    //window.open("fileadmin/highlights/hd_evol/index.html","HDEvolution","width=910,height=600,left=50,top=20,resizable=yes");
    location.href = "http://wow.360-grad-sound.de";
  }
  else if(Modus == '2')  {
    //window.open("fileadmin/highlights/hd_evol_en/index.html","HDEvolutionEN","width=910,height=600,left=50,top=20,resizable=yes");
    location.href = "http://wow.360-degree-sound.com";
  }
}

function Kampagnenwechsler_1_DoFSCommand(Befehl, Modus){
  if(Modus == '1')  {  
    window.open("fileadmin/highlights/hd_evol/index.html","HDEvolution","width=910,height=600,left=50,top=20,resizable=yes");
  }
  else if(Modus == '2')  {
    window.open("fileadmin/highlights/fileadmin/highlights/hd_evol_en/index.html","HDEvolutionEN","width=910,height=600,left=50,top=20,resizable=yes");
  }
  else if(Modus == '3')  {
    window.open("fileadmin/highlights/grundig2plus1/index.html","Grundig_1plus2","width=1070,height=800,left=50,top=20,resizable=yes");
  }
  else if(Modus == '4')  {
    window.open("fileadmin/highlights/ovation_DE/index.html","OvationSpecial","width=800,height=565,left=10,top=10,resizable=yes");
  }
  else if(Modus == '5')  {
    window.open("fileadmin/highlights/ovation_EN/index.html","OvationSpecial","width=800,height=565,left=10,top=10,resizable=yes");
  }
  
}
function Grundig2plus1_DoFSCommand(Befehl, Modus){
  if(Modus == '3')  { 
    window.open("fileadmin/highlights/grundig2plus1/index.html","Grundig_1plus2","width=1070,height=800,left=50,top=20,resizable=yes");
  }
}


function popUpKatalog(URL,winWidth,winHeight)
{
var breite = screen.width;
var hoehe = screen.height;
var fensterbreite = winWidth; // Hier die gew�nschte Breite des PopUp-Fensters eingeben.

if(hoehe < 800){
  var fensterhoehe = (winHeight-120); // Hier die gew�nschte H�he des PopUp-Fensters eingeben.
}else{
  var fensterhoehe = winHeight; // Hier die gew�nschte H�he des PopUp-Fensters eingeben.
}

var pos_x = (breite/2)-(fensterbreite/2);
var pos_y = (hoehe/2)-(fensterhoehe/2);
var winprops = new String('width='+winWidth+',outerWidth='+winWidth+',height='+winHeight+',outerHeight='+winHeight+',top='+pos_y+',left='+pos_x+',toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes');
//alert('nochmal hier: ' + url + ' ('+winprops+')');

var url_abs = "http://www.grundig.de/" + URL;

var NewWindow = window.open(url_abs,"eBook",winprops);
NewWindow.focus();

}

function popUpKatalogAbs(URL,winWidth,winHeight)
{
var breite = screen.width;
var hoehe = screen.height;
var fensterbreite = winWidth; // Hier die gew�nschte Breite des PopUp-Fensters eingeben.

if(hoehe < 800){
  var fensterhoehe = (winHeight-120); // Hier die gew�nschte H�he des PopUp-Fensters eingeben.
}else{
  var fensterhoehe = winHeight; // Hier die gew�nschte H�he des PopUp-Fensters eingeben.
}

var pos_x = (breite/2)-(fensterbreite/2);
var pos_y = (hoehe/2)-(fensterhoehe/2);
var winprops = new String('width='+winWidth+',outerWidth='+winWidth+',height='+winHeight+',outerHeight='+winHeight+',top='+pos_y+',left='+pos_x+',toolbar=No,location=No,scrollbars=No,status=No,resizable=Yes');
//alert('nochmal hier: ' + url + ' ('+winprops+')');

//var url_abs = "http://www.grundig.de/" + URL;

var NewWindow = window.open(URL,"eBook",winprops);
NewWindow.focus();

}



//Fehler unterdruecken
onerror = stopError;
function stopError()
{
 return true;
}

