﻿//********************************************************************
// WiredText JS Helpers
// Requires jQuery version 1.3.1+
//********************************************************************





function truncateText(str, len) {
    var newtext;
    newtext = str.substr(0, len);
    return newtext;
}

function getPDF(docName,fName) {
    cmCreatePageElementTag("PDF:" + docName, "NPL:PDF Documents");
    window.location.href = "../_process/GetPDF.aspx?dn=" + docName;
    //return void();
}   




//********************************************************************
// function:    wt_textboxWatermark_focus
//              
//           
//******************************************************************** 
function wt_textboxWatermark_focus(sender,wmValue,isPasswordField) {
    if (sender.value == wmValue) {
        sender.value = "";
        if (isPasswordField) {
        }   
    }
}
//********************************************************************
// function:    wt_textboxWatermark_blur
//              
//              
//********************************************************************
function wt_textboxWatermark_blur(sender, wmValue, isPasswordField) {
    if (sender.value == "") {
        sender.value = wmValue;
    }
}



function wt_textboxWatermark_focus2(sender, wmValue, isPasswordField) {
    if (sender.value == wmValue) {
        $("#divPasswordInput").show();
        $("#divPasswordMask").hide();
        $("#inputPassword").focus();
    }
}
function wt_textboxWatermark_blur2(sender, wmValue, isPasswordField) {
    //if (sender.value == "") {
    //    $("#divPasswordInput").hide();
     //   $("#divPasswordMask").show();
   // }
}
function wt_textboxWatermark_focus22(sender, wmValue, isPasswordField) {

}
function wt_textboxWatermark_blur22(sender, wmValue, isPasswordField) {
    if (sender.value == "") {
        $("#divPasswordInput").hide();
        $("#divPasswordMask").show();
    }
}






//********************************************************************
// function:    wt_setRolloverImages
//              Adds rollover/rolloff events to image that
//              utalize the rollover class
//********************************************************************
function wt_setRolloverImages(){
	$("img.rollover").hover(
	    function(){
	        this.src = this.src.replace(".jpg", "_over.jpg");
	        this.src = this.src.replace(".gif", "_over.gif");
	        this.src = this.src.replace(".png", "_over.png");
	       
		},
		function(){
		    this.src = this.src.replace("_over.jpg", ".jpg");
		    this.src = this.src.replace("_over.gif", ".gif");
		    this.src = this.src.replace("_over.png", ".png");
		}
	);

}

//********************************************************************
// function:    wt_preloadRollovers
//              preloads all images that uralize the rollover class
//********************************************************************
function wt_preloadRollovers() { 
    var preload = new Array();   
    $(".rollover").each(function() {
        s = $(this).attr("src").replace(/\.(.+)$/i, "_over.$1");
        preload.push(s)
    });
    var img = document.createElement('img');
    $(img).bind('load', function() {
        if (preload[0]) {
            this.src = preload.shift();
        }
    }).trigger('load');
};



function wt_keyTrap() { 



}




//********************************************************************
// Autowire the rollover and preloading functions
//********************************************************************
$(document).ready(function() {
//Wire up rollovers
    
    wt_setRolloverImages();
    wt_preloadRollovers();
    
});


//********************************************************************
//********************************************************************
//********************************************************************
// END
//********************************************************************
//********************************************************************
//********************************************************************










///Anchor scroll
$(document).ready(function() {
//    $('a[href*=#]').click(function() {
//        if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
//    && location.hostname == this.hostname) {
//            var $target = $(this.hash);
//            $target = $target.length && $target
//      || $('[name=' + this.hash.slice(1) + ']');
//            if ($target.length) {
//                var targetOffset = $target.offset().top;
//                $('html,body')
//        .animate({ scrollTop: targetOffset }, 1000);
//                return false;
//            }
//        }
//    });
});





//use this for the PINK content box buttons - to make it work on IE6
function cbRollover(divId, mode){
		    if(mode == 1){
			    document.getElementById(divId).className = "contentBoxButtonBkgd contentBoxButtonBkgdOver";
		    }else{
			    document.getElementById(divId).className = "contentBoxButtonBkgd";
		    }
	    }

//use this for the GREY content box buttons - to make it work on IE6
function cbGreyRollover(divId, mode){
		    if(mode == 1){
			    document.getElementById(divId).className = "greyButtonBkgd greyButtonBkgdOver";
		    }else{
			    document.getElementById(divId).className = "greyButtonBkgd";
		    }
	    }






