// COPYRIGHT CRUSHONLINE.CO.UK, 2008 
// CODING NOT TO BE COPIED OR USED ON ANY SITE WITHOUT THE WRITTEN PERMISSION OF CRUSHONLINE.CO.UK
// PLEASE REFER TO OUR TERMS AND CONDITIONS OF USE AT HTTP://WWW.CRUSHONLINE.CO.UK
//

//This functions displays images on the images and video page
function viewImage(imgSrc,caption){
	document.getElementById('imgFull').src=imgSrc;
	document.getElementById('imgCaption').innerHTML=caption;
}
function validateSignup(){
	msg = '';
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	
	if ( !document.getElementById('UserEmail').value.length > 0 )			{msg +='\nEnter a valid e-mail address.';}
	
	if ( document.getElementById('UserEmail').value.length > 0 && !filter.test(document.getElementById('UserEmail').value)){msg +='\nThe email address you supplied does not appear to be valid, A valid email looks like "user@mydomain.co.uk".';}
	
	if ( !document.getElementById('UserPassword').value.length > 0 )		{msg +='\nPlease enter a password...';}
	if ( document.getElementById('UserPassword').value.length > 0 && !document.getElementById('UserPasswordC').value.length > 0 )		{msg +='\nPlease confirm your password...';}
	if ( document.getElementById('UserPassword').value.length > 0 && document.getElementById('UserPasswordC').value.length > 0 && document.getElementById('UserPassword').value != document.getElementById('UserPasswordC').value){msg +='\nPasswords do NOT match, please re-enter them...';}
	if ( !document.getElementById('UserDisplayName').value.length > 0 )		{msg +='\nEnter a display name...';}
	
	if ( !document.getElementById('years').value.length > 0 )				{msg +='\nDate of birth (Year)...';}
	if ( !document.getElementById('months').value.length > 0 )				{msg +='\nDate of birth (Month)...';}
	if ( !document.getElementById('days').value.length > 0 )				{msg +='\nDate of birth (Day)...';}
	
	
	
	if ( !document.getElementById('UserLocation').value.length > 0 )		{msg +='\nYour Location...';}
	
	if ( !document.getElementById('humanChk').value.length > 0 )			{msg +='\nPlease enter the red characters into the box...';}
	
	if (msg.length > 0){
		alert('Please correct the following:\n' + msg);
		return false;
	}else{
		return true;
	}

	return true;
}

    var map = null;
    var geocoder = null;


//GOOGLE MAPS 
    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();
      }
    }

    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }