$( document ).ready( function(){

	$('.vslider').jcarousel({
		auto: 2,
		scroll: 1,
		vertical: true,
		wrap: 'both'
	})
	
	$('#navigation ul li').hover(function () {
		$(this).parent().find('.dropdown').hide();
		$(this).addClass('hover');
		$(this).find('.dropdown').show();	
	}, function () {
		checkNavigation()
		if ($(this).find('a:eq(0)').hasClass('active')) {
			$(this).addClass('hover');
			$(this).find('.dropdown').show();	
		} else {
			$(this).removeClass('hover');
			$(this).find('.dropdown').hide();
		};
	})
	
	check();
	
	$('.tabbed-box .tabs-nav li a').live('click', function () {
		var href = $(this).attr('href');
		var tabs = $(this).parents('.tabbed-box:eq(0)').find('.tabs-content:eq(0)');
		$(this).parents('ul:eq(0)').find('a').removeClass('active');
		$(this).addClass('active');
		tabs.find('.tab-cnt').hide();
		$(this).parents('.tabbed-box').find(href).show();
		return false;
	})
	
	$('.side-nav ul li a').hover(function () {
		$(this).parent().addClass('hover');
	}, function () {
		$(this).parent().removeClass('hover');
	})
	
	checkNavigation();
	
	$('.file').customFileInput();
	
	$('.blink')
		.focus(function(){
			if ( $(this).attr('value') == $(this).attr('title') ) {
				$(this).attr({ 'value': '' })
			}
		})
		.blur(function(){
			if ( $(this).attr('value') == '' ) {
				$(this).attr({ 'value': $(this).attr('title') })
			}
		})
		
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		DD_belatedPNG.fix('.print a, .img-frame, .join-us-box .link p, .join-us-box .link p a, .solution-box .cnt h4, .solution-box .link p, .solution-box .link p a,.home-image .links a , .home-image .links a:hover');
	};
});
function checkPage() {
	var active = $('#navigation ul li').find('.active');
	var dd = active.parents('.dropdown');
	dd.show().parent('li:eq(0)').addClass('active');
}
function check() {
	var href = $('.tabbed-box .tabs-nav li a.active').attr('href');
	$(href).show();
};

function checkNavigation() {
	$('#navigation ul li').each(function () {
		if ($(this).find('a:eq(0)').hasClass('active')) {
			$(this).addClass('hover');
			$(this).find('.dropdown').show();
		};
	})
}
