/*	
	Format the site search
*/
;

function jqPngFix() {
    try {
        //ie6 png transperency fix
        $.each($("img[src$=.png],img[src$=.PNG],input[src$=.png],input[src$=.PNG]"), function () {
            var img = $(this);
            img.css({"width": img.width(),"height": img.height(), "filter": "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.attr("src") + "', sizingMethod='scale')"});
            img.attr("src","/images/blank.gif");
        });
    } catch(e) {
        alert(e.description)
    }
}

var divCount;
var divInterval;
var divCounter = 0;
var divExpired = 0;
function quote_rotate() {
	var divCount = $('.quote div').length;
	divCounter = (divExpired + 1) % divCount;
	$('.quote div:eq('+divExpired+')').fadeOut(1000, function() {
		$('.quote div:eq('+divCounter+')').fadeIn(1000);
	});
	divExpired = divCounter;
}

$(document).ready(function(){
	if ($.browser.msie && $.browser.version == '6.0') {
		jqPngFix();
	}
	$('.quote div').hide();
	$('.quote div').css({position:"absolute"});
	$('.quote div:eq('+divCounter+')').fadeIn(1000);
	
	divInterval = setInterval(quote_rotate,5000); //time in milliseconds
	$('.quote').hover(function() {
		clearInterval(divInterval);
	}, function() {
		divInterval = setInterval(quote_rotate,5000); //time in milliseconds
		quote_rotate();
	});
	
	$(".notifyForm").css({"position":"absolute","right":"0","top":"-60px"});
	$(".notifyForm").addClass("tabbed");
	$(".notifyForm h3").click(function() {
		//$(this).fadeOut();
		$(".notifyForm form").slideDown(300);
		return false;
	});
	$(".notifyForm form").append("<p id=\"cancel\"><a href=\"#\">Cancel</a></p>\n");
	$("#cancel").click(function() {
		//$(".notifyForm h3").fadeIn();
		$(".notifyForm form").slideUp(300);
		return false;
	});
	
	$labelText = $(".notifyForm label").html();
	$("#notifyEmail").attr("value",$labelText);
	$(".notifyForm label").hide();
	$("#notifyEmail").focus(function() {
		if ($(this).attr("value") == $labelText) {
			$(this).attr("value","");
		}
	});
	$("#notifyEmail").blur(function() {
		if (!$(this).attr("value")) {
			$(this).attr("value",$labelText);
		}
	});
	$(".notifyForm form").hide();
	$(".notifyForm").css({"display":"block"});
	$barheight = $(".bg").attr("height");
	$(".bgbar").attr("height", $barheight);
	
});

$(window).resize(function(){
	$barheight = $(".bg").attr("height");
	$(".bgbar").attr("height", $barheight);
});
