var blogpath = 'http://www.archipictor.com/';

var $j = jQuery.noConflict();

$j(window).load(function(){
	
	// Height Fix
	var dH = $j(document).height();
	var mH = dH - 197;
	
	$j('.elements').height(mH);
	// bux fix for ie9 with jquery 1.4.2. not needed with jquery 1.6.x
	// $j('.elements').css('height', mH);
	$j('#signature').css('top', dH - 25);
		
	// Nav autoselect
	var path = location.pathname.substring(1);
	if (path) {
		$j('#nav_content a[href$="' + path + '"]').parent().addClass('selected');
	}
	if ($j('#blog_part').length) {
		$j('#nav_content a[href$="blog/"]').parent().addClass('selected');
	}
	
	// Link header to frontpage
	$j('#header,#header_fp').bind({
		click: function() {
			window.location.href = blogpath;
		},
		mouseenter: function() {
			$j(this).css('cursor','pointer');
		}
	});
	
	// Validate contact form
	$j("#c_form").validate({
		submitHandler: function(form) {
           $j(form).ajaxSubmit({
                success: function() {
                    $j('#c_form').hide();
                    $j('#text').append("<p class='thanks'>Kiitos! Yhteydenottopyyntösi on lähetetty.</p>");
					_gaq.push(['_trackPageview', '/contact/thankyou']);
                }
           });
		   return false;
         }	
	});
	
	
});
