// start of initialization of slideshow
	$(document).ready(function(){
		$('#photos').galleryView({
			panel_width: 680,
			panel_height: 280,
			frame_width: 100,
			frame_height: 100,
			overlay_text_color: 'white'
		});
	});
	//end slideshow

	// start of initialisation of toggle divs	
	animatedcollapse.addDiv('logodesign', 'fade=1')
	animatedcollapse.addDiv('businesscard', 'fade=1')
	animatedcollapse.addDiv('promotional', 'fade=1')
	animatedcollapse.addDiv('photoretouch', 'fade=1')
	animatedcollapse.addDiv('webdesign', 'fade=1')
	animatedcollapse.addDiv('ecommerce', 'fade=1')
	animatedcollapse.addDiv('cms', 'fade=1')
	animatedcollapse.addDiv('flash', 'fade=1')
	animatedcollapse.addDiv('seo', 'fade=1')
	animatedcollapse.addDiv('maintenance', 'fade=1')
	animatedcollapse.addDiv('webhost', 'fade=1')
	animatedcollapse.ontoggle=function($, divobj, state){}
	animatedcollapse.init()
	//end toggle divs
	var options = { 
		beforeSubmit: validation, 
    	success:    success,
		resetForm: 1
	};
	 
	
	 // wait for the DOM to be loaded 
    $(document).ready(function() { 
            // bind 'myForm' and provide a simple callback function
			$('#contact').ajaxForm(options); 
    });
	
//<![CDATA[

	

	function validation(formData, jqForm, options)
	{
		var form = jqForm[0];
		var errormsg = '';
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if (!form.firstname.value) {
			errormsg += 'Missing first name.<br />';
			form.firstname.focus();
		}
		if (!form.lastname.value) {
			errormsg += 'Missing last name<br />';
			form.lastname.focus();
		}
		if (!form.company.value) {
			errormsg += 'Missing company name<br />';
			form.company.focus();
		}
		if (!form.email.value) {
			errormsg += 'Missing email address<br />';
			form.email.focus();
		}
		else if(reg.test(form.email.value) == false) {
			errormsg += 'Invalid email address.<br />';
			form.email.focus();
		}
		if (!form.phone.value) {
			errormsg += 'Missing phone number.<br />';
			form.phone.focus();
		}
		if (form.captcha.value.toLowerCase() != 'orange') {
			errormsg += 'Wrong answer to the verification question.<br />';
			form.captcha.focus();
		}
		if (!form.msg.value) {
			errormsg += 'The message box must be filled out.';
			form.msg.focus();
		}
		
		if(errormsg != '')
		{
			document.getElementById('formfb').innerHTML = '<h3>The following error(s) have occured:</h3><p>'+errormsg+'</p>';
			document.getElementById('formfb').setAttribute('className', 'finvalid');
			document.getElementById('formfb').setAttribute('class', 'finvalid');
			return false; 
		}
	}
	
	
	function success(){
		document.getElementById('formfb').innerHTML = '<h3>Message sent</h3><p>Your message has been sent. I will get back to you as soon as possible. If you have any more questions or inquiries, you may contact me directly on my mobile phone at (514) 806-3821 everyday from 12:00 PM to 10:00 PM. Thank you.</p>';
		document.getElementById('formfb').setAttribute('className', 'fvalid');
		document.getElementById('formfb').setAttribute('class', 'fvalid');
	}
	//]]>
