﻿



function expandingWindow(image) {
    var windowprops = 'width=1,height=1,scrollbars=1,status=no,resizable=0,location=no'
    var heightspeed = 2;
    var widthspeed = 2;
    var leftdist = 10;
    var topdist = 10;
    var bredde = 600;
    var høyde = 600;


    if (bredde == 0) {
        bredde = window.screen.availWidth;
    }
    if (høyde == 0) {
        høyde = window.screen.availHeight;
    }

    html = '<HTML>\n<HEAD>\n<TITLE>Image</TITLE>\n</HEAD>\n<BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>\n<CENTER><IMG SRC=\"' + image + '\" BORDER=0 NAME=imageTest onLoad=\"window.resizeTo(document.imageTest.width+30,document.imageTest.height+62)\"></CENTER>\n</BODY>\n</HTML>';

    if (window.resizeTo && navigator.userAgent.indexOf("Opera") == -1) {
        var winwidth = bredde;
        var winheight = høyde;
        var sizer = window.open("", "", "left=" + leftdist + ",top=" + topdist + "," + windowprops);
        for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed)
            sizer.resizeTo("1", sizeheight);
        for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed)
            sizer.resizeTo(sizewidth, sizeheight);
        sizer.document.write(html);
    }

}
/* Metode for å åpne nytt editvindu */
function newPicture(id) {
    url = 'pictureadmin_tv.aspx?produktid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}
/* Metode for å åpne nytt editvindu */
function newPictureProjector(id) {
    url = 'pictureadmin_projektor.aspx?produktid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}

/* Metode for å åpne nytt editvindu */
function newPicturePlayer(id) {
    url = 'pictureadmin_player.aspx?produktid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}

/* Metode for å åpne nytt editvindu */
function newPictureRecorder(id) {
    url = 'pictureadmin_recorder.aspx?produktid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}
/* Metode for å åpne nytt editvindu */
function newPictureAvforsterker(id) {
    url = 'pictureadmin_avamp.aspx?produktid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}


/* Metode for å åpne nytt editvindu */
function editPicture(id) {
    url = 'pictureadmin_tv.aspx?bildeid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}

/* Metode for å åpne nytt editvindu */
function editPictureProjector(id) {
    url = 'pictureadmin_projektor.aspx?bildeid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}

/* Metode for å åpne nytt editvindu */
function editPicturePlayer(id) {
    url = 'pictureadmin_player.aspx?bildeid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}
/* Metode for å åpne nytt editvindu */
function editPictureRecorder(id) {
    url = 'pictureadmin_recorder.aspx?bildeid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}
/* Metode for å åpne nytt editvindu */
function editPictureAvforsterker(id) {
    url = 'pictureadmin_avamp.aspx?bildeid=' + id
    window.open(url, 'jav', 'width=400,height=300,resizable=no,status=no');
}


function compareProjector() {


    var winWidth = 255
    var total = 0;
    PID = "";
    url = 'projectorcompare.aspx?ID='
    winProp = 'resizable=yes, toolbar=no, scrollbars=yes,height=800,width='
    for (var i = 0; i < document.aspnetForm.compare.length; i++) {

        if (document.aspnetForm.compare[i].checked) {
            if (total < 1) {
                PID = PID + document.aspnetForm.compare[i].value
            }
            else {
                PID = PID + "," + document.aspnetForm.compare[i].value
            }
            total++;
        }
    }

    if (total < 2) {
        alert("Du må sammenligne minst 2 projektorer")
    }
    else if (total > 15) {
        alert("Du kan ikke sammenligne mer en 15 projektorer om gangen")
    }
    else {
        url = url + PID
        winWidth = winWidth + 214 * total
        winProp = winProp + winWidth
        window.open(url, 'Compare', winProp)
    }
}

function compareTV() {


    var winWidth = 255
    var total = 0;
    PID = "";
    url = 'tvcompare.aspx?ID='
    winProp = 'resizable=yes, toolbar=no, scrollbars=yes,height=800,width='
    for (var i = 0; i < document.aspnetForm.compare.length; i++) {

        if (document.aspnetForm.compare[i].checked) {
            if (total < 1) {
                PID = PID + document.aspnetForm.compare[i].value
            }
            else {
                PID = PID + "," + document.aspnetForm.compare[i].value
            }
            total++;
        }
    }

    if (total < 2) {
        alert("Du må sammenligne minst 2 projektorer")
    }
    else if (total > 15) {
        alert("Du kan ikke sammenligne mer en 15 TV-apparater om gangen")
    }
    else {
        url = url + PID
        winWidth = winWidth + 214 * total
        winProp = winProp + winWidth
        window.open(url, 'Compare', winProp)
    }
}


function compareAmp() {
    var winWidth = 255
    var total = 0;
    PID = "";
    url = 'ampcompare.aspx?ID='
    winProp = 'resizable=yes, toolbar=no, scrollbars=yes,height=800,width='
    for (var i = 0; i < document.aspnetForm.compare.length; i++) {

        if (document.aspnetForm.compare[i].checked) {
            if (total < 1) {
                PID = PID + document.aspnetForm.compare[i].value
            }
            else {
                PID = PID + "," + document.aspnetForm.compare[i].value
            }
            total++;
        }
    }

    if (total < 2) {
        alert("Du må sammenligne minst 2 forsterkere")
    }
    else if (total > 15) {
        alert("Du kan ikke sammenligne mer en 15 forsterkere om gangen")
    }
    else {
        url = url + PID
        winWidth = winWidth + 214 * total
        winProp = winProp + winWidth
        window.open(url, 'Compare', winProp)
    }
}






function comparePlayer() {


    var winWidth = 255
    var total = 0;
    PID = "";
    url = 'compareplayer.aspx?PIDS='
    winProp = 'resizable=yes, toolbar=no, scrollbars=yes,height=800,width='
    for (var i = 0; i < document.projectors.compare.length; i++) {

        if (document.projectors.compare[i].checked) {
            if (total < 1) {
                PID = PID + document.projectors.compare[i].value
            }
            else {
                PID = PID + "," + document.projectors.compare[i].value
            }
            total++;
        }
    }

    if (total < 2) {
        alert("Du må sammenligne minst 2 avspillere")
    }
    else if (total > 15) {
        alert("Du kan ikke sammenligne mer en 15 avspillere i gangen")
    }
    else {
        url = url + PID
        winWidth = winWidth + 214 * total
        winProp = winProp + winWidth
        window.open(url, 'Compare', winProp)
    }
}

function compareSource() {
    var winWidth = 255
    var total = 0;
    PID = "";
    url = 'sourcecompare.aspx?ID='
    winProp = 'resizable=yes, toolbar=no, scrollbars=yes,height=800,width='
    for (var i = 0; i < document.aspnetForm.compare.length; i++) {

        if (document.aspnetForm.compare[i].checked) {
            if (total < 1) {
                PID = PID + document.aspnetForm.compare[i].value
            }
            else {
                PID = PID + "," + document.aspnetForm.compare[i].value
            }
            total++;
        }
    }

    if (total < 2) {
        alert("Du må sammenligne minst 2 signalkilder")
    }
    else if (total > 15) {
        alert("Du kan ikke sammenligne mer en 15 signalkilder om gangen")
    }
    else {
        url = url + PID
        winWidth = winWidth + 214 * total
        winProp = winProp + winWidth
        window.open(url, 'Compare', winProp)
    }
}


function compareRecorder() {


    var winWidth = 255
    var total = 0;
    PID = "";
    url = 'comparerecorder.aspx?PIDS='
    winProp = 'resizable=yes, toolbar=no, scrollbars=yes,height=800,width='
    for (var i = 0; i < document.projectors.compare.length; i++) {

        if (document.projectors.compare[i].checked) {
            if (total < 1) {
                PID = PID + document.projectors.compare[i].value
            }
            else {
                PID = PID + "," + document.projectors.compare[i].value
            }
            total++;
        }
    }

    if (total < 2) {
        alert("Du må sammenligne minst 2 avspillere")
    }
    else if (total > 15) {
        alert("Du kan ikke sammenligne mer en 15 avspillere i gangen")
    }
    else {
        url = url + PID
        winWidth = winWidth + 214 * total
        winProp = winProp + winWidth
        window.open(url, 'Compare', winProp)
    }
}


function editprice(id, produktid) {
    url = 'priceadmin_tv.aspx?produktid=' + produktid + '&prisid=' + id
    window.open(url, 'jav', 'width=760,height=830,resizable=no,status=no');
}
