// JavaScript Document

$(document).ready(function(){
	
	///////// Navigation IE Fix  /////////////////
	 $("ul.dropdown li").hover(function(){
	   $(this).addClass("hover");
	   $('> .dir',this).addClass("open");
	   $('ul:first',this).css('visibility', 'visible');
	 },function(){
	   $(this).removeClass("hover");
	   $('.open',this).removeClass("open");
	   $('ul:first',this).css('visibility', 'hidden');
	 });
	 
	 
	 $(".banner-hold .banner-inner.left").hover(function(){$('.banner-hold .banner-inner.left').animate({ width: '639px'}, 500 );
	 },function(){ $('.banner-hold .banner-inner.left').animate({ width: '319px'}, 500 );});
	 
	 $(".banner-hold .banner-inner.right").hover(function(){$('.banner-hold .banner-inner.left').animate({ width: '0px'}, 500 );
	 },function(){ $('.banner-hold .banner-inner.left').animate({ width: '319px'}, 500 );});
	 
	 
	 
	 
	 // STOP IE6 FLICKER
	if ($.browser.msie && $.browser.version.substr(0,1)<7) { 
		document.execCommand('BackgroundImageCache', false, true);
		
		
		$('.Video').css('padding', '0px');
		
	};
	

	 
	 
	 ///////// Button Style /////////////////
	 $(".fg-button:not(.ui-state-disabled)")
		.hover(
			function(){ 
				$(this).addClass("ui-state-hover"); 
			},
			function(){ 
				$(this).removeClass("ui-state-hover"); 
			}
		)
		.mousedown(function(){
				$(this).parents('.fg-buttonset-single:first').find(".fg-button.ui-state-active").removeClass("ui-state-active");
				if( $(this).is('.ui-state-active.fg-button-toggleable, .fg-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); }
				else { $(this).addClass("ui-state-active"); }	
				
				
				
				
				// CODE FOR UPDATING RADIO BUTTONS
				var value = $(this).attr('name');
				
				var thingToUpdate = value+"CheckBox";
				//console.log(thingToUpdate);
				
				if ( $("#"+thingToUpdate).attr('checked') == true ) {
					//console.log('checked true');
					$('#'+thingToUpdate).attr("checked", false);
        		} else if ( $("#"+thingToUpdate).attr('checked') == false ) {
					//console.log('checked false');
					$('#'+thingToUpdate).attr("checked", true);
        		} else {
					//console.log('checked true');
					$('#'+thingToUpdate).attr("checked", false);
        		};
				// CODE FOR UPDATING RADIO BUTTONS END
				
				
				
		})
		.mouseup(function(){
			if(! $(this).is('.fg-button-toggleable, .fg-buttonset-single .fg-button,  .fg-buttonset-multi .fg-button') ){
				$(this).removeClass("ui-state-active");
			}
		});
		
		
		///////// Form Style /////////////////
		$('.FormStyle').find('input[type="text"]').addClass("idleField");
	
		$('.FormStyle').find('input[type="text"]').focus(function() {
			$(this).removeClass("idleField").addClass("focusField");
			if (this.value == this.defaultValue){ 
				this.value = '';
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		$('.FormStyle').find('input[type="text"]').blur(function() {
			$(this).removeClass("focusField").addClass("idleField");
			if ($.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
		
		
		
		
		

});


// JavaScript Document

/**
* @author Remy Sharp
* @url http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
*/

(function ($) {

$.fn.hint = function (blurClass) {
  if (!blurClass) { 
    blurClass = 'blur';
  }
    
  return this.each(function () {
    // get jQuery version of 'this'
    var $input = $(this),
    
    // capture the rest of the variable to allow for reuse
      title = $input.attr('title'),
      $form = $(this.form),
      $win = $(window);

    function remove() {
      if ($input.val() === title && $input.hasClass(blurClass)) {
        $input.val('').removeClass(blurClass);
      }
    }

    // only apply logic if the element has the attribute
    if (title) { 
      // on blur, set value to title attr if text is blank
      $input.blur(function () {
        if (this.value === '') {
          $input.val(title).addClass(blurClass);
        }
      }).focus(remove).blur(); // now change all inputs to title
      
      // clear the pre-defined text when form is submitted
      $form.submit(remove);
      $win.unload(remove); // handles Firefox's autocomplete
    }
  });
};

})(jQuery);

$(function(){ 
				$('input[title!=""]').hint();
});
