// JavaScript Document// Collapsing menu that closes subs  // FROM: http://www.i-marco.nl/weblog/jquery-accordion-menu/ function initMenu() {	$('#menu ul').hide();	$('#menu ul:first').show();	$('#menu li a').click(	function() {		var checkElement = $(this).next();		if((checkElement.is('ul')) && (checkElement.is(':visible'))) {		return false;	}	if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {		$('#menu ul:visible').slideUp('normal');		checkElement.slideDown('normal');		return false;		}	}	);}// USAGE: 	$(document).ready(function() {initMenu();});//menu item with accordian sub-menu://    <li><a href="#"><img src="../js/images/about.gif" alt="About Nelson" /></a>//      <ul>//        <li><a href="#">bio</a></li>//        <li><a href="#">press</a></li>//      </ul>//    </li>////menu item with no sub-menu://	<li><a href="#"><img src="../js/images/contact.gif" alt="Contact Nelson" /></a></li>//  Collapsing menu that leaves multiple subs open// FROM: http://www.i-marco.nl/weblog/jquery-accordion-menu/ function init_openMenu() {$('#menu ul').hide();$('#menu li a').click(function() {$(this).next().slideToggle('normal');});}function writeEmail() {	var a = new Array('o','c','uda.','ong','ls','ne','o@','nf','i','m');	document.getElementById("mail").innerHTML = a[8]+a[7]+a[6]+a[5]+a[4]+a[3]+a[2]+a[1]+a[0]+a[9];}function mail_me() {	var locationString = new String(location.href);	var locationArr = locationString.split('?');	locationString = locationArr[0];		var a = new Array('o','c','uda.','ong','ls','ne','o@','nf','i','m');	var wildwood_mail = a[8]+a[7]+a[6]+a[5]+a[4]+a[3]+a[2]+a[1]+a[0]+a[9];  mail_str = "mailto:" + wildwood_mail;   mail_str += "?subject=Questions, comments for Nelson";  location.href = mail_str;}// Resize images to fit browser// variables: bounding_container = name of parent div eg: '#left_black_back'// design_width & design_height = design dimensions// .img_resize = class for images to be resized// .div_reposition = class for divs to be repositioned (top, right, bottom, left)function store_img_sizes() {	$('.img_resize').each(function() {		var nid = $(this).attr('src').split("/");	nid = nid[nid.length-1];	nid = nid.split(".");	nid = nid[0];	var img_id = nid;		var img_width = $(this).attr('width');  	var img_height = $(this).attr('height');  	$('body').data(img_id, { iwidth: img_width, iheight: img_height });	});}function imageresize() {  	$('.img_resize').each(function() {		var content_width = $(bounding_container).width();  		var content_height = $(bounding_container).height();  			var width_mult = content_width/design_width;		var height_mult = content_height/design_height;				var nid = $(this).attr('src').split("/");		nid = nid[nid.length-1];		nid = nid.split(".");		nid = nid[0];		var image_id = nid;		var img_width = $('body').data(image_id).iwidth;  		var img_height = $('body').data(image_id).iheight;  				var new_width = width_mult*img_width;		var new_height = width_mult*img_height;			 if ((width_mult) < 1){  			$(this).attr('width',new_width);  			$(this).attr('height',new_height);  		 } else {  			$(this).attr('width',img_width);  			$(this).attr('height',img_height);  		 }  	}); }  function store_element_places() {	$('.div_reposition').each(function() {	var elem_id = $(this).attr('id');		var elem_top = parseInt($(this).css('top'));  		var elem_right = parseInt($(this).css('right'));  		var elem_btm = parseInt($(this).css('bottom'));  		var elem_left = parseInt($(this).css('left'));  			$('body').data(elem_id, {etop: elem_top, eright: elem_right, ebottom: elem_btm, eleft: elem_left});	});}function elem_resize() {  	$('.div_reposition').each(function() {	var elem_id = $(this).attr('id');	var content_width = $(bounding_container).width();  	var content_height = $(bounding_container).height();  	var width_mult = content_width/design_width;	var height_mult = content_height/design_height;		var elem_top = $('body').data(elem_id).etop;   	var elem_right = $('body').data(elem_id).eright; 	var elem_btm = $('body').data(elem_id).ebottom;  	var elem_left = $('body').data(elem_id).eleft; 			var new_top = height_mult*elem_top;	var new_left = width_mult*elem_left;		if ((elem_top) != ''){  var new_top = Math.round(height_mult*elem_top); } else {var new_top = '';}	if ((elem_right) != ''){  var new_right = Math.round(width_mult*elem_right); } else {var new_right = '';}	if ((elem_btm) != ''){  var new_btm = Math.round(height_mult*elem_btm); } else {var new_btm = '';}	if ((elem_left) != ''){  var new_left = Math.round(width_mult*elem_left); } else {var new_left = '';}		 if ((width_mult) < 1){  		$(this).css('top',new_top);  		$(this).css('right',new_right);  		$(this).css('bottom',new_btm);  		$(this).css('left',new_left);  	 } else {  		$(this).css('top',elem_top);  		$(this).css('right',elem_right);  		$(this).css('bottom',elem_btm);  		$(this).css('left',elem_left);  	 }  	 	});	  }  function adjust_images_and_divs() {	imageresize();	elem_resize();}
