/**
HandleMultimediaIcons(MultimediaDataObject);

MultimediaDataObject may have the following fields:

MultimediaDataObject.url			- specify the url to the multimedia object
MultimediaDataObject.type			- specify the type of the object (Image,...)
MultimediaDataObject.behavior		- specify how the object is opened (sameWnd - same window,
																		newWnd - new window,
																		inline - inline object)
MultimediaDataObject.width			- specify the width of the object (optional for images,
										otherwise will be opened in real size)
MultimediaDataObject.height			- specify the height of the object (optional)
MultimediaDataObject.title			- alt text for the tag (optional)
MultimediaDataObject.border			- border for the tag (optional)
MultimediaDataObject.hspace			- hspace for the tag (optional)
*/

var eventObject = null; // tag <A> that fired event "onclick"

function onClickImage()
{
	eventObject = window.event.srcElement;
}

function HandleMultimediaIcons(aObj)
{
	var OutStr = "";

	switch (aObj.type)
	{
		case "multimedia-figure-element":
		case "Image":
			if ((aObj.url.indexOf('cgm')) == (aObj.url.length - 3))
			{
				var id = aObj.url.substring(aObj.url.lastIndexOf("/")+1 ,aObj.url.indexOf('.cgm'));
				OutStr="<object id='" + id + "'";
				OutStr+= " classid='CLSID:865B2280-2B71-11D1-BC01-006097AC382A'";
				OutStr+= " align='middle' width='400px' height='400px'>";
				OutStr+= "<param name='border' value='1'/><param name='src' value='" + aObj.url + "'/>";
				OutStr+= "<embed name='" + id + "' src='" + aObj.url + "' type='application/x-isoview'";
				OutStr+= " align='middle' width='200px' height='400px'";
				OutStr+= " border='1'/></object>";
			}
			else
			{
				OutStr += "<img src='" + aObj.url + "'";

				if (aObj.width && aObj.width != "")
					OutStr += " width='" + aObj.width + "'";

				if (aObj.height && aObj.height != "")
					OutStr += " height='" + aObj.height + "'";

				if( aObj.title && aObj.title  != "" )
					OutStr += " alt = '" + aObj.title + "'";

				if( aObj.border && aObj.border  != "" )
					OutStr += " border = '" + aObj.border + "'";

				if( aObj.hspace && aObj.hspace  != "" )
					OutStr += " hspace = '" + aObj.hspace + "'";

				OutStr += ">";
			}
			break;

		default:
			alert("type " + aObj.type + " still doesn't supported");
	}



	switch (aObj.behavior)
	{
		case "sameWnd":
			document.location = "Multimedia.jsp?content=" + escape(OutStr);
			break;

		case "newWnd":
		{
			var wndCaption = aObj.title | "";
			window.open("Multimedia.jsp?target=wndCaption&content=" + escape(OutStr)+"&popup=yes",
						wndCaption,
						"scrollbars=yes,height=550,width=500,status=yes,toolbar=no,menubar=no,location=no", false);
			break;
		}

		case "inline":
		{
			if (eventObject)
				eventObject.outerHTML = OutStr;
			eventObject = null;
			break;
		}
		default:
			alert ("Unknown behavior type: " + aObj.behavior);
			break;
	}
}

function OpenUrlLinks(aObj)
{
	switch (aObj.behavior)
	{
		case "newWnd":
		{
			var wndCaption = aObj.title | "";
			window.open(aObj.url, wndCaption,
						"scrollbars=yes,height=550,width=500,status=yes,toolbar=no,menubar=no,location=no", false);
			break;
		}
		default:
			document.location = aObj.url;
			break;
	}
}


