var hasRightVersion = false;
function isIE(){
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0){
    if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6){
      return false;
    }
    if(strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  }else{
    return false;
  }
}

function createFlash(objname, url, context,  shopurl, shoptarget, metanav) {
	var obj = document.getElementById(objname);
	if (!obj) {
		return false;

	}
	var vars = "context="+context;
	vars += (shopurl.length>0) ? "&shopurl="+shopurl :"";
	vars += (shoptarget.length>0) ? "&shoptarget="+shoptarget:"";
	vars += (metanav.length>0) ? "&metanavid="+metanav:"";

//document.write(vars);

	// Erforderliche Hauptversion von Flash
	var requiredMajorVersion = 8;
	// Erforderliche Unterversion von Flash
	var requiredMinorVersion = 0;
	// Erforderliche Flash-Revision
	var requiredRevision = 0;

	hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {  // sofern eine akzeptable Version ermittelt wurde
		// hide html menu

        var hm = document.getElementById('htmlmenu');
        if(hm){

            hm.style.display = 'none';
        }

        // display flash menu
		 var mywidth='302';
		 var myheight='1200';
		 var myObj = document.createElement("object");
			myObj.classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';
			myObj.codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0';
			myObj.width=mywidth;
			myObj.height=myheight;
			myObj.id='flashmenu_obj';

			// jetzt die Parameter
			var para_a = document.createElement("param");
			para_a.setAttribute("name", "allowScriptAccess");
			para_a.setAttribute("value", "always");
			myObj.appendChild(para_a);

			var para_b = document.createElement("param");
			para_b.setAttribute("name", "wmode");
			para_b.setAttribute("value", "opaque");
			myObj.appendChild(para_b);

			var para_c = document.createElement("param");
			para_c.setAttribute("name", "movie");
			para_c.setAttribute("value", url);
			myObj.appendChild(para_c);

			var para_d = document.createElement("param");
			para_d.setAttribute("name", "quality");
			para_d.setAttribute("value", "high");
			myObj.appendChild(para_d);

			var para_e = document.createElement("param");
			para_e.setAttribute("name", "flashVars");
			para_e.setAttribute("value", vars);
			myObj.appendChild(para_e);

			var para_f = document.createElement("param");
			para_f.setAttribute("name", "bgColor");
			para_f.setAttribute("value", "FFFFFF");
			myObj.appendChild(para_f);



				var myembed =document.createElement("embed");

			myembed.setAttribute("src", url);
			myembed.setAttribute("quality", "high");
			myembed.setAttribute("flashVars", vars);
			myembed.setAttribute("bgColor", "FFFFFF");
			myembed.setAttribute("allowScriptAccess", "always");
			myembed.setAttribute("name", "menu_flash");
			myembed.setAttribute("wmode", "transparent");

			if (isIE()) {
				myembed.setAttribute("id", "flashmenu_IE");
			}
			myembed.setAttribute("width", mywidth);
			myembed.setAttribute("height", myheight);
			myembed.setAttribute("type", "application/x-shockwave-flash");
			myembed.setAttribute("pluginspace", "http://www.macromedia.com/go/getflashplayer");
			myembed.setAttribute("swLiveConnect", "true");

			if (isIE()) {
				obj.appendChild(myembed);

			} else {
				myObj.appendChild(myembed);
				obj.appendChild(myObj);

			}

	} else {
		// flash-version mismatch
	    var alternateContent = '<div style="padding-top:100px; padding-left: 15px; color: red;">'
	    + 'Sie ben&ouml;tigen Adobe Flash-Player, um das Men&uuml; anzuzueigen. '
	   	+ '<a style="text-decoration:underline; " href="http://www.macromedia.com/go/getflash/">Flash installieren oder upgraden.</a></div>';
	   	//obj.innerHTML = alternateContent;
	    //document.write(alternateContent);  // Nicht aus Flash stammenden Inhalt einf�gen

	}
	return true;
}
