$(function(){
   
    if($.cookie("Noteflag") == 1){
       $('#hideNotePanel').parents('dl').hide();
       $('#showNotePanel').parent().show();
    }
   
    if($.cookie("Tipflag") == 1){
      $('#hideTipPanel').parents('dl').hide();
      $('#showTipPanel').parent().show();

   }
  $('#togglePanel').click(function(evt){
	   if ($(this).text() == 'Collapse'){
		   $('ul.fn').hide('slow');
		   $(this).text('Expand');
	   }
	   else{
		   $('ul.fn').show('slow');
		   $(this).text('Collapse');
	   }
	   evt.preventDefault();
   })
   
   $('#hideNotePanel').click(function(evt){
       $.cookie("Noteflag",1);    
	   $(this).parents('dl').hide('slow');
 	   $('#showNotePanel').parent().show();
	   evt.preventDefault();
   })
   
   $('#hideTipPanel').click(function(evt){
       $.cookie("Tipflag",1);
	   $(this).parents('dl').hide('slow');
	   $('#showTipPanel').parent().show();
	   evt.preventDefault();
   })
   
   $('#showNotePanel').click(function(evt){
       $.cookie("Noteflag",0); 
	   $('#hideNotePanel').parents('dl').show('slow');
   	   $('#showNotePanel').parent().hide();
	   evt.preventDefault();
   })
   
   $('#showTipPanel').click(function(evt){
       $.cookie("Tipflag",0); 
	   $('#hideTipPanel').parents('dl').show('slow');
	   $('#showTipPanel').parent().hide();
	   evt.preventDefault();
   })
});

$(function(){
	/*
	$('ul.fn > li > a').attr('target', 'iframe')
						.click(function(evt){
							var type = $(this).attr('type');
							if (type == '_parent')
								location.href = $(this).attr('href');
							else if (type == '_blank')
								win = window.open($(this).attr('href'), '_blank');
							else{
								var h = $(this).attr('height');
								if (h){
									if ($('#nav-tgl').attr('title') == 'Collapse')
										$('#nav-tgl').click();
									$('#iframe').animate({height: h+'px'}, 'slow');
								}
							}
						});
	*/
	$('fieldset p:not(:last) *').focus(function(){
							$('p.focus').removeClass('focus');
						    $(this).parents('p').addClass('focus');
						});
	$('.form-ct .form-ct-item:not(:last) *').focus(function(){
							$('.form-ct-item.focus').removeClass('focus');
						    $(this).parents('.form-ct-item').addClass('focus');
						});
	$('#nav-tgl').click(function(){
								 $('.nav-pnl').toggle('fast');
								 if ($(this).attr('title') == 'Collapse'){
								 	$(this).attr('title', 'Expand');
									$(this).css('backgroundImage', 'url(../images/arrow-down.gif)');
								 }
								 else{
									 $(this).attr('title', 'Collapse');
									 $(this).css('backgroundImage', 'url(../images/arrow-up.gif)');
									 //this.style.backgroundImage = '../images/arrow-up.gif';
								 }
								 });
});

