// JavaScript Document

function kollaBredd() {
	
	s = screen.width	
	
	if(s >= 1280) {
		
		vanster=241; 
	}
		else if(s >=1152 ) {
			
			vanster=180;	
			
	}	else if(s >= 1024){
		
			vanster=117;
			
	}	else if(s >= 800) {
		
			vanster = 6;
	}	
	
}




function toLink(url) {
		kollaBredd();
		//Originalhöjd 580
		window.open (url, 'fjarris', 'toolbar=yes,menubar=yes,resizable=no,scrollbars=no,status=no, location=no, width=770,height=500,top=250, left='+vanster);
		}

function change(picture) {
document.theimg.src = picture
}

function change2(picture) {
document.theimg2.src = picture
}

function change4(picture) {
document.theimg4.src = picture
}

function change5(picture) {
document.theimg5.src = picture
}

function change6(picture) {
document.theimg6.src = picture
}

function change7(picture) {
document.theimg7.src = picture
}

function change8(picture) {
document.theimg8.src = picture
}

<!-- hide this script tag's contents from old browsers

function computeBMR(form){



   form.BMRMale.value = Math.round(66.473 + ((form.weight.value / 2.2 ) * 13.751) + (5.0033 * form.height.value * 2.54) - (6.55 * form.age.value));



    form.BMRFemale.value = Math.round(665.51 + ((form.weight.value / 2.2 ) * 9.463) + (1.8496 * form.height.value * 2.54) - (4.6756 * form.age.value));





    return;



}







function computeTotal(form){



    if (form.vlight.value.length == 0){



       form.vlight.value = "0";



    }



    if (form.light.value.length == 0){



       form.light.value = "0";



    }



    if (form.moderate.value.length == 0){



       form.moderate.value = "0";



    }



    if (form.heavy.value.length == 0){



       form.heavy.value = "0";



    }



    if (form.vheavy.value.length == 0){



       form.vheavy.value = "0";



    }



    form.TotMale.value = Math.round((1.4 * form.vlight.value) + (2.5 * form.light.value) + (4.2 *form.moderate.value) + (8.2 * form.heavy.value) + (12 * form.vheavy.value));



   



    return;



}







function clearBMR(form){



    form.age.value = "";



    form.weight.value = "";



    form.height.value = "";



    form.BMRMale.value = "";



    form.BMRFemale.value = "";



    return;



}







function clearTotal(form){



    form.vlight.value = "0";



    form.light.value = "0";



    form.moderate.value = "0";



    form.heavy.value = "0";



    form.vheavy.value = "0";



    form.TotMale.value = "0";



    form.TotFemale.value = "0";



    return;



}


<!-- Begin
function mod(div,base) {
return Math.round(div - (Math.floor(div/base)*base));
}
function calcBmi() {
var w = document.bmi.weight.value * 1;
var HeightFeetInt = document.bmi.htf.value * 1;
var HeightInchesInt = document.bmi.hti.value * 1;
HeightFeetConvert = HeightFeetInt * 12;
h = HeightFeetConvert + HeightInchesInt;
displaybmi = (Math.round((w * 703) / (h * h)));
if ( (w <= 35) || (w >= 500)  || (h <= 48) || (h >= 120) ) {
alert ("Invalid data.  Please check and re-enter!");
return false;
}
if (HeightInchesInt > 11) {
reminderinches = mod(HeightInchesInt,12);
document.bmi.hti.value = reminderinches;
document.bmi.htf.value = HeightFeetInt + 
((HeightInchesInt - reminderinches)/12);
document.bmi.answer.value = displaybmi;
}
if (displaybmi <19) 
document.bmi.comment.value = "Underweight";
if (displaybmi >=19 && displaybmi <=25) 
document.bmi.comment.value = "Desirable";
if (displaybmi >=26 && displaybmi <=29) 
document.bmi.comment.value = "prone to health risks";
if (displaybmi >=30 && displaybmi <=40) 
document.bmi.comment.value = "Obese";
if (displaybmi >40) 
document.bmi.comment.value = "Extremely obese";
document.bmi.answer.value = displaybmi;
}
//  End -->

<!-- Begin
var myWeight;
var myDistance;
function HowMany(form) {
var difference;
difference = (myDistance * myWeight) * .653;
form.Fdiff.value = difference;
    
if (difference < 100) {
form.comment.value="You better start working!";
}
if (difference >  101 && difference < 200) {
form.comment.value="Nice run, but you can do better.";
}
if (difference >  201 && difference < 300) {
form.comment.value=".";
}
if (difference >  301 && difference < 500) {
form.comment.value="";
}
if (difference >  501 && difference < 700) {
form.comment.value="";
}
if (difference > 701) {
form.comment.value="";  
}
}
function SetMyWeight(weight) {
myWeight = weight.value;
}
function SetmyDistance(dis) {
myDistance = dis.value;
}
function ClearForm(form){
form.myWeight.value = "";
form.myDistance.value = "";
form.Fdiff.value = "";
form.comment.value = "";
}
// End -->

function ClearForm(form){

    form.weight.value = "";

    form.height.value = "";

    form.bmi.value = "";

    form.my_comment.value = "";

}

function bmi(weight, height) {

          bmindx=weight/eval(height*height);

          return bmindx;

}

function checkform(form) {

       if (form.weight.value==null||form.weight.value.length==0 ||form.height.value==null||form.height.value.length==0){

            alert("\nFyll i vikt och längd!");

            return false;

       }

       else if (parseFloat(form.height.value) <= 0||

                parseFloat(form.height.value) >=500||

                parseFloat(form.weight.value) <= 0||

                parseFloat(form.weight.value) >=500){

                alert("\nReally know what you're doing? \nPlease enter values again. \nWeight in kilos and \nheight in cm");

                ClearForm(form);

                return false;

       }

       return true;

}

function computeform(form) {

       if (checkform(form)) {

       yourbmi=Math.round(bmi(form.weight.value, form.height.value/100));

       form.bmi.value=yourbmi;

       if (yourbmi >40) {

          form.my_comment.value="Du är kraftigt överviktig";

       }

       else if (yourbmi >30 && yourbmi <=40) {

          form.my_comment.value="Du är överviktig";

       }

       else if (yourbmi >27 && yourbmi <=30) {

          form.my_comment.value="Du är något överviktig";

       }

       else if (yourbmi >26 && yourbmi <=27) {

          form.my_comment.value="Du är lite överviktig";

       }

       else if (yourbmi >=21 && yourbmi <=25) {

          form.my_comment.value="Mycket bra! Fortsätt så!";

       }

       else if (yourbmi >=18 && yourbmi <21) {

          form.my_comment.value="Du är något underviktig";

       }

       else if (yourbmi >=16 && yourbmi <18) {

          form.my_comment.value="Du är underviktig";

       }

       else if (yourbmi <16) {

          form.my_comment.value="Du är kraftigt underviktig ";

       }

       }

       return;

}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' måste anges.\n'; }
  } if (errors) alert('Följande fel inträffade:\n'+errors);
  document.MM_returnValue = (errors == '');
}