
function BaseObject()
{
}

function myXMLHttpRequest()
{
	var xmlhttp = null;
	try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP") }
	catch( e ){	try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") }	catch( e ) {} }
	if( !xmlhttp && typeof XMLHttpRequest != 'undefined' )
	{
		try{ xmlhttp = new XMLHttpRequest(); } catch(e) {}
	}
	return xmlhttp;
}
function AHAHload( link_, dest, form)
{
	spot = document.getElementById( dest );
	if( spot == null )
	{
		spot = document.createElement("div");
		spot.className = "window";
		spot.id = dest;
		spot._popup = true;
		spot.style.top = "100px";
		spot.style.left = document.body.clientWidth/2 +"px";
		spot.onmousedown=function(event){ dragStart(event,dest); return false;}
		document.body.appendChild( spot );
	}
	spot._inplace = true;
	spot.xmlrequest = new myXMLHttpRequest();
	if( spot.xmlrequest )
	{
		if( form!=null )
		{
			var poststr = "";
			for( var i = 0; i<form.inputs.length; i++ )
			{
				poststr += encodeURI( form.inputs[i].name )+"="+encodeURI( form.inputs[i].value )+"&";
			}
			poststr += "nopath=";
			spot.xmlrequest.open( "POST", link_ );
			spot.xmlrequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			spot.xmlrequest.setRequestHeader("Content-length", poststr.length);
			spot.xmlrequest.setRequestHeader("Connection", "close");
			spot.xmlrequest.send(poststr);
		}
		else
		{
			spot.xmlrequest.open( "GET", link_ );
  			spot.xmlrequest.send(null);
		}
 		spot.xmlrequest.onreadystatechange = function()
 		{
			if( spot.xmlrequest.readyState == 4 )
			{
				spot.innerHTML = spot.xmlrequest.responseText;
				if( spot._popup )
				{
					spot.style.position="absolute";
					spot.style.left = (document.body.clientWidth-spot.offsetWidth)/2 + "px";
				}
				if( spot._inplace )
				{
					if( spot.tagName=="DIV" )
						spot.style.display = "block";
					tags = spot.getElementsByTagName("script")
					for( var i = 0; i< tags.length; i++ )
					{
						eval( tags[i].innerHTML );
					}
					initForms();
				}
	  		}
		}
	}
}

window.inits = new Array();
if( window.clientinits == null ) window.clientinits = new Array();
function initForms()
{
  for(var i=0; i < this.inits.length; i++)
  {
    this.inits[i]();
  }
  for(var i=0; i < this.clientinits.length; i++)
  {
    this.clientinits[i]();
  }
  window.clientinits = new Array();
}
window.onload = function()
{
  initForms();
}

function form_input_focus(event)
{
  if( this.select )
  {
	this.select();
  }
  return true;
}
function form_input_keyup(event)
{
  if( !this.valid )
  {
    form_input_error( this );
  }
  return true;
}
function form_input_change(field)
{
  if( field == "[object Event]" || field == null ) field = this;
  form_input_error( field );
  return true;
}

function form_input_seterror(element,message)
{
  if( element.message != null )
  {
    element.setinvalid = true;
    element.message.removeChild(element.message.lastChild);
    element.message.appendChild(document.createTextNode(message));
    element.message.style.display = "block";
  }
}

function form_input_error(element)
{
  if( element.isvalid )
  {
	element.valid = element.isvalid(element.value,element.minoccurs);
	if( (element.setinvalid || !element.valid ) && element.message != null )
	{
		element.message.style.display = "block";
	}
	else if( element.message != null )
	{
		element.message.style.display = "none";
	}
  }
  return true;
}
function form_seterror( form )
{
    if( form.message != null )
    {
		form.setinvalid = true;
        form.message.style.display = "block";
    }
}
function form_checkerrors()
{
  var firstError = null;
  for( var i = this.inputs.length; i!=0; i-- )
  {
    form_input_error( this.inputs[i-1] );
    if( !this.inputs[i-1].valid ) firstError = this.inputs[i-1];
  }
  if( firstError != null )
  {
    try
    {
      if( this.message != null )
      {
         this.message.style.display = "block";
      }
      firstError.focus();
    }
    catch(error){}
    return false;
  }
  if( this.message != null && !this.setinvalid )
  {
    try
    {
      this.message.style.display = "none";
    }
    catch(error){}
  }
  return true;
}
function form_submit()
{
  if( this.checkerrors() == false )
  {
	return false;
  }
  current = this;
/* lets not do this for now
  while( current.parentNode != null )
  {
	current = current.parentNode;
	if( current._inplace )
	{
		//submit the form
		AHAHload( this.action, current.id, this )
		return false;
	}
  }
*/
  return true;
}	
			
				function type_string_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					;
				}
			
				function type_integer_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					;
				}
			
				function type_float_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					;
				}
			
				function type_number_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					;
				}
			
				function type_file_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					;
				}
			
				function type_boolean_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					;
				}
			
				function type_password_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 && 
						value.length <= 32;
				}
			
				function type_string255_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 && 
						value.length <= 255;
				}
			
				function type_text_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 && 
						value.length <= 65535;
				}
			
				function type_string5_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 && 
						value.length <= 5;
				}
			
				function type_zip_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 &&
						value.match(/^[0-9]{5}(-[0-9]{4})?/) 
					;
				}
			
				function type_email_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 &&
						value.match(/\w+@\w+\.\w+/) 
					;
				}
			
				function type_postal_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 &&
						value.match(/^[a-zA-Z][0-9][a-zA-Z][ ]?[0-9][a-zA-Z][0-9]/) 
					;
				}
			
				function type_url_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 &&
						value.match(/(http:\/\/)(.)+/) 
					;
				}
			
				function type_postalorzip_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 &&
						value.match(/([a-zA-Z][0-9][a-zA-Z][ ]?[0-9][a-zA-Z][0-9])|([0-9]{5}(-[0-9]{4})?)/) 
					;
				}
			
				function type_dateString_isvalid(value,minoccurs)
				{
					return (minoccurs?value.length:true)
					  &&
						type_string_isvalid(value) 
					 &&
						value.match(/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}?/) 
					;
				}
			
			var gen =  new BaseObject();
			
				gen.root = new BaseObject();
				
					function root_registerValidation(){}
					root_registerValidation.prototype.username_isvalid = type_string255_isvalid;
					root_registerValidation.prototype.email_isvalid = type_email_isvalid;
					root_registerValidation.prototype.password_isvalid = type_password_isvalid;
					root_registerValidation.prototype.password2_isvalid = type_password_isvalid;
					root_registerValidation.prototype.postal_isvalid = type_postal_isvalid;
					
					gen.root.register = null;
					window.inits.push(init_root_register);
					function init_root_register()
					{
						if( gen.root.register && gen.root.register.username )
						{
							return;
						}
						var form = document.getElementById("root_register");
						if( form )
						{ 
							gen.root.register = form;
							gen.root.register.inputs = new Array();
							gen.root.register.validation = new root_registerValidation();
							gen.root.register.message = document.getElementById("root_registerErr");
							
							var username = document.getElementById("root_register_username");
							if( username ){ username.isvalid = gen.root.register.validation.username_isvalid;
							gen.root.register.inputs.push(username);
							gen.addEvent( username, "keyup", form_input_keyup );
							gen.addEvent( username, "focus", form_input_focus );
							username.message = document.getElementById("root_register_usernameErr");
							username.valid = true;
							username.minoccurs = 1;
							
							}
							
							var email = document.getElementById("root_register_email");
							if( email ){ email.isvalid = gen.root.register.validation.email_isvalid;
							gen.root.register.inputs.push(email);
							gen.addEvent( email, "keyup", form_input_keyup );
							gen.addEvent( email, "focus", form_input_focus );
							email.message = document.getElementById("root_register_emailErr");
							email.valid = true;
							email.minoccurs = 1;
							
							}
							
							var password = document.getElementById("root_register_password");
							if( password ){ password.isvalid = gen.root.register.validation.password_isvalid;
							gen.root.register.inputs.push(password);
							gen.addEvent( password, "keyup", form_input_keyup );
							gen.addEvent( password, "focus", form_input_focus );
							password.message = document.getElementById("root_register_passwordErr");
							password.valid = true;
							password.minoccurs = 1;
							
							}
							
							var password2 = document.getElementById("root_register_password2");
							if( password2 ){ password2.isvalid = gen.root.register.validation.password2_isvalid;
							gen.root.register.inputs.push(password2);
							gen.addEvent( password2, "keyup", form_input_keyup );
							gen.addEvent( password2, "focus", form_input_focus );
							password2.message = document.getElementById("root_register_password2Err");
							password2.valid = true;
							password2.minoccurs = 1;
							
							}
							
							var postal = document.getElementById("root_register_postal");
							if( postal ){ postal.isvalid = gen.root.register.validation.postal_isvalid;
							gen.root.register.inputs.push(postal);
							gen.addEvent( postal, "keyup", form_input_keyup );
							gen.addEvent( postal, "focus", form_input_focus );
							postal.message = document.getElementById("root_register_postalErr");
							postal.valid = true;
							postal.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("root_register_username");
							try{first.focus();}catch(e){}
							
						}
					}
			
					function root_loginValidation(){}
					root_loginValidation.prototype.email_isvalid = type_string255_isvalid;
					root_loginValidation.prototype.password_isvalid = type_password_isvalid;
					
					gen.root.login = null;
					window.inits.push(init_root_login);
					function init_root_login()
					{
						if( gen.root.login && gen.root.login.email )
						{
							return;
						}
						var form = document.getElementById("root_login");
						if( form )
						{ 
							gen.root.login = form;
							gen.root.login.inputs = new Array();
							gen.root.login.validation = new root_loginValidation();
							gen.root.login.message = document.getElementById("root_loginErr");
							
							var email = document.getElementById("root_login_email");
							if( email ){ email.isvalid = gen.root.login.validation.email_isvalid;
							gen.root.login.inputs.push(email);
							gen.addEvent( email, "keyup", form_input_keyup );
							gen.addEvent( email, "focus", form_input_focus );
							email.message = document.getElementById("root_login_emailErr");
							email.valid = true;
							email.minoccurs = 1;
							
							}
							
							var password = document.getElementById("root_login_password");
							if( password ){ password.isvalid = gen.root.login.validation.password_isvalid;
							gen.root.login.inputs.push(password);
							gen.addEvent( password, "keyup", form_input_keyup );
							gen.addEvent( password, "focus", form_input_focus );
							password.message = document.getElementById("root_login_passwordErr");
							password.valid = true;
							password.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("root_login_email");
							try{first.focus();}catch(e){}
							
						}
					}
			
					function root_searchValidation(){}
					root_searchValidation.prototype.q_isvalid = type_string255_isvalid;
					
					gen.root.search = null;
					window.inits.push(init_root_search);
					function init_root_search()
					{
						if( gen.root.search && gen.root.search.q )
						{
							return;
						}
						var form = document.getElementById("root_search");
						if( form )
						{ 
							gen.root.search = form;
							gen.root.search.inputs = new Array();
							gen.root.search.validation = new root_searchValidation();
							gen.root.search.message = document.getElementById("root_searchErr");
							
							var q = document.getElementById("root_search_q");
							if( q ){ q.isvalid = gen.root.search.validation.q_isvalid;
							gen.root.search.inputs.push(q);
							gen.addEvent( q, "keyup", form_input_keyup );
							gen.addEvent( q, "focus", form_input_focus );
							q.message = document.getElementById("root_search_qErr");
							q.valid = true;
							q.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("root_search_q");
							try{first.focus();}catch(e){}
							
						}
					}
			
					function root_tellafriendValidation(){}
					root_tellafriendValidation.prototype.email_isvalid = type_email_isvalid;
					root_tellafriendValidation.prototype.emails_isvalid = type_text_isvalid;
					root_tellafriendValidation.prototype.subject_isvalid = type_string255_isvalid;
					root_tellafriendValidation.prototype.msg_isvalid = type_text_isvalid;
					
					gen.root.tellafriend = null;
					window.inits.push(init_root_tellafriend);
					function init_root_tellafriend()
					{
						if( gen.root.tellafriend && gen.root.tellafriend.email )
						{
							return;
						}
						var form = document.getElementById("root_tellafriend");
						if( form )
						{ 
							gen.root.tellafriend = form;
							gen.root.tellafriend.inputs = new Array();
							gen.root.tellafriend.validation = new root_tellafriendValidation();
							gen.root.tellafriend.message = document.getElementById("root_tellafriendErr");
							
							var email = document.getElementById("root_tellafriend_email");
							if( email ){ email.isvalid = gen.root.tellafriend.validation.email_isvalid;
							gen.root.tellafriend.inputs.push(email);
							gen.addEvent( email, "keyup", form_input_keyup );
							gen.addEvent( email, "focus", form_input_focus );
							email.message = document.getElementById("root_tellafriend_emailErr");
							email.valid = true;
							email.minoccurs = 1;
							
							}
							
							var emails = document.getElementById("root_tellafriend_emails");
							if( emails ){ emails.isvalid = gen.root.tellafriend.validation.emails_isvalid;
							gen.root.tellafriend.inputs.push(emails);
							gen.addEvent( emails, "keyup", form_input_keyup );
							gen.addEvent( emails, "focus", form_input_focus );
							emails.message = document.getElementById("root_tellafriend_emailsErr");
							emails.valid = true;
							emails.minoccurs = 1;
							
							}
							
							var subject = document.getElementById("root_tellafriend_subject");
							if( subject ){ subject.isvalid = gen.root.tellafriend.validation.subject_isvalid;
							gen.root.tellafriend.inputs.push(subject);
							gen.addEvent( subject, "keyup", form_input_keyup );
							gen.addEvent( subject, "focus", form_input_focus );
							subject.message = document.getElementById("root_tellafriend_subjectErr");
							subject.valid = true;
							subject.minoccurs = 1;
							
							}
							
							var msg = document.getElementById("root_tellafriend_msg");
							if( msg ){ msg.isvalid = gen.root.tellafriend.validation.msg_isvalid;
							gen.root.tellafriend.inputs.push(msg);
							gen.addEvent( msg, "keyup", form_input_keyup );
							gen.addEvent( msg, "focus", form_input_focus );
							msg.message = document.getElementById("root_tellafriend_msgErr");
							msg.valid = true;
							msg.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("root_tellafriend_email");
							try{first.focus();}catch(e){}
							
						}
					}
			
					function root_addfeedValidation(){}
					root_addfeedValidation.prototype.feed_isvalid = type_url_isvalid;
					
					gen.root.addfeed = null;
					window.inits.push(init_root_addfeed);
					function init_root_addfeed()
					{
						if( gen.root.addfeed && gen.root.addfeed.feed )
						{
							return;
						}
						var form = document.getElementById("root_addfeed");
						if( form )
						{ 
							gen.root.addfeed = form;
							gen.root.addfeed.inputs = new Array();
							gen.root.addfeed.validation = new root_addfeedValidation();
							gen.root.addfeed.message = document.getElementById("root_addfeedErr");
							
							var feed = document.getElementById("root_addfeed_feed");
							if( feed ){ feed.isvalid = gen.root.addfeed.validation.feed_isvalid;
							gen.root.addfeed.inputs.push(feed);
							gen.addEvent( feed, "keyup", form_input_keyup );
							gen.addEvent( feed, "focus", form_input_focus );
							feed.message = document.getElementById("root_addfeed_feedErr");
							feed.valid = true;
							feed.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("root_addfeed_feed");
							try{first.focus();}catch(e){}
							
						}
					}
			
				gen.post = new BaseObject();
				
					function post_editValidation(){}
					post_editValidation.prototype.subject_isvalid = type_string255_isvalid;
					post_editValidation.prototype.locationid_isvalid = type_integer_isvalid;
					post_editValidation.prototype.location_isvalid = type_string255_isvalid;
					post_editValidation.prototype.post_isvalid = type_text_isvalid;
					
					gen.post.edit = null;
					window.inits.push(init_post_edit);
					function init_post_edit()
					{
						if( gen.post.edit && gen.post.edit.subject )
						{
							return;
						}
						var form = document.getElementById("post_edit");
						if( form )
						{ 
							gen.post.edit = form;
							gen.post.edit.inputs = new Array();
							gen.post.edit.validation = new post_editValidation();
							gen.post.edit.message = document.getElementById("post_editErr");
							
							var subject = document.getElementById("post_edit_subject");
							if( subject ){ subject.isvalid = gen.post.edit.validation.subject_isvalid;
							gen.post.edit.inputs.push(subject);
							gen.addEvent( subject, "keyup", form_input_keyup );
							gen.addEvent( subject, "focus", form_input_focus );
							subject.message = document.getElementById("post_edit_subjectErr");
							subject.valid = true;
							subject.minoccurs = 1;
							
							}
							
							var locationid = document.getElementById("post_edit_locationid");
							if( locationid ){ locationid.isvalid = gen.post.edit.validation.locationid_isvalid;
							gen.post.edit.inputs.push(locationid);
							gen.addEvent( locationid, "keyup", form_input_keyup );
							gen.addEvent( locationid, "focus", form_input_focus );
							locationid.message = document.getElementById("post_edit_locationidErr");
							locationid.valid = true;
							locationid.minoccurs = 1;
							
							}
							
							var location = document.getElementById("post_edit_location");
							if( location ){ location.isvalid = gen.post.edit.validation.location_isvalid;
							gen.post.edit.inputs.push(location);
							gen.addEvent( location, "keyup", form_input_keyup );
							gen.addEvent( location, "focus", form_input_focus );
							location.message = document.getElementById("post_edit_locationErr");
							location.valid = true;
							location.minoccurs = 1;
							location.minoccurs = 0;
							}
							
							var post = document.getElementById("post_edit_post");
							if( post ){ post.isvalid = gen.post.edit.validation.post_isvalid;
							gen.post.edit.inputs.push(post);
							gen.addEvent( post, "keyup", form_input_keyup );
							gen.addEvent( post, "focus", form_input_focus );
							post.message = document.getElementById("post_edit_postErr");
							post.valid = true;
							post.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("post_edit_subject");
							try{first.focus();}catch(e){}
							
						}
					}
			
				gen.person = new BaseObject();
				
				gen.user = new BaseObject();
				
					function user_addFeedValidation(){}
					user_addFeedValidation.prototype.url_isvalid = type_url_isvalid;
					
					gen.user.addFeed = null;
					window.inits.push(init_user_addFeed);
					function init_user_addFeed()
					{
						if( gen.user.addFeed && gen.user.addFeed.url )
						{
							return;
						}
						var form = document.getElementById("user_addFeed");
						if( form )
						{ 
							gen.user.addFeed = form;
							gen.user.addFeed.inputs = new Array();
							gen.user.addFeed.validation = new user_addFeedValidation();
							gen.user.addFeed.message = document.getElementById("user_addFeedErr");
							
							var url = document.getElementById("user_addFeed_url");
							if( url ){ url.isvalid = gen.user.addFeed.validation.url_isvalid;
							gen.user.addFeed.inputs.push(url);
							gen.addEvent( url, "keyup", form_input_keyup );
							gen.addEvent( url, "focus", form_input_focus );
							url.message = document.getElementById("user_addFeed_urlErr");
							url.valid = true;
							url.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("user_addFeed_url");
							try{first.focus();}catch(e){}
							
						}
					}
			
					function user_newPostValidation(){}
					user_newPostValidation.prototype.subject_isvalid = type_string255_isvalid;
					user_newPostValidation.prototype.locationid_isvalid = type_integer_isvalid;
					user_newPostValidation.prototype.location_isvalid = type_string255_isvalid;
					user_newPostValidation.prototype.post_isvalid = type_text_isvalid;
					
					gen.user.newPost = null;
					window.inits.push(init_user_newPost);
					function init_user_newPost()
					{
						if( gen.user.newPost && gen.user.newPost.subject )
						{
							return;
						}
						var form = document.getElementById("user_newPost");
						if( form )
						{ 
							gen.user.newPost = form;
							gen.user.newPost.inputs = new Array();
							gen.user.newPost.validation = new user_newPostValidation();
							gen.user.newPost.message = document.getElementById("user_newPostErr");
							
							var subject = document.getElementById("user_newPost_subject");
							if( subject ){ subject.isvalid = gen.user.newPost.validation.subject_isvalid;
							gen.user.newPost.inputs.push(subject);
							gen.addEvent( subject, "keyup", form_input_keyup );
							gen.addEvent( subject, "focus", form_input_focus );
							subject.message = document.getElementById("user_newPost_subjectErr");
							subject.valid = true;
							subject.minoccurs = 1;
							
							}
							
							var locationid = document.getElementById("user_newPost_locationid");
							if( locationid ){ locationid.isvalid = gen.user.newPost.validation.locationid_isvalid;
							gen.user.newPost.inputs.push(locationid);
							gen.addEvent( locationid, "keyup", form_input_keyup );
							gen.addEvent( locationid, "focus", form_input_focus );
							locationid.message = document.getElementById("user_newPost_locationidErr");
							locationid.valid = true;
							locationid.minoccurs = 1;
							
							}
							
							var location = document.getElementById("user_newPost_location");
							if( location ){ location.isvalid = gen.user.newPost.validation.location_isvalid;
							gen.user.newPost.inputs.push(location);
							gen.addEvent( location, "keyup", form_input_keyup );
							gen.addEvent( location, "focus", form_input_focus );
							location.message = document.getElementById("user_newPost_locationErr");
							location.valid = true;
							location.minoccurs = 1;
							location.minoccurs = 0;
							}
							
							var post = document.getElementById("user_newPost_post");
							if( post ){ post.isvalid = gen.user.newPost.validation.post_isvalid;
							gen.user.newPost.inputs.push(post);
							gen.addEvent( post, "keyup", form_input_keyup );
							gen.addEvent( post, "focus", form_input_focus );
							post.message = document.getElementById("user_newPost_postErr");
							post.valid = true;
							post.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("user_newPost_subject");
							try{first.focus();}catch(e){}
							
						}
					}
			
					function user_updateFriendsValidation(){}
					user_updateFriendsValidation.prototype.contacts_isvalid = type_text_isvalid;
					
					gen.user.updateFriends = null;
					window.inits.push(init_user_updateFriends);
					function init_user_updateFriends()
					{
						if( gen.user.updateFriends && gen.user.updateFriends.contacts )
						{
							return;
						}
						var form = document.getElementById("user_updateFriends");
						if( form )
						{ 
							gen.user.updateFriends = form;
							gen.user.updateFriends.inputs = new Array();
							gen.user.updateFriends.validation = new user_updateFriendsValidation();
							gen.user.updateFriends.message = document.getElementById("user_updateFriendsErr");
							
							var contacts = document.getElementById("user_updateFriends_contacts");
							if( contacts ){ contacts.isvalid = gen.user.updateFriends.validation.contacts_isvalid;
							gen.user.updateFriends.inputs.push(contacts);
							gen.addEvent( contacts, "keyup", form_input_keyup );
							gen.addEvent( contacts, "focus", form_input_focus );
							contacts.message = document.getElementById("user_updateFriends_contactsErr");
							contacts.valid = true;
							contacts.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("user_updateFriends_contacts");
							try{first.focus();}catch(e){}
							
						}
					}
			
					function user_setLocationValidation(){}
					user_setLocationValidation.prototype.location_isvalid = type_string255_isvalid;
					
					gen.user.setLocation = null;
					window.inits.push(init_user_setLocation);
					function init_user_setLocation()
					{
						if( gen.user.setLocation && gen.user.setLocation.location )
						{
							return;
						}
						var form = document.getElementById("user_setLocation");
						if( form )
						{ 
							gen.user.setLocation = form;
							gen.user.setLocation.inputs = new Array();
							gen.user.setLocation.validation = new user_setLocationValidation();
							gen.user.setLocation.message = document.getElementById("user_setLocationErr");
							
							var location = document.getElementById("user_setLocation_location");
							if( location ){ location.isvalid = gen.user.setLocation.validation.location_isvalid;
							gen.user.setLocation.inputs.push(location);
							gen.addEvent( location, "keyup", form_input_keyup );
							gen.addEvent( location, "focus", form_input_focus );
							location.message = document.getElementById("user_setLocation_locationErr");
							location.valid = true;
							location.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("user_setLocation_location");
							try{first.focus();}catch(e){}
							
						}
					}
			
					function user_addContactsValidation(){}
					user_addContactsValidation.prototype.contacts_isvalid = type_text_isvalid;
					
					gen.user.addContacts = null;
					window.inits.push(init_user_addContacts);
					function init_user_addContacts()
					{
						if( gen.user.addContacts && gen.user.addContacts.contacts )
						{
							return;
						}
						var form = document.getElementById("user_addContacts");
						if( form )
						{ 
							gen.user.addContacts = form;
							gen.user.addContacts.inputs = new Array();
							gen.user.addContacts.validation = new user_addContactsValidation();
							gen.user.addContacts.message = document.getElementById("user_addContactsErr");
							
							var contacts = document.getElementById("user_addContacts_contacts");
							if( contacts ){ contacts.isvalid = gen.user.addContacts.validation.contacts_isvalid;
							gen.user.addContacts.inputs.push(contacts);
							gen.addEvent( contacts, "keyup", form_input_keyup );
							gen.addEvent( contacts, "focus", form_input_focus );
							contacts.message = document.getElementById("user_addContacts_contactsErr");
							contacts.valid = true;
							contacts.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("user_addContacts_contacts");
							try{first.focus();}catch(e){}
							
						}
					}
			
				gen.grp = new BaseObject();
				
				gen.named = new BaseObject();
				
					function named_removeValidation(){}
					named_removeValidation.prototype.ok_isvalid = type_integer_isvalid;
					
					gen.named.remove = null;
					window.inits.push(init_named_remove);
					function init_named_remove()
					{
						if( gen.named.remove && gen.named.remove.ok )
						{
							return;
						}
						var form = document.getElementById("named_remove");
						if( form )
						{ 
							gen.named.remove = form;
							gen.named.remove.inputs = new Array();
							gen.named.remove.validation = new named_removeValidation();
							gen.named.remove.message = document.getElementById("named_removeErr");
							
							var ok = document.getElementById("named_remove_ok");
							if( ok ){ ok.isvalid = gen.named.remove.validation.ok_isvalid;
							gen.named.remove.inputs.push(ok);
							gen.addEvent( ok, "keyup", form_input_keyup );
							gen.addEvent( ok, "focus", form_input_focus );
							ok.message = document.getElementById("named_remove_okErr");
							ok.valid = true;
							ok.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("named_remove_ok");
							try{first.focus();}catch(e){}
							
						}
					}
			
				gen.voteable = new BaseObject();
				
				gen.postable = new BaseObject();
				
					function postable_newPostValidation(){}
					postable_newPostValidation.prototype.subject_isvalid = type_string255_isvalid;
					postable_newPostValidation.prototype.post_isvalid = type_text_isvalid;
					postable_newPostValidation.prototype.tags_isvalid = type_text_isvalid;
					
					gen.postable.newPost = null;
					window.inits.push(init_postable_newPost);
					function init_postable_newPost()
					{
						if( gen.postable.newPost && gen.postable.newPost.subject )
						{
							return;
						}
						var form = document.getElementById("postable_newPost");
						if( form )
						{ 
							gen.postable.newPost = form;
							gen.postable.newPost.inputs = new Array();
							gen.postable.newPost.validation = new postable_newPostValidation();
							gen.postable.newPost.message = document.getElementById("postable_newPostErr");
							
							var subject = document.getElementById("postable_newPost_subject");
							if( subject ){ subject.isvalid = gen.postable.newPost.validation.subject_isvalid;
							gen.postable.newPost.inputs.push(subject);
							gen.addEvent( subject, "keyup", form_input_keyup );
							gen.addEvent( subject, "focus", form_input_focus );
							subject.message = document.getElementById("postable_newPost_subjectErr");
							subject.valid = true;
							subject.minoccurs = 1;
							
							}
							
							var post = document.getElementById("postable_newPost_post");
							if( post ){ post.isvalid = gen.postable.newPost.validation.post_isvalid;
							gen.postable.newPost.inputs.push(post);
							gen.addEvent( post, "keyup", form_input_keyup );
							gen.addEvent( post, "focus", form_input_focus );
							post.message = document.getElementById("postable_newPost_postErr");
							post.valid = true;
							post.minoccurs = 1;
							
							}
							
							var tags = document.getElementById("postable_newPost_tags");
							if( tags ){ tags.isvalid = gen.postable.newPost.validation.tags_isvalid;
							gen.postable.newPost.inputs.push(tags);
							gen.addEvent( tags, "keyup", form_input_keyup );
							gen.addEvent( tags, "focus", form_input_focus );
							tags.message = document.getElementById("postable_newPost_tagsErr");
							tags.valid = true;
							tags.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("postable_newPost_subject");
							try{first.focus();}catch(e){}
							
						}
					}
			
				gen.discussable = new BaseObject();
				
					function discussable_newTopicValidation(){}
					discussable_newTopicValidation.prototype.subject_isvalid = type_string255_isvalid;
					discussable_newTopicValidation.prototype.post_isvalid = type_text_isvalid;
					
					gen.discussable.newTopic = null;
					window.inits.push(init_discussable_newTopic);
					function init_discussable_newTopic()
					{
						if( gen.discussable.newTopic && gen.discussable.newTopic.subject )
						{
							return;
						}
						var form = document.getElementById("discussable_newTopic");
						if( form )
						{ 
							gen.discussable.newTopic = form;
							gen.discussable.newTopic.inputs = new Array();
							gen.discussable.newTopic.validation = new discussable_newTopicValidation();
							gen.discussable.newTopic.message = document.getElementById("discussable_newTopicErr");
							
							var subject = document.getElementById("discussable_newTopic_subject");
							if( subject ){ subject.isvalid = gen.discussable.newTopic.validation.subject_isvalid;
							gen.discussable.newTopic.inputs.push(subject);
							gen.addEvent( subject, "keyup", form_input_keyup );
							gen.addEvent( subject, "focus", form_input_focus );
							subject.message = document.getElementById("discussable_newTopic_subjectErr");
							subject.valid = true;
							subject.minoccurs = 1;
							
							}
							
							var post = document.getElementById("discussable_newTopic_post");
							if( post ){ post.isvalid = gen.discussable.newTopic.validation.post_isvalid;
							gen.discussable.newTopic.inputs.push(post);
							gen.addEvent( post, "keyup", form_input_keyup );
							gen.addEvent( post, "focus", form_input_focus );
							post.message = document.getElementById("discussable_newTopic_postErr");
							post.valid = true;
							post.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
							first = document.getElementById("discussable_newTopic_subject");
							try{first.focus();}catch(e){}
							
						}
					}
			
				gen.commentable = new BaseObject();
				
					function commentable_commentPostValidation(){}
					commentable_commentPostValidation.prototype.comment_isvalid = type_text_isvalid;
					
					gen.commentable.commentPost = null;
					window.inits.push(init_commentable_commentPost);
					function init_commentable_commentPost()
					{
						if( gen.commentable.commentPost && gen.commentable.commentPost.comment )
						{
							return;
						}
						var form = document.getElementById("commentable_commentPost");
						if( form )
						{ 
							gen.commentable.commentPost = form;
							gen.commentable.commentPost.inputs = new Array();
							gen.commentable.commentPost.validation = new commentable_commentPostValidation();
							gen.commentable.commentPost.message = document.getElementById("commentable_commentPostErr");
							
							var comment = document.getElementById("commentable_commentPost_comment");
							if( comment ){ comment.isvalid = gen.commentable.commentPost.validation.comment_isvalid;
							gen.commentable.commentPost.inputs.push(comment);
							gen.addEvent( comment, "keyup", form_input_keyup );
							gen.addEvent( comment, "focus", form_input_focus );
							comment.message = document.getElementById("commentable_commentPost_commentErr");
							comment.valid = true;
							comment.minoccurs = 1;
							
							}
							
							form.checkerrors = form_checkerrors;
							form.onsubmit = form_submit;
							form.dosubmit = function() { if( this.onsubmit() ) this.submit(); };
							
						}
					}
			
		
//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************

// Determine browser and version.

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

gen.browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}	

gen.addEvent = function(element, event, func)
{
  if( gen.browser.isIE )
  {
    element.attachEvent("on"+event, func);
  }
  if( gen.browser.isNS )
  {
    element.addEventListener(event, func, false);
  }
}

gen.LocationComplete = function(name)
{
	gen.LocationCompleteObject = this;
	this.timeout = 0;
	this.lastloc = '';
	this.keywaiting = false;
	this.testtext = false;
	this.locdroppos = -1;
	this.name = name;
	this.l = "";
	this.e = document.getElementById( name );
    newdiv = document.createElement( "div" );
    newdiv.id = name + "drop";
    newdiv.className = "dropdown";
	this.e.parentNode.appendChild( newdiv );
	gen.addEvent( this.e, "keyup", function(event){ gen.LocationCompleteObject.onkeyup(event) } );
	this.onkeyup = function(event)
	{
		if( event.keyCode == 38 && this.locdrop )//up
		{
			if( this.locdroppos != -1 )
			{
				this.locdrop[this.locdroppos].onmouseout();
				this.locdroppos -= 1;
				if( this.locdroppos == -1 )
				{
					this.e.focus();
				}
				else
				{
					this.locdrop[this.locdroppos].onmouseover();
					this.e.value = this.locdrop[this.locdroppos].innerHTML;
				}
				
			}
		}
		else if( event.keyCode == 40 && this.locdrop )//down
		{
			if( this.locdroppos < this.locdrop.length - 1 )
			{
				if( this.locdroppos != -1 )
				{
					this.locdrop[this.locdroppos].onmouseout();
				}
				this.locdroppos += 1;
				this.locdrop[this.locdroppos].onmouseover();
				this.e.value = this.locdrop[this.locdroppos].innerHTML;
			}
		}
		else
		{
			this.keywaiting = true;
			if( this.timeout ) clearTimeout( this.timeout );
			this.l = this.e.value;
			this.timeout = setTimeout("gen.LocationCompleteObject.getloc2()",200);
			this.fullloc == 0;
			this.testtext = false;
		}
	}

	this.getloc2 = function()
	{
		this.keywaiting = false;
		if( this.l == '' )
		{
			this.e.innerHTML = "";
		}
		else if( this.l.length < this.lastloc.length )
		{
			this.lastloc = this.l;
		}
		else if( this.l != this.lastloc && !this.testtext )
		{
			this.lastloc = this.l;
			AHAHload( "http://" + gen.location + "/city/?locid=" + this.name + "&nopath=1&name=search&q=" + this.l , this.name + "drop" );
		}
	}
	this.clickcity = function(t)
	{
		this.testtext = true;
		inp = document.getElementById(this.name);
		inp.value = t.innerHTML;
		inp.focus();
		inp.select();
		if( inp.onchange )
			inp.onchange();
		document.getElementById(this.name+"drop").style.display="none";
	}
	this.onloaded = function()
	{
		this.locdrop = document.getElementsByName("locationOption");
		this.locdroppos = -1;
		var t = this.locdrop[0];
		if( t )
		{
			t.parentNode.parentNode.parentNode.style.position = "relative"
			t.parentNode.parentNode.style.position = "absolute";
			t.parentNode.parentNode.style.left = 0;
			t.parentNode.parentNode.style.top = this.e.offsetHeight + this.e.offsetTop;
			t.parentNode.parentNode.style.width = this.e.offsetWidth;
			len = this.e.value.length;
			if( !this.keywaiting && this.e.value.toLowerCase() == t.innerHTML.slice(0,len).toLowerCase() )
			{
				this.testtext = true;
				this.e.value += t.innerHTML.slice( len );
				if( this.e.createTextRange )
				{
					var tr=this.e.createTextRange();
					tr.moveStart("character",len,this.e.value.length-len );
					tr.select();
				}
				else if( this.e.setSelectionRange )
				{
				alert( "setSelectionRange" );
					this.e.setSelectionRange(this.e.value.length-len,len);
				}
				if( this.e.onchange )
					this.e.onchange();
			}
		}	
	}
	return this;
}
function bookmark(url,title)
{
  if(gen.browser.isIE)
  {
	window.external.AddFavorite(url,title);
  }
  else if( gen.browser.isNS )
  {
    window.sidebar.addPanel(title,url,"");
  }
  else
  {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}
	