<html xmlns:sds="">
<head>
<style>
@media all
{
  sds\:thumbnail {behavior:url(thumbnail.htc);}
}
</style>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Themes.js"></script>
<script language="JavaScript" src="search_errors.js"></script>
<script language="JavaScript" src="io_utils.js"></script>
<script language="JavaScript" src="ui_utils.js"></script>
<script language="JavaScript" src="math_utils.js"></script>
<script language="JavaScript">
var view = null;	// document view element (in pareant window)
var thumb = null;	// thumbnail element
var MARGIN = 5;		// margin between frame and thumbhnail

function Select()
{
  if(thumb == null)
    return;
  thumb.SelectThumbnail();
}

function Deselect()
{
  if(thumb == null)
    return;
  thumb.DeselectThumbnail();
}

function IsSelected()
{
  if(thumb == null)
    return;
  return thumb.IsThumbnailSelected();
}

function GetViewComponent(category_id, component_id)
{
  var target_view = null;
  var views = parent.document.all.item(category_id);
  
  // empty element case
  if(views == null)
    return target_view;
	
  // single element case
  if(views.length == null)
  {
    if(views.unique_id == component_id)
	  target_view = views;
  }
  else
  {
    for(var i = 0; MATH_Lt(i, views.length); i++)
    {
      if(views[i].unique_id == component_id)
      {
        target_view = views[i];
	    break;
      }
    }
  }
    
  return target_view;
}
</script>

<script language="JavaScript" for="thumbnail" event="onthumbnailselect()">
if(view == null)
  return;
view.OnDocSelect();
</script>

<script language="JavaScript" for="thumbnail" event="onthumbnaildeselect()">
if(view == null)
  return;
view.OnDocDeselect();
</script>

<script language="JavaScript" for="thumbnail" event="onthumbnailclick()">
if(view == null)
  return;
view.OnDocClick();
</script>

<script language="JavaScript" for="document" event="ondblclick()">
if(view == null)
  return;
view.OnDocDblClick();
</script>

<script language="JavaScript" for="document" event="ondragstart()">
if(view == null)
  return;
event.returnValue = false;                  
event.dataTransfer.dropEffect = "copy";
view.OnDocDragStart();
</script>

<script language="JavaScript" for="document" event="oncontextmenu()">
if(view == null)
  return;
view.OnDocContextMenu();
</script>

<script language="JavaScript" for="window" event="onload()">
// retrieve url search string and populate name-value pairs
// in it into an array
var values = GetURLOptions(location); 
var thumb_url = values["url"];

// just in case, document url can not be retrieved,
// do not try to draw thumbnail
if(thumb_url == null)
  return;

// position thumbnail so that it fits in the iframe
//var thumb_caption = values["title"];
var thumb_width = values["width"] - MARGIN * 2;
var thumb_height = values["height"] - MARGIN * 2;
var thumb_top = MARGIN;
var thumb_left = MARGIN;
var thumb_pages = 1;

// get id of view (parent frame) and thumbnail contained in this area
var view_id = values["id"];
var unique_id = values["unique_id"];
var thumb_id = "thumbnail";

// make thumbnail element based on attributes passed through src string
var thumbstr = LtCh() + 'sds:thumbnail ' +
               'id="' + thumb_id + '" ' +
               'file="' + thumb_url + '" ' +
	           'width="' + thumb_width + '" height="' + thumb_height + '" ' +
		       'pages="' + thumb_pages + '" style="position:absolute; ' +
		       'top:' + thumb_top + '; left:' + thumb_left + ';" ' +
			   'pos="center" selfSelect="false" /' + GtCh();
	   
document.body.innerHTML = thumbstr;

// set references to document view and icon components
view = GetViewComponent(view_id, unique_id);
thumb = document.all.item(thumb_id);
</script>

</head>
<body class="Centerbg" >
</body>
</html>
