/*
 *		Description: Fisma default javascript
 *		Type: javascript
 *		Copyright: Fisma
 *		Author: Luovakulma, Jani Tarvainen
 *
 */

// on load initialization
function init() {

	// js kludge to fix background hue
	var noHue = document.getElementById('content');
	var withHue = document.getElementById('sidebar');
	if (withHue && noHue.clientHeight > withHue.clientHeight){
		withHue.style.height=noHue.clientHeight+'px';
	}

	// add external targets
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
		anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";
	}

	// track intranet logins
	var loginform = document.getElementById('loginform');
	loginform.onsubmit=logIntraLogin

}

function logIntraLogin(){
	urchinTracker('/outgoing/intra_login');
}

// reset contact form
function resetContactForm(){
	if(confirm('Oletko varma?')){
		document.getElementById('contactForm').reset();
	}
}

// do that init
window.onload=init;
