/**
 * opens the image chooser dialog
 * parameter target: inputfield to take imageurl
 */
function choose_color_start( target ){  
   color_target = target;   
   Dialog('cmscomp/htmlarea/popups/select_color.html', choose_color_end , 'init');
}

/**
 * take the return value
 */
function choose_color_end( color ){  
  color_target.value = color;
 // color_target.form.submit();
}


/**
 * "do nothing method, needet for nice popup links
 */
function fo(){}




/**
 *  opens a layer and loads a URL into the layer
 */ 
function open_link_in_layer( url, config, source ){
    config = parseConfig( config );
    frame = document.createElement('iframe');    
    frame.style.position = 'absolute';
    frame.style.top = '50px';
    frame.style.left = '500px';
    frame.style.width = '300px';
    frame.style.height = '300px';  
    frame.style.zIndex = 100;
    if( config['top'] ) frame.style.top =  config['top'] + 'px';   
    if( config['left'] ) frame.style.left =  config['left'] + 'px';  
    if( config['width'] ) frame.style.width =  config['width'] + 'px';  
    if( config['height'] ) frame.style.height =  config['height'] + 'px';         
    frame.style.backgroundColor = '#FAFBFF';
    frame.style.border = '1px solid #687184';     
    document.body.appendChild( frame );        
    frame.setAttribute("src",url );
}  


function goConfirm( message, pURL ){
    if( confirm( message )  ){
      document.location.href = pURL;
    }
}


/**
 *  parses a configstring like key1=value1,key2=value2,...
 *  into an assoziative array
 */
function parseConfig( pConf ){
   lArr = pConf.split(",");
   lResult = new Array();
   for (var i=0; i < lArr.length; ++i){
     lStr = lArr[i];
     lArr2 = lStr.split("=");
     lResult[ lArr2[0] ] = lArr2[1];
   }
   return lResult;   
}
