function ExplorerFix()
{
 for (a in document.links) document.links[a].onfocus = document.links[a].blur;
}

if (document.all)
{
	document.onmousedown = ExplorerFix;
}

function OpenWindow(href, width, height)
{
 var Win = window.open(href, '', 'width=' + width + ',height=' + height);
}

function OpenWindowDefine(href, width, height, settings)
{
 var Win = window.open(href, '', 'width=' + width + ',height=' + height + ',' + settings);
}

function browserCheck()
{
 this.ver=navigator.appVersion;
 this.agent=navigator.userAgent.toLowerCase();
 this.dom=document.getElementById?1:0;
 this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera;
 this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera;
 this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6);
 this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1);
 this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6);
 this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6);
 this.ie = (this.ie4 || this.ie5 || this.ie6);
 this.mac=(this.agent.indexOf("mac")>-1);
 this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar);
 this.ns4=(!this.dom && document.layers)?1:0;
 this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6);
 this.usedom= this.ns6;
 this.reuse = this.ie||this.usedom;
 this.px=this.dom&&!this.op5?"px":""
 return this
}

function submitPoemValidation()
{
	if ((document.gallery.poemtitle.value) == '')
	{
		alert('Please enter a poem title')
	}
	else
	{
		if ((document.gallery.poem.value) == '')
		{
			alert('Please enter a poem')
		}
		else
		{
			if ((document.gallery.age.value.length) != 0)
			{
				if ((document.gallery.age.value.length) == 1)
				{
					var pattern = /[0123456789 ]/;
				}
				else if ((document.gallery.age.value.length) == 2)
				{
					var pattern = /[0123456789 ][0123456789 ]/;
				}
				else
				{
					var pattern = /[0123456789 ][0123456789 ][0123456789 ]/;
				}
				if ((pattern.test(document.gallery.age.value)) == true)
				{
					document.gallery.submit();
				}
				else
				{
					alert('Please enter a valid age');
				}
			}
			else
			{
				document.gallery.submit();
			}	
		}
	}
}

function submitGalleryValidation()
{
	if ((document.gallery.picturetitle.value) == '')
	{
		alert('Please enter a picture title')
	}
	else
	{
		if ((document.gallery.attachment.value) == '')
		{
			alert('Please select a file')
		}
		else
		{
			if ((document.gallery.age.value.length) != 0)
			{
				if ((document.gallery.age.value.length) == 1)
				{
					var pattern = /[0123456789 ]/;
				}
				else if ((document.gallery.age.value.length) == 2)
				{
					var pattern = /[0123456789 ][0123456789 ]/;
				}
				else
				{
					var pattern = /[0123456789 ][0123456789 ][0123456789 ]/;
				}
				if ((pattern.test(document.gallery.age.value)) == true)
				{
					document.gallery.submit();
				}
				else
				{
					alert('Please enter a valid age');
				}
			}
			else
			{
				document.gallery.submit();
			}	
		}
	}
}