var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try {
var pageTracker = _gat._getTracker("UA-9601366-1");
pageTracker._trackPageview();
} catch(err) {}

function setActiveStyleSheet(title) {

   var i, a, main;

   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {

     if(a.getAttribute("rel").indexOf("style") != -1

        && a.getAttribute("title")) {

       a.disabled = true;

       if(a.getAttribute("title") == title) a.disabled = false;

     }

   }

}

var currentSheet = "small";

function textBigger()
{
	if(currentSheet == "medium")
	{
		setActiveStyleSheet('Large');
		currentSheet = "large";
	}

	if(currentSheet == "small")
	{
		setActiveStyleSheet('Medium');
		currentSheet = "medium";
	}


}

function textSmaller()
{
	if(currentSheet == "medium")
	{
		setActiveStyleSheet('Small');
		currentSheet="small";
	}

	if(currentSheet == "large")
	{
		setActiveStyleSheet('Medium');
		currentSheet="medium";
	}
}

function writeDate()
{
	var theDate = new Date();
	var theDay = theDate.getDay();
	var theMonth = theDate.getMonth();
	var theYear = theDate.getFullYear();
	var dayDate = theDate.getDate();
	
	//----
	
	var days = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
	var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	
	//----
	
	var suffix = "";
	
	if((dayDate == 1) || (dayDate == 21) || (dayDate == 31))
	{
		suffix = "st";
	}
	
	if((dayDate == 2) || (dayDate == 22))
	{
		suffix = "nd";
	}
	
	if((dayDate == 3) || (dayDate == 23))
	{
		suffix = "rd";
	}
	
	if(suffix == "")
	{
		suffix = "th";
	}	
	
	//----
	
	document.write("</b><font color=\"#7B7B7B\"><a href='javascript:textBigger()' class='grey'>Large Text</a> | <a href='javascript:textSmaller();' class='grey'>Small Text</a> |</font><b> ");
	document.write(days[theDay]+" "+dayDate+suffix+" "+months[theMonth]+" "+theYear);
}

//--------------------------------------------------------

function menuCollapse( menu_name )
{
	var theMenu = document.getElementById(menu_name);
	
	if(theMenu.style.visibility == "hidden")
	{
		theMenu.style.visibility = "visible";
		theMenu.style.position   = "relative";
	}
	else
	{
		theMenu.style.visibility = "hidden";
		theMenu.style.position   = "absolute";
	}
	
	
}

//---------------------------------------------------------

function openRelWindow()
{
	if(document.getElementById(parent.pagetype))
	{
		var theMenu = document.getElementById(parent.pagetype);
		theMenu.style.visibility = "visible";
		theMenu.style.position = "relative";
	}
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid Email Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid Email Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid Email Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid Email Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid Email Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid Email Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.addComment.newCommentEmail
	var nameID=document.addComment.newCommentName
	var textID=document.addComment.newCommentText
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email Address")
		emailID.focus()
		return false
	}
	if ((nameID.value==null)||(nameID.value=="")){
		alert("Please enter your name")
		nameID.focus()
		return false
	}
	if ((textID.value==null)||(textID.value=="")){
		alert("Please enter a comment!")
		textID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }