/* Copyright (c) 2009 Onlyweb Studio | http://www.onlyweb.ru/ */
/*

Author: Mike Zimin (mihazimin@mail.ru)

From Russia with love!

*/

getScrollTop = function() {
	y = (window.scrollY) ? window.scrollY : document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
	return y;
}

var PortfolioPanel = newClass();
PortfolioPanel.prototype = {
	
	init: function() {
		var t = this;
		
		t.portfolioPanel = $('#portfolio_panel');
		
		t.top = 215;
		
		//
		// We have already done work for IE6 in main_ie_6.css
		// top: expression(
		//   eval('document.documentElement.scrollTop') <= 215 ? '215px' : (eval('document.documentElement.scrollTop') + 'px')
		// );
		//
		if (!($.browser.msie && $.browser.version == 6)) {
			$(window).scroll(function(){
				t.windowScroll();
			});
		}
	},
	
	windowScroll: function() {
		var t = this;
		if (getScrollTop() > t.top) {
			t.portfolioPanel.addClass('PortfolioFixedPanel');
			t.portfolioPanel.removeClass('PortfolioNormalPanel');
		} else {
			t.portfolioPanel.removeClass('PortfolioFixedPanel');
			t.portfolioPanel.addClass('PortfolioNormalPanel');
		}
	}
	
}