$(document).ready(function() {
						   
	// ################## Basic Jquery operations ##################

    // rollovers
    PEPS.rollover.init();

    // PNG tranparency for IE6
    $('.png').pngfix();

    // set div links
    $(".link").click(function() {
        window.location = $(this).find("a").attr("href");
        return false;
    });

    // external links
    $("a[rel='external']").click(function() {
        window.open($(this).attr('href'));
        return false;
    });

    // Add end class to list items and table rows
    $('li, tr').addClass('end');
	
	
	// ################## App specific operations ##################
	
	// Left navigation
	$('ul > li', '.nav').hover(function(){
			if($(this).hasClass('current')){
					
			}else{
				$(this).addClass('hover');
			}
		},function(){
			if($(this).hasClass('current')){
					
			}else{
				$(this).removeClass('hover');
			}
		});	
	
	
	// Pagination navigation
	$('ul > li', '.list_footer').hover(function(){
			if($(this).hasClass('current')){
					
			}else{
				$(this).addClass('hover');
			}
		},function(){
			if($(this).hasClass('current')){
					
			}else{
				$(this).removeClass('hover');
			}
		});
	$('ul > li', '.list_footer').click(function(){
		 if($(this).hasClass('current') == false){
	 	 	window.location = $(this).find("a").attr("href");
        	return false;
		 }
	});
	
	// Disable current links
	$('li.current > a, a.current').click(function(){
		return false;
	});
	
	// Set Background Min-Width for IE6
	minWidthIE6();
	$(window).resize(function(){
		minWidthIE6();
	});
	
	// Form Buttons
	$('#button_filter, #button_delete, #button_add, #button_save_continue, #button_save').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	});
	
	// Table Rows Zebra Stripes and Hover Effects
	$('tr:even').addClass('alt');
	$('tr').hover(function(){
		$(this).addClass('hover');						
	}, function(){
		$(this).removeClass('hover');
	});
	
	// Focus styles for IE
	if($.browser.msie){
		$('input,select,textarea').focus(function(){
			$(this).addClass('focus');										  
		});
		$('input,select,textarea').blur(function(){
			$(this).removeClass('focus');										  
		});
	}
	


});

// Min-Width Function
function minWidthIE6(){
	if($.browser.msie && parseInt($.browser.version) == 6 && !window["XMLHttpRequest"]){
		if($(window).width() < 985){
			$('.head,.company,.main,.foot').width(985);
		}else{
			$('.head,.company,.main,.foot').width('100%')
		}
	}
}