var ocontainer;
var ocontent;
var spaceToScroll;

$().ajaxStop($.unblockUI); 

$(document).ready(function() { 	
	if($('div').is('.scontainer')) {
  	ocontainer = $('div.scontainer');
  	ocontent = $('div.scontent');
  	
  	containerSize = jQuery.iUtil.getSize(ocontainer.get(0));
  	containerPosition = jQuery.iUtil.getPosition(ocontainer.get(0));
  	containerInner = jQuery.iUtil.getClient(ocontainer.get(0));
  	
  	contentSize = jQuery.iUtil.getSize(ocontent.get(0));
  	
  	spaceToScroll = contentSize.hb - containerInner.h;
  	
  	$('div.indicator')
  		.css('height', containerInner.h * containerSize.hb / contentSize.hb + 'px')
  	
  	$('.slider').Slider(
  		{
  			accept : '.indicator',
  			onSlide : function( cordx, cordy, x , y)
  			{
  				ocontent
  					.css('top', - spaceToScroll * cordy / 100 + 'px');
  			}
  		}
  	);			
	}

	$('a.favorite').click(function() {
		window.external.AddFavorite(location.href, document.title);
	});
	
	$('input, textarea').Tooltip({
	  track: true,
	  showBody: ";",
  	delay: 0
	});
	
	$('#secure').click(function() {
		$(this).removeClass("secure_error");
		$(this).addClass("secure");
		this.value = "";
	});
	
	$('form').submit(function() {
		var messageVal = $('#contactMessage'); 
		
		$('#text').block(messageVal); 
		$('body').load("/kontakt");
	});

	$('span.more').each(function() {
		$(this).mouseover(function() { 
			$(this).parent().parent().parent().fadeTo("slow", 0.5);
		});
		
		$(this).mouseout( function() { 
			$(this).parent().parent().parent().fadeTo("slow", 1);	
		});
	});
	
	$('span.noTop').each(function() {
		$(this).mouseover(function() { 
			$(this).parent().parent().parent().fadeTo("slow", 0.5);
		});
		
		$(this).mouseout( function() { 
			$(this).parent().parent().parent().fadeTo("slow", 1);	
		});
	});

	$('#portfolio img').each(function() {
		$(this).mouseover(function() { 
			$(this).fadeTo("slow", 0.5);
		});
		
		$(this).mouseout( function() { 
			$(this).fadeTo("slow", 1);	
		});
	});

	
});

