var myrules = {
	'#mail' : function(element){
		element.onclick = function(){
			window.location = 'mailto:info@drinkbrainjuice.com'
		}
	},
	'#logo' : function(element) {
	  element.onclick = function() {
	    myLightbox.start($('about_us_link'));
	    return false;
	  }
	},
	'#screenshots' : function(element) {
	  element.onclick = function() {
	    myLightbox.start($('screenshot_1'));
	    return false;
	  }
	},
	'.text_input' : function(element){
	  element.onfocus = function(){
	    if (this.value == 'Your email address') { this.value = '' }
	  }
  },
  'ul.navigation li' : function(element) {
    element.onclick = function() {
      openNavigationLink.call(this)
    }
  }  
};

Behaviour.register(myrules);
Behaviour.addLoadEvent(function() { initLightbox() });

function checkScreen() {
  var theWidth = 0;
  if (window.innerWidth) {
    theWidth = window.innerWidth
  } else if (document.documentElement && document.documentElement.clientWidth) {
    theWidth = document.documentElement.clientWidth
  } else if (document.body) {
    theWidth = document.body.clientWidth
  }
  var theHeight = 0;
  if (window.innerHeight) {
    theHeight = window.innerHeight
  } else if (document.documentElement && document.documentElement.clientHeight) {
    theHeight = document.documentElement.clientHeight
  } else if (document.body) {
    theHeight = document.body.clientHeight
  }
  return (theWidth > 990 && theHeight > 590) 
}

function openNavigationLink(e) {
  linkNode = this.getElementsByTagName('a').item(0)
  if (!linkNode) { return; }
  if (!linkNode.getAttribute('class') || linkNode.getAttribute('class').indexOf('unimplemented') == -1) { 
    window.location = linkNode.getAttribute('href')
  } else {
    unimplemented()
  }
}

