function jagLink(id) {
	try {
		var b = id+"";
		var c = "HotspotID0="+escape(b)+"&Exclusive=true";
		setTimeout('belenusHome.eventHandler("HotspotsSelected","'+c+'");',100);
	} catch(e) {
		alert("JAG-Link-Error: "+e.message);
	}
}



function messageHandlerPDF(message, params) {
  top.setPath2ImageViewWindow(self); // the pdf document try to call the function in the top window and not how expected in the same window 
  var paramArr = belenusHome.queryStringToArray(params);
  if (message == "LoadImage") { ////////// LoadImage //////////
    currentImageID = paramArr['ImageID'];
    var ivc = document.getElementById("ImageViewCanvas");
    if(currentImageType != PDF_MIME_TYPE) {
      while(ivc.hasChildNodes()) { // remove content
        var firstChildRef = ivc.firstChild;
        ivc.removeChild(firstChildRef);
      }
    	if(paramArr['URL']) {
	    	var pdfNode = document.createElement('<embed id="PDFView" src="'+unescape(paramArr['URL'])+'" height="100%" width="100%"/>');
		    ivc.appendChild(pdfNode);      
	    }
    } else {
	    if(paramArr['URL'])
    		document.getElementById("PDFView").setAttribute("src",unescape(paramArr['URL']));
    }   

    currentImageType = paramArr["MIMEType"];
    belenusHome.eventHandler("SetDetailFrameViews","View=null");
  //message LoadImage end
  } else if(message == "SelectHotspot") {} // SELECTION IN PDF NOT YET IMPLEMENTED
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function messageHandlerCGM(message, params) {
	//alert("msgCGM:"+message+"\n\n"+params);
	var paramArr = belenusHome.queryStringToArray(params);
	
	if(message == "LoadImage") { ////////// LoadImage //////////
		var ivc = document.getElementById("ImageViewCanvas");
		if(currentImageType != CGM_MIME_TYPE) {
			while(ivc.hasChildNodes()) { // remove content
				var firstChildRef = ivc.firstChild;
				ivc.removeChild(firstChildRef);
			}			

			if(paramArr['URL']) {
				var cgm = '';
					cgm += '<object id="CGMPlayerX" width="100%" height="100%" classid="CLSID:865B2280-2B71-11D1-BC01-006097AC382A">';
					//cgm += '<param name="src" value="'+unescape(paramArr['URL'])+'">'; // using a setTimeout, trouble shooting...
					cgm += '<param name="BgColor" value="#ffffff">';
					cgm += 'You need the <a style="color:blue;text-decoration:underline" href="./custom/isoviewx4_cust.exe" target="_blank">ISOVIEW-Plugin</a><br>and a Microsoft Internet Explorer to see this document.';
					cgm += '</object>';

					ivc.innerHTML=cgm;
					currentImageType = CGM_MIME_TYPE;
					belenusHome.eventHandler("SetDetailFrameViews","View=null");
					belenusHome.sendMessage("Toolbar","SetButtonStates",
						"Name0=ZoomIn&State0=Disabled&Name1=ZoomOut&State1=Disabled&"+
						"Name2=FitToWin&State2=Disabled&Name3=FitToWidth&State3=Disabled&"+
						"Name4=Lens&State4=Disabled&Name5=FreeScale&State5=Disabled&"+
						"Name6=Print&State6=Disabled&Name7=Rotate3d&State7=Disabled&"+
						"Name8=MoveHand&State8=Disabled&Name9=FitToWidthPart&State9=Disabled&"+
						"Name10=HideOnePart&State10=Disabled&Name11=ShowAllParts&State11=Disabled&"+
						"Name12=SemiTransparent&State12=Disabled");
					
					setTimeout('document.getElementById("CGMPlayerX").Iso3OpenFile("'+unescape(paramArr['URL'])+'");',2000);
			} 						
		} else {
			CGMOpeningFile = true;
			// now follows a special part, if a call comes from the search result, we need to check if there exists a overview image in the current loaded spar parts list, if not use the loading image as over view image
			if(belenusHome.setCGMHomeCausedBySearchResult){// && unescape(paramArr['URL']).indexOf("_ueb.cgm") !=-1) {
			try {
				var availableImages = belenusHome.getProperty("Table","AllImages");
				if(availableImages.indexOf("_ueb.cgm") == -1)
					CGMSetHome(paramArr['URL'],0); // set new home view port if it's an overview cgm file
				else {
					var imgPaths = belenusHome.queryStringToArray(availableImages);
					var counts = 0;
					while(typeof imgPaths["URL"+counts] != "undefined") {
						if(imgPaths["URL"+counts].indexOf("_ueb.cgm") != -1) {
							CGMsetHome(imgPaths["URL"+counts],0); 
							break;
						}
					}
				}
			 } catch(e) {}
				belenusHome.setCGMHomeCausedBySearchResult=false;
			}
			document.getElementById("CGMPlayerX").Iso3OpenFile(unescape(paramArr['URL'])); //document.getElementById("CGMPlayerX").setAttribute("src",unescape(paramArr['URL']));
		}
	} else if(message == "SelectHotspots") { ////////// SelectHotspot //////////
	 	CGMSelectPart(params);
	} else if(message == "DeselectHotspots") {////////// DeselectHotspot ////////// 
  		var hsids = 0;
  		while(paramArr["HotspotID"+hsids])
	  		CGMDeselectPart(paramArr["HotspotID"+hsids++]);
  	}
}