/*
	ARS REGIA - JavaScripts
	Grzegorz Kaliciak, grzegorz@kaliciak.net / etrust.pl
	v1.0.0, 04.08.2007
*/

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function inputLabelFromLabel(input_id,label_id) {
	if (!document.getElementById) return false;
	if (!document.getElementById(input_id)) return false;
	if (!document.getElementById(label_id)) return false;
	var textInput = document.getElementById(input_id);
	var label = document.getElementById(label_id);
	var text = label.innerHTML;
	if (!textInput.value) textInput.value = text;
	textInput.onfocus = function() {
		if (this.value == text) {
			this.value = '';
		}
	}
	textInput.onblur = function() {
		if (this.value == '') {
			this.value = text;
		}
	}
}

var handle_facebook = function() {
    if (!jQuery('#fb-root').length)
        return;

    window.fbAsyncInit = function() {
        FB.init({
            appId: '223752184320128',
            status: true,
            cookie: true,
            xfbml: true
        });
    };

    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol + '//connect.facebook.net/pl_PL/all.js';
    document.getElementById('fb-root').appendChild(e);
}

addLoadEvent(function(){
	inputLabelFromLabel("search","search_l");
});

$j(function() {
	handle_facebook();
});



