/*
	DOCUMENT READY
*/
$(function(){
	HOST = 'http://showservice.pl';
	/*
		:FOCUS HACK FOR IE
	*/
	$('input:text, textarea, button').focus(function(){$(this).addClass('active')}).blur(function(){$(this).removeClass('active')});
	$('button').hover(function(){$(this).addClass('active')},function(){$(this).removeClass('active')});
	/*
		RUZEE borders and shadows
	*/
	var myBorder = RUZEE.ShadedBorder.create({border: 1, corner: 5, shadow:10});
    myBorder.render($('.section'));
	/*
		MAIN-ANI flash
	*/
	if ($('#index').size()){
		$('#main-content').prepend('<div id="main-content-ani"></div>');
		swfobject.embedSWF(HOST + "/pub/uploadflash/testy.swf", "main-content-ani", "700", "625", "8", "", {HP_host: HOST},{wmode: "transparent"});
	}
	/*
		MAIN-NAV flash
	*/
	swfobject.embedSWF(HOST + "/pub/uploadflash/top_menu.swf", "main-nav", "711", "59", "8", "", {HP_host: HOST}, {wmode: "transparent"});
	/*
		NEWSLETTER field value show/hide
	*/
	$mailField = $('#mail');
	var startVal = $mailField.val();
	$mailField.focus(function(){
		(this.value == startVal) && $mailField.val('');
	})
	.blur(function(){
		this.value || $mailField.val(startVal);
	});
	$('#newsletter form').submit(function(){
		($mailField.val() == startVal) && $mailField.val('');
	});
	/*
		GOOGLE MAPS
	*/
	if ($('#map').size()) {
		if (GBrowserIsCompatible()) {
			infoText = $('#map-content').html();
			$('#map-content').remove();
			var map = new GMap2(document.getElementById("map"));
			map.addControl(new GSmallMapControl());
			map.setCenter(new GLatLng(52.400344, 16.89847), 14);
			var latlng = new GLatLng(52.400344, 16.89847);
			marker = new GMarker(latlng);
			GEvent.addListener(marker, "click", function(){
				map.openInfoWindowHtml(latlng, infoText);
			});
			map.openInfoWindowHtml(latlng, infoText);
			map.addOverlay(marker);
		}
	}
	/*
		GALLERY lightbox
	*/
	if ($('#article .gallery').size()){
		$('#article .gallery li a').lightBox({imageLoading: HOST + '/pub/uploadimages/lightbox-ico-loading.gif', imageBtnPrev: HOST + '/pub/uploadimages/lightbox-btn-prev.png', imageBtnNext: HOST + '/pub/uploadimages/lightbox-btn-next.png', imageBtnClose: HOST + '/pub/uploadimages/lightbox-btn-close.png', imageBlank: HOST + '/pub/uploadimages/lightbox-blank.gif'});
	}
	/*
		TRUSTED logos flash
	*/
	if ($('#index').size()){
		$('#main-content').append('<div id="trusted-ani"></div>');
	}
	else {
		$('#wrapper').append('<div id="trusted"><div id="trusted-ani"></div></div>');
	}
	swfobject.embedSWF(HOST + '/pub/uploadflash/klienci.swf', 'trusted-ani', '700', '90', '8', '', {xml_path: HOST + '/pub/xml/klienci.xml'});
});