function slideshow(){}
slideshow.prototype.filePath = '/multimedia/promotions/';
slideshow.prototype.init = function(){
    $("#slideshow > li > a").bind('click',slideshow.prototype.loadImage);
}

slideshow.prototype.loadImage = function(event){
    $("#slideshow > li > a").attr({className:''});
    $(event.target).attr({className:'slideshow_current'});
    
    var swf = slideshow.prototype.getFile($(event.target),'file');
    var img = slideshow.prototype.getFile($(event.target),'image');
    
    $("#slideshow_image").attr({id:'slideshow_image_temp'});

    if( swf!='' ){
        var new_image = document.createElement('DIV');
        $(new_image).css({opacity:0}).attr({id:"slideshow_image"});
    } else {
        var new_image = document.createElement('IMG');
        $(new_image).css({opacity:0}).attr({id:"slideshow_image",src:slideshow.prototype.filePath+img});
    }
    
    var url = $(event.target).attr("href");
    if( url && url!='#' ){
        $(new_image).attr({className:'slideshow_image_link'}); //,onclick:"document.location='"+url+"';"});
    }
    
    $("#slideshow_image_temp").before(new_image);
    if( swf!='' ){
        slideshow.prototype.createSwfObject('slideshow_image',slideshow.prototype.filePath+swf,468,183);
    }    
    $("#slideshow_image_temp").animate({opacity : 0}, 700, null, function(){$("#slideshow_image_temp").remove();});
    $("#slideshow_image").animate({opacity : 100}, 700);

    if( url && url!='#' ){
        $(".slideshow_image_link").bind('click',function(){
            document.location = url;
        });
    }
    
    event.preventDefault();
}

slideshow.prototype.createSwfObject = function(div,swfFile,width,height){ 
    var so = new SWFObject(swfFile + '?r=' + new Date().getTime(),'videoplayerembed', width, height, 8);
    so.addParam('wmode','transparent'); 
    so.write(div); 
}

slideshow.prototype.getFile = function(obj,file){
    var files = $(obj).attr("alt").split(",");
    for( i=0; i<files.length; i++){
        var fileParts = files[i].split(":");
        if( fileParts[0]==file ){
            return fileParts[1];
        }
    }
    return false;
}
$(document).ready(slideshow.prototype.init);