
$(function(){
	
	
	/* REMOVE BORDERS FROM VARIOUS LAST ELEMENTS */
		$("#topnav li:last").css("border","none");
		$("#utilitynav li:last").css("border","none");
		$("#footer_nav li:last").css("border","none");
		$("#mainnav ul ul").each(function(){ $("li:last",this).css("border","none"); });
	
	
	/* REMOVE SEARCH INPUT VALUE ON FOCUS */
		$("#searchform_search input").focus(function() { value=$(this).val(); $(this).attr("value",""); });
		$(".pr_searchinput").focus(function() { value=$(this).val(); $(this).attr("value",""); });
	
	 /* more vfw sites overlay */
        $("li.overlay").hover(function(){
            $("div",this).show();
            $("a",this).addClass("overlayhover");
			if($.browser.msie){
				$('#ddlSearchFolders').hide();
			}
        },function(){
            $("div",this).hide();
            $("a",this).removeClass("overlayhover");
			if($.browser.msie){
				$('#ddlSearchFolders').show();
			}
        }); 
	
	/* UTILITY NAV OVERLAYS */
		$('#utilitynav li.utilitynav_overlay').hover(function(){
			//$('.overlay_mid, .overlay_bottom, #utilitynav li.utilitynav_overlay a:first-child').addClass('on');
			//$('li.utilitynav_overlay a:first-child, div.overlay_bottom, div.overlay_mid').addClass('on');
			$('div',this).css('display','block');
			if($.browser.msie){
				$('#ddlSearchFolders').hide();
			}
		}, function () {
		   //$('#utilitynav .on').removeClass('on');
			$('div',this).css('display','none');
			if($.browser.msie){
				$('#ddlSearchFolders').show();
			}
		});
		
	/* VIDEO OVERLAYS */
	    $('#other_videos a.video_thumbnail, a#hero_video').click(function(){
			$('#video_overlay').show();
			$('#overlay_content').show();
			$('#overlay_content #overlay_top_edge').show();
			getVideo($(this),'overlay_top');
			
		});
		
		$('#video_overlay, a#overlay_close').click(function(){
		    $('#overlay_content, #video_overlay').hide();
		});

	
	/* MAIN NAV OVERLAYS */
		$("#mainnav ul li").hover(function(){
			$("ul",this).show();
			$(this).addClass("on");
		}, function(){
			$("ul",this).hide();
			$(this).removeClass("on");
		});		
		
	/* POD TABS */
		$(".pod-tpr-tabs div").click(function() {
		    whatTab = this.id;
		    $(".pod-tpr-tabs div").removeClass("ON");
		    $(this).addClass("ON");
		    $("div[class^='pod-tab_']").hide();
		    $('.' + whatTab).show();
		    //Little hack to make IE6/7 update the footer position so the pod doesnt grow through it
		    $("#footer").hide();
		    $("#footer").show();
		});

	
	/* TABS FOR PRESS ROOM AND NATIONAL VETERANS SERVICE */
		$(".tabs div").click(function() {
		    whatTab = this.id; $(".tabs div").removeClass("ON"); $(this).addClass("ON"); $("div[class^='tab_']").hide(); $('.' + whatTab).show();         //Little hack to make IE6/7 update the footer position so the pod doesnt grow through it
		    $("#footer").hide();
		    $("#footer").show();
		});

		
	/* MEMBER PROFILE SWITCHER */
		$('#ColumnRight div[id^=bio]').css("display","none");
		$('#ColumnRight div[id^=bio]:first').css("display","block");
		$('#bioThumbCarousel a').bind('click',function(){
			var getClass = $(this).attr('class');
			$('#ColumnRight div[id^=bio]').css('display','none');
			$('+' + getClass).css('display', 'block');
			//Little hack to make IE6/7 update the footer position so the pod doesnt grow through it
			$("#footer").hide();
			$("#footer").show();
		});

	/* POD PANELS */
	$('.pod_panel h4 a').bind('click',function(){
	    $('.pod_panel h4 a.on').removeClass('on');
	    $('.pod_panel h4.on').removeClass('on');
        $(this).addClass('on');
        $('.pod_panel_content').css('display','none');
        $(this).parent().next().css('display', 'block');
        $(this).parent().addClass('on');
        //Little hack to make IE6/7 update the footer position so the pod doesnt grow through it
        $("#footer").hide();
        $("#footer").show();

    });


	
});


function getVideo(elem, divId){
    if(elem.attr('rel') != null)
    {
        vid_id = $(elem).attr('rel');
        var convention_video = "http://www.youtube.com/v/" + vid_id + ".swf";
        swfobject.embedSWF(convention_video, divId, "300", "250", "9.0.0");   
    }
    else return false; 
}

/* IE6 .PNG FIX FROM http://labs.unitinteractive.com/unitpngfix.php */

var clear="/Uploadedimages/SiteAssets/images/global/clear.gif"; //path to clear.gif

document.write('<script type="text/javascript" id="ct" defer="defer" src="javascript:void(0)"><\/script>');var ct=document.getElementById("ct");ct.onreadystatechange=function(){pngfix()};pngfix=function(){var els=document.getElementsByTagName('*'),ip=/\.png/i,al="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='",i=els.length,uels=new Array(),c=0;while(i-->0){if(els[i].className.match(/unitPng/)){uels[c]=els[i];c++;}}if(uels.length==0)pfx(els);else pfx(uels);function pfx(els){i=els.length;while(i-->0){var el=els[i],es=el.style,elc=el.currentStyle,elb=elc.backgroundImage;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter=al+el.src+"',sizingMethod='crop')";el.src=clear;}else{if(elb.match(ip)){var path=elb.split('"'),rep=(elc.backgroundRepeat=='no-repeat')?'crop':'scale',elkids=el.getElementsByTagName('*'),j=elkids.length;es.filter=al+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';if(j!=0){if(elc.position!="absolute")es.position='static';while(j-->0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}};};



