// JavaScript Document
/*
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Name        :    popUpWindow
    Purpose        :    This function pops up a new window.
    Usage        :    popUpWindow( "somepath/somefile.php", 500, 250, "_myWindow" );
    Arguments:
        url        -    String. The url that will open in the poped up window.
        width        -    integer. width of the window.
        height        -    integer. height of the window.
        [windName]    -    String. Pass this argument only if a fresh window is to be
                    poped up. This argument    should not contain any spaces.
    Return        :    void.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

function adjust(){
    width  =  0;
    height = 0;
    if( navigator.appName.indexOf("Microsoft") != -1 ){ // Microsoft
        width  = document.body.scrollWidth+26;
        height = document.body.scrollHeight+50;
    }else{
        width  = document.width+26;
        height = document.height+30;
    }

    // Put condition here
    width  = ( width  > screen.availWidth  ? screen.availWidth  : width );
    height = ( height > screen.availHeight ? screen.availHeight : height );
    
    x = (screen.availWidth/2)  - (width/2);
    y = (screen.availHeight/2) - (height/2);

    window.moveTo( x, y );
    window.resizeTo( width, height );
}

function popUpWindow(url, width, height, windName){
//alert(url+"=="+width+"=="+height+"=="+windName);
    wind = window.open(url, (windName ? windName : "_sameWindow"), "width=" +width+ ",height=" +height+ ",scrollbars=no");
    x = (screen.availWidth/2)  - (width/2);
    y = (screen.availHeight/2) - (height/2);
  wind.moveTo(x, y);
   // wind.resizeTo( width, (height+23) );
    wind.focus();	
}

function popUpWindow_new(url, width, height, windName){
    windName="Commssion"
    wind = window.open(url, (windName ? windName : "_sameWindow"), "width=" +width+ ",height=" +height+ ",scrollbars=yes");
    x = (screen.availWidth/2)  - (width/2);
    y = (screen.availHeight/2) - (height/2);
    wind.moveTo(x, y);
    //wind.resizeTo( width, (height+23) );
    wind.focus();
}
function popUpWindow_new1(url, width, height, windName){
    windName="Commssion"
    wind = window.open(url, (windName ? windName : "_sameWindow"), "width=" +width+ ",height=" +height+ ",scrollbars=yes");
    x = (screen.availWidth/2)  - (width/2);
    y = (screen.availHeight/2) - (height/2);
    wind.moveTo(x, y);
    //wind.resizeTo( width, (height+23) );
    wind.focus();
}