$(document).ready(function(){
	
	$("a.external").attr("target","_blank");
	
	$(".back").click(function(){
		history.back();									 
	 });
	
	$(".fancybox").fancybox({
		'hideOnContentClick': false, 					 
		'zoomOpacity' : true,
		'zoomSpeedIn' : 500,
		'zoomSpeedOut' : 500
	});
	
	$(".fancybox-listener").bind('click',function(){
		id = $(this).attr('id');
		fancy_id = id.split('-');
		fancy_id = fancy_id[2];
		$("#gallery-" + fancy_id).click();
	});
	
	$(".toggle").addClass('toggle_open');
	
	$(".toggle").click(function(){
		if ($(this).next().css('display') == 'none') {
			$(this).next().slideDown();
			$(this).removeClass('toggle_open');
			$(this).addClass('toggle_close');
			//scrollToTarget(this);
		}else {
			$(this).next().slideUp();
			$(this).removeClass('toggle_close');
			$(this).addClass('toggle_open');
			//scrollToTarget(this);
		}
	});
	
	var toggle_count = $(".toggle").size();
	if(toggle_count == 1){
		$(".toggle").click();	
	}
	
	$(".reset").bind("focus",function(){ $(this).val(''); });
  
	if(jQuery.browser.msie){
		/* Apply actions for IE */
		
		
		/* Apply actions for IE 6 */
		var msie_version = parseInt(jQuery.browser.version);
		if(msie_version == 6){
			
		}
	}
});
function scrollToTarget(target){
	var targetOffset = $(target).offset().top;
	$('html').animate({scrollTop: targetOffset}, 1000);
}