function setOddEven(src,tr){
	
	tr = typeof(tr) != 'undefined' ? tr : 'tr';
	
	$('#' + src + ' ' + tr + ':odd').addClass('odd-row');	
	$('#' + src + ' ' + tr + ':even').addClass('even-row');
	
}

function menuItemSwap(obj) {

	$(obj).css("background-position","0px 0px");
}

function menuItemDeSwap(obj) {

	$(obj).css("background-position","0px -16px");
}

function highlight(obj) {
	
	$(obj).addClass("highlight");
}

function unhighlight(obj) {
	
	$(obj).removeClass("highlight");
}

function show_sub_content(contents){

	if ( $('.mid-sub-details').css('display') == 'none' ){	$('.mid-sub-details').css('display', 'block'); 	}
	$('.mid-sub-details').html('');
	$('.mid-sub-details').html(contents);
	
}

function toggle_mission(id){
	
	$('.active-details').hide();
	$('.active-details').removeClass('active-details');	$('.active-sub').removeClass('active-sub');
	$('#mission-sub-details-' + id).addClass('active-details');	$('#mission-sub-' + id).addClass('active-sub');
	$('#mission-sub-details-' + id).fadeIn(500);

}

function toggle_security(id){
	
	$('.active-details').hide();
	$('.active-details').removeClass('active-details');	$('.active-sub').removeClass('active-sub');
	$('#security-sub-details-' + id).addClass('active-details');	$('#security-sub-' + id).addClass('active-sub');
	$('#security-sub-details-' + id).fadeIn(500);

}

function toggle_benefits(id){
	
	$('.active-details').hide();
	$('.active-details').removeClass('active-details');	$('.active-sub').removeClass('active-sub');
	$('#benefits-sub-details-' + id).addClass('active-details');	$('#benefits-sub-' + id).addClass('active-sub');
	$('#benefits-sub-details-' + id).fadeIn(500);
	
}

function toggle_partners(id){
	
	$('.active-details').hide();
	$('.active-details').removeClass('active-details');	$('.active-sub').removeClass('active-sub');
	$('#partners-sub-details-' + id).addClass('active-details');	$('#partners-sub-' + id).addClass('active-sub');
	$('#partners-sub-details-' + id).fadeIn(500);

}

function cut_last_border(parent){
	
	$('#' + parent + ' div:last-child').css('border','none');
	
}

function center_image(){
	
	$('.ci').each(function(){
		var container = $(this);
		var anchor = container.children('a');
		var image = anchor.children('img');
		
		//anchor.css({'display':'inline-block', 'line-height': '0'});
		image.css('margin-top',(Math.round((container.height() - image.height())/2))+'px');
		image.css('margin-left',(Math.round((container.width() - image.width())/2))+'px');
	});
	
	
	/*$('.ci a img').each(function(){
		$(this).load(function(){
			
			$(this).css('display','inline-block');
			var w = $(this).width();
			var h = $(this).height();
			var sizeW = $(this).parent().parent().width();
			var sizeH = $(this).parent().parent().height();
			$(this).css('marginTop', (Math.round((sizeH - h)/2))+'px');
			$(this).css('marginLeft', (Math.round((sizeW - w)/2))+'px');
		
		});
	});*/
	
}

function center_element(){

	$('.ce').each(function(){
	
		if( $(this).children("img").length !== 0 ) { //element zawiera obrazki
		
			$(this).children("img").load(function(){
			
			var w = $(this).parent().width();
			var h = $(this).parent().height();
			var pw = $(this).parent().parent().width();
			var ph = $(this).parent().parent().height();
			$(this).parent().css('marginTop', (Math.round((ph - h)/2))+'px');
			$(this).parent().css('marginLeft', (Math.round((pw - w)/2))+'px');
		
			});
		
		}
		else { //element nie zawiera obrazk�w
		
			var w = $(this).width();
			var h = $(this).height();
			var pw = $(this).parent().width();
			var ph = $(this).parent().height();
			$(this).css('marginTop', (Math.round((ph - h)/2))+'px');
			$(this).css('marginLeft', (Math.round((pw - w)/2))+'px');
		
		}
	
	});

}

	
$.fn.cycle.defaults.timeout = 1000;

$(function() {
	  
	$('#partners-logos, #partnersModuleLogos').cycle({
	   fx:    'fade',
	   sync:   0,
	   speed: 4000,
	   continuous: 1,
	   pause: 1,
	   cleartype: !$.support.opacity
	});
	
});

function change_lang(from,to){
	document.location = String(document.location).replace(new RegExp('/' + from),'/' + to);
}

