//PAGE LOAD
$(document).ready(function(){
	//SET TITLE = ALT FOR CROSS PLATFORM STUFF
	$("img").each(function(){
		if  ( ($(this).attr("title") == undefined) || ($(this).attr("title") == "") )  {
			if  ( ($(this).attr("alt") != undefined) && ($(this).attr("alt") != "") )  {
				$(this).attr( {title: $(this).attr("alt") });	
			}
		}
	});	
	
	// SHOW LINKS WHILE PRINTING
	// Variables:
	//   _selector: CSS selector to select A tags whose links you wish to print (e.g. "#main-content .content a")
	//   _root: Root of the web site is needed to make proper internal links (e.g. "http://www.mydomain.com")
	// print_links(_selector, "http://www.wvmic.com");
	
	//ADD A CLICK EVENT TO SOMETHING USING JQUERY
	//$("tag-id-class-here").click(function(){							
		// alert($(this).attr("rel"));
		//return false;
	//});
	
	//DO SOMETHING TO ALL SOMETHINGS ON A PAGE USING JQUERY
	//$("tag-id-class-here").each(function(){
		//$(this).append("HI");
	//});
	
	// APPLY SOMTHING TO ALL OF SOMETHING, WITHOUT NEEDING TO MANIPULATE LIKE ABOVE
	//$("#container-id-or-class > things-to-targer, actual-target-maybe-with-class").attr("attr-name","value-here");
	//EXAMPLE SET ALL A TAGS TARGET = BLANK
	//$("#container > a, a").attr("target","_blank");
	
	// ALT ROW CLASSES APPLY
	$("table.altRow tbody > tr:even td").addClass("rowEven");
	$("table.altRow tbody > tr:odd td").addClass("rowOdd");
		
	// ADD FIRSTCHILD CLASS TO ALL LI FIRST CHILD ELEMENTS 
	//	$("ul li:first-child").addClass("firstChild");

	// REPLACE ALIGN RIGHT/LEFT WITH CLASSES
	//	jQuery("img[align='left']").addClass("floatLeft").removeAttr('align').removeAttr('hspace').removeAttr('vspace');
	//   jQuery("img[align='right']").addClass("floatRight").removeAttr('align').removeAttr('hspace').removeAttr('vspace');

}); // END PAGE LOAD

//BREAK OUT OF THICKBOX FROM BUTTON CLICK OR OTHER JAVASCRIPT, IF NOT IN GO BACK TO DEFAULT PAGE
function CancelClick() {
	if (document.location == top.location.href) { 
		top.location.href='http://www.google.com'; //PUT PAGE URL HERE
	} else {  
		top.location.href=top.location.href;
	}           
}

// THICKBOX CHANGED CASE, THIS IS A WRAPPER TO KEEP OLD WORKING
function TB_show(caption, url, imageGroup){
	tb_show(caption, url, imageGroup);
}

// PRINT_LINKS  FUNCTION - SEE CALL IN DOCUMENT READY BLOCK ABOVE
// ADD A CLASS OF ".print-link" TO YOUR STYLESHEET TO HIDE THESE ON SCREEN BUT TO SHOW ON PRINT
function print_links(_selector, _root){
	$(_selector).each(function(){
		var _link = $(this).attr("href");
		if((_link.indexOf('http:') != 0) && (_link.indexOf('mailto:') != 0)){
			while(_link.indexOf("../") != -1){
				_link = _link.replace("../","");
			}
			_link = _root + "/" + _link;
		} 
		_link = _link.replace("mailto:","");
		$(this).after('<span class="print-link"> (' + _link + ')</span>'); 
	});
}


$(function() {
	$('#bodyWorkLeft table a').hover(function() {
		$(this).fadeTo("fast", 0.6);
		
	},
	function() {
		$(this).fadeTo("fast", 1);
	}
	);
});