$(document).ready(function() { q.init() });

var q = {
	
	init : function() {
		if( $('#solutions').is('div') ) {
			q.solutionsInit();
		}
		
		$('.pages_wrapper').QBscroll();
		
		if( $('#flash_panic').is('div') && $.flash.hasVersion(9) ) {
			q.flash();
		}
	
	},
	
	flash : function() {
	
		$('.flash_content').each( function(i) {
			
			s = jQuery.parseJSON( $(this).find('.vars').text() );
			w = $(this).width();
			h = $(this).height();					
			
	  	$(this).flash(
	  		{
	  			swf: s.src,
	  			width: w,
	  			height: h,
	  			flashvars: s.vars
	  		}
	  	);
	  	$('.no_flash').remove();
	  	
	  });		
	
	},
	
	solutionsInit : function() {
	
		// Solutions
		solutionWidth = $('#solutions li').width();
		numOfSolutions = $('#solutions li').length;
		$('#solutions').width( ( solutionWidth * numOfSolutions ) + ( 10 * ( numOfSolutions - 1 ) ) );
		$('#solutions li').each(function(i) {
			$(this).css('left', i * 120 );
		});
		$('#solutions li:last, #solutions li:eq(' + ( $('#solutions li').length - 2 ) + ')').addClass('last');
		$('#solutions li:last').css({
			left: 'auto',
			right: 0
		});
		$('#solutions li:eq(' + ( $('#solutions li').length - 2 ) + ')').css({
			left: 'auto',
			right: '120px'
		});		
		$('#solutions li').QBsolution();
		
		// Companies
		companiesWidth = $('#companies li').width();
		numOfCompanies = $('#companies li').length;
		$('#companies').width( ( companiesWidth * numOfCompanies ) + ( 10 * ( numOfCompanies - 1 ) ) );
		$('#companies li').each(function(i) {
			$(this).css('left', i * 240 );
		});
	}
}

jQuery.fn.fixClearType = function(){ 
    return this.each(function(){ 
        if(typeof this.style.filter  && this.style.removeAttribute) 
            this.style.removeAttribute("filter"); 
    }) 
} 