/**
* Common CV Centre functions 
*/

// Open URL in current window's opener window and sets focus
// Returns true if there was opener window; false if not
function JsOpenInOpener(url) { // {{{
    if (window.opener) return false; // if no opener then go away
    
    window.opener.location.href = url;
    window.opener.focus;
    
    return true;
} // }}}

// open window to view firm invoice
function JsViewFInvoiceWindow(url) { // {{{
    
} // }}}

// open window to view member's invoice
function JsViewMInvoiceWindow(url) { // {{{
    
} // }}}

// open window to edit saved cv
function JsEditFSavedCVWindow(url) { // {{{
    JsOpenWindowNH(url, 500, 400, 'saved_cv_edit');
} // }}}

// open window to view cv
function JsViewCVWindow(url, from_cosite) { // {{{    
	if (from_cosite) {
	    JsOpenWindowWC(url, screen.width, screen.height, 'cv_view');
	} else {
	    JsOpenWindowNH(url, 800, 600, 'cv_view');
	}
} // }}}

// open window to view cv (delfi co-site)
function JsViewCVWindowDelfi(url) { // {{{
    JsOpenWindowWC(url, screen.width, screen.height, 'cv_view');
} // }}}

// open window for member to edit cv detail
function JsMEditCVDetailWindow(url) { // {{{
    
} // }}}

// open window to view jobad
function JsViewJobWindow(url) { // {{{
    
} // }}}

/**
 * Show/hide element
 * @param string element name to update.
 */
function JsSwitchElement(element){
	if (element.style.display == 'none') {
		element.style.display = '';
	} else {
		element.style.display = 'none';
	}
}

function isInteger(s) {
	return (s.toString().search(/^-?[0-9]+$/) == 0);
}
