//==============================================================================

function sh(id)
{
		document.getElementById(id).style.display = document.getElementById(id).style.display == 'none' ? 'block' : 'none';
}	

//==============================================================================

/**
 *
 */
function url ( url )
{
	window.location = baseURL + url;
}

//==============================================================================

/**
 *
 */
function tabs ( node, module, action, param )
{
    var short = ( param == -1 ) ? 1 : 0;

	$.post (
		baseURL,
		{ 
			module: module, 
			action: action,
			short:  short, 
			page:   param
		},
   		function ( data ) {  
	    	$('#' + node).fadeTo ( 
	    		'slow', 0.1, function() {
					$('#' + node)[0].innerHTML = data;
					$('#' + node).fadeTo ( 'slow', 1 );
	    		}
	    	);
   		}
 	);

}

//==============================================================================

/**
 *
 */
function newsletter(param)
{
	var field = (param) ? 'email2' : 'email';
	var div   = (param) ? 'newsletter2' : 'newsletter';

	var email = $('#' + field)[0].value;
	
	if ( !validEmail ( email ) )
	{
		alert ( 'Niepoprawny adres email' );
		return false;
	}

	$('#' + div)[0].innerHTML = $('#newsletterWait')[0].innerHTML;

	$.post (
		baseURL,
		{ 
			module: 'auth', 
			action: 'subscribe',
			email:  email
		},
   		function ( data ) {
			$('#' + div)[0].innerHTML = data;
   		}
 	);
 	
 	return true;
}

//==============================================================================

/**
 *
 */
function myIdol ( userID )
{
	if ( confirm ( 'Czy chcesz otrzymywać na maila typy tego typera?' ) ) 
	{
		$.post (
			baseURL,
			{ 
				module: 'typer', 
				action: 'myIdol',
				userID: userID
			},
	   		function ( data )
	   		{
				if ( data )
				{
					alert ( 'Będziesz otrzymywać e-mailem typy tego typera' );
				}
				else
				{
					alert ( 'Musisz się zalogować, aby móc skorzystać z tej opcji' );
				}
	   		}
	 	);
	}
}

//==============================================================================

/**
 *
 */
function serchReplace ( )
{
	var str = $(search.search_text).value;
//	var str2 = str.replace(/ /gi, "-");
	alert(str);
}

//==============================================================================
