$(document).ready(function(){

	$(".jobs").each(function(i){
		if(!i) {
			$(".login").css("width", "158px");
			$(".contacts").css("background-position", "163px 0");
			$(".contacts").children(".top").css("background-position", "163px 0");
			$(".contacts").children(".top").children(".bottom").css("background-position", "163px bottom");
		}
	});
	
	$('INPUT.auto-hint').each(function(i, el){
        if($(this).val() == ''){
            $(this).val($(this).attr('title'));
        }
        $(el).focus(function(){
            if ($(this).val() == $(this).attr('title')) {
                $(this).val('');
            }       
        });

 	$(el).blur(function(){
            if ($(this).val() == '') {
                $(this).val($(this).attr('title'));
            }
        });
    });
	

	$(".header UL LI").hover(function(){
			$(this).children(".sub-menu").addClass("active");
		},
		function(){
			$(this).children(".sub-menu").removeClass("active");
	});

	$(".sub-menu").hover(function(){
			$(this).parent("LI").children("A").css("color", "#333333");
		},
		function(){
			$(this).parent("LI").children("A").css("color", "#666666");
	});
	
	$(".photo-grid").hover(function(){
		$(".caption", this).stop().animate({bottom:'0px'},{queue:false,duration:300});  
	}, function() {
		$(".caption", this).stop().animate({bottom: '-96px'},{queue:false,duration:300});  
	});
			
	$('#viewer') 
		.cycle({ 
    	fx:     'fade', 
    	speed:  'slow', 
    	timeout: 4000, 
    	pager:  '.tabs' 
	});
	
	// PJ: Open link in new window to avoid target="_blank" which causes invalid xhtml strict
	$(function(){    
		$('a.new-window').click(function(){
			window.open(this.href);        
	   		return false;    
	   	});
	});
});
