// JavaScript Document

resizeStuff = function(){
	$(".page-template-chiro-php #wrapper").css({"width" : "100%"});
	$(".page-template-chiro-php #header").css({"width" : "90%","margin" : "0 auto"});
	$(".page-template-chiro-php #main").css({"width" : "90%","margin" : "0 auto"});
	$(".page-template-chiro-php #footer").css({"width" : "90%","margin" : "0 auto"}),
	$(".page-template-videos-php #main").css({"height" : "100%","margin" : "0 auto"})
}

placeShadow = function(main,shad,homeShad){
	var pos = $(main).position();
	var height = $(main).height();
	var width = $(main).width();
	//alert("hi");
	
	
	jQuery.each(jQuery.browser, function(i) {
			if($.browser.msie){
				
				if($.browser.version > 7){
					$(shad).css({"left":.5, "top":pos.top+height-19, "width" : "100%", "margin" : "0 auto" });
				}
				else{
					$(shad).css({"left":.5, "top":pos.top+height-19, "width" : "100%", "margin" : "0 auto" });
				}
			}
			else{
				$(shad).css({"left":.5, "top":pos.top+height-24, "width" : "100%", "margin" : "0 auto"});
				$(homeShad).css({"left":.5, "top":pos.top+height-19, "width" : "100%", "margin" : "0 auto"});
   			}
 	});
	
}

function slideSwitch() {
    var $active = $('#mycarousel li.active');

    if ( $active.length == 0 ) $active = $('#mycarousel li:last');

    var $next =  $active.next().length ? $active.next()
        : $('#mycarousel li:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function(){
	
	resizeStuff();
	jQuery.each(jQuery.browser, function(i) {
			if($.browser.msie){
				var all_5 = {
				  tl: { radius: 5 },
				  tr: { radius: 5 },
				  bl: { radius: 5 },
				  br: { radius: 5 },
				  antiAlias: true
				};
				var leftside = {
					tl: { radius:5 },
					bl: { radius:5 }
				};
	
	//var divObj = document.getElementById("#access li:hover > a");
    curvyCorners(all_5, "#main");

	curvyCorners(all_5, ".page-template-chiro-php #main");
	
			}
	});
	
	
	
	placeShadow($("#main"), $("#content_shadow"),$(".home #content_shadow"));
	
	$("a[title=About]").attr('href', '#').css({"cursor":"default"});
	$("a[title=Useful Information]").attr('href', '#').css({"cursor":"default"});
	
	//slideshow
/*
	$(function() {
		setInterval( "slideSwitch()", 5000 );
	});
*/
	//innerfade
		$('#mycarousel').innerfade({ speed: 'slow', timeout: 5500, type: 'sequence', containerheight: '583px' }); 
	
	
	
});


$(window).resize(function(){
	
	resizeStuff();

});
