I am new to javascript and i am trying to do something in a Sharepoint 2010 webpart using javascript.

If is a dynamic .vsd viewer, where the one sharepoint page can be instructed to load a specific vsd file in a sort of iframe.

If i wrap the <object></object> within the <script></script> tags then it doesn't actaully load the visio viewer active X component, so i'm looking for a variable that can be used outwith the </script> tag. I have tried calling it within the url using the script tags, but this still doesn't work. Please see the following code :

<script language="javascript">
		var query = window.location.search;

		if(query.substring(0,1) =="?")
			//remove the question mark
			query = query.substring(1);
			//split the string into an array based on ampersand locations
			var urlArray = query.split("&");
			//find the string that matches vsdurl=
			for(var i=0; i<urlArray.length; i++)

				if(urlArray[i].search("vsdurl=")== 0)
					//grab the url after the vsdURL=
					query = urlArray[i].substring(7)+".vsd";
					vsdURL = "http://intra-gla.clydeunion.local/quality/QMS/QMS/VSD%20Home/"+query;
					//alert ("URL = " + vsdURL);
<OBJECT classid="CLSID:279D6C9A-652E-4833-BEFC-312CA8887857" 
id="viewer1" width="100%" height="600"> 
<param name="BackColor" value="16777215">
<param name="AlertsEnabled" value="1">
<param name="ContextMenuEnabled" value="1">
<param name="GridVisible" value="0">
<param name="HighQualityRender" value="1">
<param name="PageColor" value="16777215">
<param name="PageVisible" value="0">
<param name="PropertyDialogEnabled" value="1">
<param name="ScrollbarsVisible" value="0">
<param name="ToolbarVisible" value="1">
<param name="PagetabsVisible" value="0">
<param name="SRC" value="http://intra-gla.clydeunion.local/quality/QMS/QMS/VSD%20Home/"+<script language="javascript">query</script>>
<param name="CurrentPageIndex" value="0">
<param name="Zoom" value="-1">
I really appreciate any help and apologise in advance for my lack of knowledge in this subject.