function bookmark () {

	var url = document.location;
	var title = document.title;

	try {
		if ((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4)) {
			window.external.AddFavorite(url,title);
		} else if (navigator.appName == 'Netscape') {
			window.sidebar.addPanel(title,url,'');
		} else alert('Press Control-D (Windows) or Command-D (Mac) to bookmark our site!');
	} catch (e) {
		alert('Press Control-D (Windows) or Command-D (Mac) to bookmark our site!');
	}
	return false;

}

function updateMac () {

	var portable = document.getElementById('portable').checked;
	var compact = document.getElementById('compact').checked;
	var basic = document.getElementById('basic').checked;
	var video = document.getElementById('video').checked;
	var prographics = document.getElementById('prographics').checked;
	var provideo = document.getElementById('provideo').checked;
	var games = document.getElementById('games').checked;
	var manygames = document.getElementById('manygames').checked;
	var display = document.getElementById('display').checked;

	var macbook = 1;
	var macbookair = 1;
	var macbookpro = 1;
	var macmini = 1;
	var imac = 1;
	var macpro = 1;
	var extras = 0;

	if (portable) {
		macbook++;
		macbookair++;
		macbookpro++;
		macmini = macmini - 3;
		imac = imac - 3;
		macpro = macpro - 3;
	}
	if (compact) {
		macbook++;
		macbookair++;
		macbookpro--;
		macmini++;
		imac++;
		macpro = macpro - 2;
	}
	if (basic) {
		macbook++;
		macbookair++;
		macbookpro--;
		macmini++;
		imac++;
		macpro--;		
	}
	if (video) {
		macbook++;
		macbookair++;
		macmini++;
		imac++;
	}
	if (prographics) {
		macbookair--;
		macbookpro++;
		imac++;
		macpro++;
		extras++;
	}
	if (provideo) {
		macbook--;
		macbookair = macbookair - 2;
		macbookpro++;
		macmini--;
		macpro++;
		extras++;
	}
	if (games) {
		macbookair--;
		macbookpro = macbookpro + 2;
		macmini--;
		imac = imac + 2;
		macpro = macpro + 2;		
	}
	if (manygames) {
		macbook = macbook - 2;
		macbookair = macbookair - 2;
		macbookpro--;
		macmini = macmini - 2;
		imac--;
		macpro = macpro + 2;		
	}
	if (display) {
		macbook--;
		macbookair--;
		macbookpro--;
		macmini++;
		imac--;
		macpro++;			
	}

	var scores = new Array();
	scores[0] = macbook;
	scores[1] = macbookair;
	scores[2] = macbookpro;
	scores[3] = macmini;
	scores[4] = imac;
	scores[5] = macpro;
	scores.sort(function(a,b){return a-b});
	
	var high = scores[5];

	macbook = adjustScore(macbook,high);
	macbookair = adjustScore(macbookair,high);
	macbookpro = adjustScore(macbookpro,high);
	macmini = adjustScore(macmini,high);
	imac = adjustScore(imac,high);
	macpro = adjustScore(macpro,high);

	setDisplay('macbook',macbook);
	setDisplay('macbook-air',macbookair);
	setDisplay('macbook-pro',macbookpro);
	setDisplay('mac-mini',macmini);
	setDisplay('imac',imac);
	setDisplay('mac-pro',macpro);

	var tips = 'Below are the computers that are recommended for you. If a choice is dimmed slightly, that means it&#8217;s less recommended, but it may still be a suitable choice for you. ';
	if (extras) tips += 'Based on your choices, you may want to consider customizing your Mac. In particular adding extra memory (RAM) can provide a significant performance boost. A larger hard drive or bigger display may also be useful to you. ';

	document.getElementById('tips').innerHTML = tips;

}

function updateiPod () {

	var notmuch = document.getElementById('notmuch').checked;
	var hundreds = document.getElementById('hundreds').checked;
	var thousands = document.getElementById('thousands').checked;
	var video = document.getElementById('video').checked;
	var manyvideos = document.getElementById('manyvideos').checked;
	var small = document.getElementById('small').checked;
	var workout = document.getElementById('workout').checked;
	var screen = document.getElementById('screen').checked;
	var tactile = document.getElementById('tactile').checked;
	var edit = document.getElementById('edit').checked;
	var wifi = document.getElementById('wifi').checked;
	var phone = document.getElementById('phone').checked;

	var shuffle = 1;
	var nano = 1;
	var classic = 1;
	var touch = 1;
	var iphone = 1;

	if (notmuch) {
		shuffle++;
		classic--;
	}
	if (hundreds) {
		shuffle--;
		nano++;
		classic--;
		touch++;
		iphone++;
	}
	if (thousands) {
		shuffle--;
		classic++;
	}
	if (video) {
		shuffle = shuffle - 2;
		nano++;
		classic++;
		touch++;
		iphone++;
	}
	if (manyvideos) {
		shuffle = shuffle - 2;
		nano--;
		classic++;
		touch++;
		iphone++;
	}
	if (small) {
		shuffle++;
		nano++;
		classic--;
		touch--;
		iphone--;
	}
	if (workout) {
		shuffle++;
		nano++;
		classic = classic - 2;
		touch--;
		iphone--;
	}
	if (screen) {
		shuffle = shuffle - 2;
		nano--;
		touch++;
		iphone++;
	}
	if (tactile) {
		shuffle++;
		nano++;
		classic++;
		touch--;
	}
	if (edit) {
		shuffle = shuffle - 3;
		nano = nano - 2;
		classic = classic - 2;
		touch++;
		iphone++;
	}
	if (wifi) {
		shuffle = shuffle - 3;
		nano = nano - 3;
		classic = classic - 3;
		touch = touch + 3;
		iphone = iphone + 3;
	}
	if (phone) {
		shuffle = shuffle - 4;
		nano = nano - 3;
		classic = classic - 3;
		touch = touch - 2;
		iphone = iphone + 3;
	}

	var scores = new Array();
	scores[0] = shuffle;
	scores[1] = nano;
	scores[2] = classic;
	scores[3] = touch;
	scores[4] = iphone;
	scores.sort(function(a,b){return a-b});
	
	var high = scores[4];

	shuffle = adjustScore(shuffle,high);
	nano = adjustScore(nano,high);
	classic = adjustScore(classic,high);
	touch = adjustScore(touch,high);
	iphone = adjustScore(iphone,high);

	setDisplay('ipod-shuffle',shuffle);
	setDisplay('ipod-nano',nano);
	setDisplay('ipod-classic',classic);
	setDisplay('ipod-touch',touch);
	setDisplay('iphone',iphone);

	var tips = 'Below are the iPods that are recommended for you. If a choice is dimmed slightly, that means it&#8217;s less recommended, but it may still be a suitable choice for you. ';

	document.getElementById('tips').innerHTML = tips;

}

function adjustScore (score,max) {
	return score / max;
}

function setDisplay (theid,score) {
	if (score < 0.5) {
		document.getElementById(theid).style.display = 'none';
	} else {
		document.getElementById(theid).style.display = 'block';
		document.getElementById(theid).style.opacity = score;
		document.getElementById(theid).style.filter = 'alpha(opacity=' + score*100 + ')';
	}
}