/* All BMJ Group custom jQuery functions should be added here */

var $jquery = jQuery.noConflict();	/* Remove Javascript libary conflicts between Prototype and jQuery */


/* A function which populates a search form-field with a default text for thehe Group and local site search (Added by D. Berhane) */
/* The first parameter is a selector (for BMJ Group search, it is "#groupSearchGadget" ), the second parameter is the default value of that input element (e.g. " Search all BMJ Products"). */


function populateElement(selector, defvalue) {
    if($jquery.trim($jquery(selector).val()) == "") {
        $jquery(selector).val(defvalue);
    }
  
    $jquery(selector).focus(function() {
        if($jquery(selector).val() == defvalue) {
            $jquery(selector).val("");
        }
    });
    
    $jquery(selector).blur(function() {
        if($jquery.trim($jquery(selector).val()) == "") {
            $jquery(selector).val(defvalue);
        }
    });
 };

 
/* A function which open a pop-up window for OOP registration when the there is a refrence 'rel="external" with the A tag'  */

function popUp() {

    $jquery('A[rel="external"]').click( function() {
        window.open( $jquery(this).attr('href'),'', 'status=yes,scrollbars=yes,resizable=yes,width=700,height=550' );
        return false;
    });

}
   
