// JavaScript Document
$(document).ready(function(){
	$("#tabList li a").click(function(event){
		event.preventDefault();
		num = $(this).attr('href').split("-")[1];
		$("#tabList li").each(function(){
			$(this).removeClass("selected");
		});
		$(this).parent().addClass("selected");
		$(".tabDiv").each(function(){
			$(this).removeClass("selected");
		});
		$("#tabs-"+num).addClass("selected");
	});

	/*$("#cCol").fadeOut(0);
	$("#tabCol").fadeOut(0);*/
	$("#cCol").fadeIn(5000);
	$("#tabCol").fadeIn(5000);
	$(".galleryview").ready(function(){
											   //alert("contact");
	});
});

function waitFix(){
	//alert("contact2");
	$(".galleryview .panel img").each(function(){
		if($(this).width() > $(this).height()){
			$(this).css("width","100%");
			/*pW = $(this).parent().width();
			pH = $(this).parent().height();
			thisW =  $(this).width();
			thisH = $(this).height();
			ratio = pW/thisW;
			scaleH = ratio*thisH;
			newTop = (pH - scaleH)/2;
			$(this).css("top",newTop+"px");*/
		} else {
			/*pW = $(this).parent().width();
			pH = $(this).parent().height();
			thisW =  $(this).width();
			thisH = $(this).height();
			alert("thisW: " + thisW);
			ratio = pH/thisH;
			scaleW = ratio*thisW;
			alert("ratio: " + ratio);
			newLeft = (pW - scaleW)/2;
			$(this).css("left",newLeft+"px");*/
			$(this).css("height","100%");
		}
	});
}

$(window).load(function(){
	//alert("contact");
	window.setTimeout("waitFix()",2000);
});
