/*****************************************
* Copyright 2003 WebLifting
* info@WebLifting.de
*
*
* basic used JavaScript functions
*
* Changes:
*    * 2002-08-20: created
*
******************************************/

/*****************************************
* global variables
******************************************/
var formname = "dataform";

/*****************************************
* status functions
******************************************/

/**
* open a new window and try to position in in the middle of the screen
*
* @param  string  url to open
* @param  int     width of the window to open
* @param  int     height of the window to open
*/
function setStatus(status)
{
    window.status = status;
}


/**
* open a new window and try to position in in the middle of the screen
*
* @param  string  url to open
* @param  int     width of the window to open
* @param  int     height of the window to open
*/
function resetStatus(status)
{
    window.status = "";
}


/**
* open a new window and try to position in in the middle of the screen
*
* @param  string  url to open
* @param  int     width of the window to open
* @param  int     height of the window to open
*/
function setDefaultStatus(status)
{
    window.defaultStatus = status;
}


/*****************************************
* popup functions
******************************************/

/**
* open a new window without statusbar and without scrollbars and try to position in in the middle of the screen
*
* @param  string  url to open
* @param  int     width of the window to open
* @param  int     height of the window to open
*/
function popup(url, mWidth, mHeight)
{
    openWindow(url, mWidth, mHeight, "no", "no", "yes");
}

/**
* open a new window with scrollbars and try to position in in the middle of the screen
*
* @param  string  url to open
* @param  int     width of the window to open
* @param  int     height of the window to open
*/
function popupSB(url, mWidth, mHeight)
{
    openWindow(url, mWidth, mHeight, "yes", "no", "yes");
}

/**
* open a new window with statusbar and without scrollbars and try to position in in the middle of the screen
*
* @param  string  url to open
* @param  int     width of the window to open
* @param  int     height of the window to open
*/
function popupStart(url, mWidth, mHeight)
{
    openWindow(url, mWidth, mHeight, "no", "yes", "no");
}

/**
* open a new window and try to position in in the middle of the screen
*
* @param  string  url to open
* @param  int     width of the window to open
* @param  int     height of the window to open
* @param  string  no if the window should not have scrollbars, else yes
*/
function openWindow(url, mWidth, mHeight, scrollbars, status, resizable)
{
    var mXPos = ((screen.width-mWidth) / 2);
    var mYPos = ((screen.height-mHeight) / 4);

    var mOptions = "toolbar=no,menubar=no,locationbar=no,scrollbars=" + scrollbars + ",resizable=" + resizable + ",status=" + status + ",left=" + mXPos + ",top=" + mYPos + ",screenX=" + mXPos + ",screenY=" + mYPos;
    m2Window = window.open(url,"myWindow",mOptions + ",width=" + mWidth + ",height=" + mHeight);
    m2Window.focus();
}

var exampleHeight = 200;
var exampleWidth = 200;

/**
* open a new window with the example
*
* @param  string  url to open
*/
function showExample(url)
{
    alert("öffne popup mit url:\n" + url);
    //popup(url,exampleWidth,exampleHeight);
}

/**
* get url as label from selection and
* open a new window with the example
*
* @param  string  selection name
*/
function showExampleFromSelect(name)
{
    var tempselect = eval("document." + formname + "." + name);
    var url = tempselect.options[tempselect.selectedIndex].label;
    if (url == "")
        alert("ERROR !\nno example is given!");
    else
        alert("öffne popup mit url:\n" + url);

        //popup(url,exampleWidth,exampleHeight);
}
