﻿/// <reference path="jquery-1.3.2-vsdoc2.js" />
function bswitcherInit() {    
    $('.PanelDetaljBilder img').click(function() {
    var bytt = $(this).attr('src');
    bytt = bytt.replace("Small", "700");     
        $('#ProduktBilde').attr({
            src: bytt
        });        
    });

    $('.PanelEkstraUtStyrBilder img').click(function() {
        var bytt = $(this).attr('src');
        bytt = bytt.replace("Small", "700");
        $('#ProduktBilde').attr({
            src: bytt
        });
    });

    $('.EkstraUtstyrPanel .tilleggLiteBilde').mousemove(function(e) {
        var imgT = document.getElementById('tmpStortBilde');
        if (!imgT) {
            var imgT = document.createElement('img');
            imgT.id = 'tmpStortBilde';
            imgT.setAttribute('src', this.getAttribute('src'));
            imgT.style.position = 'Absolute';
            imgT.style.border = 'solid black 1px';
            imgT.style.height = '250px';
            imgT.style.width = 'auto';
            document.body.appendChild(imgT);
        }
        imgT.style.top = e.pageY - 250 + 'px';
        imgT.style.left = e.pageX + 10 + 'px';

    });

    $('.EkstraUtstyrPanel .tilleggLiteBilde').mouseout(function() {
        $("#tmpStortBilde").remove();        
    }
    );

    $('.maksimerStortBilde').click(function() {
        var sr = $(this).parent().find('img').attr('src');
        sr = sr.replace('700', 'Stor');
        window.open(sr);
    });

}

$(document).ready(function() {
    bswitcherInit();
});
