    matchHeight=function(){
         var divs,contDivs,maxHeight,divHeight,d;
         // get all div elements in the document
         divs=document.getElementsByTagName('div');
         contDivs=[];
         // initialize maximum height value
         maxHeight=0;
         // iterate over all div elements in the document
         for(var i=0;i<divs.length;i++){
         	
              // make collection with div elements with class attribute 'container'
              if(/\bspalt\b/.test(divs[i].className)){
             
                   d=divs[i];
                    contDivs[contDivs.length]=d;
                    // determine height for div element
                    if(d.offsetHeight){
                         divHeight=d.offsetHeight;
                    }
                    else if(d.style.pixelHeight){
                         divHeight=d.style.pixelHeight;
                    }
                    // calculate maximum height
                    maxHeight=Math.max(maxHeight,divHeight);
              }
         }
         // assign maximum height value to all of container div elements
         for(var i=0;i<contDivs.length;i++){
              contDivs[i].style.height=maxHeight + 'px';
         }
    }
    // execute function when page loads
    window.onload=function(){
         if(document.getElementsByTagName){
             matchHeight();
         }
	   }


function getSize() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}


function setDivHeight() {
	var div = document.getElementById("framediv");
	var height = getSize();
	//div.style.height = (height - 270) + 'px';
	
	leftHeight = document.getElementById("leftcol").style.height;
	leftHeight = leftHeight.substr(0, leftHeight.length - 2);
	
	div.style.height = leftHeight - 100 + 'px'; 
}

function showHide(d) {
	d = document.getElementById(d);
	if (d.style.display == 'none') {
		d.style.display = 'block';	
	}
	else {
		d.style.display = 'none';	
	}
}

function checkForm(f, fields) {
	var checkfield = null;
	if (f.id == "frmTipsa") {
		checkfield = "tipsa_check";
	} else if (f.id == "frmMerInfo") {
		checkfield = "merinfo_check";
	}
	if (checkfield) {
		if (document.getElementById(checkfield).checked == false) {
			alert("Är du säker på att du inte är en robot?\nBevisa att du är en människa genom att bocka i\nrutan till vänster om texten\n'Jag är en människa'");
			return false;
		}
	}
	
	fieldAr = fields.split(',');
	var allok = true;

	for(var i in fieldAr) {
		//alert(fieldAr[i]);	
		eval("tf = f." + fieldAr[i] + ".value;");
		if (tf == "") {
			allok = false;
		}	
	}
	
	if (allok == true) {
		return true;	
	}
	else {
		alert("Något av fälten e-postadress/namn lämnades tomt.\n\nFörsök igen!");
		return false;
	}
}

