 function newWindow(url, hoyde, bredde) {
	var name = "window";
	var features ="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,copyhistory=1,resizable=1,width="+bredde+",height="+hoyde
	vindu = window.open(url, name, features);
 }
 
function winOpen (url, width, height) {
	time = new Date();
	theName = Math.ceil(time);
	var options='';
	if (width != null) {
		options += 'width='+width;
	}
	if (height != null) {
		options += ',height='+height;
	}
	options += ',resizable=yes, scrollbars=false';
	w = window.open (url, theName, options);
}


 function submit() {
	document.forms[0].submit();
 }

 // <!-- 996027200
// This script is (C) Copyright 2004 Jim Tucek
// Leave these comments alone!  For more info, visit
// www.jracademy.com/~jtucek/email/

function shrink(astonishment,forest,heat) {
	astonishment += ' ';
	var conception = astonishment.length;
	var confidence = 0;
	var glass = '';
	for(var decency = 0; decency < conception; decency++) {
		confidence = 0;
		while(astonishment.charCodeAt(decency) != 32) {
			confidence = confidence * 10;
			confidence = confidence + astonishment.charCodeAt(decency)-48;
			decency++;
		}
		glass += String.fromCharCode(spin(confidence,forest,heat));
	}
	parent.location = 'm'+'a'+'i'+'l'+'t'+'o'+':'+glass;
}

function sling(example,species,tremor) {
	example += ' ';
	var extraterrestrial = example.length;
	var physicist = 0;
	for(var fraction = 0; fraction < extraterrestrial; fraction++) {
		physicist = 0;
		while(example.charCodeAt(fraction) != 32) {
			physicist = physicist * 10;
			physicist = physicist + example.charCodeAt(fraction)-48;
			fraction++;
		}
		//document.write('&');
		//document.write('#');
		//document.write(spin(physicist,species,tremor));
		document.write(String.fromCharCode(spin(physicist,species,tremor)));
	}
}

function spin(hour,information,broad) {
if (broad % 2 == 0) {
moon = 1;
for(var mass = 1; mass <= broad/2; mass++) {
mark = (hour*hour) % information;
moon = (mark*moon) % information;
}
} else {
moon = hour;
for(var eye = 1; eye <= broad/2; eye++) {
mark = (hour*hour) % information;
moon = (mark*moon) % information;
}
}
return moon;
}


/**
 * Functions used in the large box containing info about the products.
 */

 
/**
 * The product active per default. When the mouse is moved out of a product
 * the default product is activated. 
 */ 
var defaultProduct = "opinio";
 
 
/**
 * The name of the currently activate product.
 */
var activeProduct = "opinio";
 
 
/**
 * The mouse is moved over a products logo, the products logo is activated
 * and the information text for the product is shown.  
 * @param name The name of the product. 
 */
function activateProduct(name) {
	if (name == activeProduct) {
		return;
	}
	if(name != defaultProduct) {
		deactivateDefaultProduct(defaultProduct);
	}

	activateMenuImage(name);
	setClass(document.getElementById(name + "Text"), "active");
	activeProduct = name;
}

		
/**
 * The mouse is moved out of a products logo, the products logo is deactivated,
 * information text for the product is hidden and the default product is activatd.  
 * @param name The name of the product. 
 */
function deactivateProduct(name) {
	if (activeProduct == defaultProduct) {
		return;
	}

	deactivateMenuImage(name);
	setClass(document.getElementById(name + "Text"), "inactive");
	activateProduct(defaultProduct);
}


/**
 * Deactivates the default product.
 */
function deactivateDefaultProduct() {
	deactivateMenuImage(defaultProduct);
	setClass(document.getElementById(defaultProduct + "Text"), "inactive");
}
	
	
/**
 * Activates a menu image.
 * @param name The name of the image to activate. 
 */
function activateMenuImage(name) {
	var image = document.getElementById(name);
	if(image == undefined || image == null) {
		return;
	}
	var src = image.src.substring(0, image.src.length - ".gif".length);
	image.src = src + "mouseover.gif";
}


/**
 * Deactivates a menu image. 
 * @param name The name of the iamge to deactivate. 
 */
function deactivateMenuImage(name) {
	var image = document.getElementById(name);
	if(image == undefined || image == null) {
		return;
	}
	var src = image.src.substring(0, image.src.length - "mouseover.gif".length);
	image.src = src + ".gif";
}	


/**
 * Set the class of html tag.
 * @param tag The tag to set the code for.
 * @param class The class to set.
 * @throws Error if tag is undefined.
 * @throws Error if class is undefined or empty. 
  */
function setClass(tag, className) {
	tag.setAttribute("class", className);
	tag.setAttribute("className", className);
}


/**
 * Gets the class of a html tag.
 * @param tag The tag to get the code for.
 * @return The class of the tag.
 * @throws Errir if tag is undefined or null.
 */
function getClassName(tag) {
	if (tag == undefined || tag == null) {
		throw new Error("Tag to get the class for is undefined or null");
	}
	var className = tag.getAttribute("class"); 
	if (className == undefined || className == null) {
		// IE
		className = tag.getAttribute("className");
	}
	return className;
}


/**
 * Sets a given class for a div tag with a given id. 
 * @param id The id of the div tag to show.
 * @param className The class to set.  
 * @throws Error if id is undefined null or empty.
 * @throws Error if className is undefined, null or empty.
 */
function setDivClass(id, className) {
	if (id == undefined || id == null || id == "") {
		throw new Error("Id of the div to show is undefined, null or empty");
	}
	if (className == undefined || className == null || className == "") {
		throw new Error("Id of the div to show is undefined, null or empty");
	}
	var div = document.getElementById(id);
	if (div != null && div != undefined) {
		setClass(div, className);		
	}
}


/**
 * Preloades the images that are used on mouseover on the products. 
 */
function preloadImages() {
	var images = new Array();
	images[0] = "images/boxlargeopinio.gif"
	images[1] = "images/boxlargeprobemouseover.gif";
	images[2] = "images/boxlargeeasychartsmouseover.gif";
	images[3] = "images/boxlargecodecentralmouseover.gif";
	
	for (var i = 0; i < images.length; i++) {
		var image = new Image();
		image.src = images[i];
	}	
}


// swapping of images


/**
 * Array containing the ids of the images to swap.
 */
var swapImages = new Array();


/**
 * The time in seconds each image should stay visible.
 */
var time = 0;


/**
 * The id of the current displayed image. 
 */
var currentImage = "";


/**
 * Starts the swap of images. Each of the given images is visible for a given amount of time.
 * @param imageId The name of the image currently displayed.
 * @param images Array containing the ids of the images to swap. 
 * @param imageTime The amount of time in seconds a image should stay visible. 
 */
function startImageSwapping(imageId, images, imageTime) {
	swapImages = images;
	time = imageTime;
	currentImage = imageId;
	window.setTimeout(swapImage, (time * 1000));
}


/**
 * Swaps the current visible image with the next image. 
 */
function swapImage() {
	setClass(document.getElementById(currentImage), "inactive");
	currentImage = getNextImage();
	setClass(document.getElementById(currentImage), "active");
	window.setTimeout(swapImage, time * 1000);
}


/**
 * Gets the next image to show. 
 */
function getNextImage() {
	// get the index of the current image
	var index = 0;
	for (var i = 0; i < swapImages.length; i++) {
		if (currentImage == swapImages[i]) {
			index = i;
		}
	}
	
	if (index >= swapImages.length -1) {
		// the current image is the last image in the array, take the first
		return swapImages[0];
	}
	else {
		return swapImages[index +1];
	}
}
