

	function open_preferences()
	{
		v_directory = 	_DBSVARS.request.cfroot + '/popups';
		v_server_protocol = 'http://';
		if (_DBSVARS.request.https == 'yes')
			v_server_protocol = 'https://';
			
		v_directory = v_server_protocol + _DBSVARS.cgi.server_name + '/' + v_directory;
		v_href = v_directory + '/index.cfm?fuseaction=user_preferences';
		open_popup(v_href,600,450);
		
	}
 

	function open_object_display(object_name,object_id,show_workflow,heading,key_list,key_index,width,height)
	{
		v_directory = 	_DBSVARS.request.cfroot + '/popups';
		v_server_protocol = 'http://';
		if (_DBSVARS.request.https == 'yes')
			v_server_protocol = 'https://';
			
    	if (width == undefined)
    		width = 450;
    		
    	if (height == undefined)
    		height = 450;
    	if (key_list == undefined)
    		key_list='';
			
		v_params = '&object_name=' + object_name + '&object_id=' + object_id + '&show_workflow=' + show_workflow + '&heading=' + heading + '&key_list=' + key_list + '&key_index=' + key_index;	
		v_directory = v_server_protocol + _DBSVARS.cgi.server_name + '/' + v_directory;
		v_href = v_directory + '/index.cfm?fuseaction=object_display' + v_params + '&cfroot=' 
				 + _DBSVARS.request.cfroot + '&' + _DBSVARS.session.urltoken;
		open_popup(v_href,width,height);
		
	}
	
	
     function open_popup(href,width,height,target)
	 {
    	
    	var popwindow = null;
    	
    	if (width == undefined)
    		width = 450;
    		
    	if (height == undefined)
    		height = 450;
		
		if (target == undefined)
			target = 'popupwin';
    		
    	var winatts = 'height=' + height + ',width=' + width + ',resizable=1,scrollbars = 1'
    	
    	if (popwindow && !popwindow.closed)
		{
			popwindow.close();
		}
 
    	popwindow = window.open(href,target,winatts);
    	popwindow.focus();
    
    } 
    
	function upload_image_popup(container_id)
	{	
    	var popwindow;
    	var height = 120;
    	var width = 450;
    	var href = 'index.cfm?fuseaction=upload_image_popup&container_id=' + container_id 
				 + '&cfroot=' + _DBSVARS.request.cfroot + '&' + _DBSVARS.session.urltoken;
    	
		var winatts = 'height=' + height + ',width=' + width + ',resizable=0,scrollbars = 0';
		
    	if (popwindow && !popwindow.closed)
		{
			popwindow.close();
		}
 
    	popwindow = window.open(href,'popupwin',winatts);
    	popwindow.focus();
    
    } 
	
	function upload_file(path,field_name,form_name)
	{
    	var file_upload_window;
    	var height = 160;
    	var width = 450;
    	var href = _DBSVARS.request.cfroot + '/popups/' + 'index.cfm?fuseaction=upload_file&path=' 
				 + path + '&field_name=' + field_name + '&form_name=' + form_name + '&cfroot=' 
				 + _DBSVARS.request.cfroot + '&' + _DBSVARS.session.urltoken;
    	var winatts = 'height=' + height + ',width=' + width + ',resizable=0,scrollbars = 0';
    	file_upload_window = window.open(href,'file_upload_window',winatts);
    	file_upload_window.focus(); 
    } 
    
    function open_window(mode,href,windowname,width,height,location)
    {
        
        if (width == 'undefined')
           width = '500';
        if (height == 'undefined')   
           height =  '600';
        if (location == 'undefined')   
           location =  0;
           
        var v_width = width;
        var v_height = height;    
        var left = (screen.width - v_width ) / 2;
        var top = (screen.height - v_height ) / 2;
     
 		
        if (mode == 'open')
            {
	           newwindow = window.open(href,windowname,'height=' + v_height + ' ,width=' + v_width + ' ,left=' + left + ',top=' + top + ',location=' + location +',scrollbars=1,menubar=0,titlebar=0,statusbar=0,resizable');
               newwindow.focus();
               }
               
        if (mode == 'close')
            {
               newwindow.close()
               }
     } 
     
        var infowindow;
    
    function info_popup(mode,message,width,height)
    {
       	var left = (screen.width - 200 ) / 2;
        var top = (screen.height - 100 ) / 2;
		
		if (width == undefined)
            width = '200';
        if (height == undefined)   
            height =  '60';
           
		
        var v_width = width;
        var v_height = height;  
		
		v_directory = 	_DBSVARS.request.cfroot + '/popups';
		v_server_protocol = 'http://';
		if (_DBSVARS.request.https == 'yes')
			v_server_protocol = 'https://';
			
		v_directory = v_server_protocol + _DBSVARS.cgi.server_name + '/' + v_directory;		
 
     	var href = v_directory + '/index.cfm?fuseaction=info_popup&message=' 
				 + message + '&background_colour=white&' + _DBSVARS.session.urltoken;
    	   
    	if (mode == 'open')
    		{
    	 	   	infowindow =  window.open(href,"infowin",'height=' + v_height + ',width=' + v_width + ',left=' + left + ',top=' + top + ',scrollbars=' + _DBSVARS.attributes.scrollbars + ',menubar=0,statusbar=0,titlebar=false,resizable');
                infowindow.focus();
            }
    	if (mode == 'close')
    	   	{
              	infowindow =  window.open(href,"infowin",'height=100,width=200,left=200,top=100,scrollbars=' + _DBSVARS.attributes.scrollbars + ',menubar=0,statusbar=0,titlebar=false,resizable');
              	infowindow.focus();
    	      	infowindow.close();
			}
    } 
	
 
