// JavaScript Document
function hideDiv(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showDiv(id) {          
	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


var shadowBoxMimeMap =
	{
		img: ['png', 'jpg', 'jpeg', 'gif', 'bmp'],
		swf: ['swf'],
		flv: ['flv', 'm4v', 'mp4']
	};
Shadowbox.init({
	language:   "en",
	players:    ["img", "flv", "swf"],
	handleOversize: "resize",
	initialHeight:750,
	initialWidth:750,
	flashVars: {
	frontcolor: '0xf9f9f9',
	lightcolor: '0xffffff',
	controlbar: 'over',
	stretching: 'fill'
	},	
	ext: shadowBoxMimeMap
});

$(document).ready(function() {
	$("img.caption_left").each(function() {
		$(this).wrap('<div class="figureLeft" style="width:'+($(this).width()+10)+'px"></div>')
		.after('<p class="capText">'+$(this).attr("alt")+'</p>');
	});
	$("img.caption_right").each(function() {
		$(this).wrap('<div class="figureRight" style="width:'+($(this).width()+10)+'px"></div>')
		.after('<p class="capText">'+$(this).attr("alt")+'</p>');
	});
	$("img.inset_left").each(function() {
		$(this).wrap('<div class="insetLeft" style="width:'+($(this).width()+6)+'px"></div>')
		.after('<p class="insetText">'+$(this).attr("alt")+'</p>');
	});
	$("img.inset_right").each(function() {
		$(this).wrap('<div class="insetRight" style="width:'+($(this).width()+6)+'px"></div>')
		.after('<p class="insetText">'+$(this).attr("alt")+'</p>');
	});
	$("a.lightbox").each(function() {
		var href = $(this).attr('href')+'?shadowbox=true';
		$(this).attr('rel','shadowbox;height:80%;width=800');
		$(this).attr('href',href);
	});
});

function gup( name ) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null )
		return "";
	else
		return results[1].replace(/%20/g," ");
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
	var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
