$.ajaxSetup ({ 
    // Disable caching of AJAX responses 
    cache: false 
}); 


$(document).ready(function(){
	//alert('test');
	//$(main).center();
	loadContent("home");
	//loadContent("bass_guitar_strings");
 });
 
$(window).resize(function() {
	//$(main).center();
});

function loadContent(page) {
	loadContentFromURL(page+".htm"); 
	$(document).attr('title', "Richard Cocco Strings - Finest Handmade Strings : " + page);
}

function loadContentFromURL(url) {
	$("#content").load(url);
	/*
	$("#content").fadeOut(125, function () { 
		$("#content").load(url, {limit: 25}, function(){ 
			$("#content").fadeIn();	
		}); 	
	});
		*/
}

jQuery.fn.center = function () {
	this.css("position","absolute");
	var top=($(window).height() - this.height() ) / 2+$(window).scrollTop();
	if (top<0) top=0;
	var left=($(window).width() - this.width() ) / 2+$(window).scrollLeft();
	if (left<0) left=0;
	this.css("top",   top + "px");
	this.css("left",  left + "px");
	return this;
}

function animateDiv(div) {
	var div = "#" + div;
	var positionD = $(div).position();
	var topD = positionD.top;
	var leftD = positionD.left;
	var heightD = $(div).height();
	var widthD = $(div).width();

	var centerHPointD = (heightD / 2) + topD;
	var centerWPointD = (widthD / 2) + leftD;
	
	$(div).css("overflow", "hidden");
	$(div).css("height", "0px");
	$(div).css("width", "0px");
	$(div).css("top", centerHPointD + "px");
	$(div).css("left", centerWPointD + "px");
	
	$(div).animate({top: "95px", left: "234px", height: "182px", width: "420px"}, 500 );	
}

