	String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
    }

		function showcaptions_small(){
			  this.captions_small = $('image_gallery_fullscreen_caption_1_small');
			  this.button1 = $('captions_text_small');
			  this.button2 = $('img_btn_captions_small');
			  var displayVal=this.captions_small.getStyle('display');
			  //alert("we are in showcaptions:"+displayVal);
			  if( displayVal== "block") {
					this.captions_small.style.display = "none";
					this.button1.innerHTML="Show Captions";
					this.button2.removeClassName('img_captions_small');
					this.button2.addClassName('img_show_captions_small');

			  } else {
			        //alert("we are in else");
					this.button1.innerHTML="Hide Captions";
					this.captions_small.style.display = "block";	
					this.button2.removeClassName('img_show_captions_small');
					this.button2.addClassName('img_captions_small');
			  }
        }
	/*-------------------------------------------------------------------
    General stuff
    -------------------------------------------------------------------*/
    function gid(name)
    {
      return document.getElementById(name);
    };

    /*-------------------------------------------------------------------
    Player javascript API
    -------------------------------------------------------------------*/
    function sendEvent(swf, typ, prm)
    {
	  //alert("we are in send event");
      thisMovie(swf).sendEvent(typ, prm); 
    };


    function getUpdate(typ, pr1, pr2, swf)
    {
    
      //added
	  if(typ == 'state'){
		  if(pr1 == 0){ // pause
			  this.slideshowpause1 = $('btn_pauseSlideshow_small');
			  this.slideshowpause1.removeClassName('pauseSlideshow');
			  this.slideshowpause1.addClassName('startSlideshow');
			  //this.slideshowpause1.href="javascript:startSlideShow();";
			  this.slideshowpause1.innerHTML="Start";
		  }else if(pr1 == 2){ //play
		      this.slideshowpause1 = $('btn_pauseSlideshow_small');
			  this.slideshowpause1.removeClassName('startSlideshow');
			  this.slideshowpause1.addClassName('pauseSlideshow');
			  //this.slideshowpause1.href="javascript:pauseSlideShow();";
			  this.slideshowpause1.innerHTML="Pause";
		  }
	  } else if(typ == 'item') { 
         // alert(typ);
		  currentItem = pr1; 
		  var obj = thisMovie(swf).itemData(currentItem);
		  
		  this.slideshowfullscreen = $('btn_fullSlideshow_image_small');
		  var fullLink='';
		  var linkFromFeed=obj["link"];
		  if(fullscreen_link != null && fullscreen_link !=''){
               if(fullscreen_link.trim().indexOf("nasa.gov") != -1){
                       fullLink=fullscreen_link;
			   }else if(fullscreen_link.trim().indexOf("/") == 0){
				   //fullLink="http://www.nasa.gov"+fullscreen_link;
				   fullLink=fullscreen_link;
			   }
		  }else if(linkFromFeed != null && linkFromFeed != ''){
               if(linkFromFeed.trim().indexOf("nasa.gov") != -1){
                       fullLink=linkFromFeed;
			   }else if(linkFromFeed.trim().indexOf("/") == 0){
				   //fullLink="http://www.nasa.gov"+linkFromFeed;
				   fullLink=linkFromFeed;
			   }
		  }else{
                fullLink=obj["file"];
		  }
		  this.slideshowfullscreen.href=fullLink;
          this.slideshowfullscreen_cpations = $('caption_region_1_small');
		  var desc=obj["description"];

		  var title=obj["title"];
		  this.captionContainer = $('image_gallery_slideshow_title');
		  if(title.length > 72){
			  this.captionContainer.setStyle({
			  	'top':'345px'					
			 }); 
		  }else{
              this.captionContainer.setStyle({
			  	'top':'363px'					
			 });
		  }

		  this.imag_title = $('smallslide_title_region');
          this.imag_title.innerHTML="<b>"+obj["title"]+" -- "+eval(currentItem+1)+" of "+thisMovie(swf).getLength()+" images</b>"

		  this.captions_small = $('image_gallery_fullscreen_caption_1_small');			  
		  if(desc != null && desc != '' && desc != 'null'){
 		      //this.slideshowfullscreen_cpations.innerHTML="<div style=\"height:20px\"><b>"+obj["title"]+" -- "+eval(currentItem+1)+" of "+thisMovie(swf).getLength()+" images</b></div><div style=\"font-size:11px;\">"+desc+"</div>";
			  this.slideshowfullscreen_cpations.innerHTML="<div style=\"font-size:11px;\">"+desc+"</div>";
			  //this.captions_small.style.display = "block";		
		  }else{
              //this.captions_small.style.display = "none";
		  }

		  //this.slideshow_imagecount = $('btn_slideshow_imagecnt_small');
          //this.slideshow_imagecount.innerHTML=eval(currentItem+1)+" of "+thisMovie(swf).getLength()+" images";

	 }

	  //end

      if((typ == 'state') && (swf == 'jstest'))
      {
        gid('stateshow').innerHTML = pr1;
      }
      if (typ == 'time')
      {
		  var tim = $('time');
		  if(tim != null && tim != '' && tim!= 'null'){
             gid('time').innerHTML = pr1;
		  }
      }
    };

    function loadFile(swf, obj)
    {
      thisMovie(swf).loadFile(obj); 
    };

    function getLength(swf)
    {
      var len = thisMovie(swf).getLength();
      alert('the length of the playlist is: ' + len);
    };

    function addItem(swf, obj, idx)
    {
      thisMovie(swf).addItem(obj, idx);
    };

    function removeItem(swf, idx)
    {
      thisMovie(swf).removeItem(idx);
    };

    function itemData(swf, idx)
    {
      var obj = thisMovie(swf).itemData(idx);
      var txt = "";
      for(var i in obj)
      {
        txt += i + ": " + obj[i] + "\n";
      }
      alert(txt);
    };

    function thisMovie(movieName)
    {
      if(navigator.appName.indexOf("Microsoft") != -1)
      {
        return window[movieName];
      }
      else
      {
        // return gid(movieName);
        return document[movieName];
      }
    };
  












