function start() {
	
	if(typeof kkStart=='function') kkStart();
	var vp=viewportDims();
	var vpw=vp.width;
	var vph=vp.height;
	if(vpw>=(400+995)) $('video_open').show();
	
	if(vpw>=(448+995)) {
		$('fb_container3').show();
		$('fb_link').hide();
	}
	else {
		$('fb_container3').hide();
		$('fb_link').show();
	}
	}
var fbRel=0;
var wRel=0;
function videoOn() {
	$('video_open').hide();	
	$('fb_container').setStyle({left:(fbRel-200)+'px'});
	$('wc').setStyle({marginLeft:'-698px'});
//	new Effect.Move($('w'), { x: (wRel-200), mode: 'absolute', duration: .7});	
	wRel-=200;
	$('video_container').show();	
	$('video_close').show();		
	fbRel-=200;
}
function videoOff() {
	$('video_container').hide();	
	$('video_close').hide();			
	$('fb_container').setStyle({left:(fbRel+200)+'px'});	
	$('wc').setStyle({marginLeft:'-498px'});
//	new Effect.Move($('w'), { x: (wRel+200), mode: 'absolute', duration: .7});
	wRel+=200;
	$('video_open').show();	
	fbRel+=200;	
}
function fbOn() {
	$('fb_open').hide();	
	$('fb_close').show();	
	new Effect.Move($('fb_container'), { x: fbRel+180, mode: 'absolute', duration: .7});
	fbRel+=180;
}
function fbOff() {
	new Effect.Move($('fb_container'), { x: fbRel-180, mode: 'absolute', duration: .7});	
	$('fb_open').show();	
	$('fb_close').hide();
	fbRel-=180;
}
function setText(oTextInput) {
	if(oTextInput.value=='') oTextInput.value = oTextInput.defaultValue;
}
function clearText(oTextInput) {
	if(oTextInput.value==oTextInput.defaultValue) oTextInput.value = '';
}




function finishGaleriaMove() {
	var os = $('galeria_container').positionedOffset();
	if(os.left<0) $('arrow_left').show();
	else $('arrow_left').hide();
	if((os.left*-1+intervalAct)<galeriaWidthSum) $('arrow_right').show();
	else $('arrow_right').hide();
	//
	//window.console.log(os+' '+(os.left*-1)+' '+(os.left*-1+interval1)+' '+interval1+' '+contentWidthSum);
	contentMoving = false;
}


/* FB */
/* FB */
function initFbLogin() {
	FB.login(function(response) {
	   if (response.authResponse) {
		 //console.log('Welcome!  Fetching your information.... ');
		 FB.api('/me', function(response) {
		   //console.log('Good to see you, ' + response.name + '.');
		   window.location.reload();
		 });
	   } else {
		 //console.log('User cancelled login or did not fully authorize.');
	   }
	 }, {scope: 'email'});
	/*FB.login(function(response) {
		test(response);
	  if (response.authResponse) {
		if (response.scope) {
		  // użytkownik jest zalogowany i nadał wymagane uprawnienia
			test('jest git');
			window.location.reload();
		} else {
			// użytkownik jest zalogowany, ale nie nadał wymaganych uprawnień
			test('nie nadałeś wymaganych uprawnień');
		}
	  } else {
	  // użytkownik nie jest zalogowany
	  	test('nie zalogowałeś się');
	  }
	}, {scope:'email'});*/
}
function regFillWithFb() {
	FB.api('/me', function(response) {
		$('email').value = response.email;
		$('imie').value = response.first_name;
		$('nazwisko').value = response.last_name;
		if($('plec_m')) {
			if(response.gender=='male') $('plec_m').checked = true;
			else if(response.gender=='female') $('plec_k').checked = true;
		}
	});
}

var fblogoutPageTo = '';
function fblogout(pageTo) {
	if(typeof pageTo=='undefined') pageTo = window.location;
	fblogoutPageTo = pageTo;
	FB.logout(function(response) {
		location.href = '?fblogout=1&pt='+fblogoutPageTo;
		//location.href = '?fblogout=1';
	});
	return false;
}

/* FB - koniec */

var rssChan=0;
function toggleRss() {
	if (rssChan==0) {
		Effect.BlindDown('rssChannels', { duration: 0.5 });
		Effect.Fade('arr', { duration: 0.5 });
		rssChan=1;
	}
	else {
		Effect.BlindUp('rssChannels', { duration: 0.5 });
		Effect.Appear('arr', { duration: 0.5 });		
		rssChan=0;
	}
}	


var prob=0;
function toggleProb() {
	if (prob==0) {
		Effect.BlindDown('problemy_lista_linki', { duration: 0.5 });
		Effect.Appear('dwukropekProb', { duration: 0.5 });
		$('arrProbDown').hide();
		Effect.Appear('arrProbUp', { duration: 0.5 });
		prob=1;
	}
	else {
		Effect.BlindUp('problemy_lista_linki', { duration: 0.5 });
		Effect.Fade('dwukropekProb', { duration: 0.5 });
		Effect.Appear('arrProbDown', { duration: 0.5 });	
		$('arrProbUp').hide();
		prob=0;
	}
}	

var kraj=0;
function toggleKraje() {
	if (kraj==0) {
		Effect.BlindDown('kraje_lista_linki', { duration: 0.5 });
		Effect.Appear('dwukropekKraje', { duration: 0.5 });
		$('arrKrajeDown').hide();
		Effect.Appear('arrKrajeUp', { duration: 0.5 });
		kraj=1;
	}
	else {
		Effect.BlindUp('kraje_lista_linki', { duration: 0.5 });
		Effect.Fade('dwukropekKraje', { duration: 0.5 });
		Effect.Appear('arrKrajeDown', { duration: 0.5 });	
		$('arrKrajeUp').hide();
		kraj=0;
	}
}	



function bannerFadeOut() {
	Effect.Fade('banner_ankieta_2010', { duration: 0.3 });
}


function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=300,height=350,screenX=150,screenY=150,top=150,left=50');
}

function fbs_click() { 
	u=location.href;
	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;
	}
	
	
	
	
	
	
	
	
	
var okno = null;
function window_open(page,PosX,PosY,width,height)
{
  borderless = false;
  
  if(okno != null && !document.layers)
  {
    okno.close();
  }
  if(borderless && !document.layers)
  {
	okno = window.open(page, "", "fullscreen=0, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=yes, resizable=0");
	okno.resizeTo(w, s);
	okno.moveTo(PosX, PosY);
  }
  else
  {
	okno = window.open(page, "", "menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, copyhistory=no, width=" + width + ", height=" + height + ", left=" + PosX + ", top=" + PosY);
  }
  okno.focus();
  okno = null;
}
function window_open_scroll(page,PosX,PosY,width,height)
{
  borderless = false;
  
  if(okno != null && !document.layers)
  {
    okno.close();
  }
  if(borderless && !document.layers)
  {
	okno = window.open(page, "", "fullscreen=0, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=yes, resizable=0");
	okno.resizeTo(w, s);
	okno.moveTo(PosX, PosY);
  }
  else
  {
	okno = window.open(page, "", "menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, copyhistory=no, width=" + width + ", height=" + height + ", left=" + PosX + ", top=" + PosY);
  }
  okno.focus()
}









function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var faqQs=Array();
function toggleFaq(i) {
	if (faqQs[i]!=1) {
		$('odp_'+i).show();
		//Effect.BlindDown('odp_'+i, { duration: 0.5 });
		faqQs[i]=1;
	}
	else {
		$('odp_'+i).hide();
		//Effect.BlindUp('odp_'+i, { duration: 0.5 });
		faqQs[i]=0;
	}
}

function viewportDims() {
	var viewportwidth;
	var viewportheight;
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth,
		viewportheight = window.innerHeight
	}
 	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	else if (typeof document.documentElement != 'undefined'&& typeof document.documentElement.clientWidth !='undefined' && document.documentElement.clientWidth != 0) {
		viewportwidth = document.documentElement.clientWidth,
		viewportheight = document.documentElement.clientHeight
	}
	// older versions of IE
	else {
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
	return {width:viewportwidth,height:viewportheight};
}

