function slideSwitch() {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1500, function() {
            $active.removeClass('active last-active');
        });
}


// FRONT SLIDE SHOW
var time;
var fShow = function(fS){
	var BfS = fS - 1;
	if(BfS==0){BfS=6;}
	$('#slideshowcont').append('<div id="ssback" onmouseover="NewLeft()" onmouseout="OldLeft()" onClick="LastFrame('+BfS+')"><img src="images/arrow_left_dark.png" /></div>');
	BsFrame(fS);
	fS++
	if(fS==7){fS=1;}
	$('#slideshowcont').append('<div id="ssforward" onmouseover="NewRight()" onmouseout="OldRight()" onClick="NextFrame('+fS+')"><img src="images/arrow_right_dark.png" /></div>');
	time = setTimeout('fShow('+fS+')',9000);
};
var sFrame = function(ff){
	var ff2 = ff+1;
	if(ff2==7){ff2=1;}
	$('#fimg'+ff+'').animate({opacity:1, marginLeft: "0px"}, 1) //delays next animation
		.animate({opacity:1, marginLeft: "1000px"}, 500); //animate text
	$('#fimg'+ff2+'').animate({opacity:1, marginLeft: "-1000px"}, 1) //delays next animation
		.animate({opacity:1, marginLeft: "0px"}, 500); //animate text
};
var BsFrame = function(ff){
	var ff2 = ff-1;
	if(ff2==0){ff2=6;}
	$('#fimg'+ff2+'').animate({opacity:1, marginLeft: "0px"}, 1) //delays next animation
		.animate({opacity:1, marginLeft: "-1000px"}, 750); //animate text
	$('#fimg'+ff+'').animate({opacity:1, marginLeft: "1000px"}, 1) //delays next animation
		.animate({opacity:1, marginLeft: "0px"}, 750); //animate text
};

var OldLeft = function(){$("#ssback").append('<img src="images/arrow_left_dark.png" />');}
var NewLeft = function(){$("#ssback").html('');}
var OldRight = function(){$("#ssforward").append('<img src="images/arrow_right_dark.png" />');}
var NewRight = function(){$("#ssforward").html('');}

var NextFrame = function(f){
	clearTimeout(time);
	fShow(f);
}
var LastFrame = function(f){
	clearTimeout(time);
}

// MENU
function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//$(document).ready(function(){
$(function(){						   						   
	setInterval("slideSwitch()",4000);					   
	mainmenu();
});


// FORM CHECK
function checkform()
{
	if (document.feedback.FirstName.value == '')
	{
		alert('Your name is required');
		return false;
	}
	else if (document.feedback.LastName.value == '')
	{
		alert('Your name is required');
		return false;
	}
	else if (document.feedback.Address.value == '')
	{
		alert('Your Address is required');
		return false;
	}
	else if (document.feedback.City.value == '')
	{
		alert('Your City is required');
		return false;
	}
	else if (document.feedback.ZipCode.value == '')
	{
		alert('Your Zipcode is required');
		return false;
	}
	else if (document.feedback.Country.value == '')
	{
		alert('Your Country is required');
		return false;
	}
	else if (document.feedback.phone.value == '')
	{
		alert('Your Phone is required');
		return false;
	}
	else if (document.feedback.captcha.value == '')
	{
		alert('Type the characters you see in the image');
		return false;
	}
	else if (document.feedback.captcha.value != 'hwy143')
	{
		alert('Type the characters you see in the image');
		return false;
	}
	return true;
}
