// JavaScript Document


function validate_email(email){
	if((email.indexOf(".") > 2) && (email.indexOf("@") > 0)){
		document.getElementById('email_valid').style.display = 'inline';
	}else{
		document.getElementById('email_valid').style.display = 'none';	
	}
}

function validate_name(name){
	if(name.length > 2){
		document.getElementById('name_valid').style.display = 'inline';
	}else{
		document.getElementById('name_valid').style.display = 'none';	
	}
}

function validate_contact_form(){
	var email = document.getElementById('email_input').value;
	var name = document.getElementById('name_input').value;
	var comment = document.getElementById('comment_input').value;
	
	if(name.length < 2){
		
		alert('Please enter your name');
		return false;
	}
	
	if((email.indexOf(".") > 2) && (email.indexOf("@") > 0)){}else{
		alert('Please enter your email');
		return false;
	}
	
	if(comment.length < 10){
		alert('Please enter a message (+10 characters)');
		return false;
	}
	
	
	return true;
	
}

 $(document).ready(function () {


        $("a.video-preview").click(function () {
            
			
			var url = $(this).attr('href');

            $.fancybox({
                'padding': 7,
                'overlayOpacity': 0.7,
                'autoDimensions': false,
				'centerOnScroll': true,
				'showCloseButton': true,
				
				'overlayColor'	: '#000',
                'width': 800,
                'height': 450,
                'content': '<div class="video-js-box vim-css"> ' +
                            '<video id="example_video_1" class="video-js" width="800" height="450" poster="player/shot.png" controls preload  type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\'>' +
                            '<source src="http://halskov.com/video/card2phone_small.m4v" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' />' +
							
						
                    
							
                            
                             
							   '<!-- Image Fallback. Typically the same as the poster image. -->' +
                                '<img src="http://halskov.com/images/apps/card2phone/video_preview.jpg" width="800" height="450" alt="Poster Image" title="No video playback capabilities." /> ' +
								 
                              '</object>' +
							  
                            '</video>' +
							
                            '</div>'
                
            });
			
			  var myPlayer = VideoJS.setup("example_video_1");
			  
                
            return false;
			
        }); // fancyvideo

       
    });
 
 
 
 <!-- Begin VideoJS --> 
        
 
            
                                                     
 
                            
                  
                  
 
 

 
 //CHECK CURRENT PAGE
 function returnDocument() {
        var file_name = document.location.href;
        var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
        return file_name.substring(file_name.lastIndexOf("/")+1, end);
  }
  
  
  
  
  
 
$(document).ready(function(){
						   
						   
						   
						   
						   $('#mailing_list').onsubmit = function(evt) {  
           
            $('#mailing_list').send(); 


            return false;
        }
						   

var clearMePrevious = '';

// clear input on focus
$('#mailing_email').focus(function()
{
if($(this).val()==$(this).attr('title'))
{
clearMePrevious = $(this).val();
$(this).val('');
}
});

// if field is empty afterward, add text again
$('#mailing_email').blur(function()
{
if($(this).val()=='')
{
$(this).val(clearMePrevious);
}
});
});


