var Praline = new function() 
{
	this.init = function()
	{
		var self = Praline;
        /*
		$('contactButton').observe('mousedown', self.contactButtonDown);
		$('contactButton').observe('mouseup', self.contactButtonUp);
		$('contactButton').observe('mouseout', self.contactButtonUp);
        */

		$('mainNav').observe('change', self.mainNav);
		if ($('category-nav')) {
			$('category-nav').observe('change', self.projectNav);
		}
		if ($('project-nav')) {
			$('project-nav').observe('change', self.projectNav);
		}
		if ($('image-nav')) {
			$('image-nav').observe('change', self.projectNav);
		}
		if ($('tag-nav')) {
			$('tag-nav').observe('change', self.tagNav);
		}
		if ($('tag-pro-nav')) {
			$('tag-pro-nav').observe('change', self.tagProNav);
		}
		if ($('img-pro-nav')) {
			$('img-pro-nav').observe('change', self.imgProNav);
		}
		if ($('list-nav')) {
			$('list-nav').observe('change', self.listNav);
		}
		if ($('shop-nav')) {
			$('shop-nav').observe('change', self.shopNav);
		}
        if (Prototype.Browser.WebKit)
        {
            var lnk = document.createElement('link');
            lnk.setAttribute('rel', 'shortcut icon');
            lnk.setAttribute('href', 'http://designbypraline.com/favicon-mac.ico');
            document.getElementsByTagName('head')[0].appendChild(lnk);

            var ico = document.createElement('link');
            ico.setAttribute('rel', 'shortcut icon');
            ico.setAttribute('href', 'http://designbypraline.com/favicon-mac.ico');
            ico.setAttribute('type', 'image/x-icon');
            document.getElementsByTagName('head')[0].appendChild(ico);
        }
        else {
            var lnk = document.createElement('link');
            lnk.setAttribute('rel', 'shortcut icon');
            lnk.setAttribute('href', 'http://designbypraline.com/favicon-final-pink.gif');
            document.getElementsByTagName('head')[0].appendChild(lnk);
        }
	};

	this.mainNav = function(e)
	{
		var t = e.element();

		window.location.href = t.options[t.selectedIndex].value;
	};

	this.shopNav = function(e)
	{
		var t = e.element();
		if (t.options[t.selectedIndex].text == 'Thumbnails') {
			if ($('shop-nav-form')) {
				$('shop-nav-form').action = '/shop/';
			}
		}
		if ($('shop-nav-form')) {
			$('shop-nav-form').submit();
		}		
	}

	this.listNav = function(e)
	{
		var t = e.element();
		if (!t) return;

		if ($('list-nav-form')) {
			$('list-nav-form').action = t.value;
			$('list-nav-form').submit();
		}
	};

	this.imgProNav = function(e)
	{
		var t = e.element();
		if (!t) return;

		if ($('img-nav-form')) {
			$('img-nav-form').action = t.value;
			$('img-nav-form').submit();
		}		
	}

	this.tagNav = function(e)
	{
		var t = e.element();
		if (!t) return;

		if ($('tag-nav-form')) {
			$('tag-nav-form').action = t.value;
			$('tag-nav-form').submit();
		}
	};

	this.tagProNav = function(e)
	{
		var t = e.element();
		if (!t) return;

		if ($('tag-pro-nav-form')) {
			$('tag-pro-nav-form').action = t.value;
			$('tag-pro-nav-form').submit();
		}
	};

	this.projectNav = function(e)
	{
		var t = e.element();
		window.location.href = t.options[t.selectedIndex].value;
	};

	this.contactButtonDown = function(e) 
	{
		var t = e.element();
		t.src = '/images/buttons/contact1.gif';
	};
	
	this.contactButtonUp = function(e) 
	{
		var t = e.element();
		t.src = '/images/buttons/contact0.gif';
	};
};

