/* -----------------------------------------------------------------
  *
  * global.js - global javascript functions
  *
  * -----------------------------------------------------------------
  *
  * 
  *
  * -----------------------------------------------------------------
  *
  * Functions: function open_popup ()
  *
  * -----------------------------------------------------------------
  *
  * Author(s): Sven Ruef, sruef@apaara.com
  * Copyright (c) 2001 apaaraGROUP
  *
  * -----------------------------------------------------------------
  *
  * Version:  2003-07-01 srf
  *          
  * TODO:    
  *
  * Changes:
  *           2003-07-01 sruef value adjustments added
  *           2001-12-18 sruef deleted function open_popup_img / added "no_main_url" to open_popup
  *           2001-12-04 sruef init
  *          
  * --------------------------------------------------------------- */

var addition_to_width = 0;
var addition_to_height = 0;

function open_popup ( popup_url, main_url, title, attribute_input ){
  var popup_win;
  
  var split_attributes = attribute_input.split(",");
  var attributes = "";
  for ( var attribute_index = 0; attribute_index < split_attributes.length; attribute_index++ )
  {
    var attribute_and_value = split_attributes[attribute_index].split("=");
    //adjusting values
    if ( attribute_and_value[0] == "width" )       eval ( "attribute_and_value[1]="+attribute_and_value[1]+"+"+addition_to_width);
    else if ( attribute_and_value[0] == "height" ) eval ( "attribute_and_value[1]="+attribute_and_value[1]+"+"+addition_to_height);
    
    attributes = attributes+attribute_and_value[0]+"="+attribute_and_value[1];
    if ( attribute_index < split_attributes.length-1 ) attributes = attributes + ", ";
  }
  popup_win=window.open( popup_url, title, attributes);
  popup_win.focus();
  if ( main_url != "no_main_url" ) window.location = main_url;
}

