$(document).ready(function() {
    Cufon.replace('.title h2, .cf, .left_main dt, .veteran, h2.title, #footer p', {
        fontFamily: 'Apex New Medium'
    });
    
    reloadTooltips();
    
    $('form#data').submit(function (e) {
       // e.preventDefault();
       
       if($('#first_name').val() == '') {
           alert('You need to enter in a first name.');
           $('#first_name').focus();
           return false;
       }
       
       if($('#last_name').val() == '') {
           alert('You need to enter in a last name.');
           $('#last_name').focus();
           return false;
       }
       
       if($('#email').val() == '') {
           alert('You need to enter in a email.');
           $('#email').focus();
           return false;
       }
       
		if(!(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test($('#email').val()))) {
			$('#email').focus();
			alert('You need to have a valid email address.');
			return false;
		}
       
       if($('#zip_code').val() == '') {
           alert('You need to enter in a ZIP code.');
           $('#zip').focus();
           return false;
       }
       // 
      // $.post($(this).attr('action'), $(this).serialize(), function (data) {
      //     eval(data);
      // });
    });
});

function reloadTooltips()
{ 
    $('.items li img, #box li img, .all_photos li img').each(function() {
		$(this).qtip({
			content: $(this).attr('alt'),
			position: {
				corner: {
					target: 'topMiddle',
					tooltip: 'bottomMiddle'
				},
				//target: 'mouse',
				adjust: {
					y: 0
				}
			},
			show: {
				when: 'mouseover',
				solo: false,
				delay: 0,
				effect: {
					length: 0
				}
			},
			hide: { 
				effect: {
					length: 75
				}
			},
			style: {
				tip: {
					corner: 'bottomMiddle',
					size : {
						x: 6,
						y: 6
					}
				},
				border: {
					width: 1,
					radius: 1
				},
				padding: 5,
				width: 'auto',
				textAlign: 'left',
				name: 'light'
			}
		});
	});
}