/* navsound code */
function initNav() {
	var navRoot = document.getElementById('header').getElementsByTagName('ul')[0]; // main menu links
	var links = navRoot.getElementsByTagName('a');
	// exclude hip-hop-beats
	//if (location.href.indexOf('hip-hop-beats.php')==-1) {
		for (var i=0; i<links.length; i++) {
			links[i].onmouseover = navSound;
		}
	//}
}
function navSound() {
 if (window.document.navSound != undefined) {
		window.document.navSound.SetVariable("x",1);
	 	// following hack helps Firefox trigger plugin update in the beats section
		//document.getElementById('navSound').style.visibility = "hidden";
		//document.getElementById('navSound').style.visibility = "visible";		
		// end hack	
	}
}

function FlashManager_detectFlashJS() {
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var plugRefr = navigator.plugins["Shockwave Flash"];
		if (!plugRefr) plugRefr = navigator.plugins["Shockwave Flash 2.0"];
		 
		if (plugRefr) {
			var descArray = plugRefr.description.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				var tempArrayMinor = descArray[3].split("r");
			} else {
				var tempArrayMinor = descArray[4].split("r");
			}
      var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		} else {
			var flashVer = "0.0.0";
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = "4.0.0";
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = "3.0.0";
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = "2.0.0";
	// can't detect in all other cases
	else flashVer = "0.0.0";
	
	return flashVer;
} 

minVer=3; maxVer=13; // version range to check

var isIE=false, isWin=false;
var i;

for (i=minVer;i<=maxVer;i++) {this['hasSWF'+i]=false;}

// Detect WinIE (VB detect)
if(navigator.appName.indexOf('Microsoft') == 0) isIE = true;
isWin = navigator.userAgent.indexOf("Win") != -1;

// Detect: Flash Version

var n=navigator;
if (isIE && isWin) {
  document.write('<script language="VBScript">\n');
  document.write('on error resume next\n');
  for (i=minVer;i<=maxVer;i++) document.write('hasSWF'+i+' = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'")))\n');   
  document.write('</script>\n');
} else {
	var actualVer = parseInt(FlashManager_detectFlashJS());
	
	for (i=minVer;i<=maxVer;i++) if ( actualVer >= i ) this['hasSWF'+i] = true;
}

function writeFlash(movie, alternative, ver, width, height, bgcolor, flashVars, wmode) {
	var cont='';
	if (this['hasSWF'+ver]) {
		cont+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
		if (movie=="navsound.swf") cont+= 'id="navSound" ';// hack;
		cont+='codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+',0,0,0" width="'+width+'" height="'+height+'">';
		cont+='<param name="movie" value="'+movie+'" />';
		cont+='<param name="bgcolor" value="'+bgcolor+'" />';
		if (flashVars != undefined) cont+='<param name="flashvars" value="'+flashVars+'" />';
		if (wmode != undefined) cont+='<param name="wmode" value="'+wmode+'" />';
		cont+='<embed src="'+movie+'" ';
		cont+='bgcolor="'+bgcolor+'" ';
		if (flashVars != undefined) cont+='flashvars="'+flashVars+'" ';
		if (wmode != undefined) cont+='wmode="'+wmode+'" ';
		if (movie=="navsound.swf") cont+= 'name="navSound" swLiveConnect="true" ';// hack;		
		cont+='width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		cont+='<\/object>';		
	} else {
		cont = alternative;
	}
	document.write(cont);
}