headerSearch = {
	body:null,
	inputBox:null,
	cueBox:null,
	value:null,
	init:function(obj,cueText){
		this.body = $(obj);
		this.inputBox = this.body.find('input[type="text"]');
		this.inputBox.wrap('<div class="searchBox" />')
		this.cueBox = this.body.find('label.cue[for="'+this.inputBox.attr('id')+'"]')
		this.inputBox.after(this.cueBox)
		if(!Boolean(this.inputBox.attr('value'))){
			this.inputBox.hide();
		}else{
			this.cueBox.hide();
		}
		var myDummy = this;
		this.cueBox.click(function(){
			myDummy.focus($(this));
		})
		this.inputBox.focusout(function(){
			myDummy.focusout($(this));
		})
	},
	focus:function(target){
		this.inputBox.show();
		this.cueBox.hide();
		this.inputBox.focus()
	},
	focusout:function(target){
		if (target.attr('value') == '') {
			this.inputBox.hide();
			this.cueBox.show();
		}
	}
}

headerMenu = {
	body:null,
	init:function(menu){
		this.body = $(menu); 
		var myDummy = this;
		this.body.children('li').each(function(index){
			var container = $(this).find('.submenu ul:first');
			container.children('li').each(function(i){
				if((i%2==0)&&(i!=0)){
					var dummy = $('<ul/>');
					dummy.append($(this));
					container.parent().append(dummy);
					container = dummy;
				}else{
					container.append($(this));
				}
			})
			$(this).hover(function(){myDummy.rollOver($(this))},function(){myDummy.rollOut($(this))});
		})
		
	},
	rollOver:function(target){
		target.addClass('select');
		target.find('.submenu').show();
		target.find('.submenu').children().fadeIn();
	},
	rollOut:function(target){
		target.removeClass('select');
		target.find('.submenu').hide();
		target.find('.submenu').children().hide();
	}
};

innerMsgList = {
	init:function(){
		$(".msg_head").click(function(){
			if(!$(this).parent().hasClass('selected')){
				$(this).parent().siblings('.selected').children('.msg_body').slideUp();
				$(this).parent().siblings('.selected').removeClass('selected');
				$(this).siblings('.msg_body').slideDown();
				$(this).parent().addClass('selected');
			}else{
				$(this).siblings('.msg_body').slideUp();
				$(this).parent().removeClass('selected');
			}
			return false;
		});
	}
}

