/*
 * JavaScript
 */
var oElementFirst, oElementSecond;

function returnHeighterValue( oElementFirst, oElementSecond )
{
	if( oElementFirst.height() > oElementSecond.height() )
	{
		oElementSecond.css(
		{
			'height': oElementFirst.height()
		});
	}
	else
	{
		oElementFirst.css(
		{
			'height': oElementSecond.height()
		});
	};
};



/*
 * jQuery
 */



$( function()
{
	if( $.browser.safari === false )
	{
		/* first level */
		returnHeighterValue( $( '#content-main-introduction' ), $( '#content-sidebar-price-list' ) );

		/* second levev */
		returnHeighterValue( $( '#content-main-packets' ), $( '#content-sidebar-assistance' ) );
	
		/* third levev */
		returnHeighterValue( $( '#content-main-promotion' ), $( '#content-sidebar-area' ) );
	}
	$( '#content-main-packets .packets:first-child' ).addClass( 'first-child' );
	
	/* change links */
	$( '#navigation-menu-clients-area' ).attr("href", "strefa-klienta-form.html");
	
	/*
	 * Fancybox
	 */
	$( '#navigation-menu-clients-area' ).fancybox(
	{
		'zoomOpacity': true,
		'zoomSpeedIn': 500, 
		'zoomSpeedOut': 500, 
		'overlayShow': true,
		'hideOnContentClick': false
	});
	
	$( '#content-main-page-gallery a[rel="image"]' ).fancybox(
	{
		'zoomSpeedIn': 500, 
		'zoomSpeedOut': 500, 
		'overlayShow': false,
		'hideOnContentClick': true,
		'easingIn': 'easeOutBack',
		'easingOut': 'easeInBack'
		
	});
	
	/*
	 * Validate
	 */
	try
	{
		$( '#content-main-page-contact-form' ).validate(
		{
			rules: {
				imieNazwisko: {
					required: true,
					minlength: 5
				},
				telefon: {
					required: true,
					number: true,
					minlength: 6
				},
				email: {
					required: true,
					email: true
				},
				zapytanie: {
					required: true,
					minlength: 5
				}
			},
			messages: {
				telefon: "Proszę wprowadź swój nr telefonu",
				email: "Proszę wprowadź swój adres E-mail",
				imieNazwisko: "Proszę wprowadź imię i nazwisko",
				zapytanie: "Wprowadź treść zapytania"
			}
		});
	}
	catch( error )
	{}
	
	try
	{
		$( '#content-main-page-clients-area-form' ).validate(
		{
			rules: {
				clientAreaFormLogin: {
					required: true,
					minlength: 4
				},
				clientAreaFormPassword: {
					required: true,
					minlength: 4
				}
			},
			messages: {
				clientAreaFormLogin: "Sprawdź proszę, czy wprowadziłeś swój login",
				clientAreaFormPassword: "Sprawdź proszę, czy wprowadzone hasło jest poprawe"
			}
		});
	}
	catch( error )
	{}
});

