<!--
// check if flash player is installed
var version = 8;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i) {
		if (isNaN(parseInt(words[i]))) continue;
		var pluginVersion = words[i];
	}
	var flashCanPlay = pluginVersion >= version;
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('flashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & version)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

/**
 * replaces the picture on home by a flash movie
 *
 * @return	void
 */
function setHomeMovie () {
	if (document.getElementById("homePic") && document.getElementById("middle")) {
		if (flashCanPlay) {
			// set flash
			var content = '';
			content += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="370" height="420" id="homeCube" align="middle">\n';
			content += '<param name="allowScriptAccess" value="sameDomain" />\n';
			content += '<param name="movie" value="fileadmin/template/swf/cube_home.swf" />\n';
			content += '<param name="menu" value="false" />\n';
			content += '<param name="quality" value="high" />\n';
			content += '<param name="wmode" value="transparent" />\n';
			content += '<param name="scale" value="noscale" />\n';
			content += '<param name="bgcolor" value="#363D44" />\n';
			content += '<embed src="fileadmin/template/swf/cube_home.swf" menu="false" quality="high" scale="noscale" wmode="transparent" bgcolor="#363D44" width="370" height="420" name="homeCube" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
			content += '</object>\n';
			document.getElementById("middle").innerHTML = content;
		} else {
			document.getElementById("homePic").src = "fileadmin/template/img/pic_home_claim.jpg";
		}
	}
}

/**
 * sets the corporate image film
 *
 * @return	void
 */
function setCorporateMovie () {
	if (document.getElementById("ocImageFilm")) {
		var container = document.getElementById("ocImageFilm");
		if (flashCanPlay) {
		    // Class that does now the building
		    container.removeChild(container.firstChild);
		    var loadImg = document.createElement('img');
			loadImg.setAttribute('src','fileadmin/template/img/loader.gif');
			loadImg.setAttribute('alt','Performing Speed Check ...');
			loadImg.setAttribute('style','padding-right:10px;');
			container.appendChild(loadImg);
            var language = document.getElementsByTagName("html")[0].getAttribute("lang");
			if (language == "de") {
				container.appendChild(document.createTextNode('Ihre Bandbreite wird überprüft'));
			} else {
				container.appendChild(document.createTextNode('We are currently checking your bandwidth'));
			}
		    corpCheckBandwidth();
		} else {
			var language = document.getElementsByTagName("html")[0].getAttribute("lang");
			var text = '';
			if (language === "de") {
				text += 'Sie haben die benötigte Flash Version nicht installiert.<br />';
				text += 'Laden Sie den <a href="http://www.macromedia.com/go/getflashplayer" title="Adobe Flash Player" target="_blank">aktuellen Player</a> herunter und installieren Sie diesen.';
			} else {
				text += 'You have not installed the required Flash version.<br />';
				text += 'Download the <a href="http://www.macromedia.com/go/getflashplayer" title="Adobe Flash Player" target="_blank">most recent player</a> and install it.';
			}
			container.innerHTML = text;
		}
	}
}

/**
 * initiates the marks for accesskeys
 *
 * @return	void
 */
function initAccesskeys () {
	var accessKeys = new Array();
	var obj = document.getElementsByTagName("span");
	var count = obj.length;
	var j = 0;
	for (var i=0; i<count; i++) {
		if (obj[i].className === "accessKey") {
			accessKeys[j] = obj[i];
			j++;
		}
	}
	count = accessKeys.length;
	if (count > 0) {
		dkAccessKeys = accessKeys;
		document.onkeydown = keyDown;
		document.onkeyup = keyUp;
	}
}

/**
 * check if alt key is pressed onkeydown
 *
 * @return	void
 */
function keyDown (keyEvent) {
	var keyCharCode;
	if (!keyEvent) keyEvent = window.event;
	if (keyEvent.which) {
		keyCharCode = keyEvent.which;
	} else if (keyEvent.keyCode) {
		keyCharCode = keyEvent.keyCode;
	}
	if (keyCharCode === 18) showAccessKeys(true);
}

/**
 * check if alt key is pressed onkeyup
 *
 * @return	void
 */
function keyUp (keyEvent) {
	var keyCharCode;
	if (!keyEvent) keyEvent = window.event;
	if (keyEvent.which) {
		keyCharCode = keyEvent.which;
	} else if (keyEvent.keyCode) {
		keyCharCode = keyEvent.keyCode;
	}
	if (keyCharCode === 18) showAccessKeys(false);
}

/**
 * change the style of the access keys
 *
 * @param	boolean		state: indicates if the elements should be displayed or not
 * @return	void
 */
function showAccessKeys (state) {
	var class2set;
	if (state) {
		class2set = "accessKeyActive";
	} else {
		class2set = "accessKey";
	}
	var count = dkAccessKeys.length;
	for (var i=0; i<count; i++) {
		dkAccessKeys[i].className = class2set;
	}
}

/**
 * generate the print link
 *
 * @return	void
 */
function makePrintLink () {
	var printText;
	var language = document.getElementsByTagName("html")[0].getAttribute("lang");
	if (language === "de") {
		printText = "Inhalt drucken";
	} else {
		printText = "Print Content";
	}
	var listContainer = document.getElementById("serviceMenu");
	var list = listContainer.getElementsByTagName("ul")[0];
	var newListItem = document.createElement("li");
	newListItem = list.appendChild(newListItem);
	var newAnchor = document.createElement("a");
	newAnchor = newListItem.appendChild(newAnchor);
	var newText = document.createTextNode(printText);
	newAnchor.appendChild(newText);
	newAnchor.setAttribute("href", "#");
	newAnchor.setAttribute("title", printText);
	newAnchor.onclick = function() {
		window.print();
		return false;
	};
}
/**
 * Build Player with Bandwidth Check
 *
 * @return	void    returns nothing
 * @access  private
 */
 var corpCheckBandwidth = function(startTime,endTime) {
		// Set the standard Format 'small'
		var movieSrc = "oc_klein_322x252.swf";
		var width = 322;
		var height = 252;
		// Set Container
		var container = document.getElementById("ocImageFilm");
		//Check if call comes from check_bcorp.html
		if(startTime && endTime){
			// bandwidthCheck is done. Second Class call if endTime and startTime are the same
			if (endTime == startTime) {
    			corpCheckBandwidth();
			}
			else {
				var downloadtime = (endTime - startTime)/1000;
			}
			var kbytes_of_data = 250; // data file size
			var linespeed     = kbytes_of_data/downloadtime;
			var kbps          = (Math.round((linespeed*8)*10*1.02))/10;
			var kbytes_sec    = (Math.round((kbytes_of_data*10)/downloadtime))/10;
			// evaluating the result
			if(kbytes_sec > 300 && kbytes_sec < 600){
                var movieSrc = "oc_mittel_689x465.swf";
				var width = 689;
				var height = 465;
			}
			if(kbytes_sec > 600){
                var movieSrc = "oc_high_689x465.swf";
				var width = 689;
				var height = 465;
			}
			//Build the player with settings
			var movieId = "ocFlashImageMovie";
			// set flash
			var content = '';
			content += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+movieId+'" align="middle">\n';
			content += '<param name="allowScriptAccess" value="sameDomain" />\n';
			content += '<param name="movie" value="fileadmin/template/swf/'+movieSrc+'" />\n';
			content += '<param name="menu" value="false" />\n';
			content += '<param name="quality" value="high" />\n';
			content += '<param name="scale" value="noscale" />\n';
			content += '<param name="bgcolor" value="#363D44" />\n';
			content += '<embed src="fileadmin/template/swf/'+movieSrc+'" menu="false" quality="high" scale="noscale" bgcolor="#363D44" width="'+width+'" height="'+height+'" name="'+movieId+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
			content += '</object>\n';
			container.innerHTML = content;
		}
		else {
  			// writing iFrame with check_bcorp.html
			var tempCheckObj = document.createElement('iframe');
			tempCheckObj.setAttribute('height','1');
			tempCheckObj.setAttribute('width','1');
			tempCheckObj.setAttribute('id','bandCheckCorp');
			tempCheckObj.setAttribute('src','fileadmin/template/html/check_bcorp.html?' + Math.random());
   			//detecting free space for iFrame
			if(document.getElementById('right')) {
				var iFrameObj = document.getElementById('right');
			    iFrameObj.appendChild(tempCheckObj);
			}
			//Workaround IE
			document.getElementById('bandCheckCorp').style.visibility = "hidden";
		}
 }


/**
 * do onLoad
 *
 * @return	void
 */
oldOnload = window.onload;
window.onload = function() {
	if (typeof(oldOnload) === "function") {
		oldOnload();
	}
	if (document.getElementById && document.createTextNode) {
		makePrintLink();
		initAccesskeys();
		setHomeMovie();
		setCorporateMovie();
	}
};


/**
 * operns a new window
 *
 * @return	void
 */
function openReporting(url, name, width, height) {
	var ocReportWindow = window.open(url,name, "width=" + width + ",height=" + height + ",left=0,top=0,scrollbars=yes,location=no,resizable=yes");
	ocReportWindow.focus();
	return false;
}
//-->
