// JavaScript Document
// added support for resizing of images
//alert("jalla")
libraryPath = "_level5";
currentMediaTypeId = "";
window.defaultStatus = "Toolbox 2.0® E-learning Studio"

function showForm( mypath , mycurrentMediaTypeId )
{
		path = mypath;
		currentMediaTypeId = mycurrentMediaTypeId;
		window.formFrame.location = '../library/flMediaUpload.getForm.asp' + '?mediatypeid=' + currentMediaTypeId;
			
	    document.all.formFrame.style.visibility = 'visible';
}
function callbackfromresizemf(fileID)
{
	document.toolbox.TGotoLabel( path, "registerMedia"); 

}

function callBack(fileID , mediatype)
{
	hideForm();
//	alert('../convert/ConvertGw.exe?imageId='+fileID+'&imageWidth='+mediaWidth+'&imageHeight='+mediaHeight);
	switch(currentMediaTypeId)
	{
		case "1":
			document.toolbox.SetVariable( libraryPath + "/repositoryProperties.currentMediaId", fileID );
	//		window.callFrame.location = '../convert/ConvertGw.exe?imageId='+fileID+'&imageWidth='+mediaWidth+'&imageHeight='+mediaHeight;
			window.callFrame.location = '../convert/ConvertGw.exe?imageId='+fileID+'&imageType='+mediatype;
		break;
		case "2":
			document.toolbox.SetVariable( libraryPath + "/repositoryProperties.currentMediaId", fileID );
			//alert( libraryPath + "/currentMediaId" + "," +  fileID);
			document.toolbox.TGotoLabel(path, "registerMedia"); 
			//window.callFrame.location = '../convert/ConvertGw.exe?imageId='+fileID+'&imageWidth='+mediaWidth+'&imageHeight='+mediaHeight;

		break;
		case "3":
			document.toolbox.SetVariable( libraryPath + "/repositoryProperties.currentMediaId", fileID );
			//alert( libraryPath + "/currentMediaId" + "," +  fileID);
			document.toolbox.TGotoLabel(path, "registerMedia"); 

		break;
		default:
		alert("no currentMediaTypeId present")
	}
	
//	http:// .....   administration/convert/ConvertGw.exe?imageId=<id>&imageWidth=<width>&imageHeight=<height>
}
function hideForm()
{
		document.all.formFrame.style.visibility = 'hidden';
	    window.formFrame.location = 'flMediaUpload.getForm.asp';
}



var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function toolbox_DoFSCommand(command, args) {
  var dbImgObj = InternetExplorer ? toolbox : document.toolbox;
  var argsArray = args.split(',');
  path = argsArray[0];
  currentMediaTypeId = parseInt(argsArray[1]);
  
    switch(command){
  	case 'showForm':
		//alert(path + "##" + currentMediaTypeId)
		//currentMediaTypeId = document.toolbox.GetVariable( libraryPath + "/currentMediaType");
		//var variable = libraryPath + "/mediatypeRequested"
		//alert(document.toolbox.TGetProperty( "debugMode" ));
		//alert(currentMediaTypeId);
		//path = args;
		showForm();
		break;
	case 'hideForm':
		hideForm();
		break;
	
  }
 //toggleVisibility();
  //
}
// Hook for Internet Explorer 
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub toolbox_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call toolbox_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}

document.write('<iframe id="formFrame" xsrc="" SCROLLING="no" frameborder="0" style="position:absolute; top:180; left:18; width:344; height:250; z-index:2;visibility: hidden;">');
document.write('</iframe>');

document.write('<iframe id="callFrame" src="" SCROLLING="no" frameborder="0" style="position:absolute; top:180; left:18; width:344; height:250; z-index:5;visibility: hidden;">');
document.write('</iframe>');