$(document).ready(function() {

	$(".resize img").each(function(){
		var maxWidth = 520; // Max width for the image
		var width = $(this).width();  // Current image width
		var height = $(this).height(); // Current image height
        
        if (width > maxWidth){
            ratio = maxWidth / width;   // get ratio for scaling image
            $(this).css("width", maxWidth); // Set new width
            $(this).css("height", height * ratio);  // Scale height based on ratio
            height = height * ratio;    // Reset height to match scaled image
            width = width * ratio;    // Reset width to match scaled image
        }
	});
	
	$("#search#search-text .ti.text").focus(function() {
		$(this).attr("value","");
	});
	
	$(function() {
		var page = $("p.works-num").text();
		var num = parseFloat(page)-1;
		num.toString();
		$("#navlist li").eq(num).addClass("on");
	});
	


});
