// JavaScript Document
window.addEvent('domready', function() {
	Element.implement({
		show: function() {
			this.setStyle('display','');
		},
		hide: function() {
			this.setStyle('display','none');
		}
	});
									 
	var l = new cvLinkSelect({
		select_class: '.linkGenBrand', //the class for the linked select boxes
		url: 'http://www.landaustore.co.uk/ajax/ajax_brandlist.php',
		multiple_var: false, //use multiple get variables or only one
		loadClass: 'loading', //the css class that is added when a request is made
					
		hasnoSub: function(){
				
				l.select.each(function(s){
					if(l.select.indexOf(s) >= l.select.indexOf(l.current)){ //if the select depends on the parent
						s.hide();
					}
					
				});
			},
		hasSub: function(){
			l.select.each(function(s){
				if(l.select.indexOf(s) >= l.select.indexOf(l.current)){ //if the select depends on the parent
					s.show();
				}
				
			});
		}
	});
	
	
	var l = new cvLinkSelect({
		select_class: '.linkCatBrand', //the class for the linked select boxes
		url: 'http://www.landaustore.co.uk/ajax/ajax_brandlist.php',
		multiple_var: false, //use multiple get variables or only one
		loadClass: 'loading', //the css class that is added when a request is made
		
		hasSub: function(){
			l.select.each(function(s){
				if(l.select.indexOf(s) >= l.select.indexOf(l.current)){ //if the select depends on the parent
					s.show();
				}
				
			});
		}
	});
		
	var l = new cvLinkSelect({
		select_class: '.linkGenSize', //the class for the linked select boxes
		url: 'http://www.landaustore.co.uk/ajax/ajax_sizelist.php',
		multiple_var: false, //use multiple get variables or only one
		loadClass: 'loading', //the css class that is added when a request is made
		
		hasSub: function(){
			l.select.each(function(s){
				if(l.select.indexOf(s) >= l.select.indexOf(l.current)){ //if the select depends on the parent
					s.show();
				}
				
			});
		}
	});
		
	var l = new cvLinkSelect({
		select_class: '.linkCatSize', //the class for the linked select boxes
		url: 'http://www.landaustore.co.uk/ajax/ajax_sizelist.php',
		multiple_var: false, //use multiple get variables or only one
		loadClass: 'loading', //the css class that is added when a request is made
		
		hasSub: function(){
			l.select.each(function(s){
				if(l.select.indexOf(s) >= l.select.indexOf(l.current)){ //if the select depends on the parent
					s.show();
				}
				
			});
		}
	});
		
	var l = new cvLinkSelect({
		select_class: '.linkBrandSize', //the class for the linked select boxes
		url: 'http://www.landaustore.co.uk/ajax/ajax_sizelist.php',
		multiple_var: false, //use multiple get variables or only one
		loadClass: 'loading', //the css class that is added when a request is made
		
		hasSub: function(){
			l.select.each(function(s){
				if(l.select.indexOf(s) >= l.select.indexOf(l.current)){ //if the select depends on the parent
					s.show();
				}
				
			});
		}
	});
});
