
function check_size() {
	var width=parseFloat(document.getElementById('width').value);
	var height=parseFloat(document.getElementById('height').value);
	var depth=parseFloat(document.getElementById('depth').value);
	var show=document.getElementById('results');
	var series="";
	var results="";
	var web="";
	if(isNaN(width) || isNaN(height) || isNaN(depth)) {
		alert('Please enter all values');
		return false;
	}
	var utx=check_utx(width,height,depth);
	var utx_t=check_utx_t(width,height,depth);
	var utx_sd=check_utx_sd(width,height,depth);
	if(utx == 1) {
		var series="UT-X";
		var web="http://www.havis.com/products/DEVMT_ULTM_UNVMT_W_LOCK-38912-0.html";
	}
	if(utx_t == 1) {
		var series="UT-X-T";
		var web="http://www.havis.com/products/DEVMT_ULTM_UNVMT_W_LOCK-38915-0.html";
	}
	if(utx_sd == 1) {
		var series="UT-X-SD";
		var web="http://www.havis.com/products/DEVMT_ULTM_UNVMT_W_LOCK_SP-38959-0.html"
	}
	if(series != "") {
		var results="Your laptop will fit in the "+series+" UNIVERSAL LAPTOP MOUNT";
	} else {
		for(i=0;i<=utx.length - 1;i++) {
			if(isNaN(utx[i])) {
				results=results+utx[i];	
			}
		}
		results=results+'<br />';
		for(i=0;i<=utx_t.length - 1;i++) {
			if(isNaN(utx_t[i])) {
				results=results+utx_t[i];	
			}
		}
		results=results+'<br />';
		for(i=0;i<=utx_sd.length - 1;i++) {
			if(isNaN(utx_sd[i])) {
				results=results+utx_sd[i];	
			}
		}
	}
	show.innerHTML="<strong class='style8o'>"+results+"</strong><br />";
	if(web != "") {
		show.innerHTML+="<br /><a class=\"style8l\" href=\""+web+"\">Click here you get your "+series+" NOW!</a>";
	}
}

function check_utx(width,height,depth) {
	/*
		UT-X
		Width: 11.43 - 14.23
		Depth: 9.3-11
		Height: 0.7-1.1
	*/
	var utx_result="";
	if(width < 11.43) {
		var sw='The width of your device is too small to fit in the UT-X mount.<br />';
	} else if(width > 14.23) {
		var sw='The width of your device is too large to fit in the UT-X mount.<br />';
	} else {
		var sw=1;	
	}
	if(height < .7) {
		var ht='The height of your device is too small to fit in the UT-X mount.<br />';
	} else if(height > 1.1) {
		var ht='The height of your device is too large to fit in the UT-X mount.<br />';
	} else {
		var ht=1;	
	}
	if(depth < 9.3) {
		var dp='The depth of your device is too small to fit in the UT-X mount.<br />';
	} else if(depth > 11) {
		var dp='The depth of your device is too large to fit in the UT-X mount.<br />';
	} else {
		var dp=1;	
	}
	if(sw==1 && ht==1 && dp==1) {
		utx_result=1;	
	} else {
		utx_result=Array(sw,ht,dp);
	}
	return utx_result;
}

function check_utx_t(width,height,depth) {
	/*
		UT-X-T
		Width: 11.43-14.23
		Depth: 9.27-11.02
		Height: 1.34-1.86
	*/
	var utxt_result="";
	if(width < 11.43) {
		var sw='The width of your device is too small to fit in the UT-X-T mount.<br />';
	} else if(width > 14.23) {
		var sw='The width of your device is too large to fit in the UT-X-T mount.<br />';
	} else {
		var sw=1;	
	}
	if(height < 1.34) {
		var ht='The height of your device is too small to fit in the UT-X-T mount.<br />';
	} else if(height > 1.86) {
		var ht='The height of your device is too large to fit in the UT-X-T mount.<br />';
	} else {
		var ht=1;	
	}
	if(depth < 9.27) {
		var dp='The depth of your device is too small to fit in the UT-X-T mount.<br />';
	} else if(depth > 11.02) {
		var dp='The depth of your device is too large to fit in the UT-X-T mount.<br />';
	} else {
		var dp=1;	
	}
	if(sw==1 && ht==1 && dp==1) {
		utxt_result=1;	
	} else {
		utxt_result=Array(sw,ht,dp);
	}
	return utxt_result;
}

function check_utx_sd(width,height,depth) {
	/*
		UT-X-SD
		Width: 9.42-11.4
		Depth: 7.58-9.33
		Height: 0.63-1.51
	*/
	var utxsd_result="";
	if(width < 9.42) {
		var sw='The width of your device is too small to fit in the UT-X-SD mount.<br />';
	} else if(width > 11.40) {
		var sw='The width of your device is too large to fit in the UT-X-SD mount.<br />';
	} else {
		var sw=1;	
	}
	if(height < .63) {
		var ht='The height of your device is too small to fit in the UT-X-SD mount.<br />';
	} else if(height > 1.51) {
		var ht='The height of your device is too large to fit in the UT-X-SD mount.<br />';
	} else {
		var ht=1;	
	}
	if(depth < 7.58) {
		var dp='The depth of your device is too small to fit in the UT-X-SD mount.<br />';
	} else if(depth > 9.33) {
		var dp='The depth of your device is too large to fit in the UT-X-SD mount.<br />';
	} else {
		var dp=1;	
	}
	if(sw==1 && ht==1 && dp==1) {
		utxsd_result=1;	
	} else {
		utxsd_result=Array(sw,ht,dp);
	}
	return utxsd_result;
}


function check_size_old() {
	var width=parseFloat(document.getElementById('width').value);
	var height=parseFloat(document.getElementById('height').value);
	var depth=parseFloat(document.getElementById('depth').value);
	if(isNaN(width) || isNaN(height) || isNaN(depth)) {
		alert('Please enter all values');
		return false;
	}
	if(width < 11.4) {
		var sw='The width of your device is too small to fit in the mount.<br />';
	} else if(width > 14.2) {
		var sw='The width of your device is too large to fit in the mount.<br />';
	} else {
		var sw=1;	
	}
	if(height < .7) {
		var ht='The height of your device is too small to fit in the mount.<br />';
	} else if(height > 1.1) {
		var ht='The height of your device is too large to fit in the mount.<br />';
	} else {
		var ht=1;	
	}
	if(depth < 9.3) {
		var dp='The depth of your device is too small to fit in the mount.<br />';
	} else if(depth > 11) {
		var dp='The depth of your device is too large to fit in the mount.<br />';
	} else {
		var dp=1;	
	}
	if(sw==1 && ht==1 && dp==1) {
		results='Your laptop will fit in the universal laptop mount';	
	} else {
		results="";
		if(sw!=1) {
			results+=sw;
		}
		if(ht!=1) {
			results+=ht;
		}
		if(dp!=1) {
			results+=dp;
		}
	}
	document.getElementById('results').innerHTML="<strong class='style8o'>"+results+"</strong>";
}

