function dirname(path) {
    // Returns the directory name component of the path  
    // version: 810.114
    // discuss at: http://phpjs.org/functions/dirname
    return path.replace(/\\/g,'/').replace(/\/[^\/]*\/?$/, '');
}

// zdefinowanie sciezki bazowej
var _BASE_PATH = new String( dirname( $("script[src$='themes/js/general.js']").attr('src') ) );
_BASE_PATH = (_BASE_PATH != '' ) ? _BASE_PATH.substring( 0 , _BASE_PATH.length - 2 ) : '';


//----- DOKUMENT ZALADOWANY  ---------------------------------------------------------------

$(document).ready( function() {
		
		// linki zewnetrzne	
		$('.external').each(function(){
				$(this).attr('target','_blank');
				$(this).click(function(){
						fSetGAStats('/external/'+$(this).attr('href'));
				});
		})
		
		// drukowanie po kliknięciu
		$('.print-window').click( function (){	window.print(); });
		
		// podpiecie wysylania formualrzy
		$('a.submit').live("click", function(){
			if ( $(this).attr('rel') ){
				fSendForm( $(this).attr('rel') );
			} else {
				fSendForm( $(this).parents('form').get(0).id );
			}
	    });
		$('a.submit[href="#"]').each( function(){
			$(this).attr('href','javascript:void(0)');	
		})

})

function fSendForm(sFormName){
		document.forms[sFormName].submit();
}
