// js extras script
$(function(){
							$("div.foo").carousel( { 								
								autoSlide: false,
								dispItems: 3,
								autoSlideInterval: 5000,
								pagination: false,
								loop: false,
								animSpeed: "slow" 
									} );
						});

						$(document).ready(function() {
						
							$('#header').pngFix();
							
							$('#navigation a').each(function(){
								if ($(this).parent().attr("class") != "thispage") {							 
									$(this).css( {backgroundPosition: "0px 0px"} )					
									.mouseover(function(){
										//alert($(this).parent().attr("class"));
										
											$(this).stop().animate({backgroundPosition:"(0px -71px)"}, {duration:400});
											$(this).css("color","#000");
										
									})
									.mouseout(function(){
										
											$(this).stop().animate({backgroundPosition:"(0px 0px)"}, {duration:200, complete:function(){
												$(this).css({backgroundPosition: "0px 0px"});
											}})
											$(this).css("color","#fff");
										
									})
								}
								
							});

									
									
								
						
													

							//accessible tweeks
							$(".subnav").css("display","none");
							$(".foo").css("height","214px");
							$(".foo").css("background","#fff");
							$("#slider1").css("height","224px")
										.css("overflow","hidden")										
										.css("float","left");
							$("#slider1Content").css("position","absolute");
							$(".slider1Image").css("display","none")
												.css("position","relative");
							

							//subnav flyout
							$(".subnav").parent().mouseover(function(){							
								
									$(this).children("ul").css("display","block");			
															
							});
							$(".subnav").parent().mouseout(function(){							
								
									$(this).children("ul").css("display","none");			
															
							});
							
							//set video and slide show links
							$("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});
							
							//initial and set slider
							if ($("#slider1").length >0) {
								$('#slider1').s3Slider({
									timeOut: 5000 
								});	
							}
							
							//faqs slider
							if ($("#faqs").length >0) {
								$('.questions').click(function(){							
								
									//$(this).toggle("fast");			
																
								});
							}


							//top nav delayed entrance
							//$('#navigation').css("display","none");
							//setTimeout(function(){$('#navigation').slideDown("slow");}, 1000);
							
							//Cms example
							if ($('#cms').length > 0) {	
								//alert("test");
								$('input#sm').css("display","none");							
								$('input#cmstitle').keyup(function(event){
								  
									var oldText = $('input#cmstitle').attr("value");
									//alert(oldText);
									$('#cms span').html(oldText);

								});


							}
							$('#icons').cycle({ 
								fx:    'fade', 
								speed:  4000 
							 });
							//form checking
		if ($("#compLeft")) {
				//error checking on form
				$("form").submit(function() {
					var error = false;
					var errordesc;
					//name input check
					if ($("input#name").val() == "") {			
						if ($("input#name").attr("toggled") != "yes") {			
							$("input#name").parent().children("span").toggle("slow");
							$("input#name").attr("toggled","yes");
						}
						var error=true;
						$("input#name").removeClass("correct");
					}
					else {
						$("input#name").parent().children("span").fadeOut("slow");
						$("input#name").attr("toggled","no");
						$("input#name").addClass("correct");
					}
					//question input check
					if ($("textarea#comments").val() == "") {
						if ($("textarea#comments").attr("toggled") != "yes") {						
							$("textarea#comments").parent().children("span").toggle("slow");
							$("textarea#comments").attr("toggled","yes");
						}
						var error=true;
						$("textarea#comments").removeClass("correct");
					}
					else {
						$("textarea#comments").parent().children("span").fadeOut("slow");
						$("textarea#comments").attr("toggled","no");
						$("textarea#comments").addClass("correct");
					}
	
					//email input check
					if ((/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($("input#email").val())) == false) {
						if ($("input#email").attr("toggled") != "yes") {	
							$("input#email").parent().children("span").toggle("slow");
							$("input#email").attr("toggled","yes");
							$("input#email").removeClass("correct");
						}
						var error=true;
					}
					else {
						$("input#email").parent().children("span").fadeOut("slow");
						$("input#email").attr("toggled","no");
						$("input#email").addClass("correct");
					}				
					if (error) {						
						return false;
					}
					else {
						return true;	
					}
					
					
				});
	
				if ($("#completed").length > 0) {
					setTimeout(function(){ $("#completed").fadeOut() }, 5000);
				}
	
			}

										
						
	});