






//#################### FUNCTIONS TO BE INCLUDED BY CONTENT EDITORS #######################################################

// stores the values selected by user in the flash calculator
function set_Amount_Term()
{
  w('<form action="#" method="post" name="flashForm">');
  w('<input type="hidden" name="Amount" id="Amount" value="">');
  w('<input type="hidden" name="Term" id="Term" value="">');
  w('</form>');
}


function incl_PersonalLoanCalc() {
  incl_PersonalLoanCalc(false);
}

function incl_PersonalLoanCalc(flexible) {
  if (!useRedirect) {
    if(hasRightVersion) {
      var fileXml = 'fixed_interest_loan.xml'
      if (flexible)
        fileXml = 'flash_rates.xml';

      w('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="275" height="153" id="personal_loan" align="middle">');
    //alert("flashString in incl_PersonalLoanCalc = "+flashString+"&xmlFile=" + fb_siteroot + fileXml);	
      w('<param name="FlashVars" value="'+flashString+'&xmlFile=' + fb_siteroot + '/' + fileXml + '"/>');
      w('<param name="allowScriptAccess" value="sameDomain" />');
      w('<param name="movie" value="' + fb_resources + '/flash/' + fb_country + '_personal_loan_' + fb_language + '.swf" />');
      w('<param name="quality" value="high" />');
      w('<param name="bgcolor" value="#ffffff" />');
      w('<embed src="' + fb_resources + '/flash/' + fb_country + '_personal_loan_' + fb_language + '.swf" FlashVars="'+flashString+'&xmlFile=' + fb_siteroot + '/' + fileXml + '" quality="high" bgcolor="#ffffff" width="275" height="160" name="personal_loan" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
      w('</object>');
    } else {
      w('<img src="' + localeResourcePic('de_personal_loan_de.gif') + '"/>');
    }
  }
}


function incl_TimeDepositCalc() {
  if (!useRedirect) {
    if(hasRightVersion) {
      w('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="275" height="140" id="personal_loan" align="middle">');
      w('<param name="FlashVars" value="'+flashString+'&xmlFile=' + fb_siteroot + 'time_deposit.xml"/>');
      w('<param name="allowScriptAccess" value="sameDomain" />');
      w('<param name="movie" value="' + fb_resources + '/flash/' + fb_country + '_time_deposit_' + fb_language + '.swf" />');
      w('<param name="quality" value="high" />');
      w('<param name="bgcolor" value="#ffffff" />');
      w('<embed src="' + fb_resources + '/flash/' + fb_country + '_time_deposit_' + fb_language + '.swf" FlashVars="'+flashString+'&xmlFile=' + fb_siteroot + 'time_deposit.xml" quality="high" bgcolor="#ffffff" width="275" height="140" name="time_deposit" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
      w('</object>');
    } else {
      w('<img src="' + localeResourcePic('') + '"/>');
    }
  }
}

function incl_persLoanRate() {
  w('<SPAN style="FONT-WEIGHT: bold; FONT-SIZE: 41px">4,95%</SPAN>');
}


function directBankingURL() {
    return 'https://intbank.crediteurope.nl/FWFIB/loginNewNV.jsp?companyCode='+countryBig()+'&lang='+language();
//  return 'https://intbank.crediteurope.nl/servlet/internet.fbh.servlet.IBServlet?LNG=' + iso3Language() + '&COUNTRY_CODE=' + countryBig() + '0010001&CODE=LOGIN_PAGE';
}

function corporateBankingURL() {
    return 'https://intbank.crediteurope.nl/FWFIB/loginNewNVKR.jsp?companyCode='+countryBig()+'&lang='+language();
//  return 'https://intbank2.crediteurope.nl/servlet/internet.fbh.servlet.IBServlet?LNG=' + iso3Language() + '&COUNTRY_CODE=' + countryBig() + '0010001&CODE=LOGIN_PAGE&CHANNELID=003';
}

function getTrackingCookie()
{
  var c_name = "TrackingCookie";
  if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1)
    {
        c_start=c_start + c_name.length+1;
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1)
          c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
  return "";
}

function appProcess_PersonalLoan() {
  var amount = document.getElementById("Amount").value;
  var term   = document.getElementById("Term").value;
  var url_de_en = 'https://www.crediteurope.de/WTU/WebApp?language=de&country=DE&product_id=5&start=true&loan_amount=' + amount + '&loan_term=' + term;
  var url_de_de = 'https://www.crediteurope.de/WTU/WebApp?language=de&country=DE&product_id=5&start=true&loan_amount=' + amount + '&loan_term=' + term;   
  var url_nl_en = 'https://www.crediteurope.nl/WTU/WebApp?language=en&country=NL&back_page_num=0&page_num=0&product_id=8&start=true'; 
  var url_nl_nl = 'https://www.crediteurope.nl/WTU/WebApp?language=nl&country=NL&back_page_num=0&page_num=0&product_id=8&start=true';
  var url_be_nl = 'https://www.crediteurope.be/WTU/WebApp?language=nl&country=BE&back_page_num=0&page_num=0&product_id=13&start=true';	
  var url_be_en = 'https://www.crediteurope.be/WTU/WebApp?language=en&country=BE&back_page_num=0&page_num=0&product_id=13&start=true';
  var url_be_fr = 'https://www.crediteurope.be/WTU/WebApp?language=fr&country=BE&back_page_num=0&page_num=0&product_id=13&start=true';  
  appProcess_openPopup(eval('url_' + country() + '_' + language()));
}

function appProcess_FlexibleLoan() {
  var url_de_en = 'https://www.crediteurope.de/WTU/WebApp?language=de&country=DE&back_page_num=0&page_num=0&product_id=7&start=true'; 
  var url_de_de = 'https://www.crediteurope.de/WTU/WebApp?language=de&country=DE&back_page_num=0&page_num=0&product_id=7&start=true';  
  var url_nl_en = 'https://www.crediteurope.nl/WTU/WebApp?language=nl&country=NL&back_page_num=0&page_num=0&product_id=9&start=true'; 
  var url_nl_nl = 'https://www.crediteurope.nl/WTU/WebApp?language=nl&country=NL&back_page_num=0&page_num=0&product_id=9&start=true';
  var url_be_nl = 'https://www.crediteurope.be/WTU/WebApp?language=nl&country=BE&back_page_num=0&page_num=0&product_id=2&start=true';	
  var url_be_en = 'https://www.crediteurope.be/WTU/WebApp?language=en&country=BE&back_page_num=0&page_num=0&product_id=2&start=true';
  var url_be_fr = 'https://www.crediteurope.be/WTU/WebApp?language=fr&country=BE&back_page_num=0&page_num=0&product_id=2&start=true';  
  var url_mt_en = 'https://www.crediteurope.nl/WTU/WebApp?language=en&country=MT&back_page_num=0&page_num=0&product_id=201&start=true'; 
  var url_mt_mt = 'https://www.crediteurope.nl/WTU/WebApp?language=mt&country=MT&back_page_num=0&page_num=0&product_id=201&start=true';
  appProcess_openPopup(eval('url_' + country() + '_' + language()));
}

function appProcess_TimeDeposit() {
 var url_de_en = 'https://www.crediteurope.de/FWFDC/enter.jsp?type=dc&companyCode=DE&lang=DE&loginPage=LOGIN&excPage=WEB67002';
 var url_de_de = 'https://www.crediteurope.de/FWFDC/enter.jsp?type=dc&companyCode=DE&lang=DE&loginPage=LOGIN&excPage=WEB67002';
 var url_nl_en = 'https://www.crediteurope.nl/FWFDC/enter.jsp?type=dc&companyCode=NL&lang=NL&loginPage=LOGIN&excPage=WEB67002'; 
 var url_nl_nl = 'https://www.crediteurope.nl/FWFDC/enter.jsp?type=dc&companyCode=NL&lang=NL&loginPage=LOGIN&excPage=WEB67002';
 var url_be_nl = 'https://www.crediteurope.be/FWFDC/enter.jsp?type=dc&companyCode=BE&lang=NL&loginPage=LOGIN';	
 var url_be_en = 'https://www.crediteurope.be/FWFDC/enter.jsp?type=dc&companyCode=BE&lang=FR&loginPage=LOGIN';
 var url_be_fr = 'https://www.crediteurope.be/FWFDC/enter.jsp?type=dc&companyCode=BE&lang=FR&loginPage=LOGIN';
 var url_mt_en = 'https://www.crediteurope.com.mt/FWFDC/enter.jsp?type=dc&companyCode=MT&lang=EN&loginPage=LOGIN'; 
 
 if (getTrackingCookie() != ""){
   url_de_de += '&' + getTrackingCookie();
   url_de_en += '&' + getTrackingCookie();
   url_nl_nl += '&' + getTrackingCookie();
   url_nl_en += '&' + getTrackingCookie();
   url_be_nl += '&' + getTrackingCookie();
   url_be_fr += '&' + getTrackingCookie();
   url_be_en += '&' + getTrackingCookie();
   url_mt_en += '&' + getTrackingCookie();
 }

 openPopup2(eval('url_' + country() + '_' + language()));
}

function appProcess_TopInterest() {
 var url_de_en = 'https://www.crediteurope.de/FWFDC/enter.jsp?type=dc&companyCode=DE&lang=DE&loginPage=LOGIN';
 var url_de_de = 'https://www.crediteurope.de/FWFDC/enter.jsp?type=dc&companyCode=DE&lang=DE&loginPage=LOGIN'; 
 var url_nl_en = 'https://www.crediteurope.nl/FWFDC/enter.jsp?type=dc&companyCode=NL&lang=NL&loginPage=LOGIN'; 
 var url_nl_nl = 'https://www.crediteurope.nl/FWFDC/enter.jsp?type=dc&companyCode=NL&lang=NL&loginPage=LOGIN';
 var url_be_nl = 'https://www.crediteurope.be/FWFDC/enter.jsp?type=dc&companyCode=BE&lang=NL&loginPage=LOGIN';	
 var url_be_en = 'https://www.crediteurope.be/FWFDC/enter.jsp?type=dc&companyCode=BE&lang=FR&loginPage=LOGIN';
 var url_be_fr = 'https://www.crediteurope.be/FWFDC/enter.jsp?type=dc&companyCode=BE&lang=FR&loginPage=LOGIN';
 var url_mt_en = 'https://www.crediteurope.com.mt/FWFDC/enter.jsp?type=dc&companyCode=MT&lang=EN&loginPage=LOGIN'; 
 
 if (getTrackingCookie() != ""){
   url_de_de += '&' + getTrackingCookie();
   url_de_en += '&' + getTrackingCookie();
   url_nl_nl += '&' + getTrackingCookie();
   url_nl_en += '&' + getTrackingCookie();
   url_be_nl += '&' + getTrackingCookie();
   url_be_fr += '&' + getTrackingCookie();
   url_be_en += '&' + getTrackingCookie();
   url_mt_en += '&' + getTrackingCookie();
 }

 openPopup2(eval('url_' + country() + '_' + language()));
}

function appProcess_BusinessTopInterest() {
 var url_nl_en = 'https://www.crediteurope.nl/WTU/WebApp?language=en&country=NL&back_page_num=0&page_num=0&product_id=11&start=true'; 
 var url_nl_nl = 'https://www.crediteurope.nl/WTU/WebApp?language=nl&country=NL&back_page_num=0&page_num=0&product_id=11&start=true';
 appProcess_openPopup(eval('url_' + country() + '_' + language()));
}


function appProcess_openPopup(url) {
    var fenster1=window.open(url, 'Apply', "width=740,height=570,resizable=no,scrollbars=yes,menubar=no");
  fenster1.focus();
}

function calculator_PersonalLoan() {
  var amount = document.getElementById("Amount").value;
  var term   = document.getElementById("Term").value
  var url_de_de = 'https://www.crediteurope.de/WTU/apps/calculators/personalLoanDE.jsp';
  var url_de_en = 'https://www.crediteurope.de/WTU/apps/calculators/personalLoanDE.jsp';
  var url_nl_nl = 'https://www.crediteurope.nl/WTU/apps/calculators/personalLoan_NL_NL.jsp';
  var url_nl_en = 'https://www.crediteurope.nl/WTU/apps/calculators/personalLoan_NL_EN.jsp';
  var url_be_nl = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_NL.jsp';
  var url_be_en = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_EN.jsp';
  var url_be_fr = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_FR.jsp';
  var win=window.open('', 'Apply', "width=750,height=570,resizable=no,scrollbars=yes,menubar=no");
  win.focus();
  win.document.writeln('<html><body onload="document.applyForm.submit();">');
  win.document.writeln('<form action="'+ eval('url_' + country() + '_' + language()) + '" method="post" name="applyForm">');
  win.document.writeln('<input type="hidden" name="Amount" value="' + amount + '">'); 
  win.document.writeln('<input type="hidden" name="Term" value="' + term + '">');     
  win.document.writeln('<input type="hidden" name="Insurance" value="1">');       
  win.document.writeln('<input type="hidden" name="Installment" value="0">');     
  win.document.writeln('<input type="hidden" name="Submit" value="Berechnen">');  
  win.document.writeln('<input type="hidden" name="callFromHomepage" value="1">');
  win.document.writeln('<input type="hidden" name="Acc_Type">');                  
  win.document.writeln('<input type="hidden" name="Net_Inc">');                   
  win.document.writeln('<input type="hidden" name="Extra_Net_Inc">');             
  win.document.writeln('<input type="hidden" name="Cost_Living">');               
  win.document.writeln('<input type="hidden" name="Rent">');                      
  win.document.writeln('<input type="hidden" name="Mortgage">');                  
  win.document.writeln('<input type="hidden" name="Alimentation">');              
  win.document.writeln('<input type="hidden" name="Extra_Expense">');             
  win.document.writeln('<input type="hidden" name="Net_Inc_Partner">');           
  win.document.writeln('<input type="hidden" name="Extra_Net_Inc_Partner">');     
  win.document.writeln('<input type="hidden" name="Cost_Living_Partner">');       
  win.document.writeln('<input type="hidden" name="Rent_Partner">');              
  win.document.writeln('<input type="hidden" name="Mortgage_Partner">');          
  win.document.writeln('<input type="hidden" name="Alimentation_Partner">');      
  win.document.writeln('<input type="hidden" name="Extra_Expense_Partner">');     
  win.document.writeln('<input type="hidden" name="Insurance" value="1">');       
  win.document.writeln('<input type="hidden" name="Installment" value="0">');     
  win.document.writeln('<input type="hidden" name="Submit" value="Berechnen">');  
  win.document.writeln('<input type="hidden" name="callFromHomepage" value="1">');
  win.document.writeln('</form></body></html>');
  win.document.close();
}

// This calculator will transfer to the first page of the calculator
//function calculator_PersonalLoanFP(){
//  var url_nl_nl = 'https://www.crediteurope.nl/WTU/apps/calculators/personalLoan_NL_NL.jsp';
//  var url_nl_en = 'https://www.crediteurope.nl/WTU/apps/calculators/personalLoan_NL_EN.jsp';
//  var url_be_nl = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_NL.jsp';
//  var url_be_en = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_EN.jsp';
//  var url_be_fr = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_FR.jsp';
//  calculator_openPopup(eval('url_' + country() + '_' + language()));
//}


function calculator_PersonalLoanFP(){
  var amount = document.getElementById("Amount").value;
  var term   = document.getElementById("Term").value

  var url_nl_nl = 'https://www.crediteurope.nl/WTU/apps/calculators/personalLoan_NL_NL.jsp';
  var url_nl_en = 'https://www.crediteurope.nl/WTU/apps/calculators/personalLoan_NL_EN.jsp';
  var url_be_nl = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_NL.jsp';
  var url_be_en = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_EN.jsp';
  var url_be_fr = 'https://www.crediteurope.be/WTU/apps/calculators/personalLoan_BE_FR.jsp';

  var win=window.open('', 'Apply', "width=750,height=570,resizable=no,scrollbars=yes,menubar=no");
  win.focus();
  win.document.writeln('<html><body onload="document.applyForm.submit();">');
  win.document.writeln('<form action="'+ eval('url_' + country() + '_' + language()) + '" method="post" name="applyForm">');
  win.document.writeln('<input type="hidden" name="Amount" value="' + amount + '">'); 
  win.document.writeln('<input type="hidden" name="Term" value="' + term + '">');     
  win.document.writeln('</form></body></html>');
  win.document.close();
}




function calculator_FlexiblelLoan(){
  var url_nl_nl = 'https://www.crediteurope.nl/WTU/apps/calculators/flexibleLoan_NL_NL.jsp';
  var url_nl_en = 'https://www.crediteurope.nl/WTU/apps/calculators/flexibleLoan_NL_EN.jsp';
  calculator_openPopup(eval('url_' + country() + '_' + language()));
}

function calculator_openPopup(url) {
  var fenster1=window.open(url, 'Apply', "width=740,height=570,resizable=no,scrollbars=yes,menubar=no");
  fenster1.focus();
}

//############################## CONTENT FLASH #############################################################
Flash = {};
Flash.dr_dispo     = {name: 'dr_dispo',     width: 270, height: 175, linkTarget: 'javascript:appProcess_FlexibleLoan()', windowTarget: '_self'};
Flash.top_interest = {name: 'top_interest', width: 270, height: 130, linkTarget: 'javascript:appProcess_TopInterest()', windowTarget: '_self'};
Flash.business_topInterest = {name: 'business_topInterest', width: 270, height: 130, linkTarget: 'javascript:appProcess_BusinessTopInterest()', windowTarget: '_self'};

Flash.bg_consumer_home = {name: 'bg_consumer_home', width: 236, height: 183};

Flash.include = function(flash) {
  includeFlash(flash.name, flash.width, flash.height);
}
Flash.include_mitLink = function(flash) {
  includeFlashMitLink(flash.name, flash.width, flash.height, flash.linkTarget, flash.windowTarget);
}




//############################## UTILITY FUNCTIONS #########################################################

function w(s) {
  document.write(s);
}

function country()  {return fb_country;}
function language() {return fb_language;}
function countryBig() {return country().toUpperCase();}
function languageBig() {return language().toUpperCase();}

function iso3Language() {
  if (language() == 'de')
    return 'DEU';
  else if (language() == 'en')
    return 'ENG';
  else if (language() == 'nl')
    return 'NED';
  else if (language() == 'fr')
    return 'FRA';
  else
    return 'ENG';	
}

function localeResourcePic(name) {
  return fb_resources + '/pics/' + fb_country + '/' + fb_language + '/' + name;
}

function includeFlash(flashBaseName, width, height) {
  if (!useRedirect) {
    if(hasRightVersion) {
      w('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '" id="personal_loan" align="middle">');
      w('<param name="allowScriptAccess" value="sameDomain" />');
      w('<param name="movie" value="' + fb_resources + '/flash/' + fb_country + '_' + flashBaseName + '_' + fb_language + '.swf" />');
      w('<param name="wmode" value="transparent" />');
      w('<param name="quality" value="high" />');
      w('<param name="bgcolor" value="#ffffff" />');
      w('<embed src="' + fb_resources + '/flash/' + fb_country + '_' + flashBaseName + '_' + fb_language + '.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="personal_loan" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
      w('</object>');
    } else {
      w('<img src="' + fb_resources + '/flash/' + fb_country + '_' + flashBaseName + '_' + fb_language + '.jpg" />');
    }
  }
}

function includeFlashMitLink(flashBaseName, width, height, linkTarget, windowTarget) {
  if (!useRedirect) {
    if(hasRightVersion) {
      w('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + width + '" height="' + height + '" id="personal_loan" align="middle">');
      w('<param name="allowScriptAccess" value="sameDomain" />');
      w('<param name="movie" value="' + fb_resources + '/flash/' + fb_country + '_' + flashBaseName + '_' + fb_language + '.swf" />');
      w('<param name="quality" value="high" />');
	w('<param name="flashVars" value="linkTo=' + linkTarget + '&linkTarget=' + windowTarget + '" />');      
      w('<param name="bgcolor" value="#ffffff" />');
      w('<embed src="' + fb_resources + '/flash/' + fb_country + '_' + flashBaseName + '_' + fb_language + '.swf" FlashVars="linkTo=' + linkTarget + '&linkTarget=' + windowTarget + '" quality="high" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="personal_loan" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
      w('</object>');
    } else {
	if (linkTarget.indexOf("javascript")!= -1){
		w('<a href="javascript:void(0)" onclick="' + linkTarget + ';return false;"><img src="' + fb_resources + '/flash/' + fb_country + '_' + flashBaseName + '_' + fb_language + '.jpg" /></a>');
	}else{
		w('<a href="' + linkTarget + '" target="' + windowTarget + '"><img src="' + fb_resources + '/flash/' + fb_country + '_' + flashBaseName + '_' + fb_language + '.jpg" /></a>');
	}
    }
  }
}


