function whiten(thisElement) {
	thisElement.style.backgroundColor='white';
}
function darken(thisElement, thisColor) {
	thisElement.style.backgroundColor=thisColor;
}


function swapImg(maxImg, thisImg) {
	thisImg ++;
	if(thisImg == maxImg) { thisImg = 0; }
	for(x=0; x<maxImg; x++) {
		imgTag = 'slide_'+x;
		document.getElementById(imgTag).style.display='none';
	}

	document.getElementById('slide_'+thisImg).style.display='block';
	return false;
}
function swapImgIE(maxImg) {
	thisImg = document.forms['variables'].currImg.value;
	document.forms['variables'].currImg.value ++;
	if(document.forms['variables'].currImg.value == maxImg) {
		document.forms['variables'].currImg.value = 0;
	}
	swapImg(maxImg, thisImg);
}

function bookmark() {
	if(window.sidebar) { window.sidebar.addPanel(document.title, document.location, ""); }
	else if(window.external) { window.external.AddFavorite(document.location, document.title); }
	else { alert("Your browser may not support javascript bookmarking."); }
}
function email(domain, article) {
	document.location = "mailto:?body=http://www." + domain + ".com/article/" + article;
}
function font() {
	if(document.getElementById('logoImg').value) { 
		if(document.getElementById('logoImg').value == 10) { document.getElementById('logoImg').value = 14; }
		else {
			if(document.getElementById('logoImg').value == 14) { document.getElementById('logoImg').value = 18; }
			else {
				document.getElementById('logoImg').value = 10;
			}
		}
	}
	else { document.getElementById('logoImg').value = 14; }
	document.getElementById('articleText').style.fontSize = document.getElementById('logoImg').value + "pt";
	return false;
}
function adjust() {
	var ht1 = document.getElementById('featuresBox').offsetHeight;
	var ht2 = document.getElementById('headlineBox').offsetHeight;
}
function printLog(thisArticle) {
	document.getElementById('recommendLink').src = "/recommend/print/" + thisArticle;
	return false;
}
function writeMail(user, text, domain) {
	document.write('<a href="mailto:'+user+'@');
	if(domain != "") { document.write(domain); }
	document.write('">');
	if(text != "") { document.write(text); }
	else {
		if(domain != "") { document.write(user+'@'+domain); }
		else { document.write('thecordovatimes.com'); }
	}
	document.write('</a>');
}
function writeMail2(user, text, domain) {
	document.write('<a href="mailto:'+user+'@');
	if(domain != "") { document.write(domain); }
	else { document.write('thecordovatimes.com'); }
	if(text != "") {
		document.write('">'+text+'</a>');
	}
	else {
		document.write('">'+user+'@');
		if(domain != "") { document.write(domain); }
		else { document.write('thecordovatimes.com'+'</a>'); }
	}
}
function writeMail_old(user, domain, text, repeat, webmaster) {
 	document.write('<a href="mailto:' + user + '@' + domain + '"');
	if(webmaster == 1) {
		document.write(' onClick="alert(\'Please do not send questions about content, archives, advertising, or editorial to this address.\')"');
	}
	document.write('>');
	if(repeat == 1) {
 		document.write(user + '@' + domain);
	}
	else {
		document.write(text);
	}
  	document.write('</a>');
}
function frameBust() {
	linkCollection = document.getElementsByTagName('link');
	var locRef = document.location;
	for (i=0; i<linkCollection.length; i++) {
		if (linkCollection[i].hasAttribute("rel")) {
			var relName = linkCollection[i].getAttribute('rel');
			if(relName == "canonical") {
				var locRef = linkCollection[i].getAttribute('href');
			}
		}
	}
	if(locRef != document.location && locRef + "#" != document.location && locRef + "?showerrors=1" != document.location) {
		document.location = locRef;
	}
}
function checkForm() {
	switch(document.keypressForm.pressed.value) {
		case "38+": case "38+38+": case "38+38+40+": case "38+38+40+40+": case "38+38+40+40+37+": case "38+38+40+40+37+39+": case "38+38+40+40+37+39+37+": case "38+38+40+40+37+39+37+39+": case "38+38+40+40+37+39+37+39+66+": case "38+38+40+40+37+39+37+39+66+65+":
			break;
		case "38+38+40+40+37+39+37+39+66+65+13+":
			document.cookie='konami'+'=1';
			document.location="index.php";
		default:
			document.keypressForm.pressed.value = "";
			break;
	}
}
function keyPress(whichKey) { 
	arrows=((whichKey.which)||(whichKey.keyCode));
	document.keypressForm.pressed.value = document.keypressForm.pressed.value + arrows + "+";
	checkForm();
}
function checkSubForm() {
	var radioLength = document.forms['subForm'].elements['delivery'].length;
	for(var i = 0; i < radioLength; i++) {
		if(document.forms['subForm'].elements['delivery'][i].checked){ checkVal = document.forms['subForm'].elements['delivery'][i].value; }
	}
	if(checkVal != 'address') {
		document.forms['subForm'].submit();
	}
	else {
		if(document.forms['subForm'].elements['name'].value == "") {
			var bad = 1;
			document.getElementById('subForm_name').style.backgroundColor = "yellow";
			document.getElementById('name_alert').style.display = "inline";
		}
		if(document.forms['subForm'].elements['address'].value == "") {
			var bad = 1;
			document.getElementById('subForm_address').style.backgroundColor = "yellow";
			document.getElementById('address_alert').style.display = "inline";
		}
		if(document.forms['subForm'].elements['city'].value == "") {
			var bad = 1;
			document.getElementById('subForm_city').style.backgroundColor = "yellow";
			document.getElementById('citystatezip_alert').style.display = "inline";
		}
		if(document.forms['subForm'].elements['state'].value == "") {
			var bad = 1;
			document.getElementById('subForm_state').style.backgroundColor = "yellow";
			document.getElementById('citystatezip_alert').style.display = "inline";
		}
		if(document.forms['subForm'].elements['zip'].value == "") {
			var bad = 1;
			document.getElementById('subForm_zip').style.backgroundColor = "yellow";
			document.getElementById('citystatezip_alert').style.display = "inline";
		}
		if(bad != 1) {
			document.forms['subForm'].submit();
		}
	}
}
function highlight(id) {
	document.getElementById(id).style.background = "#d9e0f6";
}
function highlightoff(id) {
	document.getElementById(id).style.background = "#f5f5f5";
}
function writeMailOld(user, domain, text, repeat, webmaster) {
 	document.write('<a href="mailto:' + user + '@' + domain + '"');
	if(webmaster == 1) {
		document.write(' onClick="alert(\'Please do not send questions about content, archives, advertising, or editorial to this address.\')"');
	}
	document.write('>');
	if(repeat == 1) {
 		document.write(user + '@' + domain);
	}
	else {
		document.write(text);
	}
  	document.write('</a>');
}
