﻿function pix_viewer(flash_width, flash_height, text_height){
    this.flash_width = flash_width;
    this.flash_height = flash_height;
    this.focus_width = flash_width;
    this.focus_height = flash_height - text_height;
    this.text_height = text_height;
    this.pics = '';
    this.links = '';
    this.texts = '';
    this.flash_path = '/flash/pixviewer.swf';
    
    this.addItem = function(pic, link, text){
        this.pics  = this.pics + pic + '|';
        this.links = this.links + link + '|';
        this.texts = this.texts + text + '|';
    };
    
    this.write = function(){
        if (this.flash_path.length == 0)
            return;
            
        if (this.pics.length > 0)
            this.pics = this.pics.substr(0, this.pics.length-1);
        
        if (this.links.length > 0)
            this.links = this.links.substr(0, this.links.length-1);
            
        if (this.texts.length > 0)
            this.texts = this.texts.substr(0, this.texts.length-1);
        

        document.write('<object id="focus_flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ this.focus_width +'" height="'+ this.flash_height +'">');
        document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+this.flash_path +'"><param name="quality" value="high"><param name="bgcolor" value="#E5E5EB">');
        document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
        document.write('<param name="FlashVars" value="pics='+this.pics+'&links='+this.links+'&texts='+this.texts+'&borderwidth='+this.focus_width+'&borderheight='+this.focus_height+'&textheight='+this.text_height+'">');
        document.write('<embed id="focus_flash" src="'+ this.flash_path +'" wmode="opaque" FlashVars="pics='+this.pics+'&links='+this.links+'&texts='+this.texts+'&borderwidth='+this.focus_width+'&borderheight='+this.focus_height+'&textheight='+this.text_height+'" menu="false" bgcolor="#E5E5EB" quality="high" width="'+ this.focus_width +'" height="'+ this.flash_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');		
        document.write('</object>');
    };
}
