function attachCalendars() {
  if (document.getElementById('sidesearchdate')) {
    var now = new Date();
    var dd = (now.getDate()<10) ? ('0'+now.getDate()) : (now.getDate());
    var mm = ((now.getMonth()+1)<10) ? ('0'+(now.getMonth()+1)) : (now.getMonth()+1);
    var yyyy = (now.getFullYear());
    document.getElementById('sidesearchdate').value = dd+'/'+mm+'/'+yyyy;
  }
  alldivs = document.getElementsByTagName('div');
  for (var i=0; i<alldivs.length; i++) {
    if (alldivs[i].className.indexOf('calendar')>=0) {
      alldivs[i].style.display = 'block';
    }
  }
}

function attachClickPopups() {
  var alldivs = document.getElementsByTagName('div');
  for (var i=0; i<alldivs.length; i++) {
    if (alldivs[i].className.indexOf('clickpopup')>=0) {
      alldivs[i].style.display = 'block';
      alldivs[i].getElementsByTagName('div')[0].onclick = function() {
		if(this.parentNode.getElementsByTagName('div') && this.parentNode.getElementsByTagName('div')[1]){
        	this.parentNode.getElementsByTagName('div')[1].style.display = 'block';
        	if ($('homemouse'))
        	{        	
        	  $('homemouse').style.display = 'none';
      	  }
		}
        return false;
      };
      alldivs[i].getElementsByTagName('a')[0].onclick = function() {
        this.parentNode.style.display = 'none';
        if ($('homemouse'))
      	{        	
      	  $('homemouse').style.display = 'block';
    	  }
        return false;
      };
    }
  }
}

function attachPopup(el) {
  el.onclick = function() {
    if (el.className.indexOf('size') != -1) {
      dimensions = (((el.className.replace('popup','')).replace('size','')).replace(' ','')).split('x');
      elwidth = dimensions[0];
      elheight = dimensions[1];
	} else {
      elwidth = '640';
      elheight = '480';
	}
    popup = window.open(el.href,'popup','width='+elwidth+',height='+elheight+',resizable=yes,scrollbars=yes,toolbar=no,status=no,directories=no');
	if (window.focus) popup.focus();
	return false;
  }
}
function attachPopups() {
  if (document.getElementsByTagName) {
    var links = document.getElementsByTagName('a');
    for (var i=0; i<links.length; i++) {
      if (links[i].className.indexOf('popup') != -1) {
        attachPopup(links[i]);
      }
    }
  }
}

onload = function() {
  //attachCalendars();
  attachClickPopups();
  attachPopups();
};



function order_ValidateMembershipDetails(){
	alert('1');
	return true;
}


function order_ValidatePersonalDetails() {
	alert('2');
	return true;
}

 

function order_ValidatePaymentDetails() {
	alert('3');
	return true;
}


var expandToolTip = {

    init: function() {
	    jQuery("div.expand").hide();
        jQuery("label.expander").hover(this._show, this._hide); 
    },
    
    _show: function(){
        jQuery(this).siblings(".expand").show();
    },
    
    _hide: function(){
        jQuery(this).siblings(".expand").hide();
    }
}



function initDatePickers() {
    jQuery('.datepicker')
        .attr('readonly', 'readonly')
        .datepicker({ 
            showOn: 'both', 
            buttonImageOnly: true, 
            buttonImage: '/zsys/ncms/_global_images/ninety/backgrounds/bg-calendar-icon.jpg', 
            dateFormat: 'dd/mm/yy', 
            minDate: 0,
            maxDate: 120
        });
}