// Place the user's cursor in a particular form field
//
// AK24122008
function dcFirstFormField(field_name) { 

	var field = document.getElementsByName(field_name)[0]; 
	field.focus(); 
}

// Open popup window in centre of page
//
// AK24122008
function dcPopup(windowUrl, return_field,windowHeight, windowWidth, windowName) {

    if ( windowHeight == null ){
    
    	windowHeight = 300
    }

    if ( windowWidth == null ){
    
    	windowWidth = 600
    }

    if ( windowName == null ){
    
    	windowName = 'popup'
    }

    var ifield = document.getElementById(return_field);

    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUrl, windowName, 'resizable=0,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);

    newWindow.focus();
    
    newWindow.ifield = ifield; 
    window.ifield = ifield;    
    
    return newWindow.name;
}
