jQuery.timer = function (interval, callback)
{
	var interval = interval || 100;

	if (!callback)
		return false;
	
	_timer = function (interval, callback) {
		this.stop = function () {
			clearInterval(self.id);
		};
		
		this.internalCallback = function () {
			callback(self);
		};
		
		this.reset = function (val) {
			if (self.id)
				clearInterval(self.id);
			
			var val = val || 100;
			this.id = setInterval(this.internalCallback, val);
		};
		
		this.interval = interval;
		this.id = setInterval(this.internalCallback, this.interval);
		
		var self = this;
	};
	
	return new _timer(interval, callback);
};

$(document).ready(function() {

  $("iframe").remove();

  var change = 0;
  var nmz = "one";
  
  $.timer(5000, function(timer) {
      change++;
      change = change % 5;
      switch(change) { 
        case 0 : nmz = "one"; break;
        case 1 : nmz = "two"; break;
        case 2 : nmz = "three"; break;
        case 3 : nmz = "four"; break;
        case 4 : nmz = "five"; break;
      }
      $("#changer div.info").css("display","none");
      $("#changer div#info_" + nmz).css("display","block");
      $("#changer a.number").css("background-position","right");  
      $("a#" + nmz).css("background-position","left");
      timer.reset(5000);
    });
  
  //$("#menu em").hide();
  $("#left_in p").click(function(e) {
    $("#left_in em:visible").slideToggle("fast");
    $(this).children().slideToggle("fast"); return true;
  }).hover(function() { $(this).css({"cursor":"pointer","color":"#900"}); }, function() { $(this).css({"color":"#000"}); });
  
  $("#up").click(function(e){
    e.preventDefault();
		$("html, body").animate({scrollTop:0}, "slow");
	});
  
  $("#fryzjerstwo_div, #stylizacja_div").hide();
  $("#fryzjerstwo").css("cursor","pointer").click(function(e) {
    $("#stylizacja_div:visible").slideToggle();
    $("#fryzjerstwo_div").slideToggle();
  });
  $("#stylizacja").css("cursor","pointer").click(function(e) {
    $("#fryzjerstwo_div:visible").slideToggle();
    $("#stylizacja_div").slideToggle();
  });
  
  $("a.toggle").click(function(e) {
    $(this).parent().next("div").slideToggle();
  });
  
  $('#changer a.number').hover(function() {
   
    $("#changer div.info").css("display","none");
    $("#changer div#info_" + $(this).attr("id")).css("display","block");
    $("#changer a.number").css("background-position","right");  
    $(this).css("background-position","left");  
  });
  
});

function flash() {
  var obHTML = "<object type=\"application/x-shockwave-flash\" data=\"eck_header.swf\" width=\"990\" height=\"176\">" +
    "<param name=\"movie\" value=\"eck_header.swf\" \/>" +
    "<param name=\"quality\" value=\"high\" \/>" +
    "<param name=\"bgcolor\" value=\"#ffffff\" \/>" +
    "<param name=\"wmode\" value=\"transparent\" \/>" +
    "<\/object>";
  document.write(obHTML);
}

