

// This function opens the internal link webform.
function getInternalLink(fieldobj)
{
	var obj = eval("document.all['" + fieldobj+"']");
	obj.value = showModalDialog("/dfdscommon/WebForms/InternalLinksDialog.aspx", "", "resizable: no; help: no; status: no; scroll: no; center: yes;  unadorned: yes; dialogHeight: 400px; dialogWidth: 400px;"); 
}


function openSelectMediaFileDialog(postingguid, minX,maxX,minY,maxY, groupid, prefieldname, startpath)
{
	//postingguid		: The GUID of the posting where the picture are inserted to.
	//minX				: minmum width of picture.
	//maxX				: maximum width of picture.
	//minY				: minmum height of picture.
	//maxY				: maximum height of picture.
	//groupid			: Allowed group type of pictures ( web pictures or document ).
	//prefieldname			: Prename of all the fields.
	//startpath			: Virtual start path.


	var of = eval("document.all['" + prefieldname + "path" + "']");
	var usedpath = of.value;
	var querystring = "minheight="+minY+"&maxheight="+maxY+"&minwidth="+minX+"&maxwidth="+maxX+"&filegroupid="+groupid+"&filepath="+usedpath+"&guid="+postingguid;

	var values = new Array();
	// testvales
	//values[0] = "six/Sample.jpg";
	//values[1] = "100";
	//values[2] = "200";
		
	//OLD values = showModalDialog("/dfdsMediaFiles/selectfile.aspx?"+querystring, "", "resizable: no; help: no; status: no; scroll: no; center: yes;  unadorned: yes; dialogHeight: 580px; dialogWidth: 500px;");
	values = showModalDialog("/mediabank/SelectMediaFileBrowser.aspx", "", "status: no; dialogHeight: 730px; scroll: no; dialogWidth: 1000px; center: yes;");

	if(values != null && values[0] != null && values[0] != "" )
	{
		var strPath = new String(values[0]);

		if ((strPath.length > 0) && (strPath.toLowerCase()!="undefined"))
		{
			of.value = strPath;
			// setting picture src, width and height.
			var opf = eval("document.all['" + prefieldname +"pic']");
			// alert("Debug: " + startpath+strPath + " w/h: " + values[1] + "/" + values[2]);
			opf.src = startpath+strPath;
			opf.width = values[1];
			opf.height = values[2];
			var hidden_width = eval("document.all['" + prefieldname +"width']");
			hidden_width.value = values[1];
			var hidden_height = eval("document.all['" + prefieldname +"height']");
			hidden_height.value = values[2];
			
		}
	}
}