
/*

	js/ch-nwa.js
	
	Purpose:
	Drives the javascript for the site
	
	Created:
	Monday 15th February 2010
	
	Created By:
	Andi Topping


*/

// hover over for main nav
window.addEvent('domready',function() {
	
	// colour chooser for hoodys
	$$("div#hoody div.box").addEvents({
		'click' : function(ev){
			var $chosenColour = this.getProperty('id');
			if($chosenColour == 'hkellygreen') { 
				$('hoodyphoto').setProperty('src','images/nwa/hoody-kelly-green.png');
			}
			if($chosenColour == 'hgray') { 
				$('hoodyphoto').setProperty('src','images/nwa/hoody-gray.png');
			}
			if($chosenColour == 'hfrenchnavy') { 
				$('hoodyphoto').setProperty('src','images/nwa/hoody-french-navy.png');
			}
		},
		'mouseenter' : function() {
			this.setStyle('cursor','pointer');	
		}
	});
	
	if ($('hoodycolordropdown')){
		$('hoodycolordropdown').addEvent('change',function(ev){
			if (this.getProperty('value') == 'kelly-green') {
				$('xxl').setProperty('disabled','disabled');
			} else {
				$('xxl').erase('disabled');
			}
		});	
	}

	// colour chooser for t-shirts
	$$("div#tshirt div.box").addEvents({
		'click' : function(ev){
			var $chosenColour = this.getProperty('id');
			if($chosenColour == 'tkellygreen') { 
				$('tshirtphoto').setProperty('src','images/nwa/tshirt-kelly-green.jpg');
			}
			if($chosenColour == 'tgray') { 
				$('tshirtphoto').setProperty('src','images/nwa/tshirt-gray.jpg');
			}
			if($chosenColour == 'tfrenchnavy') { 
				$('tshirtphoto').setProperty('src','images/nwa/tshirt-french-navy.jpg');
			}
		},
		'mouseenter' : function() {
			this.setStyle('cursor','pointer');	
		}
	});
	
	if ($('tshirtcolordropdown')){
		$('tshirtcolordropdown').addEvent('change',function(ev){
			if (this.getProperty('value') == 'kelly-green') {
				$('tshirtxxl').setProperty('disabled','disabled');
			} else {
				$('tshirtxxl').erase('disabled');
			}
		});	
	}
	
});	

	

