var audioBase = '';
var videoBase = '';

function writeAudio( strFile, intId ) {
	document.write('<div class=\"audiomenu\"><ul><li><a href=\"javascript:showObj(\'audioplayer'+intId+'\')\">show the player below</a></li><li><a href=\"'+audioBase + '' + strFile+'\">download the audio</a></li><li><a class=\"xclose\" href=\"javascript:hideObj(\'audioplayer'+intId+'\')" title=\"Hide the player\">X</a></li></ul></div>');
	document.write('<div id=\"audioplayer'+intId+'\" class=\"audioplayer\">');
	document.write('<object id=\"mediaPlayer\" width=\"320\" height=\"52\"');
	document.write('classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" ');
	document.write('      codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\"');
	document.write('      standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\">');
	document.write('      <param name=\"fileName\" value=\"'+audioBase + '' + strFile+'\"/>');
	document.write('      <param name=\"animationatStart\" value=\"true\"/>');
	document.write('      <param name=\"transparentatStart\" value=\"true\"/>');
	document.write('      <param name=\"autoStart\" value=\"false\"/>');
	document.write('      <param name=\"ClickToPlay\" VALUE="1">');
	document.write('      <param name=\"showControls\" value=\"true\"/>');
	document.write('      <param name=\"showStatusBar\" value=\"true\"/>');
	document.write('      <param name=\"loop\" value=\"false\"/>');
	document.write('      <embed type=\"application/x-mplayer2\"');
	document.write('        pluginspage=\"http://microsoft.com/windows/mediaplayer/en/download/\"');
	document.write('        id=\"mediaPlayer\" name=\"mediaPlayer\" displaysize=\"4\" autosize=\"-1\" ');
	document.write('        bgcolor=\"darkblue\" showcontrols=\"true\" showtracker=\"-1\" ');
	document.write('        showdisplay=\"0\" clicktoplay=\"1\" showstatusbar=\"1\" videoborder3d=\"-1\" width=\"320\" height=\"68\"');
	document.write('        src=\"'+audioBase + '' + strFile+'\" autoplay=\"false\" designtimesp=\"5311\" loop=\"false\">');
	document.write('      </embed>');
	document.write('</object>');
	document.write('</div>');
}

function writeVideo( strFile, intId ) {
	var intWidth = 320;
	var intHeight = 240;
	document.write('<div class=\"videomenu\"><ul><li><a href=\"javascript:showObj(\'videoplayer'+intId+'\')\">show the player below</a></li><li><a href=\"'+audioBase + '' + strFile+'\">download the video</a></li><li><a class=\"xclose\" href=\"javascript:hideObj(\'videoplayer'+intId+'\')" title=\"Hide the player\">X</a></li></ul></div>');
	document.write('<div id=\"videoplayer'+intId+'\" class=\"videoplayer\">');
	document.write('<object id=\"mediaPlayer\" width=\"'+intWidth+'\" height=\"'+(52+intHeight)+'\"');
	document.write('classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" ');
	document.write('      codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\"');
	document.write('      standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\">');
	document.write('      <param name=\"fileName\" value=\"'+videoBase + '' + strFile+'\"/>');
	document.write('      <param name=\"animationatStart\" value=\"true\"/>');
	document.write('      <param name=\"transparentatStart\" value=\"false\"/>');
	document.write('      <param name=\"autoStart\" value=\"false\"/>');
	document.write('      <param name=\"showControls\" value=\"true\"/>');
	document.write('      <param name=\"ShowStatusBar\" value=\"true\"/>');
	document.write('      <param name=\"loop\" value=\"false\"/>');
	document.write('      <embed type=\"application/x-mplayer2"');
	document.write('        pluginspage=\"http://microsoft.com/windows/mediaplayer/en/download/\"');
	document.write('        id=\"mediaPlayer\" name=\"mediaPlayer\"');
	document.write('        showcontrols=\"1\"');
	document.write('        showdisplay=\"0\" showstatusbar=\"1\" width=\"'+intWidth+'\" height=\"'+(68+intHeight)+'\"');
	document.write('        src=\"'+videoBase + '' + strFile+'\"/>');
	document.write('      </object>');
	document.write('</div>');
}

function writeSlide( intId ) {
	document.write('<div class=\"slidemenu\"><ul><li><a onclick=\"showSlide(\'slidedata'+intId+'\')\">show the slide below</a></li><li><a class=\"xclose\" onclick=\"hideSlide(\'slidedata'+intId+'\')" title=\"Hide the slide\">X</a></li></ul></div>');
}
var currentobj = '';

function showObj( objid ) {
	if(currentobj!='') 	getElm(currentobj).style.display = 'none';
	hideImage();
	getElm(objid).style.display = 'block';
	currentobj = objid;
}

function hideObj( objid ) {
	hideImage();
	getElm(objid).style.display = 'none';
	currentobj = '';
}

function showSlide( objid ) {
	getElm(objid).style.display = 'block';
}

function hideSlide( objid ) {
	getElm(objid).style.display = 'none';
}

function getElm( txt ) {
	if(document.all) {
		return document.all[txt];
	} else if (!(document.layers)) {
		return document.getElementById(txt);
	}
}

function showImage( sSrc ) {
	hideImage();
	setWinXY();
	getElm('largeimage').src = sSrc;
	getElm('imagediv').style.left = (winX + scrollX) + 'px';
	getElm('imagediv').style.top = (winY + scrollY) + 'px';
	getElm('imagediv').style.visibility = 'visible';
}
function hideImage() {
	getElm('largeimage').src = 't.gif';
	getElm('imagediv').style.visibility = 'hidden';
}
var winX = 0;
var winY = 0;
var scrollX = 0;
var scrollY = 0;
var totalY = 100;
function setWinXY() {
	if(document.all) {
		winX = (document.body.offsetWidth-640) / 2;
		winY = (document.body.offsetHeight-480) / 2 ;
		if (document.documentElement && document.documentElement.scrollTop)	{
			scrollX = document.documentElement.scrollLeft;
			scrollY = document.documentElement.scrollTop;
			totalY = document.documentElement.scrollHeight;
			winY = 15;
		} else if (document.body) {
			scrollX = document.body.scrollLeft;
			scrollY = document.body.scrollTop;
			totalY = document.body.scrollHeight;
		}
	} else if (!(document.layers)) {
		scrollX = self.pageXOffset;
		scrollY = self.pageYOffset;
		totalY = document.body.offsetHeight;
		winX = (window.innerWidth - 640) / 2;
		winY = (window.innerHeight - 480) / 2;
	}
	if(totalY<winY) totalY = winY;
}
