function printPopup(Url,pWidth,pHeight){
      centerPopup('printPopup',/*VIPURL*/Url,pWidth,pHeight);
    }

var popupManager = {};

    popupManager.anonymus = [];
	
function openPopup(pName,pWidth,pHeight){
     if(pName=='tafPopup'){
          centerPopup(pName,/*VIPURL*/'tell_a_friend/form.jsp?targetPageUrl=/com/en/john_cooper_works/model_mapping.jsp',pWidth,pHeight);
      }
    }
	
function centerPopup(popupName,popupUrl,popupWidth,popupHeight,myWidth,myHeight,myScrollbar) {

	if(!myWidth)     {myWidth = 10;}

	if(!myHeight)    {myHeight = 50;}

	if(!myScrollbar) {myScrollbar = 1;}


myScrollbar = 'yes';
	var popupLeft = (window.screen.width/2)  - (popupWidth/2 + myWidth);

	var popupTop  = (window.screen.height/2) - (popupHeight/2 + myHeight);



  if (popupName !== "") {

    popupManager[popupName] = window.open(popupUrl,popupName,("toolbar=no,location=no,status=no,menubar=no,scrollbars=" + myScrollbar + ",resizable=no,width=" + popupWidth + ",height=" + popupHeight + ",left=" + popupLeft + ",top=" + popupTop + ",screenX=" + popupLeft + ",screenY=" + popupTop));

    popupManager[popupName].focus();

  } else {

    popupManager.anonymus[popupManager.anonymus.length] = window.open(popupUrl,popupName,("toolbar=no,location=no,status=no,menubar=no,scrollbars=" + myScrollbar + ",resizable=no,width=" + popupWidth + ",height=" + popupHeight + ",left=" + popupLeft + ",top=" + popupTop + ",screenX=" + popupLeft + ",screenY=" + popupTop));

    popupManager.anonymus[popupManager.anonymus.length-1].focus();

  }

}	








function writeMiniJCWModuleNavigation(navFontFace, navFontColor, striplineColor) {

  var moduleNavHiColor        = "color" + navFontColor.substr(12,6);

  var teaserLinkHeadlineColor = navFontColor.substr(0,11);

  var striplineColor          = ((striplineColor) ? striplineColor : "666666");

  var moduleNavigation        = '';



  moduleNavigation         += '<table cellpadding="0" cellspacing="0" width="166" border="0">';

  

  navHeaderData["navUrl"]   = ((navHeaderData["navAddParam"]) ? navHeaderData["navUrl"].split("?")[0] + '?' + navHeaderData["navAddParam"] : navHeaderData["navUrl"]);

  navHeaderData["navUrl"]   = ((navHeaderData["navUrl"].split("?")[0].indexOf("javascript:") != -1) ? navHeaderData["navUrl"] : rootpath + navHeaderData["navUrl"]);



//  START Module navigation headline

  moduleNavigation         += '  <tr>';

  moduleNavigation         += '    <td valign="top" width="10"><img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="10" height="4" /><br /><img src="'+ rootpath +'/_common/_img/1x1_trans.gif"  width="3"   height="5" /><img src="'+ rootpath +'/_common/_img/arrow_3x5_trans_' + navFontColor.substr(12,6) + '.gif" width="3" height="5" id="ArrowNavHeader" name="ArrowNavHeader" /></td>';

  moduleNavigation         += '    <td width="156"><span class="' + navFontFace + '"><a href="' + navHeaderData["navUrl"] + '" target="_self" onmouseover="mouseOver(\'ArrowNavHeader\');self.status=\''+ navHeaderData["navStatus"] + '\';return true;" onmouseout="mouseOut(\'ArrowNavHeader\');self.status=\'\';return true;" class="' + moduleNavHiColor + '" /*title="' + navHeaderData["navText"] + '"*/ onfocus="this.blur();">' + navHeaderData["navText"] + '</a><br /></span><img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="4" /></td>';

  moduleNavigation         += '  </tr>';

  moduleNavigation         += '  <tr>';

  moduleNavigation         += '    <td></td>';

  moduleNavigation         += '    <td>';

  moduleNavigation         += '      <img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="1" /><br />';

  moduleNavigation         += '      <img src="'+ rootpath +'/_common/_img/1x1_' + striplineColor + '.gif" width="156" height="1" /><br />';

  moduleNavigation         += '      <img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="6" /><br />';

  moduleNavigation         += '    </td>';

  moduleNavigation         += '  </tr>';

//  END Module navigation headline





// START Module navigation body

  getNavigationDataPath(navMainData,navDataPath,0);//  Get actual path for the highlighting



  if (navMainData.length > 0) {

    moduleNavigation       += getModuleNavigationBody(navMainData,0,"Nav",navFontFace,navFontColor);

  }



  moduleNavigationBody = '';

// END Module navigation body



/* -------------------
     Start PRODUCTFINDER
     ------------------- */
moduleNavigation     += '  <tr>\n';
moduleNavigation     += '    <td></td>\n';
moduleNavigation     += '    <td valign="top">\n';
moduleNavigation     += '      <form id="productFinder" name="productFinder">\n';
moduleNavigation     += '        <img src="../../../_common/_img/1x1_trans.gif" height="18" /><br />\n';
moduleNavigation     += '        <label for="selectCategory" class="font10line13 colora6beaf" id="labelCategory">' + productFinderData["label1"] + '<br /></label>\n';
moduleNavigation     += '        <select onchange="eval(this.form.selectCategory.options[this.form.selectCategory.options.selectedIndex].value);document.getElementById(\'labelCategory\').style.color=\'#a6beaf\';" id="selectCategory" name="selectCategory" size="1" class="inputField font10line11">\n';
moduleNavigation     += '        </select><br />\n';

moduleNavigation     += '        <img src="../../../_common/_img/1x1_trans.gif" height="4" /><br />\n';
moduleNavigation     += '        <label for="selectModel" class="font10line13 colora6beaf" id="labelModel">' + productFinderData["label2"] + '<br /></label>\n';
moduleNavigation     += '        <select disabled="disabled" style="background-color:#ffffff" onchange="eval(this.form.selectModel.options[this.form.selectModel.options.selectedIndex].value);document.getElementById(\'labelModel\').style.color=\'#a6beaf\';" id="selectModel" name="selectModel" size="1" class="inputField font10line11">\n';
moduleNavigation     += '        </select><br />\n';

moduleNavigation     += '        <img src="../../../_common/_img/1x1_trans.gif" height="4" /><br />\n';
moduleNavigation     += '        <label for="selectDate" class="font10line13 colora6beaf" id="labelDate">' + productFinderData["label3"] + '<br /></label>\n';
moduleNavigation     += '        <select disabled="disabled" style="background-color:#ffffff" onchange="document.getElementById(\'labelDate\').style.color=\'#a6beaf\';" id="selectDate" name="selectDate" size="1" class="inputField font10line11">\n';
moduleNavigation     += '        </select><br />\n';
moduleNavigation     += '      </form>\n';

moduleNavigation     += '      <table cellpadding="0" cellspacing="0" border="0">\n';
moduleNavigation     += '        <tr>\n';
moduleNavigation     += '          <td colspan="2"><img src="../../../_common/_img/1x1_trans.gif" width="1" height="11" /></td>\n';
moduleNavigation     += '        </tr>\n';
moduleNavigation     += '        <tr>\n';
moduleNavigation     += '          <td valign="top" width="11">\n';
moduleNavigation     += '            <a href="javascript:openSelectedProduct();" onmouseover="self.status=\'\'; return true" onmouseout="self.status=\'\'; return true" onfocus="this.blur();"><img src="../../../_common/_img/1x1_trans.gif" width="11" height="2" border="0" /><br />\n';
moduleNavigation     += '            <img src="../../../_common/_img/arrow_5x8_a7beae_002f20.gif" width="5" height="8" border="0" /><img src="../../../_common/_img/1x1_trans.gif" width="6" height="8" border="0" /></a><br />\n';
moduleNavigation     += '          </td>\n';
moduleNavigation     += '          <td valign="top">\n';
moduleNavigation     += '            <a href="javascript:openSelectedProduct();" onmouseover="self.status=\'\'; return true" onmouseout="self.status=\'\'; return true" onfocus="this.blur();"><img src="' + rootpath + productFinderData["goImgPath"] + '" border="0" /></a><br />\n';
moduleNavigation     += '          </td>\n';
moduleNavigation     += '        </tr>\n';
moduleNavigation     += '      </table>\n';
moduleNavigation     += '      <img src="../../../_common/_img/1x1_trans.gif" width="1" height="10" /><br>\n';
moduleNavigation     += '    </td>\n';
moduleNavigation     += '  </tr>\n';
/* -----------------
     END PRODUCTFINDER
     ----------------- */





// START Content related topics

  if (navTeaserLinkData.length > 0) {

    if (navMainData.length > 0) {

      moduleNavigation     += '  <tr>';

      moduleNavigation     += '    <td></td>';

      moduleNavigation     += '    <td>';

      moduleNavigation     += '      <img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="1" /><br />';

      moduleNavigation     += '      <img src="'+ rootpath +'/_common/_img/1x1_' + striplineColor + '.gif" width="156" height="1" /><br />';

      moduleNavigation     += '      <img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="6" /><br />';

      moduleNavigation     += '    </td>';

      moduleNavigation     += '  </tr>';

    }



    moduleNavigation       += '  <tr>';

    moduleNavigation       += '    <td valign="top" width="10"><img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="10" height="1" /></td>';

    moduleNavigation       += '    <td valign="top">';

    moduleNavigation       += '      <img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="22" /><br />';

    moduleNavigation       += '      <table cellpadding="0" cellspacing="0" border="0">';

    moduleNavigation       += '        <tr>';

    moduleNavigation       += '          <td valign="top" width="156" colspan="2"><span class="' + navFontFace + 'bold"><span class="' + teaserLinkHeadlineColor + '">' + navTeaserLinkData["navHeadline"] + '</span><br /></span><img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="5" /></td>';

    moduleNavigation       += '        </tr>';



    for (var i=0; i<navTeaserLinkData.length ; i++) {

      var tempUrlSubString = navTeaserLinkData[i]["navUrl"].split("?")[0];

      if (!navTeaserLinkData[i]['navTarget']) {

        if (tempUrlSubString.indexOf("javascript:") != -1) {

          navTeaserLinkData[i]['navTarget'] = '_self';

        }

        else {

          if ((tempUrlSubString.indexOf("://") != -1)) {

            navTeaserLinkData[i]['navTarget'] = '_blank';

          }

          else {

              navTeaserLinkData[i]['navTarget'] = '_self';

              navTeaserLinkData[i]["navUrl"] = rootpath + navTeaserLinkData[i]["navUrl"];

          }

        }

      }

      else {

        if (tempUrlSubString.indexOf("://") == -1) {

          navTeaserLinkData[i]["navUrl"] = rootpath + navTeaserLinkData[i]["navUrl"];

        }

      }



      navTeaserLinkData[i]["navUrl"]  = ((navTeaserLinkData[i]["navAddParam"]) ? navTeaserLinkData[i]["navUrl"].split("?")[0] + '?' + navTeaserLinkData[i]["navAddParam"] : navTeaserLinkData[i]["navUrl"].split("?")[0] + '?');

      navTeaserLinkData[i]["navUrl"] += 'refType=teaserLink&refPage=' + serverRelativeUrl;

      

      moduleNavigation     += '        <tr>';

      moduleNavigation     += '          <td valign="top" width="11"><img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="4" /><br /><img src="'+ rootpath +'/_common/_img/arrow_3x5_' + navFontColor.substr(5,6) +'_' + navFontColor.substr(12,6) + '.gif" width="3" height="5" id="QuickNav' + i + '" name="QuickNav' + i + '" /></td>';

      moduleNavigation     += '          <td width="145"><span class="' + navFontFace + '"><a href="' + navTeaserLinkData[i]["navUrl"] + '" target="' + navTeaserLinkData[i]["navTarget"] + '" onmouseover="mouseOver(\'QuickNav' + i + '\');self.status=\'' + navTeaserLinkData[i]["navStatus"] + '\';return true;" onmouseout="mouseOut(\'QuickNav' + i + '\');self.status=\'\';return true;" class="' + navFontColor + '" /*title="' + navTeaserLinkData[i]["navText"] + '"*/ onfocus="this.blur();">' + navTeaserLinkData[i]["navText"] + '</a><br /></span><img src="'+ rootpath +'/_common/_img/1x1_trans.gif" width="1" height="3" /></td>';

      moduleNavigation     += '        </tr>';

    }



    moduleNavigation       += '      </table>';

    moduleNavigation       += '    </td>';

    moduleNavigation       += '  </tr>';

  }

// END Content related topics



  moduleNavigation         += '</table>';



  moduleNavigationDynLayer = DynLayer.getInline("moduleNavigationLayer");

  moduleNavigationDynLayer.setHTML(moduleNavigation);



  initProductFinder();

}





var box1Id;
var box2Id;
var box3Id;

function initProductFinder() {

  var pageFound = false;

  for (box1Id=0; box1Id < productFinderData.length; box1Id++) {
    for (box2Id=0; box2Id < productFinderData[box1Id].length; box2Id++) {
      for (box3Id=0; box3Id < productFinderData[box1Id][box2Id].length; box3Id++) {
        if (productFinderData[box1Id][box2Id][box3Id]['navUniqueID'] == navUniqueID) {
          pageFound = true;
          setCategoryBoxStatus(box1Id);
          setModelBoxStatus(box2Id, box1Id);
          setDateBoxStatus(box3Id, box1Id, box2Id);
          break;
        }
      }
      if (pageFound){
        break;
      }
    }
    if (pageFound){
      break;
    }
  }
  if (!pageFound) {
    setCategoryBoxStatus(0);
    clearBox("selectModel");
    clearBox("selectDate");
  }
}

function clearBox(boxId) {
  var selectObj = document.forms["productFinder"].elements[boxId];

  selectObj.options.length = 1;

  selectObj.options[0]        = new Option();


  if (typeof selectObj.options[0].innerHTML == "string") {

    selectObj.options[0].innerHTML = productFinderData[0]['name'];

  } else {

    selectObj.options[0].text = productFinderData[0]['name'];

  }

  
  selectObj.disabled = true;
  selectObj.style.backgroundColor = "#ffffff";
}

function setCategoryBoxStatus(box1OptionNr) {
  var selectObj = document.forms["productFinder"].elements["selectCategory"];
  selectObj.options.length = 0;

  for (var i = 0; i < productFinderData.length; i++) {
    selectObj.options[i]        = new Option();
    

    if (typeof selectObj.options[i].innerHTML == "string") {

      selectObj.options[i].innerHTML = productFinderData[i]['name'];

    } else {

      selectObj.options[i].text = productFinderData[i]['name'];

    }


    if (i>0) {
      if(productFinderData[i].length > 2) {
        selectObj.options[i].value  = "setModelBoxStatus(0," + i + ");clearBox('selectDate');";

      } else {
        if(productFinderData[i][1].length > 2) {
          selectObj.options[i].value  = "setModelBoxStatus(1," + i + ");setDateBoxStatus(0," + i + ",1);document.getElementById('labelModel').style.color = '#a6beaf';";
        } else {
          selectObj.options[i].value  = "setModelBoxStatus(1," + i + ");setDateBoxStatus(1," + i + ",1);document.getElementById('labelModel').style.color = '#a6beaf';document.getElementById('labelDate').style.color = '#a6beaf';";
        }
      }
    } else {
      selectObj.options[i].value  = "clearBox('selectModel');clearBox('selectDate');";
    }

    if(i == box1OptionNr) {
      selectObj.options[i].selected = true;
    }
  }
}

function setModelBoxStatus(selectOption, box1OptionNr) {
  var selectObj = document.forms["productFinder"].elements["selectModel"];

  selectObj.disabled              = false;
  selectObj.style.backgroundColor = "#ffffff";
  selectObj.options.length        = 0;

  for (var i = 0; i < productFinderData[box1OptionNr].length; i++) {
    selectObj.options[i]        = new Option();


    if (typeof selectObj.options[i].innerHTML == "string") {

      selectObj.options[i].innerHTML = productFinderData[box1OptionNr][i]['name'];

    } else {

      selectObj.options[i].text = productFinderData[box1OptionNr][i]['name'];

    }


    if (i>0) {
      if(productFinderData[box1OptionNr][i].length > 2) {
        selectObj.options[i].value  = "setDateBoxStatus(0," + box1OptionNr + "," + i + ")";
      } else {
        selectObj.options[i].value  = "setDateBoxStatus(1," + box1OptionNr + "," + i + ");document.getElementById('labelDate').style.color = '#a6beaf';";
      }
    } else {
      selectObj.options[i].value  = "clearBox('selectDate');";
    }

    if(i == selectOption) {
      selectObj.options[i].selected = true;
    }

  }
}

function setDateBoxStatus(selectOption, box1OptionNr, box2OptionNr) {
  var selectObj = document.forms["productFinder"].elements["selectDate"];

  selectObj.disabled              = false;
  selectObj.style.backgroundColor = "#ffffff";
  selectObj.options.length        = 0;

  for (var i = 0; i < productFinderData[box1OptionNr][box2OptionNr].length; i++) {
    selectObj.options[i]        = new Option();


    if (typeof selectObj.options[i].innerHTML == "string") {

      selectObj.options[i].innerHTML = productFinderData[box1OptionNr][box2OptionNr][i]['name'];

    } else {

      selectObj.options[i].text = productFinderData[box1OptionNr][box2OptionNr][i]['name'];

    }


    if(i>0){
      selectObj.options[i].value  = productFinderData[box1OptionNr][box2OptionNr][i]['url'];
    } else {
      selectObj.options[i].value  = "";
    }

    if(i == selectOption) {
      selectObj.options[i].selected = true;
    }

  }
}

function openSelectedProduct() {
  var selectCategoryObj = document.forms["productFinder"].elements["selectCategory"];

  var selectModelObj = document.forms["productFinder"].elements["selectModel"];

  var selectDateObj = document.forms["productFinder"].elements["selectDate"];



  if((selectDateObj.options.length > 0) && (selectDateObj.options[selectDateObj.options.selectedIndex].value != "") && (selectCategoryObj.options.selectedIndex != 0) && (selectModelObj.options.selectedIndex != 0) && (selectDateObj.options.selectedIndex != 0) ) {
    location.href=rootpath + selectDateObj.options[selectDateObj.options.selectedIndex].value;
  } else {

    if((selectCategoryObj.options.length < 1) || (selectCategoryObj.options.selectedIndex == 0)) {
      document.getElementById("labelCategory").style.color = "#ff6600";

    }

    if((selectModelObj.options.length < 1) || (selectModelObj.options.selectedIndex == 0)) {
      document.getElementById("labelModel").style.color = "#ff6600";

    }

    if((selectDateObj.options.length < 1) || (selectDateObj.options.selectedIndex == 0)) {
      document.getElementById("labelDate").style.color = "#ff6600";

    }


  }
}