function initPopups(){
	$('a.popup').each(function(){
		$(this).attr('target','_blank');
	});
}

//* GS slideshow
function initSlideShow(){
	iSSImg = $("#slideshow img").length;
	if( iSSImg > 1 ){
		$("#slideshow img").each(function(i){
			this.id = "ss-"+i;
			if ( i > 0 ){
				$( this ).hide();
			}
		});
		i = iSSImg;
		SlideshowSwitch(i);
	}
}

function SlideshowSwitch(i){
	if(i > ($("#slideshow img").length-1)){
		i = 0;
	}
	$("#slideshow img").css({position: 'absolute', left:'0', top: '0'});
	id = "#"+$("#gallery img").get(i).id;
	$(id).fadeIn(1000);
	toggleTimeout = setTimeout( "$(id).fadeOut(1000);", 500 );
	i++;
	toggleTimeout = setTimeout( "SlideshowSwitch("+i+")", 500 );
}

function initGalleryLinks(){
	$('#gallery a').click(function(){

		$("#dialog").dialog({ 
			modal: true, 
			height: 300,
			width: 400,
			overlay: { 
				opacity: 0.5, 
				background: "black" 
			} 
		});
		alert( "ajax to " + $(this).attr("id") );
		return false;
	});
	
}



$(document).ready(function(){
    $("#accordion").accordion({
		header: ".uiheader"
	});
	//initSlideShow();
	//initGalleryLinks();
	initPopups();
	$.ifixpng('/images/pixel.gif');
	$('img[@src$=.png]').ifixpng('/images/pixel.gif'); 
});
