var IE = document.all?true:false

function checkEnter(e)
{
 e=e||event;
 var code = e.which? e.which : e.keyCode;

if (code==13) {
LOn();xajax_login(xajax.getFormValues('login_form'),'k1');
}

}
function initLightbox(){
		$.Lightbox.construct({
			  show_helper_text:	false,
			  show_info: false,
			  show_extended_info: false,
			  show_linkback: false,
				text: {
					image:		'Zdjęcie',
					of: 'z',
					close: 'zamknij'
				} 
	
	  });
}
 var boxWidth = 860 ;
 var boxHeight = 350 ;
 var fadeInTime = 600;
 var fadeOutTime = 1000;
$(document).ready(function(){
	InitSocialTab()
	initLightbox();
		$(".scrollable").scrollable({ vertical: true, mousewheel: true });	
		$.fn.corner.defaults.useNative = false;
		$(".roundedImg").corner("10px");
		$(".roundedImgGalleryBigPic").corner("10px");
		$(".roundedImgGallerySmallPic").corner("10px");
		
		showPopUpBox();
		
		//       rozmiar M
		Cufon.replace('.fontM17',
		{fontWeight: '400' ,
		fontSize:'17px'
		});
		Cufon.replace('.fontM12',
		{fontWeight: '400' ,
		fontSize:'12px'
		});
		
});



function showPopUpBox()
{
	elem = document.getElementById("popUpBox");
	$("#popUpBox").fadeIn(fadeInTime);
	elem.style.left = $(window).width()/2-boxWidth/2+'px';
	elem.style.top = $(window).height()/2-boxHeight/2+'px';
	var divTag = document.createElement("div");
	divTag.id = "wholPageBox";
	divTag.style.display = 'none';
	divTag.style.width = $(document).width()+'px';
	divTag.style.height = $(document).height()+'px';
	divTag.style.backgroundColor = '#4e4748';
	divTag.style.opacity = '0.90';
	divTag.style.filter = 'alpha(opacity=90)';
	divTag.style.position = 'absolute';
	divTag.style.left = '0';
	divTag.style.top = '0';
	divTag.style.zIndex = '1000';
	document.body.appendChild(divTag);
	$("#wholPageBox").fadeIn(fadeInTime);
	setTimeout("closeBox()",20000);
}
function closeBox()
{
	elem = document.getElementById("popUpBox");
	$("#popUpBox").fadeOut(fadeOutTime);
	$("#wholPageBox").fadeOut(fadeOutTime, function() {
   	var reElement = document.getElementById('wholPageBox');
	document.body.removeChild(reElement);
  });
}
function closeAskExpert() {
	document.getElementById("AskEkspert").style.display = "none";
}
function RememberMe() {
	pages = getPageSize();
	document.getElementById('RememberMe').style.left = (pages[0]/2)-136+'px';
	if(IE)
	document.getElementById('RememberMe').style.top = document.documentElement.scrollTop + 100 + 'px';
	else 
	document.getElementById('RememberMe').style.top = window.pageYOffset + 100 + 'px';					
	document.getElementById('RememberMe').style.display = "block";	
}
function PassRemind() {
	pages = getPageSize();
	document.getElementById('PassRemind').style.left = (pages[0]/2)-136+'px';
	if(IE)
	document.getElementById('PassRemind').style.top = document.documentElement.scrollTop + 100 + 'px';
	else 
	document.getElementById('PassRemind').style.top = window.pageYOffset + 100 + 'px';					
	document.getElementById('PassRemind').style.display = "block";	
}
function ShowAskExpert(){
		pageS = new Array();
		pages = getPageSize();
		CommentBox = (pages[0]/2)-225+'px';
		document.getElementById('AskEkspert').style.left = CommentBox;
		if(IE)
		document.getElementById('AskEkspert').style.top = document.documentElement.scrollTop + 100 + 'px';
		else 
		document.getElementById('AskEkspert').style.top = window.pageYOffset + 100 + 'px';					
		document.getElementById('AskEkspert').style.display = "block";	
}
function AddComment(c) {
	pages = getPageSize();
	document.getElementById('AddCommentPopUp').style.left = (pages[0]/2)-136+'px';
	if(IE)
	document.getElementById('AddCommentPopUp').style.top = document.documentElement.scrollTop + 100 + 'px';
	else 
	document.getElementById('AddCommentPopUp').style.top = window.pageYOffset + 100 + 'px';					
	document.getElementById('AddCommentPopUp').style.display = "block";	
	document.getElementById('IDKomentarza').value = c;
}
function DoNotAddComment() {
	document.getElementById('IDKomentarza').value = null;
	document.AddComentForm.reset();
	document.getElementById('AddCommentPopUp').style.display = "none";	
}
function ShowCom(n){
	pageS = new Array();
	pages = getPageSize();
	pollX = (pages[0]/2)-230+'px';
	document.getElementById('Komunikat').style.left = pollX;

	if(IE)
	document.getElementById('Komunikat').style.top = document.documentElement.scrollTop + 150 + 'px';
	else 
	document.getElementById('Komunikat').style.top = window.pageYOffset + 150 + 'px';

	document.getElementById('Komunikat').style.display = 'block';

	document.getElementById('kText').innerHTML = n;
	
}
function HideCom(){
	document.getElementById("Komunikat").style.display = "none";
}

function getPageSize(){
	  var xScroll, yScroll;
	  if (window.innerHeight && window.scrollMaxY) {
	     xScroll = document.body.scrollWidth;
	     yScroll = window.innerHeight + window.scrollMaxY;
	  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	     xScroll = document.body.scrollWidth;
	     yScroll = document.body.scrollHeight;
	  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
	     xScroll = document.body.offsetWidth;
	     yScroll = document.body.offsetHeight;
	  }
	  var windowWidth, windowHeight;
	  if (self.innerHeight) {   // all except Explorer
	     windowWidth = self.innerWidth;
	     windowHeight = self.innerHeight;
	  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	     windowWidth = document.documentElement.clientWidth;

	     windowHeight = document.documentElement.clientHeight;
	  } else if (document.body) { // other Explorers
	     windowWidth = document.body.clientWidth;
	     windowHeight = document.body.clientHeight;
	  }
	  // for small pages with total height less then height of the viewport
	  if(yScroll < windowHeight){
	     pageHeight = windowHeight;
	  } else {
	     pageHeight = yScroll;
	  }
	  // for small pages with total width less then width of the viewport
	  if(xScroll < windowWidth){
	     pageWidth = windowWidth;
	  } else {
	     pageWidth = xScroll;
	  }
	  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	  return arrayPageSize;
	}
