// JavaScript Document


 
$(document).ready(function(){ 
	
	if($.cookie('TEXT_SIZE')) {
			$('body').addClass($.cookie('TEXT_SIZE'));	
		}
		$('.resizer a').click(function() {
			var textSize = $(this).parent().attr('id');
			$('body').removeClass('small medium large').addClass(textSize);
			$.cookie('TEXT_SIZE',textSize, { path: '/', expires: 10000 });
			return false;
		});

	$(".rightMenu").hide();
	$("h3.trigger").toggle(function(){
				$(this).addClass("active"); 
				}, function () {
				$(this).removeClass("active");
		});
			
			$("h3.trigger").click(function(){
				$(this).next(".rightMenu").slideToggle("slow,");
		});

});



function mailpage()
{
var cntrlHdnEmailLinkContainerID ="";
var cntrlHdnEmailLinkID = "";
var strSearchURL ="";

if (cntrlHdnEmailLinkContainerID != "" && cntrlHdnEmailLinkID != "")
{
    var div = document.getElementById(cntrlHdnEmailLinkContainerID);
     if (div.childNodes[0].id == cntrlHdnEmailLinkID)
     {    
         strSearchURL=  div.childNodes[0].value
     }
}

if(strSearchURL != "")
{
    mail_str = "mailto:?subject=Emailing : Saved Search Results";
    mail_str += "&body=I thought you might be interested in this saved search result set ";
    mail_str  += "located on VABOARD.ORG.  You can view these results at the following link : " + escape(strSearchURL); 
}
else
{
    mail_str = "mailto:?subject=Emailing : " + document.title;
    mail_str += "&body=I thought you might be interested in this content '" + document.title;
    mail_str += "' located on VABOARD.ORG.  You can view this content at the following link : " + location.href; 
}

location.href = mail_str;
}



$(document).ready(function(){
	$(".defaultText").focus(function(srcc){
        if ($(this).val() == $(this)[0].title)
			{
				$(this).removeClass("defaultTextActive");
				$(this).val("");
			}
    });
    
    $(".defaultText").blur(function(){
        if ($(this).val() == "")
        {
            $(this).addClass("defaultTextActive");
            $(this).val($(this)[0].title);
        }
    });
    
    $(".defaultText").blur();        
});


function find_div() {
        var divCollection = document.getElementsByTagName("div");
        for (var i=0; i<divCollection.length; i++) {
            if(divCollection[i].getAttribute("id") == "content") {

var div = divCollection[i];

 if (!document.getElementsByTagName) return;
 var anchors = div.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];

x = anchor.getAttribute("href")

if (anchor.getAttribute("href") && x.substring(0, x.indexOf('.doc'))) 
	{
    	anchor.target = "_blank";
    	anchor.title = "This Word document (" + anchor.getAttribute("href") + ") will open in a new window.";
    	//anchor.className = (anchor.className != '') ? anchor.className+' exWord' : 'exWord';
		anchor.innerHTML = anchor.innerHTML + " <img src='/images/icons/doc.gif' alt='MS Word Icon'>";
	}

if (anchor.getAttribute("href") && x.substring(0, x.indexOf('.pdf'))) 
	{
    	anchor.target = "_blank";
    	anchor.title = "This PDF document (" + anchor.getAttribute("href") + ") will open in a new window.";
    	//anchor.className = (anchor.className != '') ? anchor.className+' exWord' : 'exWord';
		anchor.innerHTML = anchor.innerHTML + " <img src='/images/icons/pdf.gif' alt='PDF Icon'>";
	}

if (anchor.getAttribute("href") && x.substring(0, x.indexOf('.xls'))) 
	{
    	anchor.target = "_blank";
    	anchor.title = "This Excel document (" + anchor.getAttribute("href") + ") will open in a new window.";
    	//anchor.className = (anchor.className != '') ? anchor.className+' exWord' : 'exWord';
		anchor.innerHTML = anchor.innerHTML + " <img src='/images/icons/xls.gif' alt='Excel Document (New Window)'>";
	}
	

if (anchor.getAttribute("href") && x.substring(0, x.indexOf('.ppt'))) 
	{
    	anchor.target = "_blank";
    	anchor.title = "This Powerpoint document (" + anchor.getAttribute("href") + ") will open in a new window.";
    	//anchor.className = (anchor.className != '') ? anchor.className+' exWord' : 'exWord';
		anchor.innerHTML = anchor.innerHTML + " <img src='/images/icons/ppt.gif' alt='Powerpoint Document (New Window)'>";
	}

if (anchor.getAttribute("href") && x.substring(0, x.indexOf('.pps'))) 
	{
    	anchor.target = "_blank";
    	anchor.title = "This Powerpoint document (" + anchor.getAttribute("href") + ") will open in a new window.";
    	//anchor.className = (anchor.className != '') ? anchor.className+' exWord' : 'exWord';
		anchor.innerHTML = anchor.innerHTML + " <img src='/images/icons/ppt.gif' alt='Powerpoint Document (New Window)'>";
	}

	
 }
            } 
        }
    }


window.onload = find_div;
