$(function(){
	$('#collectionParent').click(function() {
		$('#collectionSub').toggle('500');
	}); 
	
	$('#collection2011').click(function() {
		$('#collectionSub2011').toggle('500');
	}); 

	jQuery('img.bgmaximage').maxImage({
		isBackground: true,
		overflow: 'hidden',
		maxAtOrigImageSize:false,
		maxFollows: 'both',
		verticalAlign:'center',
		horizontalAlign:'center'
 	});

	$('img.bdfade').fadeIn(2000);

	contentSize();

	if(document.getElementById('paramiIndex')){
		setTimeout("contentFade(6000)",4000);
	}else if(document.getElementById('paramiCollection')){
		setTimeout("contentFade(2000)",1500);
	}else{
		setTimeout("contentFade(1000)",2000);
	}

});

function contentFade(delay){
	$('#content').fadeIn(delay);
}

function contentSize(){
	def_w=$(window).width();
	def_h=$(window).height();
	var cont_w=def_w-220-60;

	if($("body#paramiIndex").length){
		var marginT=def_h/2;
		$("#content").css({top:"0px",marginLeft:"0px",marginTop:marginT});
	}else if($("body#paramiCollection").length){
		var marginT=(def_h-552)/2;
		var cont_w=def_w-200-800;
		var marginL=cont_w/2;
		$("#content").css({top:"10px",marginLeft:marginL,marginTop:marginT});
	}else{
		var cont_w=def_w-220-60;
		var cont_h=def_h-140-20;
		$("#content").css({width:cont_w,height:cont_h});
	}
}

window.onresize = function(){
    contentSize();
}


