/***************************************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use. Visit
* http://www.dynamicdrive.com/ for full source code.
***************************************************************/

// Contents for menu 2, and so on
var menu2 = new Array();
menu2[0] = '<a href="?symbol=SX5P">STOXX 50</a>';
menu2[1] = '<a href="?symbol=SX5E">EURO STOXX 50</a>';
menu2[2] = '<a href="?symbol=DK5F">STOXX NORDIC 30</a>';
menu2[3] = '<a href="?symbol=EUE15P">STOXX EU Enlarged 15</a>';
menu2[4] = '<a href="?symbol=EEBCP">STOXX Eastern Europe 50</a>';
menu2[5] = '<a href="?symbol=SXYBP">STOXX Sub Balkan 30</a>';
menu2[6] = '<a href="?symbol=SXB5P">STOXX Balkan 50</a>';

var menuwidth = '160px';      //default menu width
var menubgcolor = '#F0F0FF';  //menu bgcolor
var disappeardelay = 250;     //menu disappear speed onMouseout (ms)
var hidemenu_onclick = "yes"; //hide menu when user clicks within menu?

// No further editing needed
var ie4 = document.all;
var ns6 = document.getElementById && !document.all;

if (ie4 || ns6)
    document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>');

function getposOffset(what, offsettype) {
    var totaloffset = (offsettype == "left") ? what.offsetLeft : what.offsetTop;
    var parentEl = what.offsetParent;
    while (parentEl != null) {
	totaloffset = (offsettype == "left") ? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
	parentEl = parentEl.offsetParent;
    }
    return totaloffset;
}

function showhide(obj, e, visible, hidden, menuwidth) {
    if (ie4 || ns6)
	dropmenuobj.style.left = dropmenuobj.style.top=-500;
    if (menuwidth != "") {
	dropmenuobj.widthobj = dropmenuobj.style;
	dropmenuobj.widthobj.width = menuwidth;
    }
    if (e.type == "click" && obj.visibility == hidden || e.type == "mouseover")
	obj.visibility = visible;
    else if (e.type == "click")
	obj.visibility = hidden;
}

function iecompattest() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
}

function clearbrowseredge(obj, whichedge) {
    var edgeoffset = 0;
    if (whichedge == "leftedge") {
	var windowedge = ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
	dropmenuobj.contentmeasure = dropmenuobj.offsetWidth;
	if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
	    edgeoffset = dropmenuobj.contentmeasure-obj.offsetWidth;
    }
    else {
	var topedge = ie4 && !window.opera ? iecompattest().scrollTop : window.pageYOffset;
	var windowedge = ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
	dropmenuobj.contentmeasure = dropmenuobj.offsetHeight;

	// move up?
	if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure) {
	    edgeoffset = dropmenuobj.contentmeasure+obj.offsetHeight;

	    // up no good either?
	    if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) 
		edgeoffset = dropmenuobj.y+obj.offsetHeight-topedge;
	}
    }
    return edgeoffset;
}

function populatemenu(what) {
    if (ie4 || ns6)
	dropmenuobj.innerHTML = what.join("");
}

function dropdownmenu(obj, e, menucontents, menuwidth, xOffset) {
    if (window.event)
	event.cancelBubble = true;
    else if (e.stopPropagation)
	e.stopPropagation();
    clearhidemenu();
    dropmenuobj = document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv;
    populatemenu(menucontents);

    if (ie4 || ns6) {
	showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth);
	dropmenuobj.x = getposOffset(obj, "left")+xOffset;
	dropmenuobj.y = getposOffset(obj, "top");
	dropmenuobj.style.left = dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px";
	dropmenuobj.style.top = dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px";
    }
    return clickreturnvalue();
}

function clickreturnvalue() {
    if (ie4 || ns6)
	return false;
    else
	return true;
}

function contains_ns6(a, b) {
    while (b.parentNode)
	if ((b = b.parentNode) == a)
	    return true;
    return false;
}

function dynamichide(e) {
    if (ie4 && !dropmenuobj.contains(e.toElement))
	delayhidemenu();
    else if (ns6 && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))
	delayhidemenu();
}

function hidemenu(e) {
    if (typeof dropmenuobj != "undefined") {
	if (ie4 || ns6)
	    dropmenuobj.style.visibility = "hidden";
    }
}

function delayhidemenu() {
    if (ie4 || ns6)
	delayhide = setTimeout("hidemenu()",disappeardelay);
}

function clearhidemenu() {
    if (typeof delayhide != "undefined")
	clearTimeout(delayhide);
}

/******************************************************************************
*                (c) Copyright by SWX Swiss Exchange 2002.                    *
*              All rights reserved. All trade marks respected.                *
*                                                                             *
*******************************************************************************
* This software is the exclusive property of the SWX. It is furnished under   *
* license and may only be used or copied in accordance with the terms of such *
* license.                                                                    *
* This software is subject to change without notice and no information        *
* contained in it should be construed as a commitment by the SWX. The SWX     *
* cannot accept any responsibility, financial or otherwise, for any           *
* consequences arising from the use of this software except as otherwise      *
* stated in the terms of the license.                                         *
******************************************************************************/

// ----------------------------------------------------------------
// onMouse event-handlers for navigation .
// ----------------------------------------------------------------
function SwitchBG(element, color) {
    element.style.backgroundColor = color;
}
function LinkTo(path) {
    location.href = path;
}

// ----------------------------------------------------------------
// Rotate banners on Homepage
// ----------------------------------------------------------------
var stepBannerHomepage = 0;
function rotateBannerHomepage() {

    // Rotation delay in seconds
    var speed = 5;

    // Images to display
    var image = new Array("/resources/images/banner/banner_customised.gif");

    // Links corresponding to each image
    var link = new Array("/indices/customised/customised_indices.html");
   
    // Set up for blending between images (only works in IE)
    if (!document.images)
	return;
    if (document.all)
	bannerImage.filters.blendTrans.apply();
    
    // Load this image and link
    document.images.bannerImage.src = image[stepBannerHomepage];
    if (document.all) {
	bannerImage.filters.blendTrans.play();
	document.all["bannerLink"].href = link[stepBannerHomepage];
    } else if(document.getElementById) {
	document.getElementById("bannerLink").href = link[stepBannerHomepage];
    }
    
    // Increment counter or reset (if at end of image array), sleep
    // then reload.
    stepBannerHomepage++;
    if (stepBannerHomepage >= image.length)
	stepBannerHomepage = 0;
    setTimeout("rotateBannerHomepage()", speed * 1000);
}

// ----------------------------------------------------------------
// Rotate banners on Communication page
// ----------------------------------------------------------------
var stepBannerCommunication = 0;
function rotateBannerCommunication() {

    // Rotation delay in seconds
    var speed = 5;

    // Images to display
    var image = new Array("/resources/images/campaign/door.gif",
			  "/resources/images/campaign/housecustomised.gif",
			  "/resources/images/campaign/clock.gif",
			  "/resources/images/campaign/referee.gif",
			  "/resources/images/campaign/lighthouse.gif");
        
    // Links corresponding to each image
    var link = new Array("/download/corporate/campaign/door.pdf",
			 "/download/corporate/campaign/housecustomised.pdf",
			 "/download/corporate/campaign/clock.pdf",
			 "/download/corporate/campaign/referee.pdf",
			 "/download/corporate/campaign/lighthouse.pdf");


    // Set up for blending between images (only works in IE)
    if (!document.images)
	return;
    if (document.all)
	bannerImage.filters.blendTrans.apply();
    
    // Load this image
    document.images.bannerImage.src = image[stepBannerCommunication];
    if (document.all) {
	bannerImage.filters.blendTrans.play();
	document.all["bannerLink"].href = link[stepBannerCommunication];
    } else if(document.getElementById) {
	document.getElementById("bannerLink").href = link[stepBannerCommunication];
    }
    
    // Increment counter or reset (if at end of image array), sleep
    // then reload.
    stepBannerCommunication++;
    if (stepBannerCommunication >= image.length)
	stepBannerCommunication = 0;
    setTimeout("rotateBannerCommunication()", speed * 1000);
}

// ----------------------------------------------------------------
// Check keywords in pushtool
// ----------------------------------------------------------------
function CheckKeywords(width, height, href) {
    var left = screen.width - width - 10;
    var top = (screen.height - height) / 2;
    var popup = window.open(href, 'keywords',
        "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",resizable=1"
        + "directories=0,location=0,menubar=0,scrollbars=1,status=0,titlebar=0,toolbar=0");
    popup.window.focus();
    return false;
}

// ----------------------------------------------------------------
// Printing content part only
// ----------------------------------------------------------------
function PrintPage(width, height, querystring) {
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    var dothtml = /\.html(\#.*)?(\?.*)?(\#.*)?/;
    var href = location.href.replace(dothtml, ".htm");
    var popup = window.open(href + querystring, 'popup',
        "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",resizable=1"
        + "directories=0,location=0,menubar=0,scrollbars=1,status=0,titlebar=0,toolbar=0");
    popup.window.focus();
    return false;
}

// ----------------------------------------------------------------
// Convert content part to PDF
// ----------------------------------------------------------------
function SaveAsPDF(width, height, querystring, cocoonview) {
    if ( cocoonview != null ) {
    	if ( querystring == "" ) querystring = "?cocoon-view=" + cocoonview;
    	else querystring += "&cocoon-view=" + cocoonview;
    }
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    var dothtml = /\.html(\#.*)?(\?.*)?(\#.*)?/;
    var href = location.href.replace(dothtml, ".pdf");
    var popup = window.open(href + querystring, 'popup',
        "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",resizable=1"
        + "directories=0,location=0,menubar=0,scrollbars=1,status=0,titlebar=0,toolbar=0");
    popup.window.focus();
    return false;
}

// ----------------------------------------------------------------
// Sending page via email
// ----------------------------------------------------------------
function EmailPage(width, height, querystring, url, title) {
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    // Clean out all non-ASCII characters (e.g. &reg;) because encodeURIComponent
    // returns UTF-8 whilst we use Latin-1 as HTML encoding.
    var notAscii = /[^ -~]/g;
    var href = url + "?Title=" + encodeURIComponent(title.replace(notAscii, " "))
        + "&Link=" + encodeURIComponent(location.href.replace(/\#.*/, "") + querystring);
    var popup = window.open(href, 'popup',
        "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + ",resizable=1"
        + "directories=0,location=0,menubar=0,scrollbars=0,status=0,titlebar=0,toolbar=0");
    popup.window.focus();
    return false;
}

// ----------------------------------------------------------------
// Methods used in the benchmarking and index_information pages.
// ----------------------------------------------------------------

// Pop-up the index finder - "target" is the name of the text-field
// that the popup will write the selected index to (eg, bm1_txt).
function finder_popup(target) {
    window.open("/indices/index_finder.html?target=" + target,
		"finder", "width=660,height=550,scrollbars=yes");
    return false;
}

// For benchmarking XSP: selects the highest priority value if many
// are set.
function set_parameters(form) {
    form.symbol.value = choose_parameter(form.symbol.value,
					 form.symbol_pd.value,
					 form.symbol_txt.value);    
    form.bm1.value = choose_parameter(form.bm1.value,
				      form.bm1_pd.value,
				      form.bm1_txt.value);
    form.bm2.value = choose_parameter(form.bm2.value,
				      form.bm2_pd.value,
				      form.bm2_txt.value);

    // If bm1 is empty but bm2 is populated, swap them over.
    if (form.bm1.value.length == 0 && form.bm2.value.length > 0) {
	form.bm1.value = form.bm2.value;
	form.bm2.value = "";
    }
}

// Select the first parameter that is set, in priority.
function choose_parameter(par1, par2, par3) {
    if (par1.length > 0)
        return par1;
    else if (par2.length > 0)
        return par2;
    else if (par3.length > 0)
        return par3;
    else 
        return "";
}

// Check all boxes with the given name
function check_all_boxes(name) {
    var boxList = document.getElementsByName(name);
    for (i = 0; i != boxList.length; i++) {
	boxList[i].checked=true;
    }
}

// Clear all the boxes on the tickers page
function clear_all_tickers() {
    var allTickers = document.getElementsByName("index");
    for (i = 0; i != allTickers.length; i++) {
	allTickers[i].checked=false;
    }
}

// Check if a form field contains data
function hasData(text) {
    return text.value != null && text.value.length > 0;
}
// ----------------------------------------------------------------

/******************************************
* DHTML Ad Box (By Matt Gabbert at http://www.nolag.com)
* Visit http://www.dynamicdrive.com/ for full script
* This notice must stay intact for use
******************************************/

adTime=10;  // seconds ad reminder is shown
chanceAd=1; // ad will be shown 1 in X times (put 1 for everytime)

var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
var calunit=ns? "" : "px"
adCount=0;
function initAd(){
	if(!ns && !ie && !w3) return;
	if(ie)		adDiv=eval('document.all.sponsorAdDiv.style');
	else if(ns)	adDiv=eval('document.layers["sponsorAdDiv"]');
	else if(w3)	adDiv=eval('document.getElementById("sponsorAdDiv").style');
	randAd=Math.ceil(Math.random()*chanceAd);
        if (ie||w3)
        adDiv.visibility="visible";
        else
        adDiv.visibility ="show";
	if(randAd==1) showAd();
}
function showAd(){
if(adCount<adTime*10){adCount+=1;
	if (ie){documentWidth  =truebody().offsetWidth/2+truebody().scrollLeft-132;
	documentHeight =truebody().offsetHeight/2+truebody().scrollTop-126;}	
	else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
	documentHeight=window.innerHeight/2+window.pageYOffset-20;} 
	else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-130;
	documentHeight=self.innerHeight/2+window.pageYOffset-141;} 
	adDiv.left=documentWidth-200+calunit;adDiv.top =documentHeight-200+calunit;
	setTimeout("showAd()",50);}else closeAd();
}
function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

//End-->

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function goSplashSite() {
 closeAd();
 window.open('/stoxx10/index.html', 'stoxx10', 'width=800,height=600,scrollbars=no');
}