var windowsInternetExplorer = false;    /* the browser that is being used */
                                        /* internet explorer              */
var firefox = false;                    /* the browser that is being used */
                                        /* is firefox                     */
var browserVersion = 0;                 /* the version of the browser     */
var safari = false;

function detectBrowser() {
        windowsInternetExplorer = false;
        var appVersion = navigator.appVersion;
        var temp;

        if ((appVersion.indexOf("MSIE") != -1) && (appVersion.indexOf("Macintosh") == -1)) {
                temp = appVersion.split("MSIE");

                browserVersion = parseFloat(temp[1]);
                windowsInternetExplorer = true;
        }
        else if (navigator.userAgent.indexOf("Firefox") != -1) {
                firefox = true;
        }
	else if (navigator.userAgent.indexOf("WebKit") != -1) {
		safari = true;
	}
}

function fixBrowserSpecificProblems() {
	var	div;

	detectBrowser();
	if (windowsInternetExplorer || firefox) {
		$('diningShadow').setStyle({display:  "block"});
	}
}

function openReviews() {
var never = false;

        //if (document.getElementById('reviewContent').style.display == "none") {
        if ($('reviewContent').getStyle('display') == "none") {

		new Effect.Parallel([
                                        new Effect.BlindDown('reviewContent', {sync: true}),
                                        new Effect.BlindUp('additionsContent', {sync: true}),
                                        new Effect.BlindUp('recentsContent', {sync: true})
                                    ],
                                    {
					duration: 0.2, 
					afterFinish: function(effects) {
						$('reviews').setStyle({backgroundImage: "url(images/selectedGrad.jpg)"});
						$('reviews').setStyle({color: "#404040"});
						$('additions').setStyle({backgroundImage: "url(images/unselectedGrad.jpg)"});
						$('additions').setStyle({color: "#ffffff"});
						$('additions').setStyle({webkitBorderBottomLeftRadius: "0px"});
						$('additions').setStyle({webkitBorderBottomRightRadius: "0px"});
						$('recents').setStyle({backgroundColor: "gray"});
						$('recents').setStyle({backgroundImage: "url(images/unselectedGrad.jpg)"});
						$('recents').setStyle({color: "#ffffff"});
						if (safari) {
							$('recents').setStyle({webkitBorderBottomLeftRadius: "8px"});
							$('recents').setStyle({webkitBorderBottomRightRadius: "8px"});
						}
						//if (safari) {
						//	$('additions').setStyle({webkitBorderBottomLeftRadius: "8px"});
						//	$('additions').setStyle({webkitBorderBottomRightRadius: "8px"});
						//}

						if (firefox) {
							//$('additions').setStyle({mozBorderBottomLeftRadius: "8px"});
							//$('additions').setStyle({mozBorderBottomRightRadius: "8px"});
						}
                                        }
                });
        }
}

function openAdditions() {
        if (document.getElementById('additionsContent').getStyle('display') == "none") {
                new Effect.Parallel([
                                        new Effect.BlindDown('additionsContent', {sync: true}),
                                        new Effect.BlindUp('reviewContent', {sync: true}),
                                        new Effect.BlindUp('recentsContent', {sync: true})
                                    ],
                                    {duration: 0.2, afterFinish: function(effects) {
					$('additions').setStyle({backgroundImage: "url(images/selectedGrad.jpg)"});
					$('additions').setStyle({color: "#404040"});
					if (safari) {
						$('additions').setStyle({webkitBorderBottomLeftRadius: "0px"});
						$('additions').setStyle({webkitBorderBottomRightRadius: "0px"});
					}

					if (firefox) {
						//$('additions').setStyle({mozBorderBottomLeftRadius: "0px"});
						//$('additions').setStyle({mozBorderBottomRightRadius: "0px"});
					}
					$('reviews').setStyle({backgroundColor: "gray"});
					$('reviews').setStyle({backgroundImage: "url(images/unselectedGrad.jpg)"});
					$('reviews').setStyle({color: "#ffffff"});
					$('recents').setStyle({backgroundColor: "gray"});
					$('recents').setStyle({backgroundImage: "url(images/unselectedGrad.jpg)"});
					$('recents').setStyle({color: "#ffffff"});
					if (safari) {
						$('recents').setStyle({webkitBorderBottomLeftRadius: "8px"});
						$('recents').setStyle({webkitBorderBottomRightRadius: "8px"});
					}
                                    }
                });
        }
}

function openRecents() {
        if (document.getElementById('recentsContent').getStyle('display') == "none") {
                new Effect.Parallel([
                                        new Effect.BlindDown('recentsContent', {sync: true}),
                                        new Effect.BlindUp('reviewContent', {sync: true}),
                                        new Effect.BlindUp('additionsContent', {sync: true})
                                    ],
                                    {duration: 0.2, afterFinish: function(effects) {
					$('recents').setStyle({backgroundImage: "url(images/selectedGrad.jpg)"});
					$('recents').setStyle({color: "#404040"});
					if (safari) {
						$('recents').setStyle({webkitBorderBottomLeftRadius: "0px"});
						$('recents').setStyle({webkitBorderBottomRightRadius: "0px"});
					}

					if (firefox) {
						//$('additions').setStyle({mozBorderBottomLeftRadius: "0px"});
						//$('additions').setStyle({mozBorderBottomRightRadius: "0px"});
					}
					$('reviews').setStyle({backgroundColor: "gray"});
					$('reviews').setStyle({backgroundImage: "url(images/unselectedGrad.jpg)"});
					$('reviews').setStyle({color: "#ffffff"});
					$('additions').setStyle({backgroundColor: "gray"});
					$('additions').setStyle({backgroundImage: "url(images/unselectedGrad.jpg)"});
					$('additions').setStyle({color: "#ffffff"});
					$('additions').setStyle({webkitBorderBottomLeftRadius: "0px"});
					$('additions').setStyle({webkitBorderBottomRightRadius: "0px"});
                                    }
                });
        }
}

function hideAll() {
        Element.hide('reviewContent');
        Element.hide('additionsContent');
        Element.hide('recentsContent');
}

function closeAll() {
	new Effect.BlindUp('reviewContent');
	new Effect.BlindUp('additionsContent');
        new Effect.Blindup('recentsContent');
}

function setUp() {
	fixBrowserSpecificProblems();
	hideAll();
	openAdditions();
}

