// JavaScript Document

window.addEvent('domready', function(){

		$('pc').addEvent('click', function(event){
			if (this.value == 'Postcode') this.value="";							
		});
			 
		$('pc').addEvent('blur', function(event){
			if (this.value.trim() == '') this.value="Postcode";
		});
		
		$('form1').addEvent('submit', function(event){
			if ($('pc').value.trim() == '' || $('pc').value == 'Postcode') {
				alert("Please enter a postcode");
				return false;	
			}
		});	
		
		
		
/*		$$('.open-survey').each(function(el){

			
			
			el.addEvent('click', function(e){
			
			
				SqueezeBox.initialize({
					size: {x: 550, y: 505}
				});
				
				
				SqueezeBox.open('/competition.php', {'handler':'iframe'}); 
			
			
			
			});
		});*/



  /* Slideshow */
  
  
  /* settings */
  var showDuration = 5000;
  var container = $('slideshow-container');
  var images = container.getElements('img');
  var currentIndex = 0;
  var interval;
  /* opacity and fade */
  images.each(function(img,i){ 
    if(i > 0) {
      img.set('opacity',0);
    }
  });
  /* worker */
  var show = function() {
    images[currentIndex].fade('out');
    images[currentIndex = currentIndex < images.length - 1 ? currentIndex+1 : 0].fade('in');
  };
  /* start once the page is finished loading */
  window.addEvent('load',function(){
    interval = show.periodical(showDuration);
  });

 });


