// JavaScript Document

function swapHTML(file,mediaType)
{
	//alert(file+"\n"+flgType)
	if(mediaType=="audio"){
		playMp3(file);
	}	// if(flgType!="image")
	else if(mediaType=="video"){
		playMov(file);
	}	// if(flgType!="image")
	else{
		//alert("img");
		
		//var html = "<div class='w292 h164k bggrey04'><img src='images/productimages/";
		var html = "<div class=' w292 h164k marb0 mart0 padb0 padt0'><img src='images/productimages/";
		if(file!="")
			html += file;
		else
			html += "product_blank_big.jpg";
		
		//html += "' alt='' name='ab' class='brgrey'></div>";
		html += "' alt='' name='ab' class='brgrey'></div>";
		//alert(html);
		document.getElementById("playarea").innerHTML = "";
		document.getElementById("playarea").innerHTML = html;
	}
}	// function swapHTML()

function setEmbed(ID, dir) {
    var element = document.getElementById(ID);
    //Write the following three lines in one:
    element.innerHTML = '<embed src="'+dir+ID+'.mp3" autostart="0" loop="0" height="45" width="170" ></embed>';
alert(dir+ID+'.m3u');
}// end function setEmbed 

function getMimeType(){
	var mimeType = "application/x-mplayer2"; //default
	var agt=navigator.userAgent.toLowerCase();
	if (navigator.mimeTypes && agt.indexOf("windows")==-1) {
		//non-IE, no-Windows
 	 var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
 	 if (plugin) mimeType="audio/mpeg" //Mac/Safari & Linux/FFox
	}//end no-Windows
	return mimeType
	alert(mimeType);
}//end function getMimeType


// for windows media player
/*
function plays(media){
	//alert(media);
	document.getElementById('playarea').innerHTML='<div class="w292 h164k marb0 mart0 padb0 padt0"><object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'+'type="application/x-mplayer2" width="290" height="70" id="WMP" name="WMP"><param name="loop" value="true"><param name="displaySize" value="0"><param name="fileName" value="'+media+'"><param value="true" name="ShowStatusBar">'+'<embed id="WMP" style="FILTER: xray" name=RAOCXplayer src="'+media+'" loop="true" showstatusbar="1" showcontrols="1" displaySize="0" loop="1" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/mediaplayer/" height="70" type="application/x-mplayer2"></embed></object></div>';
}
*/
/*
function plays(media){
	alert(media);
	document.getElementById('playarea').innerHTML='<embed src="flashmplayer/mediaplayer.swf" width="270" height="20" allowfullscreen="true" allowscriptaccess="always" flashvars="&file=song.mp3&height=20&width=270&autostart=true" />';
	alert(document.getElementById('playarea').innerHTML);
}
*/


// for QUICKTIME PLAYER
function playMp3(media){
	//alert(media);
	document.getElementById('playarea').innerHTML='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="290" height="16" codebase="http://www.apple.com/qtactivex/qtplugin.cab"> <param name="SRC" value="'+media+'"> <param name="AUTOPLAY" value="true"> <param name="CONTROLLER" value="true"> <param name="CACHE" value="true"> <embed src="'+media+'" width="290" height="16" autoplay="true"  pluginspage="http://www.apple.com/quicktime/download/" kioskmode="true"  TARGET="QUICKTIMEPLAYER" hotspot17="http://www.apple.com" correction="full" dontflattenwhensaving></embed> </object><br><br><br><a href="http://www.apple.com/quicktime/download/" target="_blank"><img src="http://www.apple.com/main/elements/getquicktime.gif" width="88" height="31" border="0" alt="get quicktime" ></a>';
	//alert(document.getElementById('playarea').innerHTML);
}
function playMov(media){
	//alert(media);
	document.getElementById('playarea').innerHTML='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="290" height="200" codebase="http://www.apple.com/qtactivex/qtplugin.cab"> <param name="SRC" value="'+media+'"> <param name="AUTOPLAY" value="true"> <param name="CONTROLLER" value="true"> <param name="CACHE" value="true"> <embed src="'+media+'" width="290" height="200" autoplay="true"  pluginspage="http://www.apple.com/quicktime/download/" kioskmode="true"  TARGET="QUICKTIMEPLAYER" hotspot17="http://www.apple.com" correction="full" dontflattenwhensaving></embed> </object><br><a href="http://www.apple.com/quicktime/download/" target="_blank"><img src="http://www.apple.com/main/elements/getquicktime.gif" width="88" height="31" border="0" alt="get quicktime" ></a>';
	//alert(document.getElementById('playarea').innerHTML);
}
// for flash player
/*
function plays(media){
	//alert(media);
	document.getElementById('playarea').innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8" width="270" height="20" id="theMediaPlayer"> <param name=movie value="flashmplayer/mediaplayer.swf"> <param name=allowFullScreen value="true"> <param name=allowScriptAccess value="always"> <param name="FlashVars" value="&file='+media+'&width=270&height=20&autostart=true"> <embed width="270" height="20" src="flashmplayer/mediaplayer.swf" allowfullscreen="true" allowscriptaccess="always" flashvars="&file='+media+'&width=270&height=20&autostart=true"> </embed> </object>';
	//alert(document.getElementById('playarea').innerHTML);
}
*/