
/* hides media_content quick,
 * will be handled later on ...
 */
document.write('<style type="text/css">.media_content{display:none;}</style>');

$(document).ready(function() {

$('div.media_description').wrapInner('<p/>');

	/* adds the selected inside the iframe
	 */
	$('#submenu a').each(function() {
		var loc1 = window.parent.location.href.replace(default_location_re, '');
		var loc2 = this.href.replace(default_location_re, '');

		if (loc1.indexOf(loc2) >= 0) {
			$(this).addClass('selected');
			var img = $(this).find('img');
			img.unbind();
			img.attr('src', img.attr('src').replace(/-off\./, '-on.'));
		}
	});

	/* the selected must also be on the list item
	 * for the arrow backgrounds
	 */
	$('#menu a.selected').each(function() {
		$(this).parent().addClass('selected');
	});

	/* media navigation is made with links inside the content.
	 * Links toggle display of the node it anchors to.
	 */
	$('.media_content').hide();
	$('#content a.media_anchor').each(function() {
		var id = $(this).attr('href').split('#')[1];
		var el = $('#'+id);

		if (!el.get(0)._anchors) {
			el.get(0)._anchors = [];
		}
		el.get(0)._anchors.push($(this));

		$(this).click(function() {
			$.each(media_anchor_selected.get(0)._anchors, function(i, n) { n.removeClass('selected'); });
			media_anchor_selected.hide();
			media_anchor_selected = $('#'+id);
			$.each(media_anchor_selected.get(0)._anchors, function(i, n) { n.addClass('selected'); });
			media_anchor_selected.show();
			return false;
		});
	});
	var media_anchor_selected = $('.secondary .media_content:first');
	$('#content a.media_anchor:first').click();

});

function changePic(picID){

		 alert("test");
		
	}


