$(document).ready(function(){

	$("ul#menu li.na a").css({"opacity" : 0});
	$("ul#menu li.na a").hover(function(){
		$(this).animate({"opacity" : 1}, 300);
	}, function(){
		$(this).animate({"opacity" : 0}, 300);
	});
			
	$('A[rel="history1"]').colorbox({opacity:"0.5", maxWidth:"75%", maxHeight:"75%"});
	$('A[rel="history2"]').colorbox({opacity:"0.5", maxWidth:"75%", maxHeight:"75%"});
	$('A[rel="history3"]').colorbox({opacity:"0.5", maxWidth:"75%", maxHeight:"75%"});
	$('A[rel="history4"]').colorbox({opacity:"0.5", maxWidth:"75%", maxHeight:"75%"});
	$('A[rel="history5"]').colorbox({opacity:"0.5", maxWidth:"75%", maxHeight:"75%"});
	$('A[rel="history6"]').colorbox({opacity:"0.5", maxWidth:"75%", maxHeight:"75%"});
	$('A[rel="history7"]').colorbox({opacity:"0.5", maxWidth:"75%", maxHeight:"75%"});
	
	$('A[rel="external"]').addClass("external").click( function() {
		window.open( $(this).attr('href') );
		return false;
	});

    var options = {
        beforeSubmit:  validate,  // pre-submit callback 
        success:       showResponse,  // post-submit callback 
 	clearForm: true
    }; 
 
    $('#myForm').submit(function() { 
        $(this).ajaxSubmit(options); 
        return false; 
    }); 

function validate(formData, jqForm, options) { 
    var nameValue = $('input[name=name]').fieldValue(); 
    var emailValue = $('input[name=from]').fieldValue(); 
    var subjectValue = $('input[name=subject]').fieldValue(); 
    var messageValue = $('textarea[name=message]').fieldValue(); 
 
    if (!nameValue[0] || !emailValue[0] || !subjectValue[0] || !messageValue[0]) { 
        alert('Please fill out the form.'); 
        return false; 
    } 
}
 
function showResponse(responseText, statusText, xhr, $form)  { 
    alert('Thank you for contacting ICS Inc. Someone will reply to you soon.\n If you need immediate help, please call +1 260 356 4698.'); 
} 

});

