/*
 * jQuery history plugin
 *
 * Copyright (c) 2006 Taku Sano (Mikage Sawatari)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Modified by Lincoln Cooper to add Safari support and only call the callback once during initialization
 * for msie when no initial hash supplied.
 */


jQuery.extend({
	historyCurrentHash: undefined,
	
	historyCallback: undefined,
	
	historyInit: function(callback){
		jQuery.historyCallback = callback;
		var current_hash = location.hash;
		
		jQuery.historyCurrentHash = current_hash;
		if ((jQuery.browser.msie) && (jQuery.browser.version < 8)) {
			// To stop the callback firing twice during initilization if no hash present
			if (jQuery.historyCurrentHash == '') {
			jQuery.historyCurrentHash = '#';
		}
		
			// add hidden iframe for IE
			$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentWindow.document;
			iframe.open();
			iframe.close();
			iframe.location.hash = current_hash;
		}
		else if ($.browser.safari) {
			// etablish back/forward stacks
			jQuery.historyBackStack = [];
			jQuery.historyBackStack.length = history.length;
			jQuery.historyForwardStack = [];
			
			jQuery.isFirst = true;
		}
		jQuery.historyCallback(current_hash.replace(/^#/, ''));
		setInterval(jQuery.historyCheck, 100);
	},
	
	historyAddHistory: function(hash) {
		// This makes the looping function do something
		jQuery.historyBackStack.push(hash);
		
		jQuery.historyForwardStack.length = 0; // clear forwardStack (true click occured)
		this.isFirst = true;
	},
	
	historyCheck: function(){
		if ((jQuery.browser.msie) && (jQuery.browser.version < 8)) {
			// On IE, check for location.hash of iframe
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentDocument || ihistory.contentWindow.document;
			var current_hash = iframe.location.hash;
			if(current_hash != jQuery.historyCurrentHash) {
			
				location.hash = current_hash;
				jQuery.historyCurrentHash = current_hash;
				jQuery.historyCallback(current_hash.replace(/^#/, ''));
				
			}
		} else if ($.browser.safari) {
			if (!jQuery.dontCheck) {
				var historyDelta = history.length - jQuery.historyBackStack.length;
				
				if (historyDelta) { // back or forward button has been pushed
					jQuery.isFirst = false;
					if (historyDelta < 0) { // back button has been pushed
						// move items to forward stack
						for (var i = 0; i < Math.abs(historyDelta); i++) jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());
					} else { // forward button has been pushed
						// move items to back stack
						for (var i = 0; i < historyDelta; i++) jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());
					}
					var cachedHash = jQuery.historyBackStack[jQuery.historyBackStack.length - 1];
					if (cachedHash != undefined) {
						jQuery.historyCurrentHash = location.hash;
						jQuery.historyCallback(cachedHash);
					}
				} else if (jQuery.historyBackStack[jQuery.historyBackStack.length - 1] == undefined && !jQuery.isFirst) {
					// back button has been pushed to beginning and URL already pointed to hash (e.g. a bookmark)
					// document.URL doesn't change in Safari
					if (document.URL.indexOf('#') >= 0) {
						jQuery.historyCallback(document.URL.split('#')[1]);
					} else {
						var current_hash = location.hash;
						jQuery.historyCallback('');
					}
					jQuery.isFirst = true;
				}
			}
		} else {
			// otherwise, check for location.hash
			var current_hash = location.hash;
			if(current_hash != jQuery.historyCurrentHash) {
				jQuery.historyCurrentHash = current_hash;
				jQuery.historyCallback(current_hash.replace(/^#/, ''));
			}
		}
	},
	historyLoad: function(hash){
		var newhash;
		
		if (jQuery.browser.safari) {
			newhash = hash;
		}
		else {
			newhash = '#' + hash;
			location.hash = newhash;
		}
		jQuery.historyCurrentHash = newhash;
		
		if ((jQuery.browser.msie) && (jQuery.browser.version < 8)) {
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentWindow.document;
			iframe.open();
			iframe.close();
			iframe.location.hash = newhash;
			jQuery.historyCallback(hash);
		}
		else if (jQuery.browser.safari) {
			jQuery.dontCheck = true;
			// Manually keep track of the history values for Safari
			this.historyAddHistory(hash);
			
			// Wait a while before allowing checking so that Safari has time to update the "history" object
			// correctly (otherwise the check loop would detect a false change in hash).
			var fn = function() {jQuery.dontCheck = false;};
			window.setTimeout(fn, 200);
			jQuery.historyCallback(hash);
			// N.B. "location.hash=" must be the last line of code for Safari as execution stops afterwards.
			//      By explicitly using the "location.hash" command (instead of using a variable set to "location.hash") the
			//      URL in the browser and the "history" object are both updated correctly.
			location.hash = newhash;
		}
		else {
		  jQuery.historyCallback(hash);
		}
	}
});




/*---------------------------------------------------------------

 jQuery.validation.js - ver 1.2.2
 
 jQuery required (tested on version 1.3.2)
 encoding UTF-8

 Copyright (c) 2008 nori (norimania@gmail.com)
 5509 - http://moto-mono.net
 Licensed under the MIT
 
 Document Archive:
 http://moto-mono.net/2008/08/22/realtimeformvalidation.html

 $Update: 2009-04-20 01:00
 $Date: 2008-08-20 20:00
 
 ----------------------------------------------------------------*/

$.tip={create:function(d,e,i,j,b){var h=document.createElement("div");$(h).addClass("validationTip").attr("id",d+"_tip");var g=$("#"+d).offset();var a={};var f=function(l,k){a.top=l+j+g.top;a.left=k+b+g.left;};switch(i){case"top":f(0,0);break;case"bottom":f($("#"+d).height(),0);break;case"even":f(0,b);break;default:f(0,$("#"+d).width());break;}$(h).append("<div class='tipInner'>"+e+"</div><div class='tipRt'></div><div class='tipRb'></div>").hide().css({position:"absolute",top:a.top,left:a.left});$("#introduction").append(h);},msg:function(b,a){$("#"+b+"_tip .tipInner").html(a);},fadeIn:function(a){$("#"+a+"_tip").fadeIn("normal");},fadeOut:function(a){$("#"+a+"_tip").fadeOut("normal");}};$.dialog={ids:{mat:"dlgmat",me:"dlg",top:"dlgtop",cont:"dlgcont",btm:"dlgbtm",close:"close"},create:function(e){var i=document.createElement("div");var a=document.createElement("div");var b=document.createElement("span");var h=$.dialog.ids;var g=function(){$(a).fadeTo(1,0).hide();$(i).fadeTo(1,0).hide();$("select:hidden,object:hidden").css("visibility","visible");};$("body").keyup(function(d){if(d.keyCode==27){g();}});$(i).attr("id",h.mat).hide().fadeTo(1,0).click(function(){g();});$(b).attr("id",h.close).click(function(){g();}).hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");});$(a).append("<div id='"+h.top+"'></div><div id='"+h.cont+"'><div><span></span></div></div><div id='"+h.btm+"'></div>");$("#introduction").append(i).append(a);var f={width:$(a).width(),height:$(a).height()};$(a).attr("id",h.me).append(b);$("div span","#"+h.cont).html(e);$(a).css("display","inline");$("div",a).css("display","inline");$("div","#"+h.cont).css("display","block");if(typeof document.body.style.maxHeight=="undefined"){$(a).width($(a).width());}$(a).hide().fadeTo(1,0);},fadeIn:function(e,a){var b=$.extend({duration:"fast",matOpacity:0.6,dialogOpacity:0.9,closeTitle:"このメッセージを閉じる"},a);var g=$.dialog.ids;$("#"+g.cont+" div span").html(e);$("#"+g.me).show();var f={width:$("#"+g.me).width(),height:$("#"+g.me).height()};$("#"+g.me).css("display","block");$("div","#"+g.me).css("display","block");$("#"+g.close).attr("title",b.closeTitle);$("#"+g.mat).show().fadeTo(b.duration,b.matOpacity);$("#"+g.me).fadeTo(b.duration,b.dialogOpacity).css({"margin-left":"-"+f.width/2+"px"});if(typeof document.body.style.maxHeight!="undefined"){$("#"+g.me).css({"margin-top":"-"+(parseInt(f.height/2))+"px"});if(document.all){$("#"+g.top+",#"+g.btm).css("min-width",f.width);}}else{$("select,object").css("visibility","hidden");}}};$.validate={chk:{required:function(a,d){if($(d).hasClass("group")){var b=0;$("input,select",d).each(function(){if($(this).val().length>0){b++;}});return a&&b==$("input,select",d).length;}else{return a&&a.length>0;}},hankaku:/^[a-zA-Z0-9@\;\:\[\]\^\=\/\!\*\"\#\$\%\&\'\(\)\,\.\-\_\?\\\s]*$/,email:/^[a-zA-Z0-9_\.\-]+?@[A-Za-z0-9_\.\-]+\.+[A-Za-z\.\-\_]+$/,tel:/^[\d-]*$/,numonly:/^\d*$/,zip:/\d\d\d\-?\d\d\d\d/,check:function(a,b){return $("input:checked",b).length>0;},radio:function(a,b){return $("input:checked",b).length>0;},retype:function(a,e){var g=$("#"+$(e).attr("class").split("retype-")[1].split(/\b/)[0]);if(g.hasClass("group")){var f=$("input",g),a=$("input",e);for(var d=0,b=false;d<f.length;d++){if(f[d].value==a[d].value){b=true;}else{b=false;}}if(b){return true;}}else{return g.val()==a;}},min:function(a,b){var d=$(b).attr("class").match(/min(\d+)/)?RegExp.$1:null;if(a.length>0){return a.length>=d;}},max:function(a,b){var d=$(b).attr("class").match(/max(\d+)/)?RegExp.$1:null;if(a.length>0){return a.length<=d;}}},fn:function(h,g){msgs=$.extend({retype:"直前の項目と同じ内容を入力してください",email:"正しいEメールアドレスを入力してください",hankaku:"全角文字は使えません",tel:"正しい電話番号を入力してください",numonly:"数字のみで入力してください",zip:"正しい郵便番号を入力してください",min:"文字以上で入力してください",max:"文字以内で入力してください",check:"ひとつ以上を選択してください",radio:"いずれかを選択してください",required:"必須項目です",submit:"必須項目を正しく入力してください"},g);var a=$(h).attr("value");var f=$(h).attr("class");if(f.match(/group/)){a="";var e=$("input,select",h);e.each(function(j){a+=$(this).val();if(f.match(/email/)&&j==0&&$(this).val().length>0){a+="@";}});}var d={isError:false,failed:function(i,k){var j=msgs[k];if(k.match(/min/)&&f.match(/min(\d+)/)){j=RegExp.$1+msgs[k];}else{if(k.match(/max/)&&f.match(/max(\d+)/)){j=RegExp.$1+msgs[k];}}$.tip.msg(i.id,j);$.tip.fadeIn(i.id);this.isError=true;}};var b=$.validate.chk;for(c in b){if(f.match(/required|check|radio/)){$("#"+h.id+"_tip").addClass("requiredTip");}if(f.match(c)){if(typeof(b[c])!="function"){if(a&&!a.match(b[c])){d.failed(h,c);break;}}else{if(!b[c](a,h)){d.failed(h,c);break;}}}}if(!d.isError){$.tip.fadeOut(h.id);}}};$.fn.validation=function(b){if($(this).length<1){return false;}var e=this,h=500;if(!b){var b={};}var d=$.extend({dialog:true,submit:"#submit",position:"left",top:0,left:15,AjaxZip2:false,zip:"zip",zip2:null,pref:"pref",addr1:"addr",addr2:null,addr3:null},b.extension);var a=$("input[type='text'],input[type='password'],textarea,select",e).filter(function(){return this.className.match(/required|retype|email|hankaku|numonly|tel|zip/);});var f=function(i){$.validate.fn(i,b.msgs);if(!d.dialog){setTimeout(function(){if($("div.requiredTip:visible").length>0){$(d.submit).attr("disabled","disabled").addClass("disabled");}else{$(d.submit).removeAttr("disabled").removeClass("disabled");}},500);}};a.each(function(){$.tip.create(this.id,"",d.position,d.top,d.left,h--);f(this);$(this).keyup(function(){f(this);}).blur(function(){f(this);});$(this).filter("select").change(function(){f(this);});});$(".group,.check,.radio").each(function(){var i=this;$.tip.create(this.id,"",d.position,d.top,d.left);f(this);if($(this).hasClass("group")){$("input",this).keyup(function(){f(i);}).blur(function(){f(i);});$("select",this).change(function(){f(i);});}else{$("input",this).click(function(){f(i);});}});if(d.dialog){$.dialog.create(msgs.submit);}$("*[type='submit'],input[type='image']",e).click(function(){if($("div.requiredTip:visible").length>0){$.dialog.fadeIn(msgs.submit,b.dialog);return false;}else{var elem = this;var elemval = elem.value; if(!$.browser.mozilla) {window.setTimeout(function(){ elem.disabled = true; elem.value = elem.value + "中･･･";}, 1);}else{elem.disabled = true;elem.value = elem.value + "中･･･";}  window.setTimeout(function(){ elem.disabled = false; elem.value = elemval;}, 10000);}});if(d.AjaxZip2){var g=function(){AjaxZip2.zip2addr(d.zip,d.pref,d.addr1,d.zip2,d.addr2,d.addr3);setTimeout(function(){a.each(function(){f(this);});},10);};$("input[name='"+(d.zip2!=null?d.zip2:d.zip)+"']").keyup(function(){g();}).blur(function(){g();});}};

﻿/*
* jQuery Watermark Plugin
*   http://updatepanel.net/2009/04/17/jquery-watermark-plugin/
*
* Copyright (c) 2009 Ting Zwei Kuei
*
* Dual licensed under the MIT and GPL licenses.
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.opensource.org/licenses/gpl-3.0.html
*/
(function($) {
    $.fn.updnWatermark = function(options) {
        options = $.extend({}, $.fn.updnWatermark.defaults, options);
        return this.each(function() {
            var $input = $(this);
            var $watermark = $input.data("watermark");
            // only create watermark if title attribute exists
            if (!$watermark && this.title) {
                var $watermark = $("<label/>")
                    .insertBefore(this)
                    .text(this.title)
                    .attr("for", this.id)
                    .addClass(options.cssClass)
                    .hide()
                    .bind("position", function() {
                        var pos = $input.position();
                        $(this).css({
                            position: "absolute",
                            left: pos.left,
                            top: pos.top
                        })
                    })
                    .bind("show", function() {
                        $(this).fadeIn("fast");
                    })
                    .bind("hide", function() {
                        $(this).hide();
                    })
                    .bind("update", function() {
                        ($input.is(":visible") ? $(this).trigger("position").show() : $(this).hide());
                    });
                $input.data("watermark", $watermark);
            }
            if ($watermark) {
                $input
                    .focus(function(ev) {
                        $watermark.trigger("hide");
                    });
                $input
                    .blur(function(ev) {
                        if (!$(this).val()) {
                            $watermark.trigger("show");
                        }
                    });
                // set initial state
                if (!$input.val()) {
                    $watermark.trigger("position").show();
                }
            }
        });
    };
    $.fn.updnWatermark.defaults = {
        cssClass: "updnWatermark"
    };
    $.updnWatermark = {
        attachAll: function(options) {
            $.updnWatermark.all = $("input:text[title!=''],input:password[title!=''],textarea[title!='']").updnWatermark(options);
        },
        updateAll: function() {
            ($.updnWatermark.all && $.updnWatermark.all.each(function() {
                var $watermark = $(this).data("watermark");
                ($watermark && $watermark.trigger("update"));
            }));
        }
    };
})(jQuery);

var current_page;
var nia = {
  show_loading: function(id) {
      $(id).html("<div class='niaGadgetContent' style='height:" + $(id).height() + "px'><div id='innerLoading'><img src='/images/loading.gif' width='32' /> Loading･･･ </div></div>");
  },

  openWindowLink: function(id) {
//    if(!$.browser.safari) {
      $(id + " a.openwindow").each(function() {
        $(this).attr("title", $(this).text() + " 別窓で開く");
        $(this).after('<img src="/images/openwin.gif" style="position:relative;top:-3px;" alt="別窓で開く" />');
     });
      $(id + " a.openwindow").click(function(){
        window.open(this.href, '');
        pageTracker._trackEvent("link", this.href, $(this).text());
        return false;
      });
  },

  viewHistory : function(hash) {
    hash = hash.replace(/^.*#/, '');
    current_page = hash;
	$.historyLoad(hash);
    pageTracker._trackEvent("navi", hash, document.title);
	return false;
  },
  
  chgView: function(hash) {
    if (current_page == hash){
      return false;
    }
    current_page = hash;
    if (hash == "") {
    }else{
      nia.navi(hash);
    }
    return true;
  },
  navi: function(id) {
    $.ajax({
		beforeSend:function(request){
			nia.show_loading('#introduction');
		},
        success:function(request){
			$('#introduction').html(request);
            document.title = document.title.replace(/^.*-/, nia.pagetitle[id] + ' -');
  			nia.viewHistory(id);
		},
        error:function(XMLHttpRequest, textStatus, errorThrown){
			$('#introduction').html(textStatus);
        },
		type: 'get',
		url: '/' + id
 	});
  },
  pagetitle: {
      snippet: 'スニペット',
      rule: '利用規約',
      privacypolicy: 'プライバシーポリシー',
      thank: 'thanks',
      leave: '退会',
      setting: 'ユーザー設定'
  }
};

/*
 * Metadata - jQuery plugin for parsing metadata from elements
 *
 * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id$
 *
 */

/**
 * Sets the type of metadata to use. Metadata is encoded in JSON, and each property
 * in the JSON will become a property of the element itself.
 *
 * There are three supported types of metadata storage:
 *
 *   attr:  Inside an attribute. The name parameter indicates *which* attribute.
 *          
 *   class: Inside the class attribute, wrapped in curly braces: { }
 *   
 *   elem:  Inside a child element (e.g. a script tag). The
 *          name parameter indicates *which* element.
 *          
 * The metadata for an element is loaded the first time the element is accessed via jQuery.
 *
 * As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
 * matched by expr, then redefine the metadata type and run another $(expr) for other elements.
 * 
 * @name $.metadata.setType
 *
 * @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("class")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from the class attribute
 * 
 * @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
 * @before $.metadata.setType("attr", "data")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a "data" attribute
 * 
 * @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
 * @before $.metadata.setType("elem", "script")
 * @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
 * @desc Reads metadata from a nested script element
 * 
 * @param String type The encoding type
 * @param String name The name of the attribute to be used to get metadata (optional)
 * @cat Plugins/Metadata
 * @descr Sets the type of encoding to be used when loading metadata for the first time
 * @type undefined
 * @see metadata()
 */

(function($) {

$.extend({
	metadata : {
		defaults : {
			type: 'class',
			name: 'metadata',
			cre: /({.*})/,
			single: 'metadata'
		},
		setType: function( type, name ){
			this.defaults.type = type;
			this.defaults.name = name;
		},
		get: function( elem, opts ){
			var settings = $.extend({},this.defaults,opts);
			// check for empty string in single property
			if ( !settings.single.length ) settings.single = 'metadata';
			
			var data = $.data(elem, settings.single);
			// returned cached data if it already exists
			if ( data ) return data;
			
			data = "{}";
			
			if ( settings.type == "class" ) {
				var m = settings.cre.exec( elem.className );
				if ( m )
					data = m[1];
			} else if ( settings.type == "elem" ) {
				if( !elem.getElementsByTagName )
					return undefined;
				var e = elem.getElementsByTagName(settings.name);
				if ( e.length )
					data = $.trim(e[0].innerHTML);
			} else if ( elem.getAttribute != undefined ) {
				var attr = elem.getAttribute( settings.name );
				if ( attr )
					data = attr;
			}
			
			if ( data.indexOf( '{' ) <0 )
			data = "{" + data + "}";
			
			data = eval("(" + data + ")");
			
			$.data( elem, settings.single, data );
			return data;
		}
	}
});

/**
 * Returns the metadata object for the first member of the jQuery object.
 *
 * @name metadata
 * @descr Returns element's metadata object
 * @param Object opts An object contianing settings to override the defaults
 * @type jQuery
 * @cat Plugins/Metadata
 */
$.fn.metadata = function( opts ){
	return $.metadata.get( this[0], opts );
};

})(jQuery);

/*
 *         developed by Matteo Bicocchi on JQuery
 *         2002-2009 Open Lab srl, Matteo Bicocchi
 *			    www.open-lab.com - info@open-lab.com
 *       	version 2.2
 *       	tested on: 	Explorer and FireFox for PC
 *                  		FireFox and Safari for Mac Os X
 *                  		FireFox for Linux
 *         MIT (MIT-LICENSE.txt) licenses.
 */
//document.oncontextmenu = function() { return false };
// to get the element that is fireing a contextMenu event you have $.mbMenu.lastContextMenuEl that returns an object.

(function($) {
	$.mbMenu = {
		actualMenuOpener:false,
		options: {
			template:"yourMenuVoiceTemplate",// the url that returns the menu voices via ajax. the data passed in the request is the "menu" attribute value as "menuId"
			additionalData:"",
			menuSelector:".menuContainer",
			menuWidth:150,
			openOnRight:false,
			iconPath:"ico/",
			hasImages:true,
			fadeInTime:100,
			fadeOutTime:200,
			menuTop:0,
			menuLeft:0,
			submenuTop:0,
			submenuLeft:4,
			opacity:1,
			shadow:false,
			shadowColor:"black",
			shadowOpacity:.2,
			openOnClick:true,
			closeOnMouseOut:false,
			closeAfter:500,
			minZindex:"auto", // or number
			hoverIntent:0, //if you use jquery.hoverIntent.js set this to time in milliseconds; 0= false;
			submenuHoverIntent:0, //if you use jquery.hoverIntent.js set this to time in milliseconds; 0= false;
			onContextualMenu:function(){} //it pass o (the menu you clicked on) and e (the event)
		},
		buildMenu : function (options){
			return this.each (function ()
			{
				var thisMenu =this;
				thisMenu.id = !this.id ? "menu_"+Math.floor (Math.random () * 1000): this.id;
				this.options = {};
				$.extend (this.options, $.mbMenu.options);
				$.extend (this.options, options);

				$(".menu").hide();
				thisMenu.clicked = false;
				thisMenu.rootMenu=false;
				thisMenu.clearClicked=false;
				thisMenu.actualOpenedMenu=false;
				thisMenu.menuvoice=false;
				var root=$(this);
				var openOnClick=this.options.openOnClick;
				var closeOnMouseOut=this.options.closeOnMouseOut;

				//build roots
				$(root).each(function(){

					/*
					 *using metadata plugin you can add attribut writing them inside the class attr with a JSON sintax
					 * for ex: class="rootVoice {menu:'menu_2'}"
					 */
					if ($.metadata){
						$.metadata.setType("class");
						thisMenu.menuvoice=$(this).find(".rootVoice");
						$(thisMenu.menuvoice).each(function(){
							if ($(this).metadata().menu) $(this).attr("menu",$(this).metadata().menu);
						})
					}

					thisMenu.menuvoice=$(this).find("[menu]");

					$(thisMenu.menuvoice).each(function(){
						$(this).addClass("rootVoice");
						$(this).attr("nowrap","nowrap");
					});
					if(openOnClick){
						$(thisMenu.menuvoice).bind("click",function(){
							if (!$(this).attr("isOpen")){
								$(this).buildMbMenu(thisMenu,$(this).attr("menu"));
								$(this).attr("isOpen","true");
							}else{
								$(this).removeMbMenu(thisMenu,true);
								$(this).addClass("selected");
							}

							//empty
							if($(this).attr("menu")=="empty"){
								if(thisMenu.actualOpenedMenu){
									$(thisMenu.actualOpenedMenu).removeClass("selected");
									thisMenu.clicked=true;
									$(this).removeAttr("isOpen");
									clearTimeout(thisMenu.clearClicked);
								}
								$(this).removeMbMenu(thisMenu);
							}
							return false;
						});
					}
					var mouseOver=$.browser.msie?"mouseenter":"mouseover";
					var mouseOut=$.browser.msie?"mouseleave":"mouseout";
					if (this.options.hoverIntent==0){
						$(thisMenu.menuvoice).bind(mouseOver,function(){
							if (closeOnMouseOut) clearTimeout($.mbMenu.deleteOnMouseOut);
							if (!openOnClick) $(thisMenu).find(".selected").removeClass("selected");
							if(thisMenu.actualOpenedMenu){ $(thisMenu.actualOpenedMenu).removeClass("selected");}
							$(this).addClass("selected");
							if((thisMenu.clicked || !openOnClick) && !$(this).attr("isOpen")){
								clearTimeout(thisMenu.clearClicked);
								$(this).buildMbMenu(thisMenu,$(this).attr("menu"));
								if ($(this).attr("menu")=="empty"){
									$(this).removeMbMenu(thisMenu);
									$(this).removeAttr("isOpen");
								}
							}
						})
						$(thisMenu.menuvoice).bind(mouseOut,function(){
							if (closeOnMouseOut)
								$.mbMenu.deleteOnMouseOut= setTimeout(function(){$(this).removeMbMenu(thisMenu,true)},$(root)[0].options.closeAfter);
							if(!thisMenu.clicked)
								$(this).removeClass("selected");
							$(document).bind("click",function(){
								$(this).removeMbMenu(thisMenu,true);
							})
						})
					}else{ // HOVERHINTENT

//						$(thisMenu.menuvoice).bind(mouseOver,function(){
//							$(this).addClass("selected");
//						})
//						$(thisMenu.menuvoice).bind(mouseOut,function(){
//							$(this).removeClass("selected");
//						})

						$(thisMenu.menuvoice).hoverIntent({
							over:function(){
								if (closeOnMouseOut) clearTimeout($.mbMenu.deleteOnMouseOut);
								if (!openOnClick) $(thisMenu).find(".selected").removeClass("selected");
								if(thisMenu.actualOpenedMenu){ $(thisMenu.actualOpenedMenu).removeClass("selected");}
								$(this).addClass("selected");
								if((thisMenu.clicked || !openOnClick)  && !$(this).attr("isOpen")){
									clearTimeout(thisMenu.clearClicked);
									$(this).buildMbMenu(thisMenu,$(this).attr("menu"));
									if ($(this).attr("menu")=="empty"){
										$(this).removeMbMenu(thisMenu);
										$(this).removeAttr("isOpen");
									}
								}
							},
							sensitivity: 30,
							interval: this.options.hoverIntent,
							timeout: 0,
							out:function(){
								if (closeOnMouseOut)
									$.mbMenu.deleteOnMouseOut= setTimeout(function(){$(this).removeMbMenu(thisMenu,true)},$(root)[0].options.closeAfter);
								if(!thisMenu.clicked)
									$(this).removeClass("selected");
								$(document).bind("click",function(){
									$(this).removeMbMenu(thisMenu,true);
								})
							}
						})
					}

				})
			})
		},
		buildContextualMenu :  function (options){
			return this.each (function ()
			{
				var thisMenu = this;
				thisMenu.options = {};
				$.extend (thisMenu.options, $.mbMenu.options);
				$.extend (thisMenu.options, options);
				$(".menu").hide();
				thisMenu.clicked = false;
				thisMenu.rootMenu=false;
				thisMenu.clearClicked=false;
				thisMenu.actualOpenedMenu=false;
				thisMenu.menuvoice=false;

				/*
				 *using metadata plugin you can add attribut writing them inside the class attr with a JSON sintax
				 * for ex: class="rootVoice {menu:'menu_2'}"
				 */
				var cMenuEls;
				if ($.metadata){
					$.metadata.setType("class");
					cMenuEls= $(this).find(".cmVoice");
					$(cMenuEls).each(function(){
						if ($(this).metadata().cMenu) $(this).attr("cMenu",$(this).metadata().cMenu);
					})
				}
				cMenuEls= $(this).find("[cMenu]");

				$(cMenuEls).each(function(){
					$(this).css("-khtml-user-select","none");
					var cm=this;
					cm.id = !cm.id ? "menu_"+Math.floor (Math.random () * 100): cm.id;
					$(cm).css({cursor:"default"});
					$(cm).bind("contextmenu","mousedown",function(event){
						//if (event.button ==2 || event.which==3){
						event.preventDefault();
						event.stopPropagation();
						event.cancelBubble=true;

						$.mbMenu.lastContextMenuEl=cm;

						if ($.mbMenu.options.actualMenuOpener) {
							$(thisMenu).removeMbMenu($.mbMenu.options.actualMenuOpener);
						}
						/*add custom behavior to contextMenuEvent passing the el and the event
						 *you can for example store to global var the obj that is fireing the event
						 *mbActualContextualMenuObj=cm;
						 *
						 * you can for example create a function that manipulate the voices of the menu
						 * you are opening according to a certain condition...
						 */

						thisMenu.options.onContextualMenu(this,event);

						$(this).buildMbMenu(thisMenu,$(this).attr("cMenu"),"cm",event);
						$(this).attr("isOpen","true");

						//}
					})
				})
			})
		}
	}
	$.fn.extend({
		buildMbMenu: function(op,m,type,e){
			var msie6=$.browser.msie && $.browser.version=="6.0";
			var mouseOver=$.browser.msie?"mouseenter":"mouseover";
			var mouseOut=$.browser.msie?"mouseleave":"mouseout";
			$().bind("click",function(){$(document).removeMbMenu(op,true)})
			if (e) {
				this.mouseX=$(this).getMouseX(e);
				this.mouseY=$(this).getMouseY(e);
			}

			if ($.mbMenu.options.actualMenuOpener && $.mbMenu.options.actualMenuOpener!=op)
				$(op).removeMbMenu($.mbMenu.options.actualMenuOpener);
			$.mbMenu.options.actualMenuOpener=op;
			if(!type || type=="cm")	{
				if (op.rootMenu) {
					$(op.rootMenu).removeMbMenu(op);
					$(op.actualOpenedMenu).removeAttr("isOpen")
				}
				op.clicked=true;
				op.actualOpenedMenu=this;
				$(op.actualOpenedMenu).attr("isOpen","true")
				$(op.actualOpenedMenu).addClass("selected");
			}
			var opener=this;
			var where=(!type|| type=="cm")?$(document.body):$(this).parent().parent();

			//empty
			if($(this).attr("menu")=="empty"){
				return;
			}

			var menuClass= op.options.menuSelector.replace(".","")
			where.append("<div class='menuDiv'><div class='"+menuClass+"' style='display:table'></div></div>");
			this.menu  = where.find(".menuDiv");
			$(this.menu).css({width:0, height:0});
			if (op.options.minZindex!="auto"){
				$(this.menu).css({zIndex:op.options.minZindex++});
			}else{
				$(this.menu).mb_BringToFront();
			}
			this.menuContainer  = $(this.menu).find(op.options.menuSelector);
			$(this.menuContainer).bind(mouseOver,function(){
				$(opener).addClass("selected");
			})
			$(this.menuContainer).css({
				position:"absolute",
				opacity:op.options.opacity
			});
			if (!$("#"+m).html()){
				$.ajax({
					type: "POST",
					url: op.options.template,
					cache: false,
					async: false,
					data:"menuId="+m+(op.options.additionalData!=""?"&"+op.options.additionalData:""),
					success: function(html){
						$("body").append(html);
						$("#"+m).hide();
					}
				});
			}
			$(this.menuContainer).hide();
			this.voices= $("#"+m).find("a").clone();


			if (op.options.shadow) {
				var shadow = $("<div class='menuShadow'></div>").hide();
				if(msie6)
					shadow = $("<iframe class='menuShadow'></iframe>").hide();
			}

			/*
			 *using metadata plugin you can add attribut writing them inside the class attr with a JSON sintax
			 * for ex: class="rootVoice {menu:'menu_2'}"
			 */
			if ($.metadata){
				$.metadata.setType("class");
				$(this.voices).each(function(){
					if ($(this).metadata().disabled) $(this).attr("disabled",$(this).metadata().disabled);
					if ($(this).metadata().img) $(this).attr("img",$(this).metadata().img);
					if ($(this).metadata().menu) $(this).attr("menu",$(this).metadata().menu);
					if ($(this).metadata().action) $(this).attr("action",$(this).metadata().action);
					if ($(this).metadata().disabled) $(this).attr("disabled",$(this).metadata().disabled);
				})
			}

			// build each voices of the menu
			$(this.voices).each(function(i){

				var voice=this;
				var imgPlace="";
				var isText=$(voice).attr("rel")=="text";
				var isTitle=$(voice).attr("rel")=="title";
				var isDisabled=$(voice).is("[disabled]");
				var isSeparator=$(voice).attr("rel")=="separator";

				if (op.options.hasImages && !isText){

					var imgPath=$(voice).attr("img")?$(voice).attr("img"):"blank.gif";
					imgPath=(imgPath.length>3 && imgPath.indexOf(".")>-1)?"<img class='imgLine' src='"+op.options.iconPath+imgPath+"'>":imgPath;
					imgPlace="<td class='img'>"+imgPath+"</td>"
				}
				var line="<table id='"+m+"_"+i+"' class='line"+(isTitle?" title":"")+"' cellspacing='0' cellpadding='0' border='0' style='width:100%; display:table' width='100%'><tr>"+imgPlace+"<td class='voice' nowrap></td></tr></table>";
				if(isSeparator)
					line="<div class='separator' style='width:100%; display:inline-block'><img src='"+op.options.iconPath+"blank.gif' width='1' height='1'></div>"
				if(isText)
					line="<div style='width:100%; display:table' class='line' id='"+m+"_"+i+"'><div class='voice'></div></div>";

				$(opener.menuContainer).append(line);

				if(!isSeparator){
					$(opener.menuContainer).find("#"+m+"_"+i).find(".voice").append(this);
					if($(this).attr("menu")){
						$(opener.menuContainer).find("#"+m+"_"+i).find(".voice a").wrap("<div class='menuArrow'></div>");
						$(opener.menuContainer).find("#"+m+"_"+i).find(".menuArrow").addClass("subMenuOpener");
						$(opener.menuContainer).find("#"+m+"_"+i).css({cursor:"default"})
						this.isOpener=true;
					}
					if(isText){
						$(opener.menuContainer).find("#"+m+"_"+i).find(".voice").addClass("textBox");
						this.isOpener=true;
					}
					if(isDisabled){
						$(opener.menuContainer).find("#"+m+"_"+i)
							.addClass("disabled")
							.css({cursor:"default"})
					}

					if(!(isText || isTitle || isDisabled)){
						$(opener.menuContainer)
							.find("#"+m+"_"+i)
							.css({cursor:"pointer"});
						if (op.options.submenuHoverIntent==0){
							$(opener.menuContainer).find("#"+m+"_"+i)
								.bind("mouseover",function(event){
								clearTimeout($.mbMenu.deleteOnMouseOut);
								$(this).addClass("selected");
								if(opener.menuContainer.actualSubmenu && !$(voice).attr("menu")){
									$(opener.menu).find(".menuDiv").remove();
									$(opener.menuContainer.actualSubmenu).removeClass("selected");
									opener.menuContainer.actualSubmenu=false;
									//return false;
								}
								if ($(voice).attr("menu")){

									if(opener.menuContainer.actualSubmenu && opener.menuContainer.actualSubmenu!=this){
										$(opener.menu).find(".menuDiv").remove();
										$(opener.menuContainer.actualSubmenu).removeClass("selected");
										opener.menuContainer.actualSubmenu=false;
									}
									if (!$(voice).attr("action")) $(opener.menuContainer).find("#"+m+"_"+i).css("cursor","default")
									if (!opener.menuContainer.actualSubmenu || opener.menuContainer.actualSubmenu!=this){
										$(opener.menu).find(".menuDiv").remove();

										opener.menuContainer.actualSubmenu=false;
										$(this).buildMbMenu(op,$(voice).attr("menu"),"sm",event);
										opener.menuContainer.actualSubmenu=this;
									}
									$(this).attr("isOpen","true")
									return false;
								}
							})
						}else{  // HOVERHINTENT
							$(opener.menuContainer).find("#"+m+"_"+i)
								.bind("mouseover",function(event){
								clearTimeout($.mbMenu.deleteOnMouseOut);
								$(this).addClass("selected");
							});
							$(opener.menuContainer).find("#"+m+"_"+i).hoverIntent({
								over:function(event){
									if(opener.menuContainer.actualSubmenu && !$(voice).attr("menu")){
										$(opener.menu).find(".menuDiv").remove();
										$(opener.menuContainer.actualSubmenu).removeClass("selected");
										opener.menuContainer.actualSubmenu=false;
									}
									if ($(voice).attr("menu")){

										if(opener.menuContainer.actualSubmenu && opener.menuContainer.actualSubmenu!=this){
											$(opener.menu).find(".menuDiv").remove();
											$(opener.menuContainer.actualSubmenu).removeClass("selected");
											opener.menuContainer.actualSubmenu=false;
										}
										if (!$(voice).attr("action")) $(opener.menuContainer).find("#"+m+"_"+i).css("cursor","default")
										if (!opener.menuContainer.actualSubmenu || opener.menuContainer.actualSubmenu!=this){
											$(opener.menu).find(".menuDiv").remove();

											opener.menuContainer.actualSubmenu=false;
											$(this).buildMbMenu(op,$(voice).attr("menu"),"sm",event);
											opener.menuContainer.actualSubmenu=this;
										}
										$(this).attr("isOpen","true")
										return false;
									}
								},
								out:function(){},
								sensitivity: 30,
								interval: op.options.submenuHoverIntent,
								timeout: 0
							})
						}

						$(opener.menuContainer).find("#"+m+"_"+i).bind(mouseOut,function(){
							$(this).removeClass("selected");
						})
					}
					if(isDisabled || isTitle){
						$(this).removeAttr("href");
						$(opener.menuContainer).find("#"+m+"_"+i).bind(mouseOver,function(){
							$(document).unbind("click");
							if(opener.menuContainer.actualSubmenu){
								$(opener.menu).find(".menuDiv").remove();
								opener.menuContainer.actualSubmenu=false;
							}
						}).css("cursor","default")
					}
					$(opener.menuContainer).find("#"+m+"_"+i).bind("click",function(){
						if (($(voice).attr("action") || $(voice).attr("href")) && !isDisabled){
							var target=$(voice).attr("target")?$(voice).attr("target"):"_self";
							if ($(voice).attr("href") && $(voice).attr("href").indexOf("javascript:")>-1){
								$(voice).attr("action",$(voice).attr("href").replace("javascript:",""));
								$(voice).removeAttr("href");
							}
							var link=$(voice).attr("action")?$(voice).attr("action"):"window.open('"+$(voice).attr("href")+"', '"+target+"')";
							$(voice).removeAttr("href");
							eval(link);
							$(this).removeMbMenu(op,true);
						}else if($(voice).attr("menu"))
							return false;
					})
				}
			})

			// Close on Mouseout

			var closeOnMouseOut=$(op)[0].options.closeOnMouseOut;
			if (closeOnMouseOut){
				$(opener.menuContainer).bind("mouseenter",function(){
					clearTimeout($.mbMenu.deleteOnMouseOut);
				})
				$(opener.menuContainer).bind("mouseleave",function(){
					var menuToRemove=$.mbMenu.options.actualMenuOpener;
					$.mbMenu.deleteOnMouseOut= setTimeout(function(){$(this).removeMbMenu(menuToRemove,true)},$(op)[0].options.closeAfter);
				})
			}


			//positioning opened
			var t=0,l=0
			$(this.menuContainer).css({
				width:op.options.menuWidth
			})
			if ($.browser.msie) $(this.menuContainer).css("width",$(this.menuContainer).width()+2);


			switch(type){
				case "sm":
					t=$(this).position().top+op.options.submenuTop;

					l=$(this).position().left+$(this).width()-op.options.submenuLeft;
					break;
				case "cm":
					t=this.mouseY-5;
					l=this.mouseX-5;
					break;
				default:
					if (op.options.openOnRight){
						t=$(this).offset().top-($.browser.msie?2:0)+op.options.menuTop;
						l=$(this).offset().left+$(this).outerWidth()-op.options.menuLeft-($.browser.msie?2:0);
					}else{
						t=$(this).offset().top+$(this).outerHeight()-(!$.browser.mozilla?2:0)+op.options.menuTop;
						l=$(this).offset().left+op.options.menuLeft;
					}
					break;
			}

			$(this.menu).css({
				position:"absolute",
				top:t,
				left:l
			})

			if (!type || type=="cm") op.rootMenu=this.menu;
			$(this.menuContainer).bind(mouseOut,function(){
				$(document).bind("click",function(){$(document).removeMbMenu(op,true)})
			})

			if (op.options.fadeInTime>0) $(this.menuContainer).fadeIn(op.options.fadeInTime);
			else $(this.menuContainer).show();

			if (op.options.shadow) {
				$(this.menu).prepend(shadow)
				shadow.css({
					width:$(this.menuContainer).outerWidth(),
					height:$(this.menuContainer).outerHeight()-1,
					position:'absolute',
					backgroundColor:op.options.shadowColor,
					border:0,
					opacity:op.options.shadowOpacity
				}).show();
			}

			var wh=$(window).height();
			var ww=$(window).width();
			var mh=$(this.menuContainer).outerHeight();
			var mw=shadow?shadow.outerWidth():$(this.menuContainer).outerWidth();

			var actualX=$(where.find(".menuDiv:first")).offset().left;
			var actualY=$(where.find(".menuDiv:first")).offset().top;
			switch(type){
				case "sm":
					if ((actualX+mw)>= ww){
						l-=((op.options.menuWidth*2)-(op.options.submenuLeft*2))
					}
					break;
				case "cm":
					if ((actualX+(op.options.menuWidth*1.5))>= ww){
						l-=((op.options.menuWidth*2)-(op.options.submenuLeft))
					}
					break;
				default:
					if ((actualX+mw)>= ww){
						l-=($(this.menuContainer).offset().left+mw)-ww;
					}
					break;
			}
			if ((actualY+mh)>= wh-10){
				t-=((actualY+mh)-wh)+30;
			}

			$(this.menu).css({
				top:t,
				left:l
			})
		},
		removeMbMenu: function(op,fade){
			if(!op)op=$.mbMenu.options.actualMenuOpener;
			if (op.rootMenu) {
				$(op.actualOpenedMenu)
					.removeAttr("isOpen")
					.removeClass("selected");
				$(op.rootMenu).css({width:1, height:1});
				if (fade) $(op.rootMenu).fadeOut(op.options.fadeOutTime,function(){$(this).remove()});
				else $(op.rootMenu).remove();
				op.rootMenu=false;
				op.clicked=false
				$(document).unbind("click");
			}
		},

		//mouse  Position
		getMouseX : function (e){
			var mouseX;
			if ($.browser.msie)mouseX = event.clientX + document.body.scrollLeft;
			else mouseX = e.pageX;
			if (mouseX < 0) mouseX = 0;
			return mouseX;
		},
		getMouseY : function (e){
			var mouseY;
			if ($.browser.msie)	mouseY = event.clientY + document.body.scrollTop;
			else mouseY = e.pageY;
			if (mouseY < 0)	mouseY = 0;
			return mouseY;
		},
		//get max z-inedex of the page
		mb_BringToFront: function(){
			var zi=10;
			$('*').each(function() {
				if($(this).css("position")=="absolute"){
					var cur = parseInt($(this).css('zIndex'));
					zi = cur > zi ? parseInt($(this).css('zIndex')) : zi;
				}
			});

			$(this).css('zIndex',zi+=10);
		}

	})
	$.fn.buildMenu = $.mbMenu.buildMenu;
	$.fn.buildContextualMenu = $.mbMenu.buildContextualMenu;
})(jQuery);

/**
* Styleswitch stylesheet switcher built on jQuery
* Under an Attribution, Share Alike License
* By Kelvin Luck ( http://www.kelvinluck.com/ )
**/

$(document).ready(function() {
	$('.styleswitch').click(function()
	{
		switchStylestyle(this.getAttribute("rel"));
		return false;
	});
	var c = readCookie('style');
	if (c) switchStylestyle(c);
});

function switchStylestyle(styleName)
{
	$(document).find("@rel*=style][title]").each(function(i)
	{
		this.disabled = true;
		if (this.getAttribute('title') == styleName) this.disabled = false;
	});
	createCookie('style', styleName, 365);
}

// cookie functions http://www.quirksmode.org/js/cookies.html
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
// /cookie functions

﻿/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
*	interval: 100,   // number = milliseconds of polling interval
*	over: showNav,  // function = onMouseOver callback (required)
*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
*	out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($) {
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};
})(jQuery);

(function($){$().ajaxSend(function(a,xhr,s){xhr.setRequestHeader("Accept","text/javascript, text/html, application/xml, text/xml, */*")})})(jQuery);(function($){$.fn.reset=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(){return this.each(function(){this.disabled=false})};$.fn.disable=function(){return this.each(function(){this.disabled=true})}})(jQuery);(function($){$.extend({fieldEvent:function(el,obs){var field=el[0]||el,e="change";if(field.type=="radio"||field.type=="checkbox"){e="click"}else{if(obs&&field.type=="text"||field.type=="textarea"){e="keyup"}}return e}});$.fn.extend({delayedObserver:function(delay,callback){var el=$(this);if(typeof window.delayedObserverStack=="undefined"){window.delayedObserverStack=[]}if(typeof window.delayedObserverCallback=="undefined"){window.delayedObserverCallback=function(stackPos){observed=window.delayedObserverStack[stackPos];if(observed.timer){clearTimeout(observed.timer)}observed.timer=setTimeout(function(){observed.timer=null;observed.callback(observed.obj,observed.obj.formVal())},observed.delay*1000);observed.oldVal=observed.obj.formVal()}}window.delayedObserverStack.push({obj:el,timer:null,delay:delay,oldVal:el.formVal(),callback:callback});var stackPos=window.delayedObserverStack.length-1;if(el[0].tagName=="FORM"){$(":input",el).each(function(){var field=$(this);field.bind($.fieldEvent(field,delay),function(){observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.obj.oldVal){return}else{window.delayedObserverCallback(stackPos)}})})}else{el.bind($.fieldEvent(el,delay),function(){observed=window.delayedObserverStack[stackPos];if(observed.obj.formVal()==observed.obj.oldVal){return}else{window.delayedObserverCallback(stackPos)}})}},formVal:function(){var el=this[0];if(el.tagName=="FORM"){return this.serialize()}if(el.type=="checkbox"||self.type=="radio"){return this.filter("input:checked").val()||""}else{return this.val()}}})})(jQuery);(function($){$.fn.extend({visualEffect:function(o){e=o.replace(/\_(.)/g,function(m,l){return l.toUpperCase()});return eval("$(this)."+e+"()")},appear:function(speed,callback){return this.fadeIn(speed,callback)},blindDown:function(speed,callback){return this.show("blind",{direction:"vertical"},speed,callback)},blindUp:function(speed,callback){return this.hide("blind",{direction:"vertical"},speed,callback)},blindRight:function(speed,callback){return this.show("blind",{direction:"horizontal"},speed,callback)},blindLeft:function(speed,callback){this.hide("blind",{direction:"horizontal"},speed,callback);return this},dropOut:function(speed,callback){return this.hide("drop",{direction:"down"},speed,callback)},dropIn:function(speed,callback){return this.show("drop",{direction:"up"},speed,callback)},fade:function(speed,callback){return this.fadeOut(speed,callback)},fadeToggle:function(speed,callback){return this.animate({opacity:"toggle"},speed,callback)},fold:function(speed,callback){return this.hide("fold",{},speed,callback)},foldOut:function(speed,callback){return this.show("fold",{},speed,callback)},grow:function(speed,callback){return this.show("scale",{},speed,callback)},highlight:function(speed,callback){return this.show("highlight",{},speed,callback)},puff:function(speed,callback){return this.hide("puff",{},speed,callback)},pulsate:function(speed,callback){return this.show("pulsate",{},speed,callback)},shake:function(speed,callback){return this.show("shake",{},speed,callback)},shrink:function(speed,callback){return this.hide("scale",{},speed,callback)},squish:function(speed,callback){return this.hide("scale",{origin:["top","left"]},speed,callback)},slideUp:function(speed,callback){return this.hide("slide",{direction:"up"},speed,callback)},slideDown:function(speed,callback){return this.show("slide",{direction:"up"},speed,callback)},switchOff:function(speed,callback){return this.hide("clip",{},speed,callback)},switchOn:function(speed,callback){return this.show("clip",{},speed,callback)}})})(jQuery);