Cufon.replace('h1', {
	color		: '-linear-gradient(#651802, #872309)'
});

Cufon.replace('h2', {
	color		: '-linear-gradient(#651802, #872309)'
});

Cufon.replace('#new-prod-header', {
	color		: '-linear-gradient(#c8aa44, #ffffff)'
});


Cufon.replace('#menu-top ul li a, #menu-bottom ul li a', {
	hover		: true
	
});

/************************************************************* */

//_initAjaxRequest();

$(document).ready(_initPage);

$(window).load(function() {
    $('#nivo-slider').nivoSlider({
		effect			: 'boxRainGrow',
		directionNav	: false,
		controlNav		: false,
		pauseTime		: 5000
	});
});


function _initPage()
{
	// centrowanie obrazow w pionie wewnatrze kontenera
	$('.vAlign').vAlign();
	// opisu pol w formularzach
	$('.clearField').clearField();
	// obrazy uruchamiane w lightboxie
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
	// linki obslugiwane za pomoca XMLHTTPRequest
	//$("a[rel^='ajaxRequest']").sevEnAjaxRequest({
	//	reInitCallback	: _reinitPage
	//});

	$('.toolTip').tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " -=- ",
		fade: 250
	});

	$('form').submit(function(){
		$(this).clearFormArtSeven();
	});
	
	$('img.smartNewProd').smartResize({
		maxHeight: 134
	});
	
	$('img.smartResize').smartResize({
		maxWidth: 92,
		maxHeight: 92
	}).vAlign();
    
    $('img.smartResizeContact').smartResize({
		maxWidth: 140,
		maxHeight: 140
	}).vAlign();
	
	$('img.smartResizeBig').smartResize({
		maxWidth: 250,
		maxHeight: 250
	}).vAlign();
	
	// ******************************
	
	_checkCookieForVideo();
	_initVideoButtons();
	
}

function _reinitPage()
{
	$('.vAlign').vAlign();
	$('.clearField').clearField();
	$("a[rel^='prettyPhoto']").prettyPhoto();

	$("a[rel^='ajaxRequest']").sevEnAjaxRequest({
		reInitCallback	: _reinitPage
	});

	$('.toolTip').tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " -=- ",
		fade: 250
	});

	//curvyCorners(settings, obj);
}

function _checkCookieForVideo()
{
	if($.cookie('show_player') == "false") $("#nivo-box").show();
	else $("#video-box").show();
}

function _initVideoButtons()
{
	$("#but-video-show").click(function() {
		$("#video-box").show();
		$("#nivo-box").hide();
		
		$.cookie('show_player', 'true');
	});
	
	$("#but-video-hide").click(function() {
		$("#video-box").hide();
		$("#nivo-box").show();
		
		$.cookie('show_player', 'false');
	});
}

/************************************************************* */

function pokazPozycje(obiektId)		{$("#" + obiektId).slideToggle("fast");}

/************************************************************* */

function _initAjaxRequest()
{
	// zastapienie funkcji w rsh
	window.dhtmlHistory.create( {
		debugMode : false,
		toJSON:		function(o) {return $.toJSON(o);},
		fromJSON:	function(s) {return $.parseJSON(s);}
	});

	window.onload = function() {
		dhtmlHistory.initialize();
		dhtmlHistory.addListener($().sevEnAjaxRequest.handleAjaxRequestHistory);
	};
}
