$(document).ready(function() 
{

// click function for opening and closing 'siteplan'
	$('#masthead li[title=all]')
	.toggle(function(event)
	{
		var winWidth = $(window) .width();
		var leftSide = winWidth/2 - 500;
		var allPosition = leftSide + 15;
		$('#siteplan') .css('left', allPosition);
		$('#siteplan') .fadeIn('fast');
		$(this) .addClass('all_clicked');
		$(this) .text('site map -  ');
		}, function(event)
		{
			$('#siteplan') .fadeOut('fast');
			$(this) .removeClass('all_clicked');
			$(this) .text('site map+');
	});
	
// click for login_form
	if(!readCookie("username"))
	{
	$('#login')
	.toggle(function(event)
	{
		if ($('#login_form'))
		{
			$('#login_form') .fadeOut('fast');
		};  
		$('#login_form') .css('top', 140);
		var winWidth = $(window) .width();
		var leftSide = winWidth/2 - 500;
		var login_form_pos = leftSide - 1;
		$('#login_form') .css('left', login_form_pos);
		$('#login_form') .fadeIn('fast')
		}, function(event)
		{
			$('#login_form') .fadeOut('fast');
		});
	};
	

// for tabbed interface
	if ($('div') .hasClass('tabbedInterface'))
	{
		$('.tabbedInterface > ul').tabs();
	};
	
	$('div.tabbedInterface') .each(function()
	{
	$('div.tabbedInterface ul li:first-child') .addClass('selectedTab');
	});

	$('.tabbedInterface ul li a')
	.bind('click', function(event)
	{
		var parentThis = $(this).parent();
		var parentUp = $(parentThis).parent();
		var chidrenAll = $(parentUp).children();
		$(chidrenAll) .removeClass('selectedTab');
		$(parentThis) .addClass('selectedTab');
	});
	
// for tabbedInterface_160
	if ($('div') .hasClass('tabbedInterface_160'))
	{
		$('.tabbedInterface_160 > ul').tabs();
	};
	
	$('div.tabbedInterface_160') .each(function()
	{
	$('div.tabbedInterface_160 ul li:first-child') .addClass('selectedTab');
	});

	$('.tabbedInterface_160 ul li a')
	.bind('click', function(event)
	{
		var parentThis = $(this).parent();
		var parentUp = $(parentThis).parent();
		var chidrenAll = $(parentUp).children();
		$(chidrenAll) .removeClass('selectedTab');
		$(parentThis) .addClass('selectedTab');
	});

// for tabbed interface_220
	if ($('div') .hasClass('tabbedInterface_220'))
	{
		$('.tabbedInterface_220 > ul').tabs();
	};
	
	$('div.tabbedInterface_220') .each(function()
	{
	$('div.tabbedInterface_220 ul li:first-child') .addClass('selectedTab');
	});

	$('.tabbedInterface_220 ul li a')
	.bind('click', function(event)
	{
		var parentThis = $(this).parent();
		var parentUp = $(parentThis).parent();
		var chidrenAll = $(parentUp).children();
		$(chidrenAll) .removeClass('selectedTab');
		$(parentThis) .addClass('selectedTab');
	});

	
// for tabbed interface noTop (no top margin)
	if ($('div') .hasClass('tabbedInterface_noTop'))
	{
		$('.tabbedInterface_noTop > ul').tabs();
	};
	
	$('div.tabbedInterface_noTop') .each(function()
	{
	$('div.tabbedInterface_noTop ul li:first-child') .addClass('selectedTab');
	});

	$('.tabbedInterface_noTop ul li a')
	.bind('click', function(event)
	{
		var parentThis = $(this).parent();
		var parentUp = $(parentThis).parent();
		var chidrenAll = $(parentUp).children();
		$(chidrenAll) .removeClass('selectedTab');
		$(parentThis) .addClass('selectedTab');
	});
	
// for tabbed interface noTop2 (no top margin, without rounded corner)
	if ($('div') .hasClass('tabbedInterface_noTop2'))
	{
		$('.tabbedInterface_noTop2 > ul').tabs();
	};
	
	$('div.tabbedInterface_noTop2') .each(function()
	{
	$('div.tabbedInterface_noTop2 ul li:first-child') .addClass('selectedTab');
	});

	$('.tabbedInterface_noTop2 ul li a')
	.bind('click', function(event)
	{
		var parentThis = $(this).parent();
		var parentUp = $(parentThis).parent();
		var chidrenAll = $(parentUp).children();
		$(chidrenAll) .removeClass('selectedTab');
		$(parentThis) .addClass('selectedTab');
	});

// for search result tabs
	if ($('#searchResultsTabs'))
	{
		$('#searchResultsTabs > ul').tabs();
	};
	
	$('#searchResultsTabs') .each(function()
	{
	$('#searchResultsTabs ul li:first-child') .addClass('searchTabFront');
	});

	$('#searchResultsTabs ul li a')
	.bind('click', function(event)
	{
		var parentThis = $(this).parent();
		var parentUp = $(parentThis).parent();
		var chidrenAll = $(parentUp).children();
		$(chidrenAll) .removeClass('searchTabFront');
		$(parentThis) .addClass('searchTabFront');
	});

		
// x position for army masthead
	if($('#armyMasthead'))
	{
		function armyMastheadPosition()
		{
			var winWidth = $(window) .width();
			var leftSide = winWidth/2 - 500;
			var mastPosition = leftSide - 93;
			$('#armyMasthead') .css('left', mastPosition);
		};
		$( window ).resize(armyMastheadPosition);
		armyMastheadPosition();
	};
	
// temp function for main nav highlight while on appropriate page -- for samples; need employ detection and update to accomodate subsection pages
	var locName = $('#mastsectname') .text();
	var locNameBg = "#masthead li[title=" + locName + "]";
	var locNameText = locNameBg + " a:first";
	if (locName == "news" ||locName == "sport" || locName == "entertainment" || locName == "business" || locName == "travel" || locName == "advice" || locName == "opinion" || locName == "multimedia")
	{
		$(locNameBg) .addClass('navMarker');
		$(locNameText) .css('color', '#ffffff');
	};
	
// font-resize functions on articlepage and columnists_article pages
	if ($('#article_main'))
	{
		$('#article_main p') .css('font-size', '130%');
		$('#resize1')
		.toggle(function(event)
			{
				$('#article_main p') .css('font-size', '170%');  
			}, function(event)
			{
				$('#article_main p') .css('font-size', '130%');
		});
	};

// font-resize functions on blog entry pages
	if ($('#blog_cont_re'))
	{
		$('#resize1')
		.toggle(function(event)
			{
				if ($('#blog_cont_re') .css('font-size', '130%'))
				{
				$('#blog_cont_re') .css('font-size', '170%');
				};  
			}, function(event)
			{
				$('#blog_cont_re') .css('font-size', '170%');
		});
	};
	
	// member_center: change password display toggle (3 forms at top of member_center_form.html)
	
	if ($('div.changePassword'))
	{
	$('div.changePassword')
	.toggle(function(event)
	{
		$('div.changePasswordForm') .show();
		}, function(event)
		{
		$('div.changePasswordForm') .hide();
	});
	};

		      	
// expanding box for Follow Us box
	if ($('div') .hasClass('newFollowUs_300'))
	{
		    $(function() {
	$('div.newFollowUs_closed')
	.click(function(event){
	$('div.newFollowUs_open') .slideDown('fast');
	$('div.newFollowUs_closed') .fadeOut('fast');
	});
	});
	    $(function() {
	$('span.newFollowUs_shut')
	.click(function(event){
	$('div.newFollowUs_open') .slideUp('fast');
	$('div.newFollowUs_closed') .fadeIn('fast');
	});
	});
	}
    	
// photo gallery revision 3/2010
   if ($('#featuredGallery'))
   {
   function startGallery()
   {
   var photoSet = $('#featuredGallery ul').children().size();
   var theFirst = $('#galleryImage_1')
   var currentID = $(theFirst) .attr("id")
   var currentIDdiv = document.getElementById(currentID);
   var currentPhotoIndex = $(currentIDdiv).index('#featuredGallery li')
   var boxAd = document.getElementById("boxAd1");
   var bannerTopAd = document.getElementById("bannerAd1");
   var bannerTopRightAd = document.getElementById("bannerAd2");
   var bannerBottomAd = document.getElementById("bannerAd3");

   $('div#currentPhotoNumber') .html(currentPhotoIndex + 1);
   $(theFirst) .fadeIn('fast');
   $('#galleryNext')
   .bind('click', function(event)
   {
   boxAd.src = boxAd.src;
   bannerTopAd.src = bannerTopAd.src;
   bannerTopRightAd.src = bannerTopRightAd.src;
   bannerBottomAd.src = bannerBottomAd.src;
   if (currentPhotoIndex < photoSet - 1)
   {
   var theNext = $(theFirst) .next();
   function showNext()
   {
   $(theNext) .fadeIn('slow');
   currentID = $(theNext) .attr("id");
   currentIDdiv = document.getElementById(currentID);
   currentPhotoIndex = $(currentIDdiv).index('#featuredGallery li')
   $('div#currentPhotoNumber') .html(currentPhotoIndex + 1);
   theFirst = theNext;
   };
   $(theFirst) .fadeOut('slow',showNext);
   } else {
   var theNext = $('#galleryImage_1');
   function showNext()
   {
   $(theNext) .fadeIn('slow');
   currentID = $(theNext) .attr("id");
   currentIDdiv = document.getElementById(currentID);
   currentPhotoIndex = $(currentIDdiv).index('#featuredGallery li')
   $('div#currentPhotoNumber') .html(currentPhotoIndex + 1);
   theFirst = theNext;
   };
   $(theFirst) .fadeOut('slow',showNext);
   };
   });
   $('#galleryPrevious')
   .bind('click', function(event)
   {
   boxAd.src = boxAd.src;
   bannerTopAd.src = bannerTopAd.src;
   bannerTopRightAd.src = bannerTopRightAd.src;
   bannerBottomAd.src = bannerBottomAd.src;
   if (currentPhotoIndex > 0)
   {
   var thePrev = $(theFirst) .prev();
   function showPrev()
   {
   $(thePrev) .fadeIn('slow');
   currentID = $(thePrev) .attr("id");
   currentIDdiv = document.getElementById(currentID);
   currentPhotoIndex = $(currentIDdiv).index('#featuredGallery li')
   $('div#currentPhotoNumber') .html(currentPhotoIndex + 1);
   theFirst = thePrev;
   };
   $(theFirst) .fadeOut('slow',showPrev);
   } else {
   var thePrev = $('#featuredGallery li') .slice(photoSet - 1);
   function showPrev()
   {
   $(thePrev) .fadeIn('slow');
   currentID = $(thePrev) .attr("id");
   currentIDdiv = document.getElementById(currentID);
   currentPhotoIndex = $(currentIDdiv).index('#featuredGallery li')
   $('div#currentPhotoNumber') .html(currentPhotoIndex + 1);
   theFirst = thePrev;
   };
   $(theFirst) .fadeOut('slow',showPrev);
   }
   });
   };
   startGallery();
   };

// pop-up window code for TourismIreland links
if ($('a') .hasClass('tourismIreland'))
{
	function showTIBox()
	{
		$('div#tourismIrelandBox') .fadeIn('fast');
		var boxtop = $(this).position().top;
		var boxleft = $(this).position().left;
		var TIitemUrl = $(this).attr('href');
		$('div#tourismIrelandBox') .css('top', boxtop+15 ); 
		$('div#tourismIrelandBox') .css('left', boxleft );
		$('div#tourismIrelandBox a') .attr('href',TIitemUrl);
	}
	function setTIUrl()
	{
	}
	$('a.tourismIreland') .hover(showTIBox,setTIUrl);
	function onTIBox()
	{
	}
	function hideTIBox()
	{
		$('div#tourismIrelandBox') .fadeOut('fast');
	}
	if ($('div#tourismIrelandBox')) 
	{
	$('div#tourismIrelandBox') .hover(onTIBox,hideTIBox);
	}
};


// dynamic positioning of container div for Clipsyndicate video thumbnails
if ($('div.holder690_mediaSelect'))
	{
		$('div.holder690_mediaSelect') .mouseover(function(event)
			{
				$(this).addClass('vpage_bg');
			});
		$('div.holder690_mediaSelect') .mouseout(function(event)
			{
				$(this).removeClass('vpage_bg');
			});
		
			
		$('div.vpage_button') .click(function(e)
		{
					var leftPosition = 0;
					if ($(e.target) .hasClass('vpage_button1'))
					{
						leftPosition = 0;
					};
					
					if ($(e.target) .hasClass('vpage_button2'))
					{
						leftPosition =  -714;
					};
					
					if ($(e.target) .hasClass('vpage_button3'))
					{
						leftPosition = -1428;
					};
					
					$(e.target).parent().parent().parent().children('div:nth-child(2)') .animate(
					{
						left:  leftPosition 
					},
					'normal',
					function(){
					$(e.target).siblings() .removeClass('vpage_button_selected');
					$(e.target) .addClass('vpage_button_selected');
					}
					);
					
		});
	};
/* values for leftPosition: 0 -714 -1428 -2142 -2856 */
			
		
// contestPromoForm validation and modal window, for newpencil	
if ($('input#contestPencilButton'))
{
	$('#contestPencilButton')
	.bind('click', function validUserEmail(event)
	{
		var userEmail = document.getElementById('contestPencilInput');
		var ourUrl = document.getElementById('rurl');
		var filter = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\b/i;
		if (filter.test(userEmail.value))
		{
		$('div#form_overlay') .fadeIn('slow');
		var winWidth = $(window) .width();
		var hPosition = winWidth/2 - 260;
		$('div#form_box') .css('left', hPosition);
		//var winHeight = $(window) .height();
		var vPosition = 115;
		$('div#form_box') .css('top', vPosition);
		$('div#form_box') .fadeIn('slow');
		$('div#form_box') .load('/templates/Contest_Promo_Form_Redirect', { email: userEmail.value, rurl: ourUrl.value } );		
		} else {
		userEmail.value = "Invalid E-mail Address";
		}
	});
};

if ($('div#form_overlay'))
{
	$('div#form_overlay')
	.bind('click', function(event)
	{
		$('div#form_overlay') .fadeOut('slow');
		$('div#form_box') .fadeOut('slow');
	});
			
};

// functions for hp log-in bottom box
if ($('div#bottom_login_box') && !readCookie("username")) {
	var positioner = function(divID) {
		var winWidth = $(window) .width();
		var winHeight = $(window) .height();
		$(divID) .delay(3000) .fadeIn('slow');
		$(divID) .css('width', winWidth);
		$(divID) .css('background-color', '#006600');
		$(divID) .css('color','#ffffff');
		$(divID) .css('height','40px');
		$(divID) .css('position','fixed');
		$(divID) .css('top',winHeight - 40);
		$(divID) .css('left',0);
		};
	positioner('#bottom_login_box');
	$(window) .resize(function() {
	positioner('#bottom_login_box');
	});
	$('div#bottom_box_closer') .bind('click', function(event) {
	$('#bottom_login_box') .fadeOut('fast');
	});
};
	
// end of $(document).ready(function()
});

	// code using JQuery functionality above, all other below

	// check e-mail validation used by ValidateForm() on register page, ValidateForm2() on login error page, ValidateForm3() on login retrieval
	
		function CheckEmail( str ) {
		var at = "@";
		var dot = ".";
		var lat = str.indexOf(at);
		var lstr = str.length;
		var ldot = str.indexOf(dot);
		if ( str.indexOf(at)==-1) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a valid e-mail address."
			return false;
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a valid e-mail address."
			return false;
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a valid e-mail address."
			return false;
		}
		if (str.indexOf(at,(lat+1))!=-1){
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a valid e-mail address."
			return false;
		}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a valid e-mail address."
			return false;
		}
		if (str.indexOf(dot,(lat+2))==-1){
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a valid e-mail address."
			return false;
		}
		if (str.indexOf(" ")!=-1){
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a valid e-mail address."
			return false;
		}
 		return true;
	}
	// function for register page validation

        function isProper(username) {
            var result = true;
            var stringLen = username.value.length;
            var string = username.value;
            var iChars = "*|,\":<>[]{}`\';() @&$#%-_";
            for (var i = 0; i < stringLen; i++) {
            if (iChars.indexOf(string.charAt(i)) != -1)
            result = false;
            }
            if (result == false)
            {
            var mess = document.getElementById("logonMessage")
            mess.innerHTML="Please enter a valid screen name of no more than 15 standard characters, no *|,\":<>[]{}`\';()@&$#%-_. or spaces."
            username.value = "";
            username.focus();
            return false;
            }
return true;
        }

	function ValidateForm() { 
		email = document.frm.email ; 
		if ( (email.value==null) || (email.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter an e-mail address."
			email.focus();
			return false;
		}
		if (CheckEmail(email.value) == false) {
			email.value = "" ; 
			email.focus() ; 
			return false ; 
		}
		var username = document.frm.username;
		if ( (username.value==null) || (username.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a screen name."
			username.focus();
			return false;
		}
               if (!  isProper (username)  )  {
                        return false;
               }
		if (username.value.length>15 || username.value.length<7) {
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a valid screen name of 7-15 standard characters, "
			username.value = "";
			username.focus();
			return false;
		}
		var tmpPassWord = document.frm.password1;
		if ( (tmpPassWord.value==null) || (tmpPassWord.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a password."
			tmpPassWord.focus();
			return false;
		}
		if (tmpPassWord.value.length<7) {
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Passwords must be 8 or more characters."
			tmpPassWord.value = "";
			tmpPassWord.focus();
			return false;
		}
		var tmpConfirmPassWord = document.frm.password2;
		if ( (tmpConfirmPassWord.value==null) || (tmpConfirmPassWord.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter your password again in the Confirm Password field."
			tmpConfirmPassWord.focus();
			return false;
		}
		if (tmpConfirmPassWord.value.length<7) {
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Passwords must be 8 or more characters."
			tmpConfirmPassWord.value = "";
			tmpConfirmPassWord.focus();
			return false;
		}
		if ( tmpConfirmPassWord.value != tmpPassWord.value ) {
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="The entered passwords do not match."
			tmpConfirmPassWord.value = "";
			tmpPassWord.value = "";
			tmpPassWord.focus();
			return false;
		}
		return true;
	 }
	 
	 
	// function for login error page validation 
	function ValidateForm2() { 
		email = document.frm.frmEmail; 
		if ( (email.value==null) || (email.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter an e-mail address."
			email.focus();
			return false;
		}
		if (CheckEmail(email.value) == false) {
			email.value = "" ; 
			email.focus() ; 
			return false ; 
		}
		var tmpPassWord = document.frm.frmPassWord;
		if ( (tmpPassWord.value==null) || (tmpPassWord.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a password."
			tmpPassWord.focus();
			return false;
		}
		if (tmpPassWord.value.length!=6) {
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Passwords must be 8 or more characters."
			tmpPassWord.value = "";
			tmpPassWord.focus();
			return false;
		}
		return true;
	 }
	 
	 	// function for the login retrieval page 
	function ValidateForm3() { 
		email = document.frm.frmEmail ; 
		if ( (email.value==null) || (email.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter an e-mail address."
			email.focus();
			return false;
		}
		if (CheckEmail(email.value) == false) {
			email.value = "" ; 
			email.focus() ; 
			return false ; 
		}
		return true;
	 }
	 
	 //check email function used by ValidateForm4() on masthead navigation
	 		function CheckEmail2( str ) {
		var at = "@";
		var dot = ".";
		var lat = str.indexOf(at);
		var lstr = str.length;
		var ldot = str.indexOf(dot);
		if ( str.indexOf(at)==-1) { 
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter a valid <br />e-mail address."
			return false;
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) { 
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter a valid <br />e-mail address."
			return false;
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter a valid <br />e-mail address."
			return false;
		}
		if (str.indexOf(at,(lat+1))!=-1){
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter a valid <br />e-mail address."
			return false;
		}
		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter a valid <br />e-mail address."
			return false;
		}
		if (str.indexOf(dot,(lat+2))==-1){
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter a valid <br />e-mail address."
			return false;
		}
		if (str.indexOf(" ")!=-1){
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter a valid <br />e-mail address."
			return false;
		}
 		return true;
	}
		// function for masthead logon validation 
	function ValidateForm4() { 
		email = document.frm2.frmEmail2; 
		if ( (email.value==null) || (email.value=="") ) { 
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter an e-mail address."
			email.focus();
			return false;
		}
		if (CheckEmail2(email.value) == false) {
			email.value = "" ; 
			email.focus() ; 
			return false ; 
		}
		var tmpPassWord = document.frm2.frmPassWord2;
		if ( (tmpPassWord.value==null) || (tmpPassWord.value=="") ) { 
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Please enter a password."
			tmpPassWord.focus();
			return false;
		}
		if (tmpPassWord.value.length!=6) {
			var mess = document.getElementById("logonMessage2")
			mess.innerHTML="Passwords must be 8 or more characters."
			tmpPassWord.value = "";
			tmpPassWord.focus();
			return false;
		}
		return true;
	 }

	 	// function for the member_center - to change password 
	function ValidateForm_changePassword() { 
		var tmpPassWord = document.frm.newPassword;
		if ( (tmpPassWord.value==null) || (tmpPassWord.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter a password."
			tmpPassWord.focus();
			return false;
		}
		if (tmpPassWord.value.length!=6) {
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Passwords must be 8 or more characters."
			tmpPassWord.value = "";
			tmpPassWord.focus();
			return false;
		}
		var tmpConfirmPassWord = document.frm.newPasswordConfirm;
		if ( (tmpConfirmPassWord.value==null) || (tmpConfirmPassWord.value=="") ) { 
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="Please enter your password again in the Confirm Password field."
			tmpConfirmPassWord.focus();
			return false;
		}
		if (tmpConfirmPassWord.value.length!=6) {
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="This does not match the password entered."
			tmpConfirmPassWord.value = "";
			tmpConfirmPassWord.focus();
			return false;
		}
		if ( tmpConfirmPassWord.value != tmpPassWord.value ) {
			var mess = document.getElementById("logonMessage")
			mess.innerHTML="This does not match the password entered."
			tmpConfirmPassWord.value = "";
			tmpPassWord.value = "";
			tmpPassWord.focus();
			return false;
		}
		return true;
	 }
	 
	 // function for the member_center - required fields 
	function ValidateForm_requiredFields() { 
		var tmpFirstName = document.frmReq.firstName;
		if ( (tmpFirstName.value==null) || (tmpFirstName.value=="") ) { 
			var mess = document.getElementById("requiredMessage")
			mess.innerHTML="Please enter your first name."
			tmpFirstName.focus();
			return false;
		}
		var tmpLastName = document.frmReq.lastName;
		if ( (tmpLastName.value==null) || (tmpLastName.value=="") ) { 
			var mess = document.getElementById("requiredMessage")
			mess.innerHTML="Please enter your last name."
			tmpLastName.focus();
			return false;
		}
		var tmpDob_year = document.frmReq.dob_year;
		if ( tmpDob_year.selectedIndex == 00 ) {
 			var mess = document.getElementById("requiredMessage")
			mess.innerHTML="Please enter your date of birth."
			return false;
    	}
		var tmpGender = document.frmReq.gender;
		if ( (tmpGender[0].checked == false ) && (tmpGender[1].checked == false ) ) {
			var mess = document.getElementById("requiredMessage")
			mess.innerHTML="Please select Male or Female."
			return false;
   		 }
		var tmpZipCode = document.frmReq.zipCode;
		if ( (tmpZipCode.value==null) || (tmpZipCode.value=="") ) { 
			var mess = document.getElementById("requiredMessage")
			mess.innerHTML="Please enter a zip code."
			tmpZipCode.focus();
			return false;
		}
		var tmpCountryCode = document.frmReq.countryCode;
		if ( tmpCountryCode.selectedIndex == 0 ) {
 			var mess = document.getElementById("requiredMessage")
			mess.innerHTML="Please enter your country."
			return false;
    	}
		return true;
	}
	 
	
/* Client-side access to querystring name=value pairs
	Version 1.3
	28 May 2008
	
	License (Simplified BSD):
	http://adamv.com/dev/javascript/qslicense.txt
*/
function Querystring(qs) { // optionally pass a querystring to parse
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}

