var $j = jQuery;

jQuery.noConflict();

/*
    // IE 6 trasparency fix
    $j(document).ready(function(){
        // apply ifixpng to all png images and specific css styles
        $j('img[@src$=.png], .entryStep2, .entryStep3, .entryStep4').ifixpng();
    });
*/

$j(document).ready(function(){
  // Client Side Nav highlighting
  var subpath = location.pathname + self.location.search;
  if ( subpath ) {
     $j('#mainNav a[@href="' + subpath + '"]').addClass("active");
     $j('#rightCol ul.sbNav a[@href="' + subpath + '"]').addClass("active");
     $j('#rightCol ul.subItems a[@href="' + subpath + '"]').addClass("active").parent().parent().show();
    }

});


function focusInputMsg(el, msg, type){
  var el = el;
  var type = (type == null || type == "" ) ? 'text' : 'password' ;

  if ($j(el).val() == msg)
  {
    $j(el).val('');  // clear default message
    
    if (type == 'password')
    {
      try {
            var cloneInput = $j(el).clone(true);
            cloneInput.attr('type', 'password');
            $j(cloneInput).insertAfter(el);
            $j(el).remove();
            $j(cloneInput).focus();
      }
      catch(e){
            // IE fix
            var newInput = document.createElement('input');
            $j(newInput).attr('type', 'password');
            if ($j(el).attr('id'))
            {
              $j(newInput).attr('id', $j(el).attr('id'));
            }
            if ($j(el).attr('name'))
            {
              $j(newInput).attr('name', $j(el).attr('name'));
            }
            if ($j(el).attr('tabindex'))
            {
              $j(newInput).attr('tabindex', $j(el).attr('tabindex'));
            }
            if ($j(el).attr('class'))
            {
              $j(newInput).attr('class', $j(el).attr('class'));
            }
            $j(newInput).insertAfter(el);
            $j(el).remove();
            $j(newInput).focus();
      }
    }
    
    
  }
}

function blurInputMsg(el, msg, type){
  var el = el;
  var type = (type == null || type == "" ) ? 'text' : 'password' ;

  if ($j(el).val() == '')
  {
    if (type == 'password')
    {
      try {
        var cloneInput = $j(el).clone(true);
        cloneInput.attr('type', 'text');
        cloneInput.attr('value', msg);
        $j(cloneInput).insertAfter(el);
        $j(el).remove(); 
      }
      catch(e){
        // IE fix
        // leave it alone
      }
    }
    else
    {
      $j(el).val(msg);
    }
  }
}


function toggleLotto(el) 
{
  // hide all of them
  $j(".lottoWrapper:visible").slideUp("fast");
  $j(".slideButton").removeClass("active");
 
  // show the right one
  $j(el).next(".lottoWrapper").slideDown("fast");
  $j(el).children(".slideButton").addClass("active");

  return true;
};



function toggleFAQ(el) 
{
	$j('.faqBody:visible').slideUp("fast");
  $j(el).next(".faqBody").slideDown("fast");
	return true;
}

function toggleBlock(el) 
{
    var el = el;
    $j(el).next(".content").slideToggle("fast", function() {
        if ($j(this).is(':visible')) {
            $j("img.arrow", el).toggleClass("expanded");
        } else {
            $j("img.arrow", el).toggleClass("expanded");
        }
    });
	return false;
};


function highlightNav(el) 
{
	$j('#' + el).addClass("active");
};

