/* -------------- script to rotate projects on right sidebar ------------- */
     var headline_count;
     var headline_interval;
     var old_headline = 0;
     var current_headline = 0;
     $(document).ready(function(){
        headline_count = $("li.widget_categoryposts ul li.cat-post-item").size();
        $("li.widget_categoryposts ul li.cat-post-item:eq("+current_headline+")").css('top', '5px');
       
        headline_interval = setInterval(headline_rotate,5000);

        $('li.widget_categoryposts ul li.cat-post-item').hover(function() {
          clearInterval(headline_interval);
        }, function() {
          headline_interval = setInterval(headline_rotate,5000);
          headline_rotate();
        });
      });

      function headline_rotate() {
        current_headline = (old_headline + 1) % headline_count;
        $("li.widget_categoryposts ul li.cat-post-item:eq(" + old_headline + ")")
          .animate({top: -405},"slow", function() {
            $(this).css('top', '410px');
          });
        $("li.widget_categoryposts ul li.cat-post-item:eq(" + current_headline + ")")
          .animate({top: 5},"slow");  
        old_headline = current_headline;
      }
/* -------------- END script to rotate projects on right sidebar ------------- */






function contactFormInputCheck() {
	var filter = /^(([^<>()[\]\\.,;:\s@\”]+(\.[^<>()[\]\\.,;:\s@\”]+)*)|(\”.+\”))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	if (document.theform.first_name.value == '') {
		alert('Please enter your first name.');
		document.theform.first_name.select();
		return false;
	} else if (document.theform.last_name.value == '') {
		alert('Please enter your last name.');
		document.theform.last_name.select();
		return false;
	} else if (document.theform.email.value == '') {
		alert('Please enter your email address.');
		document.theform.email.select();
		return false;
	} else if (!filter.test(document.theform.email.value)) {
		alert('Please enter a valid email address.');
		document.theform.email.select();
		return false;
	} /* else if (document.theform.email.value != document.theform.email2.value) {
		alert("Verification email address does not match.\n\r\n\rPlease ensure your email address is entered correctly (twice).");
		document.theform.email2.select();
		return false;
	} */ else if ((document.theform.phone.value == '')&&(document.theform.mobile.value == '')) {
		alert('Please enter your phone number.');
		document.theform.phone.select();
		return false;
	} else if (document.theform.description.value == '') {
		alert("Please enter your message.");
		document.theform.description.select();
		return false;
	} else { 
		return true;
	}
}


