//* Javascript by Bring Me Business


//* Force CSS active state for Inputs
function inputClass(){
$(document).ready(function() {  
    $('input[type="text"],textarea').focus(function() {  
        $(this).addClass("focusField");  
       });
	   
    $('input[type="text"],textarea').blur(function() {  
        $(this).removeClass("focusField");  
        });  
}); 
};


//* Force Submit on Enter
function submitEnter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}
//add this to relevant input tags: onKeyPress="return submitEnter(this,event)"


//*Preload Backgrounds
function load2bg($img1,$w1,$h1,$img2,$w2,$h2){
Image1= new Image($w1,$h1)
Image1.src = $img1

Image2 = new Image($w2,$h2)
Image2.src = $img2
};

//* Find Images for Lightbox Gallery
function findImages(){
$(function() {
$('a.lightbox').lightBox();
});
};

//* Fading SlideShow
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}, 800, function() {
            $active.removeClass('active last-active');
        });
};

//* Call SlideShow
function startSlideShow(){
$(function() {
    setInterval( "slideSwitch()", 3600 );
});
};

//* Sexy Drop Down

$(document).ready(function() {

$("ul.topnav > li a:first-child").mouseover(function() {
$(this).parent().find("ul.subnav").slideDown('fast').show();
$(this).parent().hover(function() {
}, function() {
$(this).parent().find("ul.subnav").slideUp('slow');
});
}).hover(function() {
$(this).addClass("subhover");
}, function() {
$(this).removeClass("subhover");
});
});

//* Play an Flv with parameters of:'swfplayer location','width','height','video url','image url'.
/*
function playThisFlv($swfPlayerUrl,$myWidth,$myHeight,$myVideoUrl,$myImgUrl,$myVideoId){

  jwplayer($myVideoId).setup({
    'flashplayer': $swfPlayerUrl,
    'id': 'playerID',
    'width': $myWidth,
    'height': $myHeight,
    'file': $myVideoUrl,
    'image': $myImgUrl
	
  });
};
*/
