var newWindow;
var ppath = "";
var countpic = "";

function writearticle(path, articlebody, piccount) {
    var articleoutput = "";
    ppath = path;
    articleoutput += articlebody;

    if (piccount > 0) {
        for (var i = 1; i < piccount + 1; i++) {
            if (i == 1) {
                articleoutput += "<a href='javascript:get_large(1, ppath);'><img src='" + path + "/small_01.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 2) {
                articleoutput += "<a href='javascript:get_large(2, ppath);'><img src='" + path + "/small_02.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 3) {
                articleoutput += "<a href='javascript:get_large(3, ppath);'><img src='" + path + "/small_03.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 4) {
                articleoutput += "<a href='javascript:get_large(4, ppath);'><img src='" + path + "/small_04.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 5) {
                articleoutput += "<a href='javascript:get_large(5, ppath);'><img src='" + path + "/small_05.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 6) {
                articleoutput += "<a href='javascript:get_large(6, ppath);'><img src='" + path + "/small_06.jpg' style='border: solid 2px #ffffff''></a>&nbsp;";
            } else if (i == 7) {
                articleoutput += "<a href='javascript:get_large(7, ppath);'><img src='" + path + "/small_07.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 8) {
                articleoutput += "<a href='javascript:get_large(8, ppath);'><img src='" + path + "/small_08.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 9) {
                articleoutput += "<a href='javascript:get_large(9, ppath);'><img src='" + path + "/small_09.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 10) {
                articleoutput += "<a href='javascript:get_large(10, ppath);'><img src='" + path + "/small_10.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 11) {
                articleoutput += "<a href='javascript:get_large(11, ppath);'><img src='" + path + "/small_11.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 12) {
                articleoutput += "<a href='javascript:get_large(12, ppath);'><img src='" + path + "/small_12.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 13) {
                articleoutput += "<a href='javascript:get_large(13, ppath);'><img src='" + path + "/small_13.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 14) {
                articleoutput += "<a href='javascript:get_large(14, ppath);'><img src='" + path + "/small_14.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 15) {
                articleoutput += "<a href='javascript:get_large(15, ppath);'><img src='" + path + "/small_15.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 16) {
                articleoutput += "<a href='javascript:get_large(16, ppath);'><img src='" + path + "/small_16.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 17) {
                articleoutput += "<a href='javascript:get_large(17, ppath);'><img src='" + path + "/small_17.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 18) {
                articleoutput += "<a href='javascript:get_large(18, ppath);'><img src='" + path + "/small_18.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 19) {
                articleoutput += "<a href='javascript:get_large(19, ppath);'><img src='" + path + "/small_19.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 20) {
                articleoutput += "<a href='javascript:get_large(20, ppath);'><img src='" + path + "/small_20.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 21) {
                articleoutput += "<a href='javascript:get_large(21, ppath);'><img src='" + path + "/small_21.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 22) {
                articleoutput += "<a href='javascript:get_large(22, ppath);'><img src='" + path + "/small_22.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 23) {
                articleoutput += "<a href='javascript:get_large(23, ppath);'><img src='" + path + "/small_23.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 24) {
                articleoutput += "<a href='javascript:get_large(24, ppath);'><img src='" + path + "/small_24.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 25) {
                articleoutput += "<a href='javascript:get_large(25, ppath);'><img src='" + path + "/small_25.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 26) {
                articleoutput += "<a href='javascript:get_large(26, ppath);'><img src='" + path + "/small_26.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 27) {
                articleoutput += "<a href='javascript:get_large(27, ppath);'><img src='" + path + "/small_27.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 28) {
                articleoutput += "<a href='javascript:get_large(28, ppath);'><img src='" + path + "/small_28.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 29) {
                articleoutput += "<a href='javascript:get_large(29, ppath);'><img src='" + path + "/small_29.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            } else if (i == 30) {
                articleoutput += "<a href='javascript:get_large(30, ppath);'><img src='" + path + "/small_30.jpg' style='border: solid 2px #ffffff'></a>&nbsp;";
            }
        }
    }
    
	document.getElementById("article").innerHTML = articleoutput;
	
}

function get_large(id, picpath) {
    if (!newWindow || newWindow.closed) {
        newWindow = window.open("", "sub", "status,width=700");
        if (id == 1) {
            setTimeout("writePic('" + picpath + "/large_01.jpg')", 10);
        } else if (id == 2) {
            setTimeout("writePic('" + picpath + "/large_02.jpg')", 10);
        } else if (id == 3) {
            setTimeout("writePic('" + picpath + "/large_03.jpg')", 10);
        } else if (id == 4) {
            setTimeout("writePic('" + picpath + "/large_04.jpg')", 10);
        } else if (id == 5) {
            setTimeout("writePic('" + picpath + "/large_05.jpg')", 10);
        } else if (id == 6) {
            setTimeout("writePic('" + picpath + "/large_06.jpg')", 10);
        } else if (id == 7) {
            setTimeout("writePic('" + picpath + "/large_07.jpg')", 10);
        } else if (id == 8) {
            setTimeout("writePic('" + picpath + "/large_08.jpg')", 10);
        } else if (id == 9) {
            setTimeout("writePic('" + picpath + "/large_09.jpg')", 10);
        } else if (id == 10) {
            setTimeout("writePic('" + picpath + "/large_10.jpg')", 10);
        } else if (id == 11) {
            setTimeout("writePic('" + picpath + "/large_11.jpg')", 10);
        } else if (id == 12) {
            setTimeout("writePic('" + picpath + "/large_12.jpg')", 10);
        } else if (id == 13) {
            setTimeout("writePic('" + picpath + "/large_13.jpg')", 10);
        } else if (id == 14) {
            setTimeout("writePic('" + picpath + "/large_14.jpg')", 10);
        } else if (id == 15) {
            setTimeout("writePic('" + picpath + "/large_15.jpg')", 10);
        } else if (id == 16) {
            setTimeout("writePic('" + picpath + "/large_16.jpg')", 10);
        } else if (id == 17) {
            setTimeout("writePic('" + picpath + "/large_17.jpg')", 10);
        } else if (id == 18) {
            setTimeout("writePic('" + picpath + "/large_18.jpg')", 10);
        } else if (id == 19) {
            setTimeout("writePic('" + picpath + "/large_19.jpg')", 10);
        } else if (id == 20) {
            setTimeout("writePic('" + picpath + "/large_20.jpg')", 10);
        } else if (id == 21) {
            setTimeout("writePic('" + picpath + "/large_21.jpg')", 10);
        } else if (id == 22) {
            setTimeout("writePic('" + picpath + "/large_22.jpg')", 10);
        } else if (id == 23) {
            setTimeout("writePic('" + picpath + "/large_23.jpg')", 10);
        } else if (id == 24) {
            setTimeout("writePic('" + picpath + "/large_24.jpg')", 10);
        } else if (id == 25) {
            setTimeout("writePic('" + picpath + "/large_25.jpg')", 10);
        } else if (id == 26) {
            setTimeout("writePic('" + picpath + "/large_26.jpg')", 10);
        } else if (id == 27) {
            setTimeout("writePic('" + picpath + "/large_27.jpg')", 10);
        } else if (id == 28) {
            setTimeout("writePic('" + picpath + "/large_28.jpg')", 10);
        } else if (id == 29) {
            setTimeout("writePic('" + picpath + "/large_29.jpg')", 10);
        } else if (id == 30) {
            setTimeout("writePic('" + picpath + "/large_30.jpg')", 10);
        }
    } else if (newWindow.focus) {
        newWindow.focus();
    }
}

function writePic(pic) {
    var newContent = "<html><head><title>Picture Window</title>	<link rel='stylesheet' href='stylesheets/drvcstyles.css' type='text/css'></head>";
    newContent += "<body class='subs'><img src='" + pic + "'>";
    newContent += "</body></html>";
    newWindow.document.write(newContent);
    newWindow.document.close();
}

