function popup(where) {
	window.open(where,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=800, height=600");
}

function showMenu() {
	document.getElementById("menu").style.display = "block";
}
function hideMenu() {
	document.getElementById("menu").style.display = "none";
}

var num = 1, image1;
function initHeader() {
	image1 = document.getElementById("image1");
	
	if(typeof(headerimages) != "undefined") {
		setTimeout("doStart()", 3000);
	}
}
var useImage, tim, opa, speed;
function doStart() {
	num++;
	if(num >= headerimages.length) {
		num = 0;
	}
	useImage = image1;
	opa = 100;
	speed = -4;
	tim = setInterval("sethide()", 39);
}

function sethide() {
	opa = opa + speed;
	if(opa <= 0) {
		opa = 0;
		clearInterval(tim);
		useImage.src = headerimages[num];
		speed = 4;
		tim = setInterval("setshow()", 39);
	}
	useImage.style.opacity = opa/100;
}
function setshow() {
	opa = opa + speed;
	if(opa >= 100) {
		opa = 99;
		clearInterval(tim);
		setTimeout("doStart()", 3000);
	}
	useImage.style.opacity = opa/100;
}


var newImg, act;
 $(document).ready(function() {
   $(".inbigimg").click(function() {
   	newImg = this.href;
   	$("#bigimage").fadeOut("slow", function() {
   		var i = new Image();
   		i.src = newImg;
   		$(i)
   			.load(function(){
   				$("#bigimage").fadeIn();
   				$("#bigimage img").attr('src', this.src);
   			})
   			.attr('src', newImg);
   	});
   	
   	return false;
  });
  $("#bigimage").click(function() {
  	$("#bigimage").fadeOut();
  });
	$(".domedia").click(function() {
		if(act) {
			$(act).removeClass("active");
		}
		
		act = this;
		$(this).addClass("active");
		h = $(this).attr("href");
		
		$("#popmedia").load(h, {pop:1});
		$("#popmedia").fadeIn();
		
		return false;
	});
});
function dohide(w) {
	if(act) {
		$(act).removeClass("active");
		act = false;
	}	
	$("#" + w).fadeOut();
}
 
function displ(w, m) {
	
	if ($("#" + w).is(":hidden")) {
		$("#" + w).slideDown();
		$(m).addClass("active");
	} else {
		$("#" + w).slideUp();
		$(m).removeClass("active");
	}
}