// archive selections
function archive_vol()
	{
		
		var dropdown = document.getElementById("volumes");
		
		location.href = "http://shawlman.com/issues/"+dropdown.options[dropdown.selectedIndex].value+"/";
		
	}
function archive_sec()
	{
		
		var dropdown = document.getElementById("sections");
		
		location.href = "http://shawlman.com/archive/section/"+dropdown.options[dropdown.selectedIndex].value+"/";
		
	}
function archive_cat()
	{
		
		var dropdown = document.getElementById("categories");
		
		location.href = "http://shawlman.com/archive/category/"+dropdown.options[dropdown.selectedIndex].value+"/";
		
	}
function archive_set()
	{
		
		var dropdown = document.getElementById("sets");
		
		location.href = "http://shawlman.com/archive/set/"+dropdown.options[dropdown.selectedIndex].value+"/";
		
	}
function archive_con()
	{
		
		var dropdown = document.getElementById("contributors");
		
		location.href = "http://shawlman.com/archive/author/"+dropdown.options[dropdown.selectedIndex].value+"/";
		
	}

// copy to clipboard
function ClipBoard() 
	{
		holdtext.innerText = copytext.innerText;
		Copied = holdtext.createTextRange();
		
		Copied.execCommand("Copy");
	}

// tabbed boxes
function toggleLayer(whichLayer)
	{
		var elem, vis;
		if(document.getElementById) // this is the way the standards work
		elem = document.getElementById(whichLayer);
		else if(document.all) // this is the way old msie versions work
		elem = document.all[whichLayer];
		else if(document.layers) // this is the way nn4 works
		elem = document.layers[whichLayer];
		vis = elem.style;
		// if the style.display value is blank we try to figure it out here
		if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
		vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
		vis.display = (vis.display==''||vis.display=='block')?'none':'block';
	}

// tabbed boxes
function switchTab(tabView,tabHide)
	{
	
		if (document.getElementById)
			{
				document.getElementById(tabView).style.display = "block";
				document.getElementById(tabHide).style.display = "none";
				
				return false;
			}
	}

// tabbed boxes
function switchThreeTab(tabView,tabHide1,tabHide2)
	{
	
		if (document.getElementById)
			{
				document.getElementById(tabView).style.display = "block";
				document.getElementById(tabHide1).style.display = "none";
				document.getElementById(tabHide2).style.display = "none";
				
				return false;
			}
	}

// tabbed boxes
function switchFourTab(tabView,tabHide1,tabHide2,tabHide3)
	{
	
		if (document.getElementById)
			{
				document.getElementById(tabView).style.display = "block";
				document.getElementById(tabHide1).style.display = "none";
				document.getElementById(tabHide2).style.display = "none";
				document.getElementById(tabHide3).style.display = "none";
				
				return false;
			}
	}

// tabbed boxes
function switchFiveTab(tabView,tabHide1,tabHide2,tabHide3,tabHide4)
	{
	
		if (document.getElementById)
			{
				document.getElementById(tabView).style.display = "block";
				document.getElementById(tabHide1).style.display = "none";
				document.getElementById(tabHide2).style.display = "none";
				document.getElementById(tabHide3).style.display = "none";
				document.getElementById(tabHide4).style.display = "none";
				
				return false;
			}
	}
function switchFiveTabReverse(tabView,tabHide1,tabHide2,tabHide3,tabHide4)
	{
	
		if (document.getElementById)
			{
				document.getElementById(tabView).style.display = "none";
				document.getElementById(tabHide1).style.display = "block";
				document.getElementById(tabHide2).style.display = "block";
				document.getElementById(tabHide3).style.display = "block";
				document.getElementById(tabHide4).style.display = "block";
				
				return false;
			}
	}
	
// contact verify
function verify()
	{
		var themessage = "You are required to complete the following fields: ";
		if (document.forms.contact.name.value=="")
			{
				themessage = themessage + " - Name";
			}
		if (document.forms.contact.email.value=="")
			{
				themessage = themessage + " -  E-mail";
			}
		if (document.forms.contact.department.value=="checked")
			{
				themessage = themessage + " -  Department";
			}
		if (document.forms.contact.message.value=="")
			{
				themessage = themessage + " -  Message";
			}
		
		//alert if fields are empty and cancel form submit
		if (themessage == "You are required to complete the following fields: ")
			{
				return true;
			}
		
		else
			{
				alert(themessage);
				return false;
		   }
	}
	
// commenting verify
function verifyC1()
	{
		var themessage = "You are required to complete the following fields: ";
		if (document.forms.form_comment.comment.value=="")
			{
				themessage = themessage + " - Comment";
			}
		
		//alert if fields are empty and cancel form submit
		if (themessage == "You are required to complete the following fields: ")
			{
				return true;
			}
		
		else
			{
				alert(themessage);
				return false;
		   }
	}
	
// commenting verify (without apages)
function verifyC2()
	{
		var themessage = "You are required to complete the following fields: ";
		if (document.forms.form_comment.comment_author.value=="")
			{
				themessage = themessage + " - Name";
			}
		if (document.forms.form_comment.email.value=="")
			{
				themessage = themessage + " -  E-mail";
			}
		if (document.forms.form_comment.comment.value=="")
			{
				themessage = themessage + " -  Comment";
			}
		
		//alert if fields are empty and cancel form submit
		if (themessage == "You are required to complete the following fields: ")
			{
				return true;
			}
		
		else
			{
				alert(themessage);
				return false;
		   }
	}
	
// apages verify
function apages_verify()
	{
		var themessage = "You are required to complete the following fields: ";
		if (document.forms.apages_registration.display_name.value=="")
			{
				themessage = themessage + " - Display Name";
			}
		if (document.forms.apages_registration.email.value=="")
			{
				themessage = themessage + " - E-mail";
			}
		if (document.forms.apages_registration.username.value=="")
			{
				themessage = themessage + " - Username";
			}
		if (document.forms.apages_registration.password.value=="")
			{
				themessage = themessage + " - Password";
			}
		
		//alert if fields are empty and cancel form submit
		if (themessage == "You are required to complete the following fields: ")
			{
				return true;
			}
		
		else
			{
				alert(themessage);
				return false;
		   }
	}

// character counter
var maxLength = 900;
function charLimit(el)
	{
		if (el.value.length > maxLength)
			{
				return false;
			}
		return true;
	}
function characterCount(el)
	{
		var charCount = document.getElementById('charCount');
		if (el.value.length > maxLength)
			{
				el.value = el.value.substring(0,maxLength);
			}
		if (charCount)
			{
				charCount.innerHTML = maxLength - el.value.length;
			}
		return true;
	}

// dynamic character counter 1
function DcharacterCount(el,maxLength)
	{
		var DcharCount = document.getElementById('DcharCount');
		if (el.value.length == 0)
			{
				DcharCount.innerHTML = "0";
			}
		if (DcharCount)
			{
				DcharCount.innerHTML = el.value.length + " characters (" + (maxLength - el.value.length) + " left)";
			}
		return true;
	}

// dynamic character counter 2
function D2characterCount(el,maxLength)
	{
		var D2charCount = document.getElementById('D2charCount');
		if (el.value.length == 0)
			{
				D2charCount.innerHTML = "0";
			}
		if (D2charCount)
			{
				D2charCount.innerHTML = el.value.length + " characters (" + (maxLength - el.value.length) + " left)";
			}
		return true;
	}

// dynamic character counter 3
function DcharacterCount2(el,maxLength)
	{
		var DcharCount = document.getElementById('DcharCount');
		if (el.value.length == 0)
			{
				DcharCount.innerHTML = "0";
			}
		if (DcharCount)
			{
				DcharCount.innerHTML = el.value.length + " out of " + (maxLength - el.value.length) + " characters";
			}
		return true;
	}

