try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


// font change functions

var fontsizeup_on = new Image();
fontsizeup_on.src = '/design/images/icon-text-plus.jpg';
var fontsizeup_off = new Image();
fontsizeup_off.src = '/design/images/icon-text-plus-inactive.jpg';
var fontsizeup_hover = new Image();
fontsizeup_hover.src = '/design/images/icon-text-plus-hover.jpg';

var fontsizedown_on = new Image();
fontsizedown_on.src = '/design/images/icon-text-minus.jpg';
var fontsizedown_off = new Image();
fontsizedown_off.src = '/design/images/icon-text-minus-inactive.jpg';
var fontsizedown_hover = new Image();
fontsizedown_hover.src = '/design/images/icon-text-minus-hover.jpg';

function fontsizeup() {
  active = getActiveStyleSheet();
  setActiveStyleSheet('cms_alt2');
}

function fontsizedown() {
  active = getActiveStyleSheet();
  setActiveStyleSheet('cms_alt1');
}

function fontsizeOverOut(img_name, img_over, anchor_name){
	img = document.getElementById(img_name);
	a = document.getElementById(anchor_name);

	if(a.getAttribute('href')){
		img.src = img_over.src;
	}
}

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  
  imgdown = document.getElementById('font-size-down-img');
  imgup = document.getElementById('font-size-up-img');

  adown = document.getElementById('font-size-down-a');
  aup = document.getElementById('font-size-up-a');

  if(imgdown && imgup){
	  if(title == 'cms_alt2'){
		  imgdown.src = fontsizedown_on.src;
		  imgup.src = fontsizeup_off.src;
		  aup.removeAttribute('href');
		  adown.setAttribute('href','javascript:void(0)');
	  }else{
  		  imgdown.src = fontsizedown_off.src;
		  imgup.src = fontsizeup_on.src;
		  aup.setAttribute('href','javascript:void(0)');
		  adown.removeAttribute('href');
	  }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
	return ('cms_alt1');
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function styleSheetOnLoad() {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

function styleSheetOnUnload() {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
if (title == 'null') {
  title = getPreferredStyleSheet();
}


addEvent(window, 'load', function() {setActiveStyleSheet(title)}, false);

//


function openWinSiegel(sPage) {
  window.open(sPage,"",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=550,height=600');
}

// investor info callout change

function showInvCallout1() {
	if (document.getElementById) {
		document.getElementById('inv-call-tab-l-a').style.color = '#000000';
		document.getElementById('inv-call-tab-r-a').style.color = '#cc3300';
		document.getElementById('inv-call-info1').style.display = 'block';
		document.getElementById('inv-call-info2').style.display = 'none';
	}
}

function showInvCallout2() {
	if (document.getElementById) {
		document.getElementById('inv-call-tab-l-a').style.color = '#cc3300';
		document.getElementById('inv-call-tab-r-a').style.color = '#000000';
		document.getElementById('inv-call-info1').style.display = 'none';
		document.getElementById('inv-call-info2').style.display = 'block';
	}
}

function changeLanguage(sNewLanguage) {
  var sUrl = top.location.href;
  if(sNewLanguage!="") top.location.href = sUrl.replace(sOldLanguage, sNewLanguage);
}
function Fneu() {
F1=window.open('http://www.customerservicesonline.ch/platform/apps/npsLegal/index.asp','PopUp','width=600,height=500,scrollbars=yes,resizable=yes,screenX=0,screenY=0');
}

function Fneuf() {
F1=window.open('http://www.customerservicesonline.ch/platform/apps/npsLegal/index_f.asp','PopUp','width=600,height=500,scrollbars=yes,resizable=yes,screenX=0,screenY=0');
}
