function extendForms()
{
  params = {
    _default : {
      galleryBackgroundId: 'layer_background',
      galleryLoaderId: 'layer_loader',
      galleryClass: 'gallery',
      galleryLayerClass: 'layer_gallery',
      layerAnchorClass: 'layer',
  		layerBackgroundId: 'layer_background',
  		layerLoaderId: 'layer_loader',
  		layerContentClass: 'layer_content',
  		ajaxAnchorClass: 'ajax'
		}
  };
  
  FSite2.extendForm(document, params._default);
}

function ShowLayer()
{
	var Layer = new FSite2.Layer('ankieta_class',null,'ankieta');
	Layer.fullScreen(1);
	return Layer;
}

function ShowSurvey(id) 
{
	var ankieta = document.getElementById(id);
	ankieta.style.display = 'block';
	ankieta.style.left = window.getScrollX() + Math.round((window.getWindowWidth() - window.getObjectWidth(ankieta)) / 2) + 'px';
	ankieta.style.top = '50px';
}

function CloseSurvey()
{
	document.getElementById('ankieta').style.display = 'none';
	document.getElementById('content_ankieta').style.display = 'none';
}

function getCookie(c_name)
{
	if (document.cookie.length>0)
  {
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
	  {
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	  }
  }
return "";
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie = c_name+"="+escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toUTCString())+"; path=/";
		
	CloseSurvey();
	window.location.href = location.href;
}

function checkCookie()
{
	username=getCookie('ankieta');
	if (username==null && username=="")
	{
	  ShowLayer();
	}
}
