/*

[js] sticky package 02:16:09 07/02/12

19:11:57 25/08/10 - jquery.media.js - 17K
19:11:57 25/08/10 - jquery.colorbox.js - 9K
19:11:57 25/08/10 - jquery.form.js - 10K
19:11:57 25/08/10 - jquery.validate.js - 22K
19:11:57 25/08/10 - javalib.js - 17K

*/

/* jquery.media.js */

var _jm;
_jm = jQuery.fn.media = function(scriptoptions,mediaoptions){
	$(".jm_noscript").remove();
	if(typeof(version)=='undefined')var version=[];
	return this.each(function(index){
		var $this=jQuery(this);
		var soptions=jQuery.extend({
			elemType:this.nodeName,
			elemClass:'jm_replaced',
			forceObjectTag:false,
			mode:'replace',
			version:'6,0,0',
			fullScreen:false,
			errTxt:'',
			sifrPaddingTop:0,
			sifrPaddingBottom:0,
			sifrPaddingLeft:0,
			sifrPaddingRight:0,
			flashXI:false,
			flashXIsrc:'js/XI.swf'
		}, scriptoptions || {});
		var moptions=jQuery.extend({
			src: $this.attr('href') || $this.attr('src') || '#',
			width:320,
			height:280
			}, mediaoptions || {});
		if(moptions.src=="#")return false;	//	exit: no valid src
		var t=_jm.getPluginName(moptions.src);
		if (t==false) return false;			//	exit: no valid src extension
		if (typeof(version[t])=='undefined' && _jm.uaHas("w3cdom") && !_jm.uaHas("ieMac")) version[t]=_jm.detectPluginVersion(t,soptions.forceObjectTag);
		if(_jm.checkVersion(soptions.version,version[t])==true){
			if(t=='flash' && soptions.mode=='sifr')moptions=_jm.getSifrContent($this,moptions,soptions);
			else if(soptions.mode=='replace')$this.hide();
			var _el=$('<'+soptions.elemType+' class="'+ soptions.elemClass +'"></'+soptions.elemType+'>');
			if (soptions.fullScreen==true){
				$(_el).width("100%");
				$(_el).height("100%");
				$(_el).css({"position":"absolute","left":0,"top":0});
				$("body").css({"overflow":"hidden","height":"100%","width":"100%"});
				$("html").css({"overflow":"hidden","height":"100%","width":"100%"});
				moptions.width="100%";
				moptions.height="100%";
			}
			var _s=_jm.writeHtml($this,t,soptions,moptions);
			if(t=='flash' && soptions.mode=='sifr'){
				var _alternate=document.createElement('span');
				$(_alternate).addClass('sifr-alternate');
				$(_alternate).append($this.html());
				$this.html('');
				if ((typeof(_s)).toString().toLowerCase()=='string')$this.html(_s);
				else $this.append(_s);
				$this.append(_alternate);
			}
			else if(soptions.mode=='onclick'){
				$(this).click(function(){
					$(_el).hide();
					$(".jm_closebtn").remove();
					var _closecon=$("<span></span>");;
					$(_closecon).addClass("jm_closebtn");
					$(_closecon).css({width:moptions.width});
					var _closebtn=$('<a href="#">close&nbsp;</a>');
					$(_closecon).append($(_closebtn));
					$(_closebtn).click(function(){$(_el).remove();return false;});
					$(this).after($(_el));
					$(_el).show();
					if ((typeof(_s)).toString().toLowerCase()=='string')$(_el).html(_s);
					else $(_el).append(_s);
					$(_el).prepend($(_closecon));
					return false;
				});
			}
			else {
				if ((typeof(_s)).toString().toLowerCase()=='string')_el.html(_s);
				else _el.append(_s);
				$this.after(_el).remove();
			}
			return true;
		}
		else if( t=='flash' && soptions.flashXI==true && (_jm.checkVersion("6,0,65",version[t])==true) ){
			// do flashXI
			moptions.src=soptions.flashXIsrc;
			moptions.width='215';
			moptions.height='138';
			var _type = _jm.type=='axo' ? "ActiveX" : "PlugIn";
			var _uc = typeof soptions.flashXIcancelURL != "undefined" ? "&xiUrlCancel=" + soptions.flashXIcancelURL : "";
			var _uf = typeof soptions.flashXIfailedURL != "undefined" ? "&xiUrlFailed=" + soptions.flashXIfailedURL : "";
			if (_jm.uaHas("xml") && _jm.uaHas("safari")) var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
			else var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
			moptions.flashVars="MMredirectURL=" + window.location + "&MMplayerType=" + _type + "&MMdoctitle=" + _mmd + _uc + _uf;
			var _s=_jm.writeHtml($this,t,soptions,moptions);
			var _el=jQuery('<div id="flashXI"></div>');
			var _con=jQuery('<div id="flashXIcon"></div>');
			if ((typeof(_s)).toString().toLowerCase()=='string')_el.html(_s);
			else _el.append(_s);
			$('body').css({height:"100%",overflow:"hidden"});
			$('html').css({height:"100%",overflow:"hidden"});
			$(_con).css({position:"absolute", top:0, left:0, "z-index":1000, background:"white", width:"100%", height:"100%", filter:"alpha(opacity:75)", opacity:0.75});
			$(_el).css({position:"absolute", left:"50%", top:"50%", "margin-left":parseInt(moptions.width/2*(-1)) + "px", "margin-top":parseInt(moptions.height/2*(-1)) + "px"});
			$(_el).css({width:moptions.width + "px",height:moptions.height + "px"});
			$(_con).append(_el);
			$('body').prepend($(_con));
		}
		else if(soptions.mode=='onclick'){
			var _trig=false;
			$(this).click(function(){
				$(".jm_onfailure").remove();
				if (_trig==false){
					var errtxt=$(soptions.errTxt.replace(/#link/,$(this).attr("href")));
					$(this).after($(errtxt));
					if(_jm.uaHas("w3cdom") && !_jm.uaHas("ieMac"))$(".jm_oldbrowsers").remove();
					_trig=true;
				}
				else {
					_trig=false;
				}
				return false;
			});
		}	
		else return false;
	});
};
_jm.checkVersion = function(reqver,uaver){
	if (typeof(uaver)=='undefined' || uaver=='not installed')return false;
	else {
		if(uaver=='unknown')return true;	// wmedia && npapi
		var _uav = uaver.split(",");
		var _rqv = reqver.toString().replace(/\./,",").split(",");
		for(var i = 0; i < 3; i++) {
			_uav[i] = parseInt(_uav[i] || 0);
			_rqv[i] = parseInt(_rqv[i] || 0);
			if(_uav[i] < _rqv[i]) return false;
			if(_uav[i] > _rqv[i]) return true;
		}
		return true;
}};
_jm.detectPluginVersion = function(t,fo){
	if(typeof(t)=='undefined')return false;	//	exit: no plugintype
	var _gao=false;
	var _np=navigator.plugins;
	if (_np && _np.length){
		if ( t == 'wmedia' && fo==false) _gao = _jm.detectGeckoAXO(); 	//		deactivate to skip geckoactiveX detection
		if (_gao==false){
		_jm.type='npapi';
		//	_jm.type='axo'; 	//to simulate axo markup;
		for (_i = 0; _i < _np.length; _i++){
			var _p = _np[_i];
			var _sl=_jm.plugins[t].description.length;
			for (_ii = 0; _ii < _sl; _ii++){
				if (_p.name.indexOf(_jm.plugins[t].description[_ii]) != -1) {
					var _n = _p.name;
					var _d = _p.description;
					switch(t){
						case "flash" :
							return _d.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").replace(/(\.)/g,",");
						case "director" :
							return  _d.split('version ')[1].replace(/(\.)/g,",");
						case "quicktime" :
							return  _n.replace(/([a-zA-Z]|\s|-)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").replace(/(\.)/g,",");
						case "real" :
							return  _d.replace(/(\.)/g,",");
						case "wmedia" :
							return  'unknown';
						default:
							return  'not installed';
	}}}}}}
	if( window.ActiveXObject || _gao == true ) {
		_jm.type='axo';
		for (_i = 0; _i < _jm.plugins[t].progID.length; _i++){
			var _axon=_jm.plugins[t].progID[_i];
			try {
				if (_gao == true) _axo = new GeckoActiveXObject(_axon);
				else _axo = new ActiveXObject(_axon);
				switch(t){
					case "flash":
						var _axov=0;
						if (_axon=="ShockwaveFlash.ShockwaveFlash.7")_axov = axo.GetVariable("$version");
						else if("ShockwaveFlash.ShockwaveFlash.6"){
							_axov =  "6,0,21,0";
							_axo.AllowScriptAccess = "always";
							_axov = _axo.GetVariable("$version");
						}
						else if("ShockwaveFlash.ShockwaveFlash.3"){
							_axov = axo.GetVariable("$version");
							if(_axov==0)_axov = "3,0,18,0";
						}
						else if("ShockwaveFlash.ShockwaveFlash")_axov = "2,0,0,11";
						return  _axov.replace(/([a-zA-Z]|\s|-)+/, "").toString();
					case "director":
						return  _axo.ShockwaveVersion("").replace(/r/,",").replace(/\./g,",");
					case "quicktime" :
						return _axo.QuickTimeVersion.toString(16).replace(/(\d)/g,"$1,").toString().replace(/\./,",");
					case "real":
						return _axo.GetVersionInfo().toString().replace(/(\.)/g,",");
					case "wmedia":
						return _axo.versionInfo.toString().replace(/(\.)/g,",");
					case "acrobat":
						var _acv=_axon.split(".")[2];
						if (_acv=="1")_acv=7;
						return _acv+",0";
					default:
						return 'not installed';
					}} 
			catch (e) {}
}}};
_jm.detectGeckoAXO = function(){
	var _n=navigator.plugins;
	if (_n && _n.length){
	for (_x=0; _x<_n.length; _x++){
		if (_n[_x].name.indexOf('ActiveX') != -1 && window.GeckoActiveXObject)return true;
	}}
	return false;
};
_jm.getPluginName = function(src){
	var _arr=src.split(".");
	var ext=_arr[(_arr.length-1)];
	switch(ext){
		case 'ram':
			return 'real';
		case 'rm':
			return 'real';
		case 'swf':
			return 'flash';
		case 'mov':
			return 'quicktime';
		case 'dcr':
			return 'director';
		case 'wmv':
			return 'wmedia';
		case 'asx':
			return 'wmedia';
	}
	return false;
};
_jm.writeHtml = function(elem,t,soptions,moptions){
	var _pt=t;
	if(_pt=='flash' && typeof(moptions.flashVars)!='undefined' && moptions.flashVars.indexOf(/&/)==0)moptions.flashVars=moptions.flashVars.substr(1,(moptions.flashVars.length-1));
	if(_jm.type=='axo'){
		var _objPar = "";
		for(var key in moptions)
			if(typeof moptions[key] != 'function' && key !="height" && key !="width" && key !="src" && (_pt!="flash" || (key!="align" && key!="base" && key!="swfliveconnect")))
				_objPar += '<param name="'+key+'" value="'+moptions[key]+'">';
		if(_pt=="flash")_objPar += '<param name="movie" value="' + moptions.src + '">';
		else if(_pt=="wmedia")_objPar += '<param name="filename" value="' +moptions.src + '">';
		else _objPar += '<param name="src" value="' + moptions.src + '">';
		var _objAtt = "";
		if (_pt=="flash" && typeof(moptions.align)!='undefined')_objAtt += ' align="' + moptions.align + '"';
		if (_pt=="flash" && typeof(moptions.base)!='undefined')_objAtt += ' base="' + moptions.base + '"';
		else if (_pt=="wmedia")_objAtt += ' type="' + _jm.plugins[_pt].mimeType[2] + '"';
		var _cb="";
		var _p = window.location.protocol == "https:" ? "https:" : "http:";
		if(_jm.plugins[_pt].codeBase!=undefined) _cb=' codebase="' + _p+ "//" + _jm.plugins[_pt].codeBase + '"';
		var _oStr='<object classid="clsid:' + _jm.plugins[_pt].classID +'" '+ _objAtt + ' width="' + moptions.width + '" height="' + moptions.height + '"' + _cb + '>' + _objPar + '</object>';
		return _oStr;
		} 
	else if (_jm.type=='npapi'){
	   if ((soptions.forceObjectTag==true && _jm.uaHas("gecko")) || _jm.uaHas("xml")) {
			var _obj = $("<object></object>");
			var _mt = _jm.plugins[_pt].mimeType[1] ? _jm.plugins[_pt].mimeType[1] : _jm.plugins[_pt].mimeType[0];
			$(_obj).attr({type:_mt, data: moptions.src,width:moptions.width,height: moptions.height});
			var _objPar = "";
			for(var key in moptions){
				if(typeof moptions[key] != 'function' && key !="height" && key !="width" && key !="src" ){
					if (_pt != 'real') {
						var _p = $("<param>");
					   $(_p).attr({name: key, value: moptions[key] });
					   $(_obj).append($(_p));
					}
					else $(_obj).attr(key,moptions[key]);
				}
			}
			if (_pt=="flash"){
			  var _p = $("<param>");
			  $(_p).attr({name:"movie", value:moptions.src});
			  $(_obj).append($(_p));
			}
			else {
			   var _p = $("<param>");
			   $(_p).attr({name:"src", value: moptions.src});
			   $(_obj).append($(_p));
			}
			return _obj;
		}
		else {
			var _embAttr ='';
			for(var key in moptions)
				if(typeof moptions[key] != 'function' && key!='src')
					_embAttr += key+'="'+moptions[key]+'" ';
			var _embStr='<embed type="' + _jm.plugins[_pt].mimeType[0] + '" src="' + moptions.src + '" pluginspage="' + _jm.plugins[_pt].pluginsPage + '" ' + _embAttr + '></embed>';
			return _embStr;
		}
 }};
_jm.getSifrContent = function(elem,moptions,soptions){
	$('body').addClass('sifr-hasflash');
	$(elem).addClass('sifr-replaced');
	moptions.width=parseInt($(elem).offsetWidth - soptions.sifrPaddingLeft - soptions.sifrPaddingRight);
	moptions.height=$(elem).height() - soptions.sifrPaddingTop - soptions.sifrPaddingBottom;
	if(isNaN(moptions.width))moptions.width=$(elem).width() - soptions.sifrPaddingLeft - soptions.sifrPaddingRight;
	if (typeof(moptions.flashVars)=='undefined') jQuery.extend(moptions,{flashVars:''});
	if(!moptions.flashVars.match(/textcolor/)) moptions.flashVars += "&textcolor=#000000";
	var _ch=$(elem).children();
	if(_ch.length>0){
		var content="";
		var sLinkVars="";
		var sLinkCnt=0;
		_ch.each(function(){
			if(this.nodeName.toLowerCase()=="a" && this.href != 'undefined'){
				if($(this).attr("target")){
						sLinkVars += "&sifr_url_" + nLinkCount + "_target=" + $(this).attr("target");
					};
					
				content+='<a href="asfunction:_root.launchURL,'+ sLinkCnt + '">' + $(this).text() + '</a>';
				sLinkVars+='&sifr_url_' + sLinkCnt + '=' + escapeHex(this.href).replace(/&/g, "%26");
				sLinkCnt++;
			}
			else content+=$(this).text();
		});
		moptions.flashVars += "&txt=" + escapeHex(content).replace(/\+/g, "%2B").replace(/&/g, "%26").replace(/\"/g, "%22").normalize() + "&h=" + moptions.height  + "&w=" + moptions.width + sLinkVars;
	}
	else moptions.flashVars += "&txt=" + escapeHex(elem.text()).replace(/\+/g, "%2B").replace(/&/g, "%26").replace(/\"/g, "%22").normalize() + "&h=" + moptions.height  + "&w=" + moptions.width;
	moptions.sifr="true";
	return moptions;
};
_jm.uaHas = function(ft) {
	var _u = navigator.userAgent.toLowerCase();
	switch(ft) {
		case "w3cdom":
			return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
		case "xml":
			var _m = document.getElementsByTagName("meta");
			var _l = _m.length;
			for (var i = 0; i < _l; i++) if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
			return false;
		case "ieMac":
			return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
		case "ieWin":
			return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
		case "gecko":
			return /gecko/.test(_u) && !/applewebkit/.test(_u);
		case "opera":
			return /opera/.test(_u);
		case "safari":
			return /applewebkit/.test(_u);
		default:
			return false;
}};
_jm.plugins ={
	"flash": {
		classID: "D27CDB6E-AE6D-11CF-96B8-444553540000",
		progID: ["ShockwaveFlash.ShockwaveFlash.9", "ShockwaveFlash.ShockwaveFlash.8.5", "ShockwaveFlash.ShockwaveFlash.8", "ShockwaveFlash.ShockwaveFlash.7", "ShockwaveFlash.ShockwaveFlash.6", "ShockwaveFlash.ShockwaveFlash.5", "ShockwaveFlash.ShockwaveFlash.4"], 
		description: ["Shockwave Flash"], 
		mimeType: ["application/x-shockwave-flash"], 
		pluginsPage: "http://www.macromedia.com/go/getflashplayer", 
		codeBase: "download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"},
	"quicktime": {
		classID: "02BF25D5-8C17-4B23-BC80-D3488ABDDC6B", 
		progID: ["QuickTimeCheckObject.QuickTimeCheck.1", "QuickTime.QuickTime"], 
		description: ["QuickTime"], 
		mimeType: ["video/quicktime"], 
		pluginsPage: "http://www.apple.com/quicktime/download/",  
		codeBase: "www.apple.com/qtactivex/qtplugin.cab"},	
	"real": {
		classID: "CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA",
		progID: ["RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)", "RealVideo.RealVideo(tm) ActiveX Control (32-bit)", "rmocx.RealPlayer G2 Control"],
		description: ["RealOne Player","RealPlayer Version"],
		mimeType: ["audio/x-pn-realaudio-plugin"], 
		pluginsPage: "http://www.real.com/freeplayer/?rppr=rnwk"},
	"wmedia": {
		progID: ["WMPlayer.OCX", "MediaPlayer.MediaPlayer.1"],
		classID: "22D6f312-B0F6-11D0-94AB-0080C74C7E95",
		description: ["Windows Media"],
		pluginsPage: "http://www.microsoft.com/windows/windowsmedia/",
		codeBase: "activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab",
		mimeType: ["application/x-mplayer2","video/x-ms-asf","application/x-oleobject"]},
	"director": {
		classID: "166B1BCA-3F9C-11CF-8075-444553540000",
		progID: ["SWCtl.SWCtl.11","SWCtl.SWCtl.10","SWCtl.SWCtl.9","SWCtl.SWCtl.8","SWCtl.SWCtl.7","SWCtl.SWCtl.6","SWCtl.SWCtl.5","SWCtl.SWCtl.4","SWCtl.SWCtl"], 
		description: ["Shockwave for Director"], 
		pluginsPage: "http://www.macromedia.com/shockwave/download/", 
		codeBase: "download.macromedia.com/pub/shockwave/cabs/director/sw.cab", 
		mimeType: ["application/x-director"]}
};
function escapeHex(sHex){
	if(_jm.uaHas('ieWin') || _jm.uaHas('ieMac')){ /* The RegExp for IE breaks old Gecko's, the RegExp for non-IE breaks IE 5.01 */
		return sHex.replace(new RegExp("%\d{0}", "g"), "%25");
	}
	return sHex.replace(new RegExp("%(?!\d)", "g"), "%25");
};
String.prototype.normalize = function(){
	return this.replace(/\s+/g, " ");
};

// SWF cleanup functions
_jm.cleanupSWFs=function(){
	if(_jm.uaHas("opera")||!document.all){return;}
	var _2d=document.getElementsByTagName("OBJECT");
	for(var i=0;i<_2d.length;i++){
		_2d[i].style.display="none";
		for(var x in _2d[i]){
			if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}
		}
	}
};
var prepUnload=function(){
	var __flash_unloadHandler=function(){};
	var __flash_savedUnloadHandler=function(){};
	if(typeof window.onunload=="function"){
		var _30=window.onunload;
		window.onunload=function(){
			_jm.cleanupSWFs();
			_30();
		};
	}
	else window.onunload=_jm.cleanupSWFs;
};
if(typeof window.onbeforeunload=="function"){
	var oldBeforeUnload=window.onbeforeunload;
	window.onbeforeunload=function(){
		prepUnload();
		oldBeforeUnload();
	};
}
else window.onbeforeunload=prepUnload;

//	UFO expressInstall callback onAbort
var UFO = {
	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("flashXIcon");
		_b.removeChild(_c);
		_b.style.setAttribute("overflow","auto");
		_b.style.setAttribute("height","auto");
		document.getElementsByTagName("html")[0].style.setAttribute("overflow","auto");
		document.getElementsByTagName("html")[0].stylesetAttribute("height","auto");
	}
};
/* jquery.colorbox.js */

/*  1.3.7 */ (function(c){function o(b,d){d=d==="x"?n.width():n.height();return typeof b==="string"?Math.round(b.match(/%/)?d/100*parseInt(b,10):parseInt(b,10)):b}function K(b){b=c.isFunction(b)?b.call(h):b;return a.photo||b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function Y(){for(var b in a)if(c.isFunction(a[b])&&b.substring(0,2)!=="on")a[b]=a[b].call(h);a.rel=a.rel||h.rel||"nofollow";a.href=a.href||c(h).attr("href");a.title=a.title||h.title}function Z(b){h=b;a=c.extend({},c(h).data(s)); Y();if(a.rel!=="nofollow"){j=c(".cboxElement").filter(function(){return(c(this).data(s).rel||this.rel)===a.rel});g=j.index(h);if(g<0){j=j.add(h);g=j.length-1}}else{j=c(h);g=0}if(!q){A=q=l;L=h;try{L.blur()}catch(d){}c.event.trigger(ba);a.onOpen&&a.onOpen.call(h);r.css({opacity:parseFloat(a.opacity),cursor:a.overlayClose?"pointer":"auto"}).show();a.w=o(a.initialWidth,"x");a.h=o(a.initialHeight,"y");e.position(0);M&&n.bind("resize.cboxIE6 scroll.cboxIE6",function(){r.css({width:n.width(),height:n.height(), top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll.cboxIE6")}N.add(E).add(F).add(t).add(O).hide();P.html(a.close).show();e.slideshow();e.load()}var s="colorbox",l=true,e,B=c.browser.msie&&!c.support.opacity,M=B&&c.browser.version<7,ba="cbox_open",I="cbox_load",Q="cbox_complete",r,k,x,p,R,S,T,U,j,n,m,J,G,O,N,t,F,E,P,y,z,u,v,h,L,g,a,q,A,$={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false, scalePhotos:l,scrolling:l,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:l,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:l,loop:l,slideshow:false,slideshowAuto:l,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,escKey:l,arrowKey:l};e=c.fn.colorbox=c.colorbox=function(b,d){var f= this;if(f.selector&&!f.length)return f;b=b||{};if(d)b.onComplete=d;if(!f.length||f.selector===undefined){f=c("<a/>");b.open=l}f.each(function(){c(this).data(s,c.extend({},c(this).data(s)||$,b)).addClass("cboxElement")});b.open&&Z(f[0]);return f};e.init=function(){function b(d){return c('<div id="cbox'+d+'"/>')}n=c(window);k=c('<div id="colorbox"/>');r=b("Overlay").hide();x=b("Wrapper");p=b("Content").append(m=b("LoadedContent").css({width:0,height:0}),G=b("LoadingOverlay").add(b("LoadingGraphic")), O=b("Title"),N=b("Current"),F=b("Next"),E=b("Previous"),t=b("Slideshow"),P=b("Close"));x.append(c("<div/>").append(b("TopLeft"),R=b("TopCenter"),b("TopRight")),c("<div/>").append(S=b("MiddleLeft"),p,T=b("MiddleRight")),c("<div/>").append(b("BottomLeft"),U=b("BottomCenter"),b("BottomRight"))).children().children().css({"float":"left"});J=c("<div id='cboxLoadingBay' style='position:absolute; width:9999px;'/>");c("body").prepend(r,k.append(x,J));if(B){k.addClass("cboxIE");M&&r.css("position","absolute")}p.children().hover(function(){c(this).addClass("hover")}, function(){c(this).removeClass("hover")}).addClass("hover");y=R.height()+U.height()+p.outerHeight(l)-p.height();z=S.width()+T.width()+p.outerWidth(l)-p.width();u=m.outerHeight(l);v=m.outerWidth(l);k.css({"padding-bottom":y,"padding-right":z}).hide();F.click(e.next);E.click(e.prev);P.click(e.close);p.children().removeClass("hover");c(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined"||d.ctrlKey||d.shiftKey||d.altKey)return l;else{Z(this);return false}});r.click(function(){a.overlayClose&& e.close()});c(document).bind("keydown",function(d){if(q&&a.escKey&&d.keyCode===27){d.preventDefault();e.close()}if(q&&a.arrowKey&&!A&&j.length>1)if(d.keyCode===37&&(g>0||a.loop)){d.preventDefault();E.click()}else if(d.keyCode===39&&(g<j.length-1||a.loop)){d.preventDefault();F.click()}})};e.remove=function(){k.add(r).remove();c(".cboxElement").removeData(s).removeClass("cboxElement")};e.position=function(b,d){function f(C){R[0].style.width=U[0].style.width=p[0].style.width=C.style.width;G[0].style.height= G[1].style.height=p[0].style.height=S[0].style.height=T[0].style.height=C.style.height}var i,w=Math.max(n.height()-a.h-u-y,0)/2+n.scrollTop(),H=Math.max(n.width()-a.w-v-z,0)/2+n.scrollLeft();i=k.width()===a.w+v&&k.height()===a.h+u?0:b;x[0].style.width=x[0].style.height="9999px";k.dequeue().animate({width:a.w+v,height:a.h+u,top:w,left:H},{duration:i,complete:function(){f(this);A=false;x[0].style.width=a.w+v+z+"px";x[0].style.height=a.h+u+y+"px";d&&d()},step:function(){f(this)}})};e.resize=function(b){if(q){b= b||{};if(b.width)a.w=o(b.width,"x")-v-z;if(b.innerWidth)a.w=o(b.innerWidth,"x");m.css({width:a.w});if(b.height)a.h=o(b.height,"y")-u-y;if(b.innerHeight)a.h=o(b.innerHeight,"y");if(!b.innerHeight&&!b.height){b=m.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}m.css({height:a.h});e.position(a.transition==="none"?0:a.speed)}};e.prep=function(b){function d(w){var H,C,V,W,D=j.length,X=a.loop;e.position(w,function(){function aa(){B&&k[0].style.removeAttribute("filter")} if(q){B&&f&&m.fadeIn(100);if(a.iframe)c("<iframe frameborder=0"+(a.scrolling?"":" scrolling='no'")+(B?" allowtransparency='true'":"")+"/>").appendTo(m).attr({src:a.href,id:"cboxIframe",name:(new Date).getTime()});m.show();O.show().html(a.title);if(D>1){N.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,D)).show();F[X||g<D-1?"show":"hide"]().html(a.next);E[X||g>0?"show":"hide"]().html(a.previous);H=g>0?j[g-1]:j[D-1];V=g<D-1?j[g+1]:j[0];if(a.slideshow){t.show();g===D-1&&!X&&k.is(".cboxSlideshow_on")&& t.click()}if(a.preloading){W=c(V).data(s).href||V.href;C=c(H).data(s).href||H.href;if(K(W))c("<img/>")[0].src=W;if(K(C))c("<img/>")[0].src=C}}G.hide();a.transition==="fade"?k.fadeTo(i,1,function(){aa()}):aa();n.bind("resize.cbox",function(){e.position(0)});c.event.trigger(Q);a.onComplete&&a.onComplete.call(h)}})}if(q){var f,i=a.transition==="none"?0:a.speed;n.unbind("resize.cbox");m.remove();m=c('<div id="cboxLoadedContent"/>').html(b);m.hide().appendTo(J).css({width:function(){a.w=a.w||m.width(); a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?"auto":"hidden"}).css({height:function(){a.h=a.h||m.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(p);c("#cboxPhoto").css({cssFloat:"none"});M&&c("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",function(){this.style.visibility="inherit"});a.transition==="fade"?k.fadeTo(i,0,function(){d(0)}):d(i)}};e.load=function(){var b,d,f,i=e.prep; A=l;h=j[g];a=c.extend({},c(h).data(s));Y();c.event.trigger(I);a.onLoad&&a.onLoad.call(h);a.h=a.height?o(a.height,"y")-u-y:a.innerHeight?o(a.innerHeight,"y"):false;a.w=a.width?o(a.width,"x")-v-z:a.innerWidth?o(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=o(a.maxWidth,"x")-v-z;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=o(a.maxHeight,"y")-u-y;a.mh=a.h&&a.h<a.mh?a.h:a.mh}b=a.href;G.show();if(a.inline){c('<div id="cboxInlineTemp"/>').hide().insertBefore(c(b)[0]).bind(I+" cbox_cleanup", function(){c(this).replaceWith(m.children())});i(c(b))}else if(a.iframe)i(" ");else if(a.html)i(a.html);else if(K(b)){d=new Image;d.onload=function(){var w;d.onload=null;d.id="cboxPhoto";c(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){f=function(){d.height-=d.height*w;d.width-=d.width*w};if(a.mw&&d.width>a.mw){w=(d.width-a.mw)/d.width;f()}if(a.mh&&d.height>a.mh){w=(d.height-a.mh)/d.height;f()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,0)/2+"px";i(d); j.length>1&&c(d).css({cursor:"pointer"}).click(e.next);if(B)d.style.msInterpolationMode="bicubic"};d.src=b}else c("<div>Request unsuccessful.</div>").appendTo(J).load(b,function(){i(this)})};e.next=function(){if(!A){g=g<j.length-1?g+1:0;e.load()}};e.prev=function(){if(!A){g=g>0?g-1:j.length-1;e.load()}};e.slideshow=function(){function b(){t.text(a.slideshowStop).bind(Q,function(){f=setTimeout(e.next,a.slideshowSpeed)}).bind(I,function(){clearTimeout(f)}).one("click",function(){d()});k.removeClass(i+ "off").addClass(i+"on")}var d,f,i="cboxSlideshow_";t.bind("cbox_closed",function(){t.unbind();clearTimeout(f);k.removeClass(i+"off "+i+"on")});d=function(){clearTimeout(f);t.text(a.slideshowStart).unbind(Q+" "+I).one("click",function(){b();f=setTimeout(e.next,a.slideshowSpeed)});k.removeClass(i+"on").addClass(i+"off")};if(a.slideshow&&j.length>1)a.slideshowAuto?b():d()};e.close=function(){if(q){q=false;c.event.trigger("cbox_cleanup");a.onCleanup&&a.onCleanup.call(h);n.unbind(".cbox .cboxIE6");k.add(r).stop().fadeTo("fast", 0,function(){c("#colorbox iframe").attr("src","about:blank");m.remove();k.add(r).css({opacity:1,cursor:"auto"}).hide();try{L.focus()}catch(b){}setTimeout(function(){c.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(h)},1)})}};e.element=function(){return c(h)};e.settings=$;c(e.init)})(jQuery);

/* jquery.form.js */

/* 2.43 */ (function($){$.fn.ajaxSubmit=function(_1){if(!this.length){_2("ajaxSubmit: skipping submit process - no element selected");return this;}if(typeof _1=="function"){_1={success:_1};}var _3=$.trim(this.attr("action"));if(_3){_3=(_3.match(/^([^#]+)/)||[])[1];}_3=_3||window.location.href||"";_1=$.extend({url:_3,type:this.attr("method")||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},_1||{});var _4={};this.trigger("form-pre-serialize",[this,_1,_4]);if(_4.veto){_2("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this;}if(_1.beforeSerialize&&_1.beforeSerialize(this,_1)===false){_2("ajaxSubmit: submit aborted via beforeSerialize callback");return this;}var a=this.formToArray(_1.semantic);if(_1.data){_1.extraData=_1.data;for(var n in _1.data){if(_1.data[n] instanceof Array){for(var k in _1.data[n]){a.push({name:n,value:_1.data[n][k]});}}else{a.push({name:n,value:_1.data[n]});}}}if(_1.beforeSubmit&&_1.beforeSubmit(a,this,_1)===false){_2("ajaxSubmit: submit aborted via beforeSubmit callback");return this;}this.trigger("form-submit-validate",[a,this,_1,_4]);if(_4.veto){_2("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this;}var q=$.param(a);if(_1.type.toUpperCase()=="GET"){_1.url+=(_1.url.indexOf("?")>=0?"&":"?")+q;_1.data=null;}else{_1.data=q;}var _5=this,_6=[];if(_1.resetForm){_6.push(function(){_5.resetForm();});}if(_1.clearForm){_6.push(function(){_5.clearForm();});}if(!_1.dataType&&_1.target){var _7=_1.success||function(){};_6.push(function(_8){var fn=_1.replaceTarget?"replaceWith":"html";$(_1.target)[fn](_8).each(_7,arguments);});}else{if(_1.success){_6.push(_1.success);}}_1.success=function(_9,_a,_b){for(var i=0,_c=_6.length;i<_c;i++){_6[i].apply(_1,[_9,_a,_b||_5,_5]);}};var _d=$("input:file",this).fieldValue();var _e=false;for(var j=0;j<_d.length;j++){if(_d[j]){_e=true;}}var _f=false;if((_d.length&&_1.iframe!==false)||_1.iframe||_e||_f){if(_1.closeKeepAlive){$.get(_1.closeKeepAlive,_10);}else{_10();}}else{$.ajax(_1);}this.trigger("form-submit-notify",[this,_1]);return this;function _10(){var _11=_5[0];if($(":input[name=submit]",_11).length){alert("Error: Form elements must not be named \"submit\".");return;}var _12=$.extend({},$.ajaxSettings,_1);var s=$.extend(true,{},$.extend(true,{},$.ajaxSettings),_12);var id="jqFormIO"+(new Date().getTime());var $io=$("<iframe id=\""+id+"\" name=\""+id+"\" src=\""+_12.iframeSrc+"\" onload=\"(jQuery(this).data('form-plugin-onload'))()\" />");var io=$io[0];$io.css({position:"absolute",top:"-1000px",left:"-1000px"});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr("src",_12.iframeSrc);}};var g=_12.global;if(g&&!$.active++){$.event.trigger("ajaxStart");}if(g){$.event.trigger("ajaxSend",[xhr,_12]);}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&$.active--;return;}if(xhr.aborted){return;}var _13=false;var _14=0;var sub=_11.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){_12.extraData=_12.extraData||{};_12.extraData[n]=sub.value;if(sub.type=="image"){_12.extraData[n+".x"]=_11.clk_x;_12.extraData[n+".y"]=_11.clk_y;}}}function _15(){var t=_5.attr("target"),a=_5.attr("action");_11.setAttribute("target",id);if(_11.getAttribute("method")!="POST"){_11.setAttribute("method","POST");}if(_11.getAttribute("action")!=_12.url){_11.setAttribute("action",_12.url);}if(!_12.skipEncodingOverride){_5.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});}if(_12.timeout){setTimeout(function(){_14=true;cb();},_12.timeout);}var _16=[];try{if(_12.extraData){for(var n in _12.extraData){_16.push($("<input type=\"hidden\" name=\""+n+"\" value=\""+_12.extraData[n]+"\" />").appendTo(_11)[0]);}}$io.appendTo("body");$io.data("form-plugin-onload",cb);_11.submit();}finally{_11.setAttribute("action",a);t?_11.setAttribute("target",t):_5.removeAttr("target");$(_16).remove();}};if(_12.forceSync){_15();}else{setTimeout(_15,10);}var _17=100;function cb(){if(_13){return;}var ok=true;try{if(_14){throw "timeout";}var _18,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;var _19=_12.dataType=="xml"||doc.XMLDocument||$.isXMLDoc(doc);_2("isXml="+_19);if(!_19&&(doc.body==null||doc.body.innerHTML=="")){if(--_17){_2("requeing onLoad callback, DOM not available");setTimeout(cb,250);return;}_2("Could not access iframe DOM after 100 tries.");return;}_2("response detected");_13=true;xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(_1a){var _1b={"content-type":_12.dataType};return _1b[_1a];};if(_12.dataType=="json"||_12.dataType=="script"){var ta=doc.getElementsByTagName("textarea")[0];if(ta){xhr.responseText=ta.value;}else{var pre=doc.getElementsByTagName("pre")[0];if(pre){xhr.responseText=pre.innerHTML;}}}else{if(_12.dataType=="xml"&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=_1c(xhr.responseText);}}_18=$.httpData(xhr,_12.dataType);}catch(e){_2("error caught:",e);ok=false;xhr.error=e;$.handleError(_12,xhr,"error",e);}if(ok){_12.success(_18,"success");if(g){$.event.trigger("ajaxSuccess",[xhr,_12]);}}if(g){$.event.trigger("ajaxComplete",[xhr,_12]);}if(g&&!--$.active){$.event.trigger("ajaxStop");}if(_12.complete){_12.complete(xhr,ok?"success":"error");}setTimeout(function(){$io.removeData("form-plugin-onload");$io.remove();xhr.responseXML=null;},100);};function _1c(s,doc){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(s);}else{doc=(new DOMParser()).parseFromString(s,"text/xml");}return (doc&&doc.documentElement&&doc.documentElement.tagName!="parsererror")?doc:null;};};};$.fn.ajaxForm=function(_1d){return this.ajaxFormUnbind().bind("submit.form-plugin",function(e){e.preventDefault();$(this).ajaxSubmit(_1d);}).bind("click.form-plugin",function(e){var _1e=e.target;var $el=$(_1e);if(!($el.is(":submit,input:image"))){var t=$el.closest(":submit");if(t.length==0){return;}_1e=t[0];}var _1f=this;_1f.clk=_1e;if(_1e.type=="image"){if(e.offsetX!=undefined){_1f.clk_x=e.offsetX;_1f.clk_y=e.offsetY;}else{if(typeof $.fn.offset=="function"){var _20=$el.offset();_1f.clk_x=e.pageX-_20.left;_1f.clk_y=e.pageY-_20.top;}else{_1f.clk_x=e.pageX-_1e.offsetLeft;_1f.clk_y=e.pageY-_1e.offsetTop;}}}setTimeout(function(){_1f.clk=_1f.clk_x=_1f.clk_y=null;},100);});};$.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin");};$.fn.formToArray=function(_21){var a=[];if(this.length==0){return a;}var _22=this[0];var els=_21?_22.getElementsByTagName("*"):_22.elements;if(!els){return a;}for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n){continue;}if(_21&&_22.clk&&el.type=="image"){if(!el.disabled&&_22.clk==el){a.push({name:n,value:$(el).val()});a.push({name:n+".x",value:_22.clk_x},{name:n+".y",value:_22.clk_y});}continue;}var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,_23=v.length;j<_23;j++){a.push({name:n,value:v[j]});}}else{if(v!==null&&typeof v!="undefined"){a.push({name:n,value:v});}}}if(!_21&&_22.clk){var _24=$(_22.clk),_25=_24[0],n=_25.name;if(n&&!_25.disabled&&_25.type=="image"){a.push({name:n,value:_24.val()});a.push({name:n+".x",value:_22.clk_x},{name:n+".y",value:_22.clk_y});}}return a;};$.fn.formSerialize=function(_26){return $.param(this.formToArray(_26));};$.fn.fieldSerialize=function(_27){var a=[];this.each(function(){var n=this.name;if(!n){return;}var v=$.fieldValue(this,_27);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++){a.push({name:n,value:v[i]});}}else{if(v!==null&&typeof v!="undefined"){a.push({name:this.name,value:v});}}});return $.param(a);};$.fn.fieldValue=function(_28){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,_28);if(v===null||typeof v=="undefined"||(v.constructor==Array&&!v.length)){continue;}v.constructor==Array?$.merge(val,v):val.push(v);}return val;};$.fieldValue=function(el,_29){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof _29=="undefined"){_29=true;}if(_29&&(!n||el.disabled||t=="reset"||t=="button"||(t=="checkbox"||t=="radio")&&!el.checked||(t=="submit"||t=="image")&&el.form&&el.form.clk!=el||tag=="select"&&el.selectedIndex==-1)){return null;}if(tag=="select"){var _2a=el.selectedIndex;if(_2a<0){return null;}var a=[],ops=el.options;var one=(t=="select-one");var max=(one?_2a+1:ops.length);for(var i=(one?_2a:0);i<max;i++){var op=ops[i];if(op.selected){var v=op.value;if(!v){v=(op.attributes&&op.attributes["value"]&&!(op.attributes["value"].specified))?op.text:op.value;}if(one){return v;}a.push(v);}}return a;}return el.value;};$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields();});};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=="text"||t=="password"||tag=="textarea"){this.value="";}else{if(t=="checkbox"||t=="radio"){this.checked=false;}else{if(tag=="select"){this.selectedIndex=-1;}}}});};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset();}});};$.fn.enable=function(b){if(b==undefined){b=true;}return this.each(function(){this.disabled=!b;});};$.fn.selected=function(_2b){if(_2b==undefined){_2b=true;}return this.each(function(){var t=this.type;if(t=="checkbox"||t=="radio"){this.checked=_2b;}else{if(this.tagName.toLowerCase()=="option"){var _2c=$(this).parent("select");if(_2b&&_2c[0]&&_2c[0].type=="select-one"){_2c.find("option").selected(false);}this.selected=_2b;}}});};function _2(){if($.fn.ajaxSubmit.debug){var msg="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(msg);}else{if(window.opera&&window.opera.postError){window.opera.postError(msg);}}}};})(jQuery);
/* jquery.validate.js */

/* 1.7 */ (function($){$.extend($.fn,{validate:function(_1){if(!this.length){_1&&_1.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var _2=$.data(this[0],"validator");if(_2){return _2;}_2=new $.validator(_1,this[0]);$.data(this[0],"validator",_2);if(_2.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){_2.cancelSubmit=true;});if(_2.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){_2.submitButton=this;});}this.submit(function(_3){if(_2.settings.debug){_3.preventDefault();}function _4(){if(_2.settings.submitHandler){if(_2.submitButton){var _5=$("<input type='hidden'/>").attr("name",_2.submitButton.name).val(_2.submitButton.value).appendTo(_2.currentForm);}_2.settings.submitHandler.call(_2,_2.currentForm);if(_2.submitButton){_5.remove();}return false;}return true;};if(_2.cancelSubmit){_2.cancelSubmit=false;return _4();}if(_2.form()){if(_2.pendingRequest){_2.formSubmitted=true;return false;}return _4();}else{_2.focusInvalid();return false;}});}return _2;},valid:function(){if($(this[0]).is("form")){return this.validate().form();}else{var _6=true;var _7=$(this[0].form).validate();this.each(function(){_6&=_7.element(this);});return _6;}},removeAttrs:function(_8){var _9={},_a=this;$.each(_8.split(/\s/),function(_b,_c){_9[_c]=_a.attr(_c);_a.removeAttr(_c);});return _9;},rules:function(_d,_e){var _f=this[0];if(_d){var _10=$.data(_f.form,"validator").settings;var _11=_10.rules;var _12=$.validator.staticRules(_f);switch(_d){case "add":$.extend(_12,$.validator.normalizeRule(_e));_11[_f.name]=_12;if(_e.messages){_10.messages[_f.name]=$.extend(_10.messages[_f.name],_e.messages);}break;case "remove":if(!_e){delete _11[_f.name];return _12;}var _13={};$.each(_e.split(/\s/),function(_14,_15){_13[_15]=_12[_15];delete _12[_15];});return _13;}}var _16=$.validator.normalizeRules($.extend({},$.validator.metadataRules(_f),$.validator.classRules(_f),$.validator.attributeRules(_f),$.validator.staticRules(_f)),_f);if(_16.required){var _17=_16.required;delete _16.required;_16=$.extend({required:_17},_16);}return _16;}});$.extend($.expr[":"],{blank:function(a){return !$.trim(""+a.value);},filled:function(a){return !!$.trim(""+a.value);},unchecked:function(a){return !a.checked;}});$.validator=function(_18,_19){this.settings=$.extend(true,{},$.validator.defaults,_18);this.currentForm=_19;this.init();};$.validator.format=function(_1a,_1b){if(arguments.length==1){return function(){var _1c=$.makeArray(arguments);_1c.unshift(_1a);return $.validator.format.apply(this,_1c);};}if(arguments.length>2&&_1b.constructor!=Array){_1b=$.makeArray(arguments).slice(1);}if(_1b.constructor!=Array){_1b=[_1b];}$.each(_1b,function(i,n){_1a=_1a.replace(new RegExp("\\{"+i+"\\}","g"),n);});return _1a;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(_1d){this.lastActive=_1d;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,_1d,this.settings.errorClass,this.settings.validClass);this.errorsFor(_1d).hide();}},onfocusout:function(_1e){if(!this.checkable(_1e)&&(_1e.name in this.submitted||!this.optional(_1e))){this.element(_1e);}},onkeyup:function(_1f){if(_1f.name in this.submitted||_1f==this.lastElement){this.element(_1f);}},onclick:function(_20){if(_20.name in this.submitted){this.element(_20);}else{if(_20.parentNode.name in this.submitted){this.element(_20.parentNode);}}},highlight:function(_21,_22,_23){$(_21).addClass(_22).removeClass(_23);},unhighlight:function(_24,_25,_26){$(_24).removeClass(_25).addClass(_26);}},setDefaults:function(_27){$.extend($.validator.defaults,_27);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var _28=(this.groups={});$.each(this.settings.groups,function(key,_29){$.each(_29.split(/\s/),function(_2a,_2b){_28[_2b]=key;});});var _2c=this.settings.rules;$.each(_2c,function(key,_2d){_2c[key]=$.validator.normalizeRule(_2d);});function _2e(_2f){var _30=$.data(this[0].form,"validator"),_31="on"+_2f.type.replace(/^validate/,"");_30.settings[_31]&&_30.settings[_31].call(_30,this[0]);};$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",_2e).validateDelegate(":radio, :checkbox, select, option","click",_2e);if(this.settings.invalidHandler){$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);}},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid()){$(this.currentForm).triggerHandler("invalid-form",[this]);}this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,_32=(this.currentElements=this.elements());_32[i];i++){this.check(_32[i]);}return this.valid();},element:function(_33){_33=this.clean(_33);this.lastElement=_33;this.prepareElement(_33);this.currentElements=$(_33);var _34=this.check(_33);if(_34){delete this.invalid[_33.name];}else{this.invalid[_33.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return _34;},showErrors:function(_35){if(_35){$.extend(this.errorMap,_35);this.errorList=[];for(var _36 in _35){this.errorList.push({message:_35[_36],element:this.findByName(_36)[0]});}this.successList=$.grep(this.successList,function(_37){return !(_37.name in _35);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm){$(this.currentForm).resetForm();}this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var _38=0;for(var i in obj){_38++;}return _38;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var _39=this.lastActive;return _39&&$.grep(this.errorList,function(n){return n.element.name==_39.name;}).length==1&&_39;},elements:function(){var _3a=this,_3b={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&_3a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in _3b||!_3a.objectLength($(this).rules())){return false;}_3b[this.name]=true;return true;});},clean:function(_3c){return $(_3c)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(_3d){this.reset();this.toHide=this.errorsFor(_3d);},check:function(_3e){_3e=this.clean(_3e);if(this.checkable(_3e)){_3e=this.findByName(_3e.name)[0];}var _3f=$(_3e).rules();var _40=false;for(method in _3f){var _41={method:method,parameters:_3f[method]};try{var _42=$.validator.methods[method].call(this,_3e.value.replace(/\r/g,""),_3e,_41.parameters);if(_42=="dependency-mismatch"){_40=true;continue;}_40=false;if(_42=="pending"){this.toHide=this.toHide.not(this.errorsFor(_3e));return;}if(!_42){this.formatAndAdd(_3e,_41);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+_3e.id+", check the '"+_41.method+"' method",e);throw e;}}if(_40){return;}if(this.objectLength(_3f)){this.successList.push(_3e);}return true;},customMetaMessage:function(_43,_44){if(!$.metadata){return;}var _45=this.settings.meta?$(_43).metadata()[this.settings.meta]:$(_43).metadata();return _45&&_45.messages&&_45.messages[_44];},customMessage:function(_46,_47){var m=this.settings.messages[_46];return m&&(m.constructor==String?m:m[_47]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined){return arguments[i];}}return undefined;},defaultMessage:function(_48,_49){return this.findDefined(this.customMessage(_48.name,_49),this.customMetaMessage(_48,_49),!this.settings.ignoreTitle&&_48.title||undefined,$.validator.messages[_49],"<strong>Warning: No message defined for "+_48.name+"</strong>");},formatAndAdd:function(_4a,_4b){var _4c=this.defaultMessage(_4a,_4b.method),_4d=/\$?\{(\d+)\}/g;if(typeof _4c=="function"){_4c=_4c.call(this,_4b.parameters,_4a);}else{if(_4d.test(_4c)){_4c=jQuery.format(_4c.replace(_4d,"{$1}"),_4b.parameters);}}this.errorList.push({message:_4c,element:_4a});this.errorMap[_4a.name]=_4c;this.submitted[_4a.name]=_4c;},addWrapper:function(_4e){if(this.settings.wrapper){_4e=_4e.add(_4e.parent(this.settings.wrapper));}return _4e;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var _4f=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,_4f.element,this.settings.errorClass,this.settings.validClass);this.showLabel(_4f.element,_4f.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,_50=this.validElements();_50[i];i++){this.settings.unhighlight.call(this,_50[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(_51,_52){var _53=this.errorsFor(_51);if(_53.length){_53.removeClass().addClass(this.settings.errorClass);_53.attr("generated")&&_53.html(_52);}else{_53=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(_51),generated:true}).addClass(this.settings.errorClass).html(_52||"");if(this.settings.wrapper){_53=_53.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(_53).length){this.settings.errorPlacement?this.settings.errorPlacement(_53,$(_51)):_53.insertAfter(_51);}}if(!_52&&this.settings.success){_53.text("");typeof this.settings.success=="string"?_53.addClass(this.settings.success):this.settings.success(_53);}this.toShow=this.toShow.add(_53);},errorsFor:function(_54){var _55=this.idOrName(_54);return this.errors().filter(function(){return $(this).attr("for")==_55;});},idOrName:function(_56){return this.groups[_56.name]||(this.checkable(_56)?_56.name:_56.id||_56.name);},checkable:function(_57){return /radio|checkbox/i.test(_57.type);},findByName:function(_58){var _59=this.currentForm;return $(document.getElementsByName(_58)).map(function(_5a,_5b){return _5b.form==_59&&_5b.name==_58&&_5b||null;});},getLength:function(_5c,_5d){switch(_5d.nodeName.toLowerCase()){case "select":return $("option:selected",_5d).length;case "input":if(this.checkable(_5d)){return this.findByName(_5d.name).filter(":checked").length;}}return _5c.length;},depend:function(_5e,_5f){return this.dependTypes[typeof _5e]?this.dependTypes[typeof _5e](_5e,_5f):true;},dependTypes:{"boolean":function(_60,_61){return _60;},"string":function(_62,_63){return !!$(_62,_63.form).length;},"function":function(_64,_65){return _64(_65);}},optional:function(_66){return !$.validator.methods.required.call(this,$.trim(_66.value),_66)&&"dependency-mismatch";},startRequest:function(_67){if(!this.pending[_67.name]){this.pendingRequest++;this.pending[_67.name]=true;}},stopRequest:function(_68,_69){this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0;}delete this.pending[_68.name];if(_69&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else{if(!_69&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}}},previousValue:function(_6a){return $.data(_6a,"previousValue")||$.data(_6a,"previousValue",{old:null,valid:true,message:this.defaultMessage(_6a,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(_6b,_6c){_6b.constructor==String?this.classRuleSettings[_6b]=_6c:$.extend(this.classRuleSettings,_6b);},classRules:function(_6d){var _6e={};var _6f=$(_6d).attr("class");_6f&&$.each(_6f.split(" "),function(){if(this in $.validator.classRuleSettings){$.extend(_6e,$.validator.classRuleSettings[this]);}});return _6e;},attributeRules:function(_70){var _71={};var _72=$(_70);for(method in $.validator.methods){var _73=_72.attr(method);if(_73){_71[method]=_73;}}if(_71.maxlength&&/-1|2147483647|524288/.test(_71.maxlength)){delete _71.maxlength;}return _71;},metadataRules:function(_74){if(!$.metadata){return {};}var _75=$.data(_74.form,"validator").settings.meta;return _75?$(_74).metadata()[_75]:$(_74).metadata();},staticRules:function(_76){var _77={};var _78=$.data(_76.form,"validator");if(_78.settings.rules){_77=$.validator.normalizeRule(_78.settings.rules[_76.name])||{};}return _77;},normalizeRules:function(_79,_7a){$.each(_79,function(_7b,val){if(val===false){delete _79[_7b];return;}if(val.param||val.depends){var _7c=true;switch(typeof val.depends){case "string":_7c=!!$(val.depends,_7a.form).length;break;case "function":_7c=val.depends.call(_7a,_7a);break;}if(_7c){_79[_7b]=val.param!==undefined?val.param:true;}else{delete _79[_7b];}}});$.each(_79,function(_7d,_7e){_79[_7d]=$.isFunction(_7e)?_7e(_7a):_7e;});$.each(["minlength","maxlength","min","max"],function(){if(_79[this]){_79[this]=Number(_79[this]);}});$.each(["rangelength","range"],function(){if(_79[this]){_79[this]=[Number(_79[this][0]),Number(_79[this][1])];}});if($.validator.autoCreateRanges){if(_79.min&&_79.max){_79.range=[_79.min,_79.max];delete _79.min;delete _79.max;}if(_79.minlength&&_79.maxlength){_79.rangelength=[_79.minlength,_79.maxlength];delete _79.minlength;delete _79.maxlength;}}if(_79.messages){delete _79.messages;}return _79;},normalizeRule:function(_7f){if(typeof _7f=="string"){var _80={};$.each(_7f.split(/\s/),function(){_80[this]=true;});_7f=_80;}return _7f;},addMethod:function(_81,_82,_83){$.validator.methods[_81]=_82;$.validator.messages[_81]=_83!=undefined?_83:$.validator.messages[_81];if(_82.length<3){$.validator.addClassRules(_81,$.validator.normalizeRule(_81));}},methods:{required:function(_84,_85,_86){if(!this.depend(_86,_85)){return "dependency-mismatch";}switch(_85.nodeName.toLowerCase()){case "select":var val=$(_85).val();return val&&val.length>0;case "input":if(this.checkable(_85)){return this.getLength(_84,_85)>0;}default:return $.trim(_84).length>0;}},remote:function(_87,_88,_89){if(this.optional(_88)){return "dependency-mismatch";}var _8a=this.previousValue(_88);if(!this.settings.messages[_88.name]){this.settings.messages[_88.name]={};}_8a.originalMessage=this.settings.messages[_88.name].remote;this.settings.messages[_88.name].remote=_8a.message;_89=typeof _89=="string"&&{url:_89}||_89;if(_8a.old!==_87){_8a.old=_87;var _8b=this;this.startRequest(_88);var _8c={};_8c[_88.name]=_87;$.ajax($.extend(true,{url:_89,mode:"abort",port:"validate"+_88.name,dataType:"json",data:_8c,success:function(_8d){_8b.settings.messages[_88.name].remote=_8a.originalMessage;var _8e=_8d===true;if(_8e){var _8f=_8b.formSubmitted;_8b.prepareElement(_88);_8b.formSubmitted=_8f;_8b.successList.push(_88);_8b.showErrors();}else{var _90={};var _91=(_8a.message=_8d||_8b.defaultMessage(_88,"remote"));_90[_88.name]=$.isFunction(_91)?_91(_87):_91;_8b.showErrors(_90);}_8a.valid=_8e;_8b.stopRequest(_88,_8e);}},_89));return "pending";}else{if(this.pending[_88.name]){return "pending";}}return _8a.valid;},minlength:function(_92,_93,_94){return this.optional(_93)||this.getLength($.trim(_92),_93)>=_94;},maxlength:function(_95,_96,_97){return this.optional(_96)||this.getLength($.trim(_95),_96)<=_97;},rangelength:function(_98,_99,_9a){var _9b=this.getLength($.trim(_98),_99);return this.optional(_99)||(_9b>=_9a[0]&&_9b<=_9a[1]);},min:function(_9c,_9d,_9e){return this.optional(_9d)||_9c>=_9e;},max:function(_9f,_a0,_a1){return this.optional(_a0)||_9f<=_a1;},range:function(_a2,_a3,_a4){return this.optional(_a3)||(_a2>=_a4[0]&&_a2<=_a4[1]);},email:function(_a5,_a6){return this.optional(_a6)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(_a5);},url:function(_a7,_a8){return this.optional(_a8)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(_a7);},date:function(_a9,_aa){return this.optional(_aa)||!/Invalid|NaN/.test(new Date(_a9));},dateISO:function(_ab,_ac){return this.optional(_ac)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(_ab);},number:function(_ad,_ae){return this.optional(_ae)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(_ad);},digits:function(_af,_b0){return this.optional(_b0)||/^\d+$/.test(_af);},creditcard:function(_b1,_b2){if(this.optional(_b2)){return "dependency-mismatch";}if(/[^0-9-]+/.test(_b1)){return false;}var _b3=0,_b4=0,_b5=false;_b1=_b1.replace(/\D/g,"");for(var n=_b1.length-1;n>=0;n--){var _b6=_b1.charAt(n);var _b4=parseInt(_b6,10);if(_b5){if((_b4*=2)>9){_b4-=9;}}_b3+=_b4;_b5=!_b5;}return (_b3%10)==0;},accept:function(_b7,_b8,_b9){_b9=typeof _b9=="string"?_b9.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(_b8)||_b7.match(new RegExp(".("+_b9+")$","i"));},equalTo:function(_ba,_bb,_bc){var _bd=$(_bc).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(_bb).valid();});return _ba==_bd.val();}}});$.format=$.validator.format;})(jQuery);(function($){var _be=$.ajax;var _bf={};$.ajax=function(_c0){_c0=$.extend(_c0,$.extend({},$.ajaxSettings,_c0));var _c1=_c0.port;if(_c0.mode=="abort"){if(_bf[_c1]){_bf[_c1].abort();}return (_bf[_c1]=_be.apply(this,arguments));}return _be.apply(this,arguments);};})(jQuery);(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:"focusin",blur:"focusout"},function(_c2,fix){$.event.special[fix]={setup:function(){this.addEventListener(_c2,_c3,true);},teardown:function(){this.removeEventListener(_c2,_c3,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function _c3(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);};});}$.extend($.fn,{validateDelegate:function(_c4,_c5,_c6){return this.bind(_c5,function(_c7){var _c8=$(_c7.target);if(_c8.is(_c4)){return _c6.apply(_c8,arguments);}});}});})(jQuery);
/* javalib.js */

var clear="/shared/pngfix.gif" //path to clear.gif
pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}}

function redirect_url(url){
	window.location=url;
}

var image_zoom_timer = 0;
function image_zoom(id,speed,delay,w,h,step_w,step_h,div_w,div_h){
	var step_w = (step_w == null) ? 0 : step_w;
	var step_h = (step_h == null) ? 0 : step_h;
	var div_w  = (div_w == null) ? 0 : div_w;
	var div_h  = (div_h == null) ? 0 : div_h;
	var w = (w == null) ? 0 : w;
	var h = (h == null) ? 0 : h;
	if (!step_w) {
		w = $(id).width();	ow = w;
		h = $(id).height();	oh = h;
		if (!w) {
			setTimeout("image_zoom('"+id+"',"+speed+","+delay+")",2000);
			return;
		}
		ratio = w/h;
		if (w>h){
			step_w = 1;
			step_h = 1/ratio;
		} else {
			step_w = 1/ratio;
			step_h = 1;
		}
		step_w *= speed;
		step_h *= speed;
		div = $(id).parents("div").get(0).id;
		div_w = $('#'+div).width();
		div_h = $('#'+div).height();
		// firelog("image_zoom('"+id+"',"+speed+","+delay+","+w+","+h+","+step_w+","+step_h+","+div_w+","+div_h+")");
	}
	w = w - step_w;
	h = h - step_h;
	if (h>=div_h && w>=div_w) {
		$(id).width(w).height(h);
		window.status = "Img Zoom : timer : "+image_zoom_timer+" div_w "+div_w+" div_h "+div_h+" speed "+speed+" delay "+delay+ " w "+Math.floor(w)+"/"+ow+" h "+Math.floor(h)+"/"+oh+" step_w "+step_w+" step_h "+step_h+" ratio "+ratio;
		image_zoom_timer = setTimeout("image_zoom('"+id+"',"+speed+","+delay+","+w+","+h+","+step_w+","+step_h+","+div_w+","+div_h+")",delay);
	} else {
		//window.status = 'Zoom Complete';
	}
}

function image_zoom_cancel(){
	if (image_zoom_timer) {
		window.status = "Img Zoom : cancelled";
		clearTimeout(image_zoom_timer);
	}
}

function jcarousel_initCallback(carousel)
{
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
}

function highlight_inputs() {
	$(".input_button").live('mouseover', function(){
		$(this).addClass('input_button_selected');
	});
	$(".input_button").live('mouseout', function(){
		$(this).removeClass('input_button_selected');
	});
	elements = ".input_qty, .input_select, .input_text, .input_checkbox, .input_radio, .input_textarea";
	// detect IE not input_select, dissapears when you mouse off in IE */
	if (!$.support.leadingWhitespace) elements = ".input_qty, .input_text, .input_checkbox, .input_radio, .input_textarea";
	$(elements).live('mouseover', function(){ 
		$(this).addClass("input_hover");
	});
	$(elements).live('mouseout', function(){ 
		$(this).removeClass("input_hover");
	});
}

function firelog(s){
	if (typeof(console)!="undefined") console.log(s);
}

function checkId(id){
	id = id.replace("#","");
	if (!id) return;
	c = $('#'+id).length;
	//firelog("checkId "+id+" "+c);
	return (c > 0);
}

auto_div_height_animating = new Array;
function auto_div_height(id,monitor){
	if (auto_div_height_animating[id]) return;
	if (!checkId(monitor)) {
		firelog("auto_div_height : "+monitor+' removed from dom');
		return;
	}
	//firelog("auto_div_height : ('"+id+"','"+monitor+"')");
	container = id.replace('#','')+"_container";
	cid = "#"+container;
	if (!checkId(cid)) $(id).wrap("<div id='"+container+"'></div>");
	ch = $(cid).height();
	c  = $(id).height();
	if (c != ch){
		auto_div_height_animating[id] = true;
		firelog("auto_div_height : animating c "+c+" ch "+ch+" monitor "+monitor);
		$(cid).animate(
			{ height : c }, 500,
			function() {
				firelog("auto_div_height : animation complete "+monitor);
				auto_div_height_animating[id] = false;
				if ($(id).css('display') == 'none') $(id).fadeIn();
				setTimeout("auto_div_height('"+id+"','"+monitor+"')",500);
			}	
		);
	} else {
		$(cid).css('backgroundImage','none');
		if ($(id).css('display') == 'none') $(id).fadeIn();
		//firelog("auto_div_height : c "+c+" ch "+ch+" id "+id+" cid "+cid+" "+monitor);
		setTimeout("auto_div_height('"+id+"','"+monitor+"')",500);
	}
}

// stop ajax forms being submitted for invalid forms
function check_form(formData, jqForm, options){ 
	valid = $(options.id).valid();
	if (options.fadeout){
		if (valid) $(options.target).fadeOut();
		//else $(options.target).effect("highlight", { color: '#F00' }, 3000);
	}
	return valid;
}

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt) {
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_itemList[idx - 1].html);
}

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt) {
    carousel.remove(i);
}

function datePicker(id) {
	$("#"+id).datepicker({ 
		dateFormat: 'dd/mm/yy', 
		changeMonth: true,
		changeYear: true,
		showAnim: 'slideDown'
	});
}
function datePickerIPTC(id) {
	$("#"+id).datepicker({ 
		dateFormat: 'yymmdd', 
		changeMonth: true,
		changeYear: true,
		showAnim: 'slideDown'
	});
}

function centerDiv(div) {
	divW = $(div).width();
	divH = $(div).height();
	width  = $(window).width();
	height = $(window).height();
	x = (width/2)-(divW/2);
	y = (height/2)-(divH/2)+$(window).scrollTop();
	$(div).css('top',y).css('left',x);
	$(div).fadeIn();
}

function popup_div(img) {
	$('#popup_div').fadeOut().html("<img id='popup_img' src='/tmp'+img+'>");
	setTimeout("centerDiv('#popup_div')",2000);
}

function popup_div_no_fade(img) {
	$('#popup_div_no_fade').hide().html("<img id='popup_img' src='/tmp"+img+"'>");
	centerDiv('#popup_div_no_fade');
}

// required for $('#id').load('page.php?params=have spaces in them')
function urlencode (str) {
    var hexStr = function (dec) {
        return '%' + dec.toString(16).toUpperCase();
    };
 
    var ret = '',
            unreserved = /[\w.-]/; // A-Za-z0-9_.- // Tilde is not here for historical reasons; to preserve it, use rawurlencode instead
    str = (str+'').toString();
 
    for (var i = 0, dl = str.length; i < dl; i++) {
        var ch = str.charAt(i);
        if (unreserved.test(ch)) {
            ret += ch;
        }
        else {
            var code = str.charCodeAt(i);
            // Reserved assumed to be in UTF-8, as in PHP
            if (code === 32) {
                ret += '+'; // %20 in rawurlencode
            }
            else if (code < 128) { // 1 byte
                ret += hexStr(code);
            }
            else if (code >= 128 && code < 2048) { // 2 bytes
                ret += hexStr((code >> 6) | 0xC0);
                ret += hexStr((code & 0x3F) | 0x80);
            }
            else if (code >= 2048 && code < 65536) { // 3 bytes
                ret += hexStr((code >> 12) | 0xE0);
                ret += hexStr(((code >> 6) & 0x3F) | 0x80);
                ret += hexStr((code & 0x3F) | 0x80);
            }
            else if (code >= 65536) { // 4 bytes
                ret += hexStr((code >> 18) | 0xF0);
                ret += hexStr(((code >> 12) & 0x3F) | 0x80);
                ret += hexStr(((code >> 6) & 0x3F) | 0x80);
                ret += hexStr((code & 0x3F) | 0x80);
            }
        }
    }
    return ret;
}

function id_check(){
	var allTags = document.body.getElementsByTagName('*');
	var ids = [];
	for (var tg = 0; tg< allTags.length; tg++) {
		var tag = allTags[tg];
		if (tag.id) {
			if (ids[tag.id] && tag.id != ',ilink' && tag.id != 'filename') ids.push(tag.id+'\n');
			else ids[tag.id] = 1;
		}
	}
	alert(ids);
}

function toggle_checkbox(id) {
	el = document.getElementById(id); 
	if (!el) {
		walert("Cannot set checkbox, no such id ["+id+"]");
		return;
	}
	el.value = 1-el.value;
}

function Height() {	return $(body).height(); }
function Width() {	return $(body).width(); }
function getHeight() { return Height(); }
function getWidth() { return Width(); }

function set_valid(nm,is_valid){
	return;
	e = document.getElementById("valid_"+nm);
	if (!e) {
		walert("Cannot find id to display error looking for valid_"+nm);
	} else {
		if (is_valid) e.innerHTML = "";
		else e.innerHTML = "<img alt='This field is required.' src='/shared/cart_warning.gif'>";
	}
}

function err_row(nm,s){
	set_valid(nm,false);
	nm = nm.replace('_',' ');
	return "<li>"+nm+" "+s+"</li>\n";
}

// validate + set_valid for old carts
function validate_form(formname){
	var txt = ""; 
	e = document.getElementById(formname);
	if (!e){
		walert("Cannot validate "+formname+" no such id.");
		return true;
	}
	check_password = false;
	fields = e.elements;
	password = confirm_password = "";
	for(i=0; i<fields.length; i++)
	{
		nm  = fields[i].name;
		id  = fields[i].id;
		val = fields[i].value;
//		txt = txt + id + " " + nm + " " + "[" + val + "]<br>";
		if (id.length<8) continue;
		s = id.slice(0,8);
		if (s!="id_valid") continue;
		set_valid(nm,true);
		fields[i].style.background='#FFFFFF';
		if (id=="id_valid_not_null" && val.length==0) {
			fields[i].style.background='#FF7777';
			txt = txt + err_row(nm,"is a mandatory field.");
		}
		if (id=="id_valid_email" && !echeck(val)){
			fields[i].style.background='#FF7777';
			txt = txt + err_row(nm,"is not a valid email address.");
		}
		if (id=="id_valid_credit_card" && !checkcreditcard(val)){
			fields[i].style.background='#FF7777';
			txt = txt + err_row(nm,"is not a valid credit card number.");
		}
		if (id=="id_valid_terms"){
			val = fields[i].checked;
			if (val==false){
				alert("You must accept our terms and conditions before you can place your order.");
				return;
			}
		}
		if (nm=="password") password = val;
		if (nm=="confirm_password") {
			check_password = true;
			confirm_password = val;
		}
	}
	if (check_password && (password != confirm_password)){
		txt = txt + err_row(nm,"your passwords do not match");
		set_valid("password",false);
		set_valid("confirm_password",false);
	}
	if (txt) {
		err.innerHTML=txt
		return false;
	} else err.innerHTML="";
	return true;
}

function saveFormId(fn){
	formId = document.getElementById(fn);
	if (formId) {
		$('#spinner').show();
		formId.submit();
	} else alert('cannot save: bad form id: '+fn);
}

function conf(s){
	return window.confirm(s);
}

var activeEditors = new Array()

function activateEditor(id) {
    //alert("activate "+id);
	activeEditors[activeEditors.length] = id;
    toggleEditor(id);
}

function deactivateEditors() {
	//alert('active '+activeEditors.length);
    for(x=0;x<activeEditors.length;x++) {
		walert("Removing editor "+x);
        toggleEditor(activeEditors[x])
    }
    activeEditors.length = 0;
}

// functions
function toggleEditor(id) {
	var elm = document.getElementById(id);
	if (!elm) {
		walert("no such id "+id);
		return;
	}
	if (tinyMCE.getInstanceById(id) == null){
		walert('add' + id);
		tinyMCE.execCommand('mceAddControl', false, id);
	} else {
		walert('focus' + id);
		tinyMCE.execCommand('mceFocus', false, id);
		walert('remove' + id);
		tinyMCE.execCommand('mceRemoveControl', false, id);
	}
} 

function popup(URL,w,h) {
	aWindow=window.open(URL, "thewindow", "toolbar=no, width="+w+", height="+h+", status=no, scrollbars=yes, resize=no, menubars=no");
}

function popup_full(URL,w,h) {
	aWindow=window.open(URL, "thewindow", "toolbar=no, width="+w+", height="+h+", status=yes, scrollbars=yes, resize=yes, menubars=no");
}

function popup_clean(URL,w,h) {
	aWindow=window.open(URL, "", "toolbar=no, width="+w+", height="+h+", status=no, scrollbars=no, resize=no, menubars=no");
}

function popup_scroll(URL,w,h) {
	aWindow=window.open(URL, "", "toolbar=no, width="+w+", height="+h+", status=no, scrollbars=yes, resize=no, menubars=no");
}

function putFocus(formInst, elementInst) {
	if (document.forms.length > 0) {
		if (document.forms[formInst].elements[elementInst]) {
			document.forms[formInst].elements[elementInst].focus();
		}
	}
}

function placeFocus() {
	if (document.forms.length > 0) {
		var field = document.forms[0];
		for (i = 0; i < field.length; i++) {
			if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
				document.forms[0].elements[i].focus();
				break;
			}
		}
	}
}

function checkcreditcard(object_value){
	if (object_value.length == 0)
		return false;
	var white_space = " -";
	var creditcard_string="";
	var check_char;

	for (var i = 0; i < object_value.length; i++)
	{
		check_char = white_space.indexOf(object_value.charAt(i));
		if (check_char < 0)
			creditcard_string += object_value.substring(i, (i + 1));
	}	

	if (creditcard_string.length < 13 || creditcard_string.length > 19)
		return false;

	if (creditcard_string.charAt(0) == "+")
		return false;

	if (!_CF_checkinteger(creditcard_string))
		return false;

	var doubledigit = creditcard_string.length % 2 == 1 ? false : true;
	var checkdigit = 0;
	var tempdigit;

	for (var i = 0; i < creditcard_string.length; i++)
	{
		tempdigit = eval(creditcard_string.charAt(i));

		if (doubledigit)
		{
			tempdigit *= 2;
			checkdigit += (tempdigit % 10);

			if ((tempdigit / 10) >= 1.0)
				checkdigit++;

			doubledigit = false;
		}
		else
		{
			checkdigit += tempdigit;
			doubledigit = true;
		}
	}	
	return (checkdigit % 10) == 0 ? true : false;
}

var debugId = false;	

function walert(s){	window.status = s; }

function malert(s){
	if (debugId==1) alert(s);
	if (debugId==2) walert(s);
}

function setDebugId(v){
	// 1 alert // 2 status bar
	walert("debugId ("+v+")");
	debugId=v;
}

function getId(id) {
	return $('#'+id);
}

var lastId = 0;	
function statId(id){
	if (debugId) alert("statId "+id);
	if (!checkId(id)) return;
	display = $(id).css('display');
	opacity = $(id).css('opacity');
	//firelog("statId "+id+" display "+display+" opacity "+opacity);
	if (display=="none" || opacity==0) return 0;
	else return 1;
}

function hideId(id){
	if (debugId) alert("hideId "+id);
	if (!checkId(id)) return;
	$('#'+id).hide();
}

function showId(id,mode){
	if (debugId) alert("showId "+id);
	if (!checkId(id)) return;
	var mode = (mode == null) ? 0 : mode;
	if (!mode) lastId = id;
	$('#'+id).show();
}

function toggleId(id,mode){
	if (debugId) malert("toggleId "+id);
	if (!checkId(id)) return;
	var mode = (mode == null) ? 0 : mode;
	if (!mode && lastId != id) hideId(lastId);
	$('#'+id).toggle();
}

function vislayer(){    
	this.lastId = '';
} 

vislayer.prototype.stat = function (id){
	if (!checkId(id)) return;
	opacity = $('#'+id).css('opacity');
	state   = $('#'+id).css('display');
	if (debugId) alert(id+" is display ["+state+"] opacity ["+opacity+"]");
	if (state=="block") return 1; else return 0;
}

vislayer.prototype.show = function (id,mode){
	if (debugId) malert("show "+id);
	if (!checkId(id)) return;
	var mode = (mode == null) ? 0 : mode;
	if (!mode) this.lastId = id;
	$('#'+id).show().css('opacity',1);
}

vislayer.prototype.hide = function (id){
	if (debugId) malert("hide "+id);
	if (!checkId(id)) return;
	$('#'+id).hide();
}

vislayer.prototype.toggle = function (id,mode){
	if (debugId) malert("toggle "+id);
	if (!checkId(id)) return;
	var mode = (mode == null) ? 0 : mode;
	if (!mode && this.lastId != id) this.hide(this.lastId);
	if (this.stat(id)) this.hide(id); else this.show(id,mode);
}

vislayer.prototype.slideDown = function (id,mode){
	if (debugId) malert("slideDown "+id);
	if (!checkId(id)) return;
	var mode = (mode == null) ? 0 : mode;
	if (!mode) this.lastId = id;
	$('#'+id).slideDown("slow").css('opacity',1);
}

vislayer.prototype.slideUp = function (id){
	if (debugId) malert("slideUp "+id);
	if (!checkId(id)) return;
	$('#'+id).slideUp("slow");
}

vislayer.prototype.slideUpDown = function (id,mode){
	if (debugId) malert("slideUpDown "+id);
	if (!checkId(id)) return;
	realthis = this;
	$('#'+this.lastId).slideUp("slow", function () { realthis.slideDown(id,mode); } );
}

vislayer.prototype.faderIn = function (id,mode){
	if (debugId) malert("fadeIn "+id);
	if (!checkId(id)) return;
	var mode = (mode == null) ? 0 : mode;
	if (!mode) this.lastId = id;
	alert("last "+this.lastId);
	$('#'+id).fadeIn().css('opacity',1);
}

vislayer.prototype.faderOut = function (id){
	if (debugId) malert("faderOut "+id+" busy "+this.busy);
	if (!checkId(id)) return;
	$('#'+id).fadeOut("slow", function () { this.busy = false; malert("faderOut "+id+" busy "+this.busy); } );
}

vislayer.prototype.faderInOut = function (id,mode){
	if (typeof(this.busy) == "undefined") this.busy = false;
	if (debugId) malert("faderInOut "+id+" busy "+this.busy);
	if (!checkId(id)) return;
	if (this.busy) return;
	realthis = this;
	previousId = this.lastId;
	if (previousId == id) $('#'+id).fadeIn("slow");
	else {
		this.busy = true;
		$('#'+id).fadeIn("slow", function () { realthis.faderOut(previousId,mode); walert("busy "+this.busy); } );
	}
	if (!mode) this.lastId = id;
}

vislayer.prototype.slideToggle = function (id,mode){
	if (debugId) malert("slideToggle "+id);
	if (!checkId(id)) return;
	var mode = (mode == null) ? 0 : mode;
	// a panel is open, and its not this one // close it first
	if (this.stat(this.lastId) && this.lastId != id) {
		this.slideUpDown(id,mode);
	} else {
		if (this.stat(id)) this.slideUp(id); else this.slideDown(id,mode);
	}
}
