act_event=0;

function CById(href,id) 
{
	var h=$('#'+id);
	h.load(href,{});
}

function jById(href,id) {
	var h=$('#'+id);
	
	h.load(href,{},function(){
		 loadEnd(id);
	});
	
	loadStart(id);
}
function getFormConteiner(href, id, form_id)
{
	var h = $('#'+id);	
	h.load(href,$('#'+form_id).serializeArray());
}

function loadEnd(id) {
	
	var h=$('#'+id);
	
	h.animate({
		opacity: "1"
	},1000);
	
	$('.Lightbox').lightbox({
	 	fitToScreen: true,
	 	disableNavbarLinks: true
	});
	if(typeof window.displayMap == 'function'){
		displayMap();
	}
}

function loadStart(id) {
	var h=$('#'+id);
	h.css('opacity','0.4');
	var he = h.css('height');
	
	var wi = h.css('width');
	hei = he.replace('px','');
	wid = wi.replace('px','');
	heig = (Math.round((hei)/2));
	widt = (Math.round((wid)/2));
	h.append('<div style=\'top:'+heig+'px; left: '+widt+'px;\' class=\'Loadrek\'></div>');
}

function collapseAll() {
	var m=$('.MapBox');
	m.css('border','0px');
	m.animate({
		height: "0px"
	},900);
}
function showMap() {
   var m=$('.MapBox');
   m.css('border','1px solid #C9C9C9');
   m.animate({
	   height: "300px"
   },900);
}

function showConteinerOrHide(id)
{
	var m=$('#'+id);
	if (m.css('display')=='none') {
		m.show('slow');
	} else {
		m.hide('slow');
	}
}
function choseAct(value)
{
	alert(value);
}

function mainEventsSwich(ile) {
	var ile = $('.NewsBody').length;
	
	setTimeout('mainEventsSwich2('+ile+',1);',6000);
}

function mainEventsSwich2(ile,t) {

	if (act_event==ile) act_event=0;
	change=act_event+1;
	if(change==ile)  change=0;
	changePromoEvents(act_event,change);
	
	if (t) setTimeout('mainEventsSwich2('+ile+',1);',6000);
	
	act_event++;
	
}

function mainEventsSwichRev(ile) {

	if (act_event==ile) act_event=0;
	change=act_event-1;
	
	if (change==-1)  change=ile;
	changePromoEvents(act_event,change);
	
	act_event--;
	
}


function changePromoEvents(act,change) {
	$('#promo_event_'+act).hide();
	$('#promo_event_'+change).show();
}

function fbs_click() {
	t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

