var Profile = {
	init:function(){
		jQuery.each($(".portfolio-link"),function(c,b,a){	
			var url = $(b).attr('href');
			$(b).click(function(e){	
				e.preventDefault();		
				Profile.show(url);				
			});		
		});
	},
	show: function(url){		
			
			if ($('#portfolio-window').length>0){
				$('#portfolio-window').dialog('destroy');
				$('#portfolio-window').remove();
			}
			jQuery.get(url, {format:'plain'},
				function(result) {
					$('body').append('<div id="portfolio-window">'+result+'</div>');
					$('#portfolio-window').dialog({
						title		: 'Пример выполненной работы',
						width		: 510,
						height		: 390,
						autoResize	: false,
						modal		: true,
						resizable	: false,
						buttons		: {
							'закрыть' : function(){								
								$('#portfolio-window').dialog('destroy');
								
							}
						}
					});	
					
					
				}
			);			
						
		}
}

$(document).ready(function(){ 	
 	Profile.init();
});


$(document).ready(function(){
	$('.profile-parts a').click(function(){
		if ($(this).attr('href') == '') {
			$('.profile-parts a.active').removeClass('active');
			$(this).addClass('active');
			$('.view-block').hide();
			$('.view-' + $(this).attr('rel')).show();
			return false;
		}
	});
	
	if (profileparts_active)
		$('.profile-parts a[rel=' + profileparts_active + ']').click();
});

