﻿
/*
Pop win 
*/
function popwin(popuppath) {
 
    window.open(popuppath, null, 'toolbar=no,location=no,status=no,width=464,height=536,scrollbars=no,left=225,top=100')
}

function popwinmax(popuppath) {
    window.open(popuppath, null, 'toolbar=no,location=no,status=no')
}


/*
example with no scroll popwindynamic(popuppath, 'no', 'no', 'no', '464' , '600' , 'no', '', '', true,false)
example with scroll popwindynamic(popuppath, 'no', 'no', 'no', '481' , '600' , 'yes', '', '', true,false)
*/

function popwindynamic(popuppath, toolbar, location, status, width, height, scrollbars, left, top, centerX,centerY) {


    var parms = ""

    if (toolbar == "no") {
        parms = parms + "toolbar = no";
    }
    else {
        parms = parms + "toolbar = yes";
    }

    if (location == "no") {
        parms = parms + ", location = no";
    }
    else {
        parms = parms + ", location = yes";
    }

    if (status == "no") {
        parms = parms + ", status = no";
    }
    else {
        parms = parms + ", status = yes";
    }

    if (width == "") {
        parms = parms + ", width = 464";
    }
    else {
        parms = parms + ", width = " + width;
    }

    if (height == "") {
        parms = parms + ", height = 600";
    }
    else {
        parms = parms + ", height = " + height;
    }

    if (scrollbars == "no") {
        parms = parms + ", scrollbars = no";
    }
    else {
        parms = parms + ", scrollbars = yes";
    }

    if (left == "") {left = 225;}
    
    if (centerX == true){
        var xoffset
        var widthint

        if (width == "") {width=465;}
        widthint = parseInt(width);
        xoffset = event.x - (widthint/2);

        parms = parms + ", left = " + xoffset;
           
    }
    else
    {
        parms = parms + ", left = 225";

    }

    if (top == "") {
        parms = parms + ", top = 100";
    }
    else {
        parms = parms + ", top = " + top;
    }


    window.open(popuppath, null, parms)

}








  
