/*
Title: JavaScript for Flugbutiken.se
Author: Per Eriksson
Last modified: 2006-12-10 17:55:31
---------------------------------------------- */

function toggle (obj, obj2) {
	var obj_elem = document.getElementById(obj);
	var obj2_elem = document.getElementById(obj2);
	
	if (obj_elem.style.display == 'none') {
		obj_elem.style.display = 'block';
		obj2_elem.style.display = 'none';
	} else {
		obj_elem.style.display = 'none';
		obj2_elem.style.display = 'block';
	}
}

function resize () {
	offsetX = 6;
	offsetY = 47;
	window.resizeTo (document.images[0].width+offsetX, document.images[0].height+offsetY);
	position ();
}

function position () {
	var width = 300;
	var height = 300;
	if (document.layers) {
		var width = window.innerWidth;
		var height = window.innerHeight;
	}
	else if (document.all) {
		var width = document.body.clientWidth;
		var height = document.body.clientHeight;
	}
	popupLeft = Math.round (window.screen.availWidth / 2- (width / 2));
	popupTop = Math.round (window.screen.availHeight / 2- (height / 2));
	window.moveTo (popupLeft,popupTop);
}

function popupwin (page, width, height) {
	window.open (page,'','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,scrollbars=no,width='+width+',height='+height);
}

function perform_search (q) {
	window.location = 'http://flugbutiken.se/search.php?q='+q;
}
