
/*******************jQuery Toggle Customized**********************************/
$(document).ready(function(){
	$(".toggleWrapper").hide();

	$(".toggleTrigger").toggle(function(){
		$(this).addClass("iconMinus"); 
		}, function () {
		$(this).removeClass("iconMinus");
	});
	
	
	$(".toggleTrigger").click(function(){
		$(this).next(".toggleWrapper").slideToggle("slow,");
	});
});

	
/*******************Dialog	- jQuery UI Lib**********************************/
$(function(){
	$('#dialog').dialog({autoOpen: false, width: 600, buttons: {
	//$('#dialog').dialog({autoOpen: false, width: 600, buttons: {
			"Ok": function() { 
				$(this).dialog("close"); 
			}, 
			"Cancel": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
				
	// Dialog Link
	$('#dialog_link').click(function(){
 		$('#dialog').dialog('open');
		return false;
	});

	//hover states on the static widgets - it isnt used in my example so it could just go away
	$('#dialog_link, ul#icons li').hover(
			function() { $(this).addClass('ui-state-hover'); }, 
			function() { $(this).removeClass('ui-state-hover'); }
		);	
});

/*********************jQuery ToolTip*******************************/
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

/***************Custom confirmation script***************************************/

function confirmMessageURL(message,url){
	var x = message;
		if (confirm(x) == false) {
			alert("you decided against it");
			return false;
			//window.blur();
			//setTimeout("self.close()",1000);
			//window.close();
    } else {
			document.location.href=url;
		}	
	return false;
}

		
		
/******************************************************************************/
// Open News Pop Up Window
function openPopup( pageToLoad, winName, width, height, center, scroll, winXpos, winYpos, resize) {
	xposition = 0;
	xposition = winXpos;
	yposition = 0;
	yposition = winYpos;
	resizable = 0;
	resizable = resize;
	if ((parseInt(navigator.appVersion) >= 4 ) && (center)) {
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	}
	args = "width=" + width + ","     + "height=" + height + "," 
	+ "location=0," + "menubar=0,"  + "resizable=" + resizable + "," + "scrollbars=" + scroll + ","
	+ "status=0,"   + "titlebar=0," + "toolbar=0," + "hotkeys=0,"
	+ "screenx=" + xposition + ","  //NN Only
	+ "screeny=" + yposition + ","  //NN Only
	+ "left=" + xposition + ","     //IE Only
	+ "top=" + yposition;           //IE Only
	var win = window.open( pageToLoad,winName,args );
}

function openSampleWindow(pageToLoad) {
	var win = openPopup(pageToLoad,'aNameForWin',800,500,1,1);
	win.focus();
}


function openWin(url) {
	window.open(url, 'win', 'resizable=no,location=yes,menubar=no,toolbar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=600');
}

//JQUERY MASKED INPUT FOR FORM FIELDS BY ID
jQuery(function($){   
	/* My Account, Create, and View Users */
		try {
		$("#Zip").mask("99999");
		} catch (e) { } //nada
		
		try {
			$("#PhonePrimary").mask("(999) 999-9999");
		} catch (e) { } //nada
		
		try {
			$("#PhoneSecondary").mask("(999) 999-9999");
		} catch (e) { } //nada

		try {
			$("#DatesOfServiceFrom").mask("99/99/9999");
		} catch (e) { } //nada
		
		try {
			$("#DatesOfServiceTo").mask("99/99/9999");
		} catch (e) { } //nada
		try {
			$("#DateOfDischarge").mask("99/99/9999");
		} catch (e) { } //nada
});

$(document).ready(function() {
	$("a.#actionLinkLP").tooltip({ tip:'.tooltipPicLP', effect:'toggle'});
	$("a.#actionLinkVAMHC").tooltip({ tip:'.tooltipPicVAMHC', effect:'toggle'});
	$("a.#actionLinkKNR").tooltip({ tip:'.tooltipPicKNR', effect:'toggle'});
	$("a.#actionLinkGS").tooltip({ tip:'.tooltipPicGS', effect:'toggle'});	
	$("a.#actionLinkAA").tooltip({ tip:'.tooltipPicAA', effect:'toggle'});
	$("a.#actionLinkBB").tooltip({ tip:'.tooltipPicBB', effect:'toggle'});
	$("a.#actionLinkCC").tooltip({ tip:'.tooltipPicCC', effect:'toggle'});
	$("a.#actionLinkDD").tooltip({ tip:'.tooltipPicDD', effect:'toggle'});
	$("a.#actionLinkEE").tooltip({ tip:'.tooltipPicEE', effect:'toggle'});
	$("a.#actionLinkFF").tooltip({ tip:'.tooltipPicFF', effect:'toggle'});
	$("a.#actionLinkGG").tooltip({ tip:'.tooltipPicGG', effect:'toggle'});
	$("img[rel]").overlay();
	tooltip();
});




