$.noConflict();

jQuery(document).ready(function($){

	// $('img').each(function(){ 

		// $(this).attr('src',$(this).attr('src').replace('/assets','assets'));

	// });

	try {	

		$('#aaaaaaa').flash({

			src: 'rozkladowka.swf',

			width: 670,

			height: 400,

			quality: 'high',

			salign: 'lt',

			align: 'middle',

			wmode: 'transparent', 

			expressInstall: true,

			quality: 'high',

			play: 'true',

			loop: 'true',

			scale: 'noscale',

			devicefont: 'false',

			bgcolor: '#000000',

			menu: 'true',

			allowFullScreen: 'false',

			allowScriptAccess: 'sameDomain'

		});

	} catch(e) {}

	try {	

		$('#flashnews').flash({

			src: 'assets/flash/flash_news.swf',

			width: 480,

			height: 269,

			allowScriptAccess: 'sameDomain',

			quality: 'high',

			salign: 'lt',

			flashvars: { XMLSettingsPath: 'assets/flash/settings.xml', XMLImagesPath: 'assets/flash/images.xml?cachebuster=0.848402673378587&timestamp=1105827627406' },

			wmode: 'transparent', 

			expressInstall: true

		});	

	} catch(e) {}

	//try {

		$('#newsfeed').rssReader({

			targeturl: "class.rssReader.php",

			items: 7,

			Maxlength:120

		});

	//} catch(e) {}

	

	

	$('.banner a').each(function(){ 

		if ($(this).attr('rel')==1) $(this).parent('.banner').parent().css('position','fixed');

	});

	$('#reklama_header').cycle({ 

		fx:     'scrollHorz', 

		speed:  'slow', 

		timeout: 5000

	});

	$('#reklama_menu').cycle({ 

		fx:     'scrollHorz', 

		speed:  'slow', 

		timeout: 5000

	});

	$('#reklama_right').cycle({ 

		fx:     'scrollHorz', 

		speed:  'slow', 

		timeout: 5000

	});

	$('.banner').mouseover(function(){ 

		$(this).children('.rollup').show();

	});

	$('.banner').mouseout(function(){ 

		$(this).children('.rollup').hide();	

	});

	

	$('#wyniki').each(function(){ 

		items = $(this).find('tr');

		rows = '';

		$(this).html('<a href="#" id="wyniki_slider_prev" /><a id="wyniki_slider_prev_dep" /><div id="wyniki_slider"></div><a href="#" id="wyniki_slider_next" /><a id="wyniki_slider_next_dep" />')

		for ( i=0;i<items.size();i++) {

			if ((i != 0) && (i%15 == 0)) {

				$('#wyniki_slider').append('<div class="wyniki_slider"><table>'+rows+'</table></div>');

				rows = '';

			} 

			rows+='<tr'+(($(items[i]).hasClass('br'))?' class="br"':'')+'>'+$(items[i]).html()+'</tr>';

		}

		if (rows!='') $('#wyniki_slider').append('<div class="wyniki_slider"><table>'+rows+'</table></div>');

	});

	var sliderSize = $('.wyniki_slider').size()-1;

	$('#wyniki_slider').cycle({ 

		fx:     'scrollVertUp', 

		speed:  'slow', 

		timeout: 0,

		next: '#wyniki_slider_next',

		prev: '#wyniki_slider_prev',

		after: function(currSlideElement, nextSlideElement, options, forwardFlag) {

			if (options['currSlide'] == sliderSize) {

				$('#wyniki_slider_next').hide();

				$('#wyniki_slider_next_dep').show();

			} else {

				$('#wyniki_slider_next').show();

				$('#wyniki_slider_next_dep').hide();

			}

			if (options['currSlide'] == 0) {

				$('#wyniki_slider_prev').hide();

				$('#wyniki_slider_prev_dep').show();

			} else {

				$('#wyniki_slider_prev').show();

				$('#wyniki_slider_prev_dep').hide();

			}

		}

	});

	$('#wyniki_slider_prev_dep, #wyniki_slider_next_dep').click(function(){ 

		return false;

	});

			

	if ($('#reklama_popup').children().hasClass('.banner')) {$('#reklama_popup').show(); }

	$('#reklama_popup .banner').html($('#reklama_popup .banner').html()+'<div class="close"></div>');

	var myWidth = 0, myHeight = 0;

	function getWindowSize() {

	  if( typeof( window.innerWidth ) == 'number' ) {

		//Non-IE

		myWidth = window.innerWidth;

		myHeight = window.innerHeight;

	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {

		//IE 6+ in 'standards compliant mode'

		myWidth = document.documentElement.clientWidth;

		myHeight = document.documentElement.clientHeight;

	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {

		//IE 4 compatible

		myWidth = document.body.clientWidth;

		myHeight = document.body.clientHeight;

	  }

	}

	getWindowSize();

	$('#reklama_popup').height($('#wrap').height());

	ppHeight = $('#reklama_popup .banner').height();

	ppWidth = $('#reklama_popup .banner').width();

	$('#reklama_popup .banner').css('top', (myHeight-ppHeight)/2);

	$('#reklama_popup .banner').css('left', (myWidth-ppWidth)/2);

	$('#reklama_popup .close').click(function(){ 

		$('#reklama_popup').hide(400);

	});

	

	

	jQuery('input:text, input:password, textarea').focus(function () {

		if (jQuery(this).val()==jQuery(this).attr('title')) jQuery(this).val('');

		jQuery(this).removeClass('invalid');

		jQuery(this).addClass('active');

		jQuery(this).parents('p').find('.err').removeClass('err');

		jQuery(this).parents('p').find('.msg').remove();

	});

	jQuery('input:text, input:password, textarea').blur(function () {

		if (jQuery(this).val()=='') jQuery(this).val(jQuery(this).attr('title'));

		jQuery(this).removeClass('active');

	});

	

	try {

		$.Juitter.start({

			searchType:"fromUser", // needed, you can use "searchWord", "fromUser", "toUser"

			searchObject:"MVPmagazyn", // needed, you can insert a username here or a word to be searched for, if you wish multiple search, separate the words by comma.

			lang:"pl", // restricts the search by the given language

			live:"live-15", // the number after "live-" indicates the time in seconds to wait before request the Twitter API for updates.

			placeHolder:"juitterContainer", // Set a place holder DIV which will receive the list of tweets example <div id="juitterContainer"></div>

			loadMSG: "Wczytywanie...", // Loading message, if you want to show an image, fill it with "image/gif" and go to the next variable to set which image you want to use on 

			imgName: "loader.gif", // Loading image, to enable it, go to the loadMSG var above and change it to "image/gif"

			total: 1, // number of tweets to be show - max 100

			readMore: "Przeczytaj na twitterze", // read more message to be show after the tweet content

			nameUser:"image", // insert "image" to show avatar of "text" to show the name of the user that sent the tweet 

			openExternalLinks:"newWindow", // here you can choose how to open link to external websites, "newWindow" or "sameWindow"

					filter:"sex->*BAD word*,porn->*BAD word*,fuck->*BAD word*,shit->*BAD word*"  // insert the words you want to hide from the tweets followed by what you want to show instead example: "sex->censured" or "porn->BLOCKED WORD" you can define as many as you want, if you don't want to replace the word, simply remove it, just add the words you want separated like this "porn,sex,fuck"... Be aware that the tweets will still be showed, only the bad words will be removed

		});

	} catch(e) {}

});



jQuery(window).load(function($){	

	try {

		$(".shortDateFormat").each(function (idx, elem) {

			if ($(elem).is(":input")) {

				$(elem).val($.format.date($(elem).val(), 'dd/MM/yyyy'));

			} else {

				$(elem).text($.format.date($(elem).text(), 'dd/MM/yyyy'));

			}

		});

		$(".longDateFormat").each(function (idx, elem) {

			if ($(elem).is(":input")) {

				$(elem).val($.format.date($(elem).val(), 'dd/MM/yyyy hh:mm:ss'));

			} else {

				$(elem).text($.format.date($(elem).text(), 'dd/MM/yyyy hh:mm:ss'));

			}

		});

	} catch(e) {}

});
