﻿;
(function($) {
	var f = clearTimeout;
	var g = setTimeout;
	var h = Array.prototype;
	$.each(['trigger', 'triggerHandler'], function(i, e) {
		$.fn[e + 'Defer'] = function() {
			var a = arguments;
			var b = e + 'Defer.' + a[0];
			f(this.data(b));
			var c = (typeof (a[a.length - 1]) == 'number') ? h.pop.call(a) : 150;
			var d = this;
			this.data(b, g(function() {
				d[e].apply(d, a)
			}, c));
			return this
		}
	});
	$.fn.bindDefer = function() {
		var a = arguments;
		var b = (typeof (a[a.length - 1]) == "number") ? h.pop.call(a) : 150;
		var c = h.pop.call(a);
		var d = this;
		var e;
		h.push.call(a, function() {
			f(e);
			a = arguments;
			e = g(function() {
				c.apply(d, a)
			}, b)
		});
		this.bind.apply(this, a);
		return this
	}
})(jQuery);
(function($) {
	var ie6 = $.browser.msie && parseInt($.browser.version) == 6 && typeof window['XMLHttpRequest'] != "object",
        ieQuirks = null,
        w = [];
	$.modal = function(data, options) {
		return $.modal.impl.init(data, options);
	};
	$.modal.close = function() {
		$.modal.impl.close();
	};
	$.fn.modal = function(options) {
		return $.modal.impl.init(this, options);
	};
	$.modal.defaults = {
		opacity: 50,
		overlayId: 'simplemodal-overlay',
		overlayCss: {},
		containerId: 'simplemodal-container',
		containerCss: {},
		dataCss: {},
		zIndex: 1000,
		close: true,
		closeHTML: '<a class="modalCloseImg" title="Close"></a>',
		closeClass: 'simplemodal-close',
		position: null,
		persist: false,
		onOpen: null,
		onShow: null,
		onClose: null
	};
	$.modal.impl = {
		opts: null,
		init: function(data, options) {
			if (this.dialog.data) {
				return false;
			}
			ieQuirks = $.browser.msie && !$.boxModel;
			this.opts = $.extend({}, $.modal.defaults, options);
			this.zIndex = this.opts.zIndex;
			this.occb = false;
			if (typeof data == 'object') {
				data = data instanceof jQuery ? data : $(data);
				if (data.parent().parent().size() > 0) {
					this.dialog.parentNode = data.parent();
					if (!this.opts.persist) {
						this.dialog.orig = data.clone(true);
					}
				}
			} else if (typeof data == 'string' || typeof data == 'number') {
				data = $('<div/>').html(data);
			} else {
				alert('SimpleModal Error: Unsupported data type: ' + typeof data);
				return false;
			}
			this.dialog.data = data.addClass('simplemodal-data').css(this.opts.dataCss);
			data = null;
			this.create();
			this.open();
			if ($.isFunction(this.opts.onShow)) {
				this.opts.onShow.apply(this, [this.dialog]);
			}
			return this;
		},
		bindEvents: function() {
			var self = this;
			$('.' + this.opts.closeClass).bind('click.simplemodal', function(e) {
				e.preventDefault();
				self.close();
			});
			$(window).bind('resize.simplemodal', function() {
				w = self.getDimensions();
				self.setPosition();
				if (ie6 || ieQuirks) {
					self.fixIE();
				} else {
					self.dialog.iframe && self.dialog.iframe.css({
						height: w[0],
						width: w[1]
					});
					self.dialog.overlay.css({
						height: w[0],
						width: w[1]
					});
				}
			});
		},
		close: function() {
			if (!this.dialog.data) {
				return false;
			}
			if ($.isFunction(this.opts.onClose) && !this.occb) {
				this.occb = true;
				this.opts.onClose.apply(this, [this.dialog]);
			} else {
				if (this.dialog.parentNode) {
					if (this.opts.persist) {
						this.dialog.data.hide().appendTo(this.dialog.parentNode);
					} else {
						this.dialog.data.remove();
						this.dialog.orig.appendTo(this.dialog.parentNode);
					}
				} else {
					this.dialog.data.remove();
				}
				this.dialog.container.remove();
				this.dialog.overlay.remove();
				this.dialog.iframe && this.dialog.iframe.remove();
				this.dialog = {};
			}
			this.unbindEvents();
		},
		create: function() {
			w = this.getDimensions();
			if (ie6) {
				this.dialog.iframe = $('<iframe src="javascript:false;"/>').css($.extend(this.opts.iframeCss, {
					display: 'none',
					opacity: 0,
					position: 'fixed',
					height: w[0],
					width: w[1],
					zIndex: this.opts.zIndex,
					top: 0,
					left: 0
				})).appendTo('body');
			}
			this.dialog.overlay = $('<div/>').attr('id', this.opts.overlayId).addClass('simplemodal-overlay').css($.extend(this.opts.overlayCss, {
				display: 'none',
				opacity: this.opts.opacity / 100,
				height: w[0],
				width: w[1],
				position: 'fixed',
				left: 0,
				top: 0,
				zIndex: this.opts.zIndex + 1
			})).appendTo('body');
			this.dialog.container = $('<div/>').attr('id', this.opts.containerId).addClass('simplemodal-container').css($.extend(this.opts.containerCss, {
				display: 'none',
				position: 'fixed',
				zIndex: this.opts.zIndex + 2
			})).append(this.opts.close ? $(this.opts.closeHTML).addClass(this.opts.closeClass) : '').appendTo('body');
			this.setPosition();
			if (ie6 || ieQuirks) {
				this.fixIE();
			}
			this.dialog.container.append(this.dialog.data.hide());
		},
		dialog: {},
		fixIE: function() {
			var p = this.opts.position;
			$.each([this.dialog.iframe || null, this.dialog.overlay, this.dialog.container], function(i, el) {
				if (el) {
					var bch = 'document.body.clientHeight',
                        bcw = 'document.body.clientWidth',
                        bsh = 'document.body.scrollHeight',
                        bsl = 'document.body.scrollLeft',
                        bst = 'document.body.scrollTop',
                        bsw = 'document.body.scrollWidth',
                        ch = 'document.documentElement.clientHeight',
                        cw = 'document.documentElement.clientWidth',
                        sl = 'document.documentElement.scrollLeft',
                        st = 'document.documentElement.scrollTop',
                        s = el[0].style;
					s.position = 'absolute';
					if (i < 2) {
						s.removeExpression('height');
						s.removeExpression('width');
						s.setExpression('height', '' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"');
						s.setExpression('width', '' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"');
					} else {
						var te, le;
						if (p && p.constructor == Array) {
							var top = p[0] ? typeof p[0] == 'number' ? p[0].toString() : p[0].replace(/px/, '') : el.css('top').replace(/px/, '');
							te = top.indexOf('%') == -1 ? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"' : parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';
							if (p[1]) {
								var left = typeof p[1] == 'number' ? p[1].toString() : p[1].replace(/px/, '');
								le = left.indexOf('%') == -1 ? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"' : parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
							}
						} else {
							te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';
							le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
						}
						s.removeExpression('top');
						s.removeExpression('left');
						s.setExpression('top', te);
						s.setExpression('left', le);
					}
				}
			});
		},
		getDimensions: function() {
			var el = $(window);
			var h = $.browser.opera && $.browser.version > '9.5' && $.fn.jquery <= '1.2.6' ? document.documentElement['clientHeight'] : el.height();
			return [h, el.width()];
		},
		open: function() {
			this.dialog.iframe && this.dialog.iframe.show();
			if ($.isFunction(this.opts.onOpen)) {
				this.opts.onOpen.apply(this, [this.dialog]);
			} else {
				this.dialog.overlay.show();
				this.dialog.container.show();
				this.dialog.data.show();
			}
			this.bindEvents();
		},
		setPosition: function() {
			var top, left, hCenter = (w[0] / 2) - ((this.dialog.container.height() || this.dialog.data.height()) / 2),
                vCenter = (w[1] / 2) - ((this.dialog.container.width() || this.dialog.data.width()) / 2);
			if (this.opts.position && this.opts.position.constructor == Array) {
				top = this.opts.position[0] || hCenter;
				left = this.opts.position[1] || vCenter;
			} else {
				top = hCenter;
				left = vCenter;
			}
			this.dialog.container.css({
				left: left,
				top: top
			});
		},
		unbindEvents: function() {
			$('.' + this.opts.closeClass).unbind('click.simplemodal');
			$(window).unbind('resize.simplemodal');
		}
	};
})(jQuery);
var redirecturl = document.location.href;
var login = {
	message: null,
	_contentHeight: null,
	ajaxOpener: function(redirectURL, entity) {
		var querystring = "";
		if (entity == 'copyfiles' || entity == 'movefiles') {
			querystring = '&url=' + redirecturl;
		}
		$.ajax({
			url: redirectURL,
			data: $('#login-container form').serialize() + querystring,
			type: 'post',
			cache: false,
			dataType: 'html',
			complete: function(xhr) {
				$('#login-container .login-loading').fadeOut(200, function() { });
				if (entity == 'login') {
					login.contentHeight(350);
					$(xhr.responseText).modal({
						close: false,
						position: ["15%", ],
						overlayId: 'login-overlay',
						containerId: 'login-container',
						onOpen: login.open,
						onShow: login.showLogin,
						onClose: login.close
					});
				}
				if (entity == 'tellafriend') {
					login.contentHeight(420);
					$(xhr.responseText).modal({
						close: false,
						position: ["15%", ],
						overlayId: 'login-overlay',
						containerId: 'login-container',
						onOpen: login.open,
						onShow: login.showTellAFriend,
						onClose: login.close
					});
				}
				if (entity == 'photoflag') {
					login.contentHeight(250);
					$(xhr.responseText).modal({
						close: false,
						position: ["15%", ],
						overlayId: 'login-overlay',
						containerId: 'login-container',
						onOpen: login.open,
						onShow: login.showPhotoFlag,
						onClose: login.close
					});
				}
				if (entity == 'photoalbumflag') {
					login.contentHeight(250);
					$(xhr.responseText).modal({
						close: false,
						position: ["15%", ],
						overlayId: 'login-overlay',
						containerId: 'login-container',
						onOpen: login.open,
						onShow: login.showPhotoAlbumFlag,
						onClose: login.close
					});
				}
				if (entity == 'copyfiles') {
					login.contentHeight(400);
					$(xhr.responseText).modal({
						close: false,
						position: ["15%", ],
						overlayId: 'login-overlay',
						containerId: 'login-container',
						onOpen: login.open,
						onShow: login.ShowCopy,
						onClose: login.close
					});
				}
				if (entity == 'movefiles') {
					login.contentHeight(400);
					$(xhr.responseText).modal({
						close: false,
						position: ["15%", ],
						overlayId: 'login-overlay',
						containerId: 'login-container',
						onOpen: login.open,
						onShow: login.ShowMove,
						onClose: login.close
					});
				}
			},
			error: function(xhr) {
				alert(xhr.statusText);
			}
		});
	},
	contentHeight: function(height) {
		if (height == null) {
			return login._contentHeight;
		} else {
			login._contentHeight = height
		}
	},
	error: function(xhr) {
		alert(xhr.statusText);
	},
	open: function(dialog) {
		if ($.browser.mozilla) {
			$('#login-container .login-button').css({
				'padding-bottom': '2px'
			});
		}
		if ($.browser.safari) {
			$('#login-container .login-input').css({
				'font-size': '.9em'
			});
		}
		var h = login.contentHeight();
		if ($('#login-subject').length) {
			h += 26;
		} 
		{
			if ($('#login-cc').length) h += 22;
		}
		var title = $('#login-container .login-title').html();
		$('#login-container .login-title').html('Loading...');
		dialog.overlay.fadeIn(200, function() {
			dialog.container.fadeIn(200, function() {
				dialog.data.fadeIn(200, function() {
					$('#login-container .login-content').animate({
						height: h
					}, function() {
						$('#login-container .login-title').html(title);
						$('#login-container form').fadeIn(200, function() {
							$('#login-container input#txtEmail').focus();
							$('#login-container .login-cc').click(function() {
								var cc = $('#login-container #login-cc');
								cc.is(':checked') ? cc.attr('checked', '') : cc.attr('checked', 'checked');
							});
							if ($.browser.msie && $.browser.version < 7) {
								$('#login-container .login-button').each(function() {
									if ($(this).css('backgroundImage').match(/^url[("']+(.*\.png)[)"']+$/i)) {
										var src = RegExp.$1;
										$(this).css({
											backgroundImage: 'none',
											filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '", sizingMethod="crop")'
										});
									}
								});
							}
						});
					});
				});
			});
		});
	},
	showNoError: function() {
		$('#login-container .login-message').animate({
			height: '30px'
		}, login.showError);
	},
	showValidationFailedError: function() {
		var msg = $('#login-container .login-message div');
		msg.fadeOut(200, function() {
			msg.empty();
			login.showError();
			msg.fadeIn(200);
		});
	},
	notValid: function() {
		if ($('#login-container .login-message:visible').length) {
			login.showValidationFailedError();
		} else {
			login.showNoError();
		}
	},
	submitdata: function(redurl, entity) {
		$('#login-container .login-message').hide('slow');
		$('#login-container .login-content').animate({
			height: login.contentHeight()
		}, function() {
			var querystring = "";
			if (entity == 'copyfiles' || entity == 'movefiles') {
				var pageurl = document.location.href;
				var ParentDirectoryId = $('.divParentID').children('span:last').html() != '' ? $('.divParentID').children('span:last').html() : $('.divParentID').children('span').html();
				querystring = '&selectedFile=' + $('#selectedFile').val() + '&parentDirectoryID=' + ParentDirectoryId;
			} else if (entity == 'tellafriend') {
				querystring = '&entityType=' + $('#entity').val()
			} else if (entity == 'tellafriend') {
				querystring = '&entityType=' + $('#entity').val()
			}
			$('#login-container .login-loading').fadeIn(200, function() {
				$.ajax({
					url: redurl,
					data: $('#login-container form').serialize() + '&action=send&url=' + redirecturl + querystring + '&ReturnURL=' + getQuerystringParamValue('ReturnURL'),
					type: 'post',
					cache: false,
					dataType: 'html',
					complete: function(xhr) {
						$('#login-container .login-loading').fadeOut(200, function() { });
						if (entity == 'login') {
							if (xhr != null) {
								$('#login-container .login-loading').fadeOut(200, function() { });
								if (xhr.responseText == "success") {
									if ((getQuerystringParamValue('ReturnURL') == null) || (getQuerystringParamValue('ReturnURL') == '')) {
										window.location.href = redirecturl;
									} else {
										window.location.href = getQuerystringParamValue('ReturnURL');
									}
								} else {
									$('#login-container .login-content').animate({
										height: '400px'
									});
									fadeInfadeOutAnimation($('#login-container .login-message').html($('<div class="login-error">').append(xhr.responseText)));
								}
							}
						} else if (entity == 'tellafriend') {
							$('#login-container .login-content-form').fadeOut();
							$('#login-container .login-content').animate({
								height: '150px'
							});
							$('#login-container .login-message').html($('<div class="login-error">').append("This page has been forwarded.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
						} else if (entity == 'photoflag') {
							$('#login-container .login-content-form').fadeOut();
							$('#login-container .login-message').html($('<div class="login-error">').append("This photo has been flagged")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
						} else if (entity == 'photoalbumflag') {
							$('#login-container .login-content-form').fadeOut();
							$('#login-container .login-message').html($('<div class="login-error">').append("This album has been flagged")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
						} else if (entity == 'copyfiles') {
							if (xhr.responseText == "a") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("Some files were not found while copying. these corrupted files were deleted. You may need to upload them again.</br>And some files you copied already exist in the destination directory.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							}
							if (xhr.responseText == "b") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("Some files you copied already exist in the destination directory.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							}
							if (xhr.responseText == "c") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("Some files were not found while copying. these corrupted files were deleted. You may need to upload them again.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							} else if (xhr.responseText == "y") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("File(s) copied successfully.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							} else if (xhr.responseText == "f") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("There are no selected file to copy.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							}
							$('#MainDiv').find('input:checkbox').removeAttr('checked');
						} else if (entity == 'movefiles') {
							if (xhr.responseText == "p") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("Some files were not found while moving. these corrupted files were deleted. You may need to upload them again.</br>And some files you copied already exist in the destination directory.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							}
							if (xhr.responseText == "q") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("Some files you moved already exist in the destination directory.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							}
							if (xhr.responseText == "r") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("Some files were not found while moving. these corrupted files were deleted. You may need to upload them again.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							} else if (xhr.responseText == "s") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("File(s) moved successfully.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							} else if (xhr.responseText == "t") {
								$('#login-container .login-content').animate({
									height: '320px'
								});
								$('#login-container .login-message').html($('<div class="login-error">').append("There are no selected file to move.")).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
							}
							window.location.href = pageurl;
						}
					},
					error: login.error
				});
			});
		});
	},
	showLogin: function(dialog) {
		$('#login-container .login-send').click(function(e) {
			var status = null;
			if (login.validateLogin()) {
				login.submitdata(String.format('{0}/ModalDialogs/loginmodal.aspx', RELATIVEAPPLICATIONURL), 'login');
			} else {
				login.notValid();
			}
			e.preventDefault();
		});
	},
	showPhotoFlag: function(dialog) {
		$('#login-container .login-send').click(function(e) {
			e.preventDefault();
			var status = null;
			if (login.validateFlagEntity()) {
				login.submitdata(String.format('{0}/ModalDialogs/photomodal.aspx', RELATIVEAPPLICATIONURL), 'photoflag');
			} else {
				login.notValid();
			}
		});
	},
	showPhotoAlbumFlag: function(dialog) {
		$('#login-container .login-send').click(function(e) {
			e.preventDefault();
			var status = null;
			if (login.validateFlagEntity()) {
				login.submitdata(String.format('{0}/ModalDialogs/photoalbummodal.aspx', RELATIVEAPPLICATIONURL), 'photoalbumflag');
			} else {
				login.notValid();
			}
		});
	},
	showTellAFriend: function(dialog) {
		$('#login-container .login-send').click(function(e) {
			e.preventDefault();
			var status = null;
			if (login.validateTellAFriend()) {
				login.submitdata(String.format('{0}/ModalDialogs/tellafriendmodal.aspx', RELATIVEAPPLICATIONURL), 'tellafriend');
			} else {
				login.notValid();
			}
		});
	},
	ShowCopy: function(dialog) {
		$('#login-container .login-send').click(function(e) {
			e.preventDefault();
			var status = null;
			if (login.validateFileDirectry()) {
				login.submitdata(String.format('{0}/ModalDialogs/copyfiles.aspx', RELATIVEAPPLICATIONURL), 'copyfiles');
			} else {
				login.notValid();
			}
		});
	},
	ShowMove: function(dialog) {
		$('#login-container .login-send').click(function(e) {
			e.preventDefault();
			var status = null;
			if (login.validateFileDirectry()) {
				login.submitdata(String.format('{0}/ModalDialogs/movefiles.aspx', RELATIVEAPPLICATIONURL), 'movefiles');
			} else {
				login.notValid();
			}
		});
	},
	close: function(dialog) {
		$('#login-container .login-message').fadeOut();
		$('#login-container .login-title').html('Goodbye...');
		$('#login-container form').fadeOut(200);
		$('#login-container .login-content').animate({
			height: 40
		}, function() {
			dialog.data.fadeOut(200, function() {
				dialog.container.fadeOut(200, function() {
					dialog.overlay.fadeOut(200, function() {
						$.modal.close();
					});
				});
			});
		});
	},
	validateLogin: function() {
		login.message = '';
		var email = $('#login-container #txtEmail').val();
		if (!email) {
			login.message += 'User Name is required. ';
		}
		if (!$('#login-container #txtPassword').val()) {
			login.message += 'Password is required. ';
		}
		if (login.message.length > 0) {
			return false;
		} else {
			return true;
		}
	},
	validateFileDirectry: function() {
		login.message = '';
		var destinationDirectoryID = $('#login-container #hdnDirectoryID').val();
		var selectedFile = $('#selectedFile').val();
		if (selectedFile == '') {
			login.message += 'There are no selected file .';
		} else if (!destinationDirectoryID) {
			login.message = 'Select a destination directory';
		} else if (ParentId == destinationDirectoryID) {
			login.message = 'Source and destination directories are same';
		}
		if (login.message.length > 0) {
			return false;
		} else {
			return true;
		}
	},
	validateTellAFriend: function() {
		login.message = '';
		var txtName = $('#login-container #txtName');
		var txtFriendName = $('#login-container #txtFriendName');
		var txtFriendEmail = $('#login-container #txtFriendEmail');
		var txtMessage = $('#login-container #txtMessage');
		if (txtName.val() == '' && txtFriendName.val() == '' && txtFriendEmail.val() == '') {
			login.message += "Your name, friend's name and email id is required.";
		} else {
			if (txtName.val() == '') {
				login.message += 'Your Name is required. ';
			}
			if (txtFriendName.val() == '') {
				login.message += 'Friend\'s Name is required. ';
			}
			if (txtFriendEmail.val() == '') {
				login.message += 'Friend\'s Email is required. ';
			}
			if (!login.validateEmail(txtFriendEmail.val())) {
				login.message += 'Email is invalid. ';
			}
		}
		if (login.message.length > 0) {
			return false;
		} else {
			return true;
		}
	},
	validateFlagEntity: function() {
		login.message = '';
		if ($.trim($('#login-container textarea#txtMessage').val()) == '') {
			login.message = 'Why do you want to flag this photo?';
		}
		return (login.message.length == 0)
	},
	validateEmail: function(email) {
		var at = email.lastIndexOf("@");
		if (at < 1 || (at + 1) === email.length) {
			return false;
		}
		if (/(\.{2,})/.test(email)) {
			return false;
		};
		var local = email.substring(0, at);
		var domain = email.substring(at + 1);
		if (local.length < 1 || local.length > 64 || domain.length < 4 || domain.length > 255) {
			return false;
		}
		if (/(^\.|\.$)/.test(local) || /(^\.|\.$)/.test(domain)) return false;
		if (!/^"(.+)"$/.test(local)) {
			if (!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&'+=_\.]*$/.test(local)) {
				return false;
			}
		}
		if (!/^[-a-zA-Z0-9\.]*$/.test(domain) || domain.indexOf(".") === -1) {
			return false;
		}
		return true;
	},
	showError: function() {
		$('#login-container .login-message').animate({
			height: '50px'
		}).html($('<div class="login-error">').append(login.message)).fadeIn(400).fadeOut(400).fadeIn(400).fadeOut(400).fadeIn(400);
	}
};
$(function() {
    $('.loginCss1').click(function(e) {
        if ($(this).attr('href') != null) {
            redirecturl = $(this).attr('href');
        }
        login.ajaxOpener(String.format('{0}/ModalDialogs/loginmodal.aspx', RELATIVEAPPLICATIONURL), 'login');
        e.preventDefault();
    });
    $('.tellafriendlink').click(function(e) {
        redirecturl = document.location.href;
        login.ajaxOpener(String.format('{0}/ModalDialogs/tellafriendmodal.aspx', RELATIVEAPPLICATIONURL), 'tellafriend');
        e.preventDefault();
    });
    $('.photoFlagLink').click(function(e) {
        if ($(this).attr('href') != null) {
            redirecturl = $(this).attr('href');
        }
        login.ajaxOpener(String.format('{0}/ModalDialogs/photomodal.aspx', RELATIVEAPPLICATIONURL), 'photoflag');
        e.preventDefault();
    });

    $('.photoAlbumFlagLink').click(function(e) {
        if ($(this).attr('href') != null) {
            redirecturl = $(this).attr('href');
        }
        login.ajaxOpener(String.format('{0}/ModalDialogs/photoalbummodal.aspx', RELATIVEAPPLICATIONURL), 'photoalbumflag');
        e.preventDefault();
    });
    $('.copyFile').click(function(e) {
        e.preventDefault();
        if ($('.copyFile').parent().children('input:hidden').val() == '0') {
            if (this.attributes['href'] != null) {
                redirecturl = $(this).attr('href');
            }
            var headerChckBox = $('#checkAll');
            var checkboxCollection = $('#simTableHeader').children('tbody').find('input:checkbox:not(#' + headerChckBox[0].id + ')');
            var fileArray = new Array();
            $.each(checkboxCollection, function(i, checkBox) {
                if ($(checkBox).attr('checked')) {
                    var id = $(checkBox).parent().next().next().children('div').children('input:hidden').val();
                    fileArray.push(id);
                }
            });
            if (fileArray.length > 0) {
                login.ajaxOpener(String.format('{0}/ModalDialogs/copyfiles.aspx', RELATIVEAPPLICATIONURL), 'copyfiles');
                var comaSeperated = fileArray.join(',');
                $('#selectedFile').val(comaSeperated);
            } else {
                $('#divNotice2').html('There are no selected files to copy.');
                $('#divNotice2').show('slow');
                $('#divNotice2').fadeOut(6000);
            }
        }
    });
    $('.moveFile').click(function(e) {
        e.preventDefault();
        if ($('.moveFile').parent().children('input:hidden').val() == '0') {
            if (this.attributes['href'] != null) {
                redirecturl = $(this).attr('href');
            }
            var headerChckBox = $('#checkAll');
            var checkboxCollection = $('#simTableHeader').children('tbody').find('input:checkbox:not(#' + headerChckBox[0].id + ')');
            var fileArray = new Array();
            $.each(checkboxCollection, function(i, checkBox) {
                if ($(checkBox).attr('checked')) {
                    var id = $(checkBox).parent().next().next().children('div').children('input:hidden').val();
                    fileArray.push(id);
                }
            });
            if (fileArray.length > 0) {
                login.ajaxOpener(String.format('{0}/ModalDialogs/movefiles.aspx', RELATIVEAPPLICATIONURL), 'movefiles');
                var comaSeperated = fileArray.join(',');
                $('#selectedFile').val(comaSeperated);
            } else {
                $('#divNotice2').html('There are no selected files to move.');
                $('#divNotice2').show('slow');
                $('#divNotice2').fadeOut(6000);
            }
        }
    });
});
var img = ['cancel.png', 'form_bottom.gif', 'form_top.gif', 'indicator_medium.gif', 'send.png'];
$(img).each(function() {
	var i = new Image();
	i.src = String.format('{0}/assets/images/', RELATIVEAPPLICATIONURL) + this;
});
$('#login-container #txtEmail,#txtPassword').live('keypress', function(e) {
	var code = (e.keyCode ? e.keyCode : e.which);
	if (code == 13) {
		$(this).closest('div.login-content-form').find('button#btnLoginSubmit').click();
		e.preventDefault();
	}
});

function ddtabcontent(tabinterfaceid) {
	this.tabinterfaceid = tabinterfaceid
	this.tabs = document.getElementById(tabinterfaceid).getElementsByTagName("a");
	this.enabletabpersistence = true;
	this.hottabspositions = [];
	this.currentTabIndex = 0;
	this.subcontentids = [];
	this.revcontentids = [];
	this.selectedClassTarget = "link"
}
ddtabcontent.getCookie = function(Name) {
	var re = new RegExp(Name + "=[^;]+", "i");
	if (document.cookie.match(re)) {
		return document.cookie.match(re)[0].split("=")[1]
	}
	return ""
};
ddtabcontent.setCookie = function(name, value) {
	document.cookie = name + "=" + value + ";path=/"
};
ddtabcontent.prototype = {
	expandit: function(tabid_or_position) {
		this.cancelautorun();
		var tabref = "";
		try {
			if (typeof tabid_or_position == "string" && document.getElementById(tabid_or_position).getAttribute("rel")) {
				tabref = document.getElementById(tabid_or_position)
			} else if (parseInt(tabid_or_position) != NaN && this.tabs[tabid_or_position].getAttribute("rel")) {
				tabref = this.tabs[tabid_or_position]
			}
		} catch (err) {
			alert("Invalid Tab ID or position entered!")
		}
		if (tabref != "") {
			this.expandtab(tabref)
		}
	},
	cycleit: function(dir, autorun) {
		if (dir == "next") {
			var currentTabIndex = (this.currentTabIndex < this.hottabspositions.length - 1) ? this.currentTabIndex + 1 : 0
		} else if (dir == "prev") {
			var currentTabIndex = (this.currentTabIndex > 0) ? this.currentTabIndex - 1 : this.hottabspositions.length - 1
		}
		if (typeof autorun == "undefined") {
			this.cancelautorun()
		}
		this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]])
	},
	setpersist: function(bool) {
		this.enabletabpersistence = bool
	},
	setselectedClassTarget: function(objstr) {
		this.selectedClassTarget = objstr || "link"
	},
	getselectedClassTarget: function(tabref) {
		return (this.selectedClassTarget == ("linkparent".toLowerCase())) ? tabref.parentNode : tabref
	},
	urlparamselect: function(tabinterfaceid) {
		var result = window.location.search.match(new RegExp(tabinterfaceid + "=(\\d+)", "i"));
		return (result == null) ? null : parseInt(RegExp.$1)
	},
	expandtab: function(tabref) {
		var subcontentid = tabref.getAttribute("rel");
		var associatedrevids = (tabref.getAttribute("rev")) ? "," + tabref.getAttribute("rev").replace(/\s+/, "") + "," : "";
		this.expandsubcontent(subcontentid);
		this.expandrevcontent(associatedrevids);
		for (var i = 0; i < this.tabs.length; i++) {
			this.getselectedClassTarget(this.tabs[i]).className = (this.tabs[i].getAttribute("rel") == subcontentid) ? "selected" : ""
		}
		if (this.enabletabpersistence) {
			ddtabcontent.setCookie(this.tabinterfaceid, tabref.tabposition)
		}
		this.setcurrenttabindex(tabref.tabposition)
	},
	expandsubcontent: function(subcontentid) {
		for (var i = 0; i < this.subcontentids.length; i++) {
			var subcontent = document.getElementById(this.subcontentids[i]);
			subcontent.style.display = (subcontent.id == subcontentid) ? "block" : "none"
		}
	},
	expandrevcontent: function(associatedrevids) {
		var allrevids = this.revcontentids;
		for (var i = 0; i < allrevids.length; i++) {
			document.getElementById(allrevids[i]).style.display = (associatedrevids.indexOf("," + allrevids[i] + ",") != -1) ? "block" : "none"
		}
	},
	setcurrenttabindex: function(tabposition) {
		for (var i = 0; i < this.hottabspositions.length; i++) {
			if (tabposition == this.hottabspositions[i]) {
				this.currentTabIndex = i;
				break
			}
		}
	},
	autorun: function() {
		this.cycleit('next', true)
	},
	cancelautorun: function() {
		if (typeof this.autoruntimer != "undefined") {
			clearInterval(this.autoruntimer)
		}
	},
	init: function(automodeperiod) {
		var persistedtab = ddtabcontent.getCookie(this.tabinterfaceid);
		var selectedtab = -1;
		var selectedtabfromurl = this.urlparamselect(this.tabinterfaceid);
		this.automodeperiod = automodeperiod || 0
		for (var i = 0; i < this.tabs.length; i++) {
			this.tabs[i].tabposition = i;
			if (this.tabs[i].getAttribute("rel")) {
				var tabinstance = this;
				this.hottabspositions[this.hottabspositions.length] = i;
				this.subcontentids[this.subcontentids.length] = this.tabs[i].getAttribute("rel");
				this.tabs[i].onclick = function() {
					tabinstance.expandtab(this);
					tabinstance.cancelautorun();
					return false;
				};
				if (this.tabs[i].getAttribute("rev")) {
					this.revcontentids = this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/))
				}
				if (selectedtabfromurl == i || this.enabletabpersistence && selectedtab == -1 && parseInt(persistedtab) == i || !this.enabletabpersistence && selectedtab == -1 && this.getselectedClassTarget(this.tabs[i]).className == "selected") {
					selectedtab = i
				}
			}
		}
		if (selectedtab != -1) {
			this.expandtab(this.tabs[selectedtab])
		} else {
			this.expandtab(this.tabs[this.hottabspositions[0]])
		}
		if (parseInt(this.automodeperiod) > 500 && this.hottabspositions.length > 1) {
			this.autoruntimer = setInterval(function() {
				tabinstance.autorun()
			}, this.automodeperiod)
		}
	}
};
jQuery.ui || (function($) {
	var _remove = $.fn.remove,
        isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
	$.ui = {
		version: "1.7.1",
		plugin: {
			add: function(module, option, set) {
				var proto = $.ui[module].prototype;
				for (var i in set) {
					proto.plugins[i] = proto.plugins[i] || [];
					proto.plugins[i].push([option, set[i]]);
				}
			},
			call: function(instance, name, args) {
				var set = instance.plugins[name];
				if (!set || !instance.element[0].parentNode) {
					return;
				}
				for (var i = 0; i < set.length; i++) {
					if (instance.options[set[i][0]]) {
						set[i][1].apply(instance.element, args);
					}
				}
			}
		},
		contains: function(a, b) {
			return document.compareDocumentPosition ? a.compareDocumentPosition(b) & 16 : a !== b && a.contains(b);
		},
		hasScroll: function(el, a) {
			if ($(el).css('overflow') == 'hidden') {
				return false;
			}
			var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
                has = false;
			if (el[scroll] > 0) {
				return true;
			}
			el[scroll] = 1;
			has = (el[scroll] > 0);
			el[scroll] = 0;
			return has;
		},
		isOverAxis: function(x, reference, size) {
			return (x > reference) && (x < (reference + size));
		},
		isOver: function(y, x, top, left, height, width) {
			return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
		},
		keyCode: {
			BACKSPACE: 8,
			CAPS_LOCK: 20,
			COMMA: 188,
			CONTROL: 17,
			DELETE: 46,
			DOWN: 40,
			END: 35,
			ENTER: 13,
			ESCAPE: 27,
			HOME: 36,
			INSERT: 45,
			LEFT: 37,
			NUMPAD_ADD: 107,
			NUMPAD_DECIMAL: 110,
			NUMPAD_DIVIDE: 111,
			NUMPAD_ENTER: 108,
			NUMPAD_MULTIPLY: 106,
			NUMPAD_SUBTRACT: 109,
			PAGE_DOWN: 34,
			PAGE_UP: 33,
			PERIOD: 190,
			RIGHT: 39,
			SHIFT: 16,
			SPACE: 32,
			TAB: 9,
			UP: 38
		}
	};
	if (isFF2) {
		var attr = $.attr,
            removeAttr = $.fn.removeAttr,
            ariaNS = "http://www.w3.org/2005/07/aaa",
            ariaState = /^aria-/,
            ariaRole = /^wairole:/;
		$.attr = function(elem, name, value) {
			var set = value !== undefined;
			return (name == 'role' ? (set ? attr.call(this, elem, name, "wairole:" + value) : (attr.apply(this, arguments) || "").replace(ariaRole, "")) : (ariaState.test(name) ? (set ? elem.setAttributeNS(ariaNS, name.replace(ariaState, "aaa:"), value) : attr.call(this, elem, name.replace(ariaState, "aaa:"))) : attr.apply(this, arguments)));
		};
		$.fn.removeAttr = function(name) {
			return (ariaState.test(name) ? this.each(function() {
				this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
			}) : removeAttr.call(this, name));
		};
	}
	$.fn.extend({
		remove: function() {
			$("*", this).add(this).each(function() {
				$(this).triggerHandler("remove");
			});
			return _remove.apply(this, arguments);
		},
		enableSelection: function() {
			return this.attr('unselectable', 'off').css('MozUserSelect', '').unbind('selectstart.ui');
		},
		disableSelection: function() {
			return this.attr('unselectable', 'on').css('MozUserSelect', 'none').bind('selectstart.ui', function() {
				return false;
			});
		},
		scrollParent: function() {
			var scrollParent;
			if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
				scrollParent = this.parents().filter(function() {
					return (/(relative|absolute|fixed)/).test($.curCSS(this, 'position', 1)) && (/(auto|scroll)/).test($.curCSS(this, 'overflow', 1) + $.curCSS(this, 'overflow-y', 1) + $.curCSS(this, 'overflow-x', 1));
				}).eq(0);
			} else {
				scrollParent = this.parents().filter(function() {
					return (/(auto|scroll)/).test($.curCSS(this, 'overflow', 1) + $.curCSS(this, 'overflow-y', 1) + $.curCSS(this, 'overflow-x', 1));
				}).eq(0);
			}
			return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
		}
	});
	$.extend($.expr[':'], {
		data: function(elem, i, match) {
			return !!$.data(elem, match[3]);
		},
		focusable: function(element) {
			var nodeName = element.nodeName.toLowerCase(),
                tabIndex = $.attr(element, 'tabindex');
			return (/input|select|textarea|button|object/.test(nodeName) ? !element.disabled : 'a' == nodeName || 'area' == nodeName ? element.href || !isNaN(tabIndex) : !isNaN(tabIndex)) && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
		},
		tabbable: function(element) {
			var tabIndex = $.attr(element, 'tabindex');
			return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
		}
	});

	function getter(namespace, plugin, method, args) {
		function getMethods(type) {
			var methods = $[namespace][plugin][type] || [];
			return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
		}
		var methods = getMethods('getter');
		if (args.length == 1 && typeof args[0] == 'string') {
			methods = methods.concat(getMethods('getterSetter'));
		}
		return ($.inArray(method, methods) != -1);
	}
	$.widget = function(name, prototype) {
		var namespace = name.split(".")[0];
		name = name.split(".")[1];
		$.fn[name] = function(options) {
			var isMethodCall = (typeof options == 'string'),
                args = Array.prototype.slice.call(arguments, 1);
			if (isMethodCall && options.substring(0, 1) == '_') {
				return this;
			}
			if (isMethodCall && getter(namespace, name, options, args)) {
				var instance = $.data(this[0], name);
				return (instance ? instance[options].apply(instance, args) : undefined);
			}
			return this.each(function() {
				var instance = $.data(this, name);
				(!instance && !isMethodCall && $.data(this, name, new $[namespace][name](this, options))._init());
				(instance && isMethodCall && $.isFunction(instance[options]) && instance[options].apply(instance, args));
			});
		};
		$[namespace] = $[namespace] || {};
		$[namespace][name] = function(element, options) {
			var self = this;
			this.namespace = namespace;
			this.widgetName = name;
			this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
			this.widgetBaseClass = namespace + '-' + name;
			this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, $.metadata && $.metadata.get(element)[name], options);
			this.element = $(element).bind('setData.' + name, function(event, key, value) {
				if (event.target == element) {
					return self._setData(key, value);
				}
			}).bind('getData.' + name, function(event, key) {
				if (event.target == element) {
					return self._getData(key);
				}
			}).bind('remove', function() {
				return self.destroy();
			});
		};
		$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
		$[namespace][name].getterSetter = 'option';
	};
	$.widget.prototype = {
		_init: function() { },
		destroy: function() {
			this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled').removeAttr('aria-disabled');
		},
		option: function(key, value) {
			var options = key,
                self = this;
			if (typeof key == "string") {
				if (value === undefined) {
					return this._getData(key);
				}
				options = {};
				options[key] = value;
			}
			$.each(options, function(key, value) {
				self._setData(key, value);
			});
		},
		_getData: function(key) {
			return this.options[key];
		},
		_setData: function(key, value) {
			this.options[key] = value;
			if (key == 'disabled') {
				this.element[value ? 'addClass' : 'removeClass'](this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled').attr("aria-disabled", value);
			}
		},
		enable: function() {
			this._setData('disabled', false);
		},
		disable: function() {
			this._setData('disabled', true);
		},
		_trigger: function(type, event, data) {
			var callback = this.options[type],
                eventName = (type == this.widgetEventPrefix ? type : this.widgetEventPrefix + type);
			event = $.Event(event);
			event.type = eventName;
			if (event.originalEvent) {
				for (var i = $.event.props.length, prop; i; ) {
					prop = $.event.props[--i];
					event[prop] = event.originalEvent[prop];
				}
			}
			this.element.trigger(event, data);
			return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false || event.isDefaultPrevented());
		}
	};
	$.widget.defaults = {
		disabled: false
	};
	$.ui.mouse = {
		_mouseInit: function() {
			var self = this;
			this.element.bind('mousedown.' + this.widgetName, function(event) {
				return self._mouseDown(event);
			}).bind('click.' + this.widgetName, function(event) {
				if (self._preventClickEvent) {
					self._preventClickEvent = false;
					event.stopImmediatePropagation();
					return false;
				}
			});
			if ($.browser.msie) {
				this._mouseUnselectable = this.element.attr('unselectable');
				this.element.attr('unselectable', 'on');
			}
			this.started = false;
		},
		_mouseDestroy: function() {
			this.element.unbind('.' + this.widgetName);
			($.browser.msie && this.element.attr('unselectable', this._mouseUnselectable));
		},
		_mouseDown: function(event) {
			event.originalEvent = event.originalEvent || {};
			if (event.originalEvent.mouseHandled) {
				return;
			} (this._mouseStarted && this._mouseUp(event));
			this._mouseDownEvent = event;
			var self = this,
                btnIsLeft = (event.which == 1),
                elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
			if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
				return true;
			}
			this.mouseDelayMet = !this.options.delay;
			if (!this.mouseDelayMet) {
				this._mouseDelayTimer = setTimeout(function() {
					self.mouseDelayMet = true;
				}, this.options.delay);
			}
			if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
				this._mouseStarted = (this._mouseStart(event) !== false);
				if (!this._mouseStarted) {
					event.preventDefault();
					return true;
				}
			}
			this._mouseMoveDelegate = function(event) {
				return self._mouseMove(event);
			};
			this._mouseUpDelegate = function(event) {
				return self._mouseUp(event);
			};
			$(document).bind('mousemove.' + this.widgetName, this._mouseMoveDelegate).bind('mouseup.' + this.widgetName, this._mouseUpDelegate);
			($.browser.safari || event.preventDefault());
			event.originalEvent.mouseHandled = true;
			return true;
		},
		_mouseMove: function(event) {
			if ($.browser.msie && !event.button) {
				return this._mouseUp(event);
			}
			if (this._mouseStarted) {
				this._mouseDrag(event);
				return event.preventDefault();
			}
			if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
				this._mouseStarted = (this._mouseStart(this._mouseDownEvent, event) !== false);
				(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
			}
			return !this._mouseStarted;
		},
		_mouseUp: function(event) {
			$(document).unbind('mousemove.' + this.widgetName, this._mouseMoveDelegate).unbind('mouseup.' + this.widgetName, this._mouseUpDelegate);
			if (this._mouseStarted) {
				this._mouseStarted = false;
				this._preventClickEvent = (event.target == this._mouseDownEvent.target);
				this._mouseStop(event);
			}
			return false;
		},
		_mouseDistanceMet: function(event) {
			return (Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance);
		},
		_mouseDelayMet: function(event) {
			return this.mouseDelayMet;
		},
		_mouseStart: function(event) { },
		_mouseDrag: function(event) { },
		_mouseStop: function(event) { },
		_mouseCapture: function(event) {
			return true;
		}
	};
	$.ui.mouse.defaults = {
		cancel: null,
		distance: 1,
		delay: 0
	};
})(jQuery);
(function($) {
	$.widget("ui.tabs", {
		_init: function() {
			this._tabify(true);
		},
		_setData: function(key, value) {
			if ((/^selected/).test(key)) {
				this.select(value);
			} else {
				this.options[key] = value;
				this._tabify();
			}
		},
		length: function() {
			return this.$tabs.length;
		},
		_tabId: function(a) {
			return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || this.options.idPrefix + $.data(a);
		},
		ui: function(tab, panel) {
			return {
				options: this.options,
				tab: tab,
				panel: panel,
				index: this.$tabs.index(tab)
			};
		},
		_sanitizeSelector: function(hash) {
			return hash.replace(/:/g, '\\:');
		},
		_cookie: function() {
			var cookie = this.cookie || (this.cookie = 'ui-tabs-' + $.data(this.element[0]));
			return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
		},
		_tabify: function(init) {
			this.$lis = $('li:has(a[href])', this.element);
			this.$tabs = this.$lis.map(function() {
				return $('a', this)[0];
			});
			this.$panels = $([]);
			var self = this,
                o = this.options;
			this.$tabs.each(function(i, a) {
				if (a.hash && a.hash.replace('#', '')) {
					self.$panels = self.$panels.add(self._sanitizeSelector(a.hash));
				} else if ($(a).attr('href') != '#') {
					$.data(a, 'href.tabs', a.href);
					$.data(a, 'load.tabs', a.href);
					var id = self._tabId(a);
					a.href = '#' + id;
					var $panel = $('#' + id);
					if (!$panel.length) {
						$panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass).insertAfter(self.$panels[i - 1] || self.element);
						$panel.data('destroy.tabs', true);
					}
					self.$panels = self.$panels.add($panel);
				} else {
					o.disabled.push(i + 1)
				};
			});
			if (init) {
				this.element.addClass(o.navClass);
				this.$panels.addClass(o.panelClass);
				if (o.selected === undefined) {
					if (location.hash) {
						this.$tabs.each(function(i, a) {
							if (a.hash == location.hash) {
								o.selected = i;
								return false;
							}
						});
					} else if (o.cookie) {
						var index = parseInt(self._cookie(), 10);
						if (index && self.$tabs[index]) {
							o.selected = index;
						}
					} else if (self.$lis.filter('.' + o.selectedClass).length) {
						o.selected = self.$lis.index(self.$lis.filter('.' + o.selectedClass)[0]);
					}
				}
				o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0;
				o.disabled = $.unique(o.disabled.concat($.map(this.$lis.filter('.' + o.disabledClass), function(n, i) {
					return self.$lis.index(n);
				}))).sort();
				if ($.inArray(o.selected, o.disabled) != -1) o.disabled.splice($.inArray(o.selected, o.disabled), 1);
				this.$panels.addClass(o.hideClass);
				this.$lis.removeClass(o.selectedClass);
				if (o.selected !== null) {
					this.$panels.eq(o.selected).removeClass(o.hideClass);
					var classes = [o.selectedClass];
					if (o.deselectable) classes.push(o.deselectableClass);
					this.$lis.eq(o.selected).addClass(classes.join(' '));
					var onShow = function() {
						self._trigger('show', null, self.ui(self.$tabs[o.selected], self.$panels[o.selected]));
					};
					if ($.data(this.$tabs[o.selected], 'load.tabs')) {
						this.load(o.selected, onShow);
					} else onShow();
				}
				$(window).bind('unload', function() {
					self.$tabs.unbind('.tabs');
					self.$lis = self.$tabs = self.$panels = null;
				});
			} else o.selected = this.$lis.index(this.$lis.filter('.' + o.selectedClass)[0]);
			if (o.cookie) {
				this._cookie(o.selected, o.cookie);
			}
			for (var i = 0, li; li = this.$lis[i]; i++) $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
			if (o.cache === false) {
				this.$tabs.removeData('cache.tabs');
			}
			var hideFx, showFx;
			if (o.fx) {
				if (o.fx.constructor == Array) {
					hideFx = o.fx[0];
					showFx = o.fx[1];
				} else {
					hideFx = showFx = o.fx;
				}
			}
			function resetStyle($el, fx) {
				$el.css({
					display: ''
				});
				if ($.browser.msie && fx.opacity) {
					$el[0].style.removeAttribute('filter');
				}
			}
			var showTab = showFx ?
            function(clicked, $show) {
            	$show.animate(showFx, showFx.duration || 'normal', function() {
            		$show.removeClass(o.hideClass);
            		resetStyle($show, showFx);
            		self._trigger('show', null, self.ui(clicked, $show[0]));
            	});
            } : function(clicked, $show) {
            	$show.removeClass(o.hideClass);
            	self._trigger('show', null, self.ui(clicked, $show[0]));
            };
			var hideTab = hideFx ?
            function(clicked, $hide, $show) {
            	$hide.animate(hideFx, hideFx.duration || 'normal', function() {
            		$hide.addClass(o.hideClass);
            		resetStyle($hide, hideFx);
            		if ($show) {
            			showTab(clicked, $show, $hide);
            		}
            	});
            } : function(clicked, $hide, $show) {
            	$hide.addClass(o.hideClass);
            	if ($show) {
            		showTab(clicked, $show);
            	}
            };

			function switchTab(clicked, $li, $hide, $show) {
				var classes = [o.selectedClass];
				if (o.deselectable) {
					classes.push(o.deselectableClass);
				}
				$li.addClass(classes.join(' ')).siblings().removeClass(classes.join(' '));
				hideTab(clicked, $hide, $show);
			}
			this.$tabs.unbind('.tabs').bind(o.event + '.tabs', function() {
				var $li = $(this).parents('li:eq(0)'),
                    $hide = self.$panels.filter(':visible'),
                    $show = $(self._sanitizeSelector(this.hash));
				if (($li.hasClass(o.selectedClass) && !o.deselectable) || $li.hasClass(o.disabledClass) || $(this).hasClass(o.loadingClass) || self._trigger('select', null, self.ui(this, $show[0])) === false) {
					this.blur();
					return false;
				}
				o.selected = self.$tabs.index(this);
				if (o.deselectable) {
					if ($li.hasClass(o.selectedClass)) {
						self.options.selected = null;
						$li.removeClass([o.selectedClass, o.deselectableClass].join(' '));
						self.$panels.stop();
						hideTab(this, $hide);
						this.blur();
						return false;
					} else if (!$hide.length) {
						self.$panels.stop();
						var a = this;
						self.load(self.$tabs.index(this), function() {
							$li.addClass([o.selectedClass, o.deselectableClass].join(' '));
							showTab(a, $show);
						});
						this.blur();
						return false;
					}
				}
				if (o.cookie) {
					self._cookie(o.selected, o.cookie);
				}
				self.$panels.stop();
				if ($show.length) {
					var a = this;
					self.load(self.$tabs.index(this), $hide.length ?
                    function() {
                    	switchTab(a, $li, $hide, $show);
                    } : function() {
                    	$li.addClass(o.selectedClass);
                    	showTab(a, $show);
                    });
				} else {
					throw 'jQuery UI Tabs: Mismatching fragment identifier.';
				}
				if ($.browser.msie) {
					this.blur();
				}
				return false;
			});
			if (o.event != 'click') {
				this.$tabs.bind('click.tabs', function() {
					return false;
				});
			}
		},
		add: function(url, label, index) {
			if (index == undefined) {
				index = this.$tabs.length;
			}
			var o = this.options;
			var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
			$li.data('destroy.tabs', true);
			var id = url.indexOf('#') == 0 ? url.replace('#', '') : this._tabId($('a:first-child', $li)[0]);
			var $panel = $('#' + id);
			if (!$panel.length) {
				$panel = $(o.panelTemplate).attr('id', id).addClass(o.hideClass).data('destroy.tabs', true);
			}
			$panel.addClass(o.panelClass);
			if (index >= this.$lis.length) {
				$li.appendTo(this.element);
				$panel.appendTo(this.element[0].parentNode);
			} else {
				$li.insertBefore(this.$lis[index]);
				$panel.insertBefore(this.$panels[index]);
			}
			o.disabled = $.map(o.disabled, function(n, i) {
				return n >= index ? ++n : n
			});
			this._tabify();
			if (this.$tabs.length == 1) {
				$li.addClass(o.selectedClass);
				$panel.removeClass(o.hideClass);
				var href = $.data(this.$tabs[0], 'load.tabs');
				if (href) {
					this.load(index, href);
				}
			}
			this._trigger('add', null, this.ui(this.$tabs[index], this.$panels[index]));
		},
		remove: function(index) {
			var o = this.options,
                $li = this.$lis.eq(index).remove(),
                $panel = this.$panels.eq(index).remove();
			if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1) {
				this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
			}
			o.disabled = $.map($.grep(o.disabled, function(n, i) {
				return n != index;
			}), function(n, i) {
				return n >= index ? --n : n
			});
			this._tabify();
			this._trigger('remove', null, this.ui($li.find('a')[0], $panel[0]));
		},
		enable: function(index) {
			var o = this.options;
			if ($.inArray(index, o.disabled) == -1) {
				return;
			}
			var $li = this.$lis.eq(index).removeClass(o.disabledClass);
			if ($.browser.safari) {
				$li.css('display', 'inline-block');
				setTimeout(function() {
					$li.css('display', 'block');
				}, 0);
			}
			o.disabled = $.grep(o.disabled, function(n, i) {
				return n != index;
			});
			this._trigger('enable', null, this.ui(this.$tabs[index], this.$panels[index]));
		},
		disable: function(index) {
			var self = this,
                o = this.options;
			if (index != o.selected) {
				this.$lis.eq(index).addClass(o.disabledClass);
				o.disabled.push(index);
				o.disabled.sort();
				this._trigger('disable', null, this.ui(this.$tabs[index], this.$panels[index]));
			}
		},
		select: function(index) {
			if (typeof index == 'string') {
				index = this.$tabs.index(this.$tabs.filter('[href$=' + index + ']')[0]);
			}
			this.$tabs.eq(index).trigger(this.options.event + '.tabs');
		},
		load: function(index, callback) {
			var self = this,
                o = this.options,
                $a = this.$tabs.eq(index),
                a = $a[0],
                bypassCache = callback == undefined || callback === false,
                url = $a.data('load.tabs');
			callback = callback ||
            function() { };
			if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
				callback();
				return;
			}
			var inner = function(parent) {
				var $parent = $(parent),
                    $inner = $parent.find('*:last');
				return $inner.length && $inner.is(':not(img)') && $inner || $parent;
			};
			var cleanup = function() {
				self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass).each(function() {
					if (o.spinner) {
						inner(this).parent().html(inner(this).data('label.tabs'));
					}
				});
				self.xhr = null;
			};
			if (o.spinner) {
				var label = inner(a).html();
				inner(a).wrapInner('<em></em>').find('em').data('label.tabs', label).html(o.spinner);
			}
			var ajaxOptions = $.extend({}, o.ajaxOptions, {
				url: url,
				success: function(r, s) {
					$(self._sanitizeSelector(a.hash)).html(r);
					cleanup();
					if (o.cache) {
						$.data(a, 'cache.tabs', true);
					}
					self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index]));
					try {
						o.ajaxOptions.success(r, s);
					} catch (e) { }
					callback();
				}
			});
			if (this.xhr) {
				this.xhr.abort();
				cleanup();
			}
			$a.addClass(o.loadingClass);
			self.xhr = $.ajax(ajaxOptions);
		},
		url: function(index, url) {
			this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url);
		},
		destroy: function() {
			var o = this.options;
			this.element.unbind('.tabs').removeClass(o.navClass).removeData('tabs');
			this.$tabs.each(function() {
				var href = $.data(this, 'href.tabs');
				if (href) {
					this.href = href;
				}
				var $this = $(this).unbind('.tabs');
				$.each(['href', 'load', 'cache'], function(i, prefix) {
					$this.removeData(prefix + '.tabs');
				});
			});
			this.$lis.add(this.$panels).each(function() {
				if ($.data(this, 'destroy.tabs')) {
					$(this).remove();
				} else {
					$(this).removeClass([o.selectedClass, o.deselectableClass, o.disabledClass, o.panelClass, o.hideClass].join(' '));
				}
			});
			if (o.cookie) {
				this._cookie(null, o.cookie);
			}
		}
	});
	$.extend($.ui.tabs, {
		version: '@VERSION',
		getter: 'length',
		defaults: {
			deselectable: false,
			event: 'click',
			disabled: [],
			cookie: null,
			spinner: 'Loading&#8230;',
			cache: false,
			idPrefix: 'ui-tabs-',
			ajaxOptions: null,
			fx: null,
			tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',
			panelTemplate: '<div></div>',
			navClass: 'ui-tabs-nav',
			selectedClass: 'ui-tabs-selected',
			deselectableClass: 'ui-tabs-deselectable',
			disabledClass: 'ui-tabs-disabled',
			panelClass: 'ui-tabs-panel',
			hideClass: 'ui-tabs-hide',
			loadingClass: 'ui-tabs-loading'
		}
	});
	$.extend($.ui.tabs.prototype, {
		rotation: null,
		rotate: function(ms, continuing) {
			continuing = continuing || false;
			var self = this,
                t = this.options.selected;

			function start() {
				self.rotation = setInterval(function() {
					t = ++t < self.$tabs.length ? t : 0;
					self.select(t);
				}, ms);
			}
			function stop(e) {
				if (!e || e.clientX) {
					clearInterval(self.rotation);
				}
			}
			if (ms) {
				start();
				if (!continuing) {
					this.$tabs.bind(this.options.event + '.tabs', stop);
				} else {
					this.$tabs.bind(this.options.event + '.tabs', function() {
						stop();
						t = self.options.selected;
						start();
					});
				}
			} else {
				stop();
				this.$tabs.unbind(this.options.event + '.tabs', stop);
			}
		}
	});
})(jQuery);
eval(function(p, a, c, k, e, r) {
	e = function(c) {
		return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
	};
	if (!''.replace(/^/, String)) {
		while (c--) r[e(c)] = k[c] || e(c);
		k = [function(e) {
			return r[e]
		} ];
		e = function() {
			return '\\w+'
		};
		c = 1
	};
	while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
	return p
} ('(9($){$.1v.C=9(o){z 4.1b(9(){3p r(4,o)})};8 q={Z:F,25:1,21:1,u:7,1c:3,15:7,1K:\'2X\',2c:\'2Q\',1q:0,B:7,1j:7,1G:7,2F:7,2B:7,2z:7,2x:7,2v:7,2s:7,2p:7,1S:\'<P></P>\',1Q:\'<P></P>\',2m:\'2l\',2k:\'2l\',1O:7,1L:7};$.C=9(e,o){4.5=$.16({},q,o||{});4.Q=F;4.D=7;4.H=7;4.t=7;4.U=7;4.R=7;4.N=!4.5.Z?\'1H\':\'26\';4.E=!4.5.Z?\'24\':\'23\';8 a=\'\',1e=e.K.1e(\' \');1r(8 i=0;i<1e.I;i++){6(1e[i].2y(\'C-2w\')!=-1){$(e).1E(1e[i]);8 a=1e[i];1p}}6(e.2t==\'3o\'||e.2t==\'3n\'){4.t=$(e);4.D=4.t.19();6(4.D.1o(\'C-H\')){6(!4.D.19().1o(\'C-D\'))4.D=4.D.B(\'<P></P>\');4.D=4.D.19()}10 6(!4.D.1o(\'C-D\'))4.D=4.t.B(\'<P></P>\').19()}10{4.D=$(e);4.t=$(e).3h(\'>2o,>2n,P>2o,P>2n\')}6(a!=\'\'&&4.D.19()[0].K.2y(\'C-2w\')==-1)4.D.B(\'<P 3g=" \'+a+\'"></P>\');4.H=4.t.19();6(!4.H.I||!4.H.1o(\'C-H\'))4.H=4.t.B(\'<P></P>\').19();4.R=$(\'.C-11\',4.D);6(4.R.u()==0&&4.5.1Q!=7)4.R=4.H.1z(4.5.1Q).11();4.R.V(4.K(\'C-11\'));4.U=$(\'.C-17\',4.D);6(4.U.u()==0&&4.5.1S!=7)4.U=4.H.1z(4.5.1S).11();4.U.V(4.K(\'C-17\'));4.H.V(4.K(\'C-H\'));4.t.V(4.K(\'C-t\'));4.D.V(4.K(\'C-D\'));8 b=4.5.15!=7?1k.1P(4.1m()/4.5.15):7;8 c=4.t.32(\'1F\');8 d=4;6(c.u()>0){8 f=0,i=4.5.21;c.1b(9(){d.1I(4,i++);f+=d.S(4,b)});4.t.y(4.N,f+\'T\');6(!o||o.u===J)4.5.u=c.u()}4.D.y(\'1y\',\'1A\');4.U.y(\'1y\',\'1A\');4.R.y(\'1y\',\'1A\');4.2G=9(){d.17()};4.2b=9(){d.11()};4.1U=9(){d.2q()};6(4.5.1j!=7)4.5.1j(4,\'2a\');6($.2A.28){4.1f(F,F);$(27).1u(\'2I\',9(){d.1t()})}10 4.1t()};8 r=$.C;r.1v=r.2H={C:\'0.2.3\'};r.1v.16=r.16=$.16;r.1v.16({1t:9(){4.A=7;4.G=7;4.X=7;4.13=7;4.14=F;4.1d=7;4.O=7;4.W=F;6(4.Q)z;4.t.y(4.E,4.1s(4.5.21)+\'T\');8 p=4.1s(4.5.25);4.X=4.13=7;4.1i(p,F);$(27).22(\'2E\',4.1U).1u(\'2E\',4.1U)},2D:9(){4.t.2C();4.t.y(4.E,\'3u\');4.t.y(4.N,\'3t\');6(4.5.1j!=7)4.5.1j(4,\'2D\');4.1t()},2q:9(){6(4.O!=7&&4.W)4.t.y(4.E,r.M(4.t.y(4.E))+4.O);4.O=7;4.W=F;6(4.5.1G!=7)4.5.1G(4);6(4.5.15!=7){8 a=4;8 b=1k.1P(4.1m()/4.5.15),N=0,E=0;$(\'1F\',4.t).1b(9(i){N+=a.S(4,b);6(i+1<a.A)E=N});4.t.y(4.N,N+\'T\');4.t.y(4.E,-E+\'T\')}4.1c(4.A,F)},3s:9(){4.Q=1h;4.1f()},3r:9(){4.Q=F;4.1f()},u:9(s){6(s!=J){4.5.u=s;6(!4.Q)4.1f()}z 4.5.u},3q:9(i,a){6(a==J||!a)a=i;6(4.5.u!==7&&a>4.5.u)a=4.5.u;1r(8 j=i;j<=a;j++){8 e=4.L(j);6(!e.I||e.1o(\'C-1a-1D\'))z F}z 1h},L:9(i){z $(\'.C-1a-\'+i,4.t)},2u:9(i,s){8 e=4.L(i),20=0,2u=0;6(e.I==0){8 c,e=4.1B(i),j=r.M(i);1n(c=4.L(--j)){6(j<=0||c.I){j<=0?4.t.2r(e):c.1X(e);1p}}}10 20=4.S(e);e.1E(4.K(\'C-1a-1D\'));1R s==\'3l\'?e.3k(s):e.2C().3j(s);8 a=4.5.15!=7?1k.1P(4.1m()/4.5.15):7;8 b=4.S(e,a)-20;6(i>0&&i<4.A)4.t.y(4.E,r.M(4.t.y(4.E))-b+\'T\');4.t.y(4.N,r.M(4.t.y(4.N))+b+\'T\');z e},1V:9(i){8 e=4.L(i);6(!e.I||(i>=4.A&&i<=4.G))z;8 d=4.S(e);6(i<4.A)4.t.y(4.E,r.M(4.t.y(4.E))+d+\'T\');e.1V();4.t.y(4.N,r.M(4.t.y(4.N))-d+\'T\')},17:9(){4.1C();6(4.O!=7&&!4.W)4.1T(F);10 4.1c(((4.5.B==\'1Z\'||4.5.B==\'G\')&&4.5.u!=7&&4.G==4.5.u)?1:4.A+4.5.1c)},11:9(){4.1C();6(4.O!=7&&4.W)4.1T(1h);10 4.1c(((4.5.B==\'1Z\'||4.5.B==\'A\')&&4.5.u!=7&&4.A==1)?4.5.u:4.A-4.5.1c)},1T:9(b){6(4.Q||4.14||!4.O)z;8 a=r.M(4.t.y(4.E));!b?a-=4.O:a+=4.O;4.W=!b;4.X=4.A;4.13=4.G;4.1i(a)},1c:9(i,a){6(4.Q||4.14)z;4.1i(4.1s(i),a)},1s:9(i){6(4.Q||4.14)z;6(4.5.B!=\'18\')i=i<1?1:(4.5.u&&i>4.5.u?4.5.u:i);8 a=4.A>i;8 b=r.M(4.t.y(4.E));8 f=4.5.B!=\'18\'&&4.A<=1?1:4.A;8 c=a?4.L(f):4.L(4.G);8 j=a?f:f-1;8 e=7,l=0,p=F,d=0;1n(a?--j>=i:++j<i){e=4.L(j);p=!e.I;6(e.I==0){e=4.1B(j).V(4.K(\'C-1a-1D\'));c[a?\'1z\':\'1X\'](e)}c=e;d=4.S(e);6(p)l+=d;6(4.A!=7&&(4.5.B==\'18\'||(j>=1&&(4.5.u==7||j<=4.5.u))))b=a?b+d:b-d}8 g=4.1m();8 h=[];8 k=0,j=i,v=0;8 c=4.L(i-1);1n(++k){e=4.L(j);p=!e.I;6(e.I==0){e=4.1B(j).V(4.K(\'C-1a-1D\'));c.I==0?4.t.2r(e):c[a?\'1z\':\'1X\'](e)}c=e;8 d=4.S(e);6(d==0){3f(\'3e: 3d 1H/26 3c 1r 3b. 3a 39 38 37 36 35. 34...\');z 0}6(4.5.B!=\'18\'&&4.5.u!==7&&j>4.5.u)h.33(e);10 6(p)l+=d;v+=d;6(v>=g)1p;j++}1r(8 x=0;x<h.I;x++)h[x].1V();6(l>0){4.t.y(4.N,4.S(4.t)+l+\'T\');6(a){b-=l;4.t.y(4.E,r.M(4.t.y(4.E))-l+\'T\')}}8 n=i+k-1;6(4.5.B!=\'18\'&&4.5.u&&n>4.5.u)n=4.5.u;6(j>n){k=0,j=n,v=0;1n(++k){8 e=4.L(j--);6(!e.I)1p;v+=4.S(e);6(v>=g)1p}}8 o=n-k+1;6(4.5.B!=\'18\'&&o<1)o=1;6(4.W&&a){b+=4.O;4.W=F}4.O=7;6(4.5.B!=\'18\'&&n==4.5.u&&(n-k+1)>=1){8 m=r.Y(4.L(n),!4.5.Z?\'1l\':\'1N\');6((v-m)>g)4.O=v-g-m}1n(i-->o)b+=4.S(4.L(i));4.X=4.A;4.13=4.G;4.A=o;4.G=n;z b},1i:9(p,a){6(4.Q||4.14)z;4.14=1h;8 b=4;8 c=9(){b.14=F;6(p==0)b.t.y(b.E,0);6(b.5.B==\'1Z\'||b.5.B==\'G\'||b.5.u==7||b.G<b.5.u)b.2j();b.1f();b.1M(\'2i\')};4.1M(\'31\');6(!4.5.1K||a==F){4.t.y(4.E,p+\'T\');c()}10{8 o=!4.5.Z?{\'24\':p}:{\'23\':p};4.t.1i(o,4.5.1K,4.5.2c,c)}},2j:9(s){6(s!=J)4.5.1q=s;6(4.5.1q==0)z 4.1C();6(4.1d!=7)z;8 a=4;4.1d=30(9(){a.17()},4.5.1q*2Z)},1C:9(){6(4.1d==7)z;2Y(4.1d);4.1d=7},1f:9(n,p){6(n==J||n==7){8 n=!4.Q&&4.5.u!==0&&((4.5.B&&4.5.B!=\'A\')||4.5.u==7||4.G<4.5.u);6(!4.Q&&(!4.5.B||4.5.B==\'A\')&&4.5.u!=7&&4.G>=4.5.u)n=4.O!=7&&!4.W}6(p==J||p==7){8 p=!4.Q&&4.5.u!==0&&((4.5.B&&4.5.B!=\'G\')||4.A>1);6(!4.Q&&(!4.5.B||4.5.B==\'G\')&&4.5.u!=7&&4.A==1)p=4.O!=7&&4.W}8 a=4;4.U[n?\'1u\':\'22\'](4.5.2m,4.2G)[n?\'1E\':\'V\'](4.K(\'C-17-1w\')).1J(\'1w\',n?F:1h);4.R[p?\'1u\':\'22\'](4.5.2k,4.2b)[p?\'1E\':\'V\'](4.K(\'C-11-1w\')).1J(\'1w\',p?F:1h);6(4.U.I>0&&(4.U[0].1g==J||4.U[0].1g!=n)&&4.5.1O!=7){4.U.1b(9(){a.5.1O(a,4,n)});4.U[0].1g=n}6(4.R.I>0&&(4.R[0].1g==J||4.R[0].1g!=p)&&4.5.1L!=7){4.R.1b(9(){a.5.1L(a,4,p)});4.R[0].1g=p}},1M:9(a){8 b=4.X==7?\'2a\':(4.X<4.A?\'17\':\'11\');4.12(\'2F\',a,b);6(4.X!==4.A){4.12(\'2B\',a,b,4.A);4.12(\'2z\',a,b,4.X)}6(4.13!==4.G){4.12(\'2x\',a,b,4.G);4.12(\'2v\',a,b,4.13)}4.12(\'2s\',a,b,4.A,4.G,4.X,4.13);4.12(\'2p\',a,b,4.X,4.13,4.A,4.G)},12:9(a,b,c,d,e,f,g){6(4.5[a]==J||(1R 4.5[a]!=\'2h\'&&b!=\'2i\'))z;8 h=1R 4.5[a]==\'2h\'?4.5[a][b]:4.5[a];6(!$.2W(h))z;8 j=4;6(d===J)h(j,c,b);10 6(e===J)4.L(d).1b(9(){h(j,4,d,c,b)});10{1r(8 i=d;i<=e;i++)6(i!==7&&!(i>=f&&i<=g))4.L(i).1b(9(){h(j,4,i,c,b)})}},1B:9(i){z 4.1I(\'<1F></1F>\',i)},1I:9(e,i){8 a=$(e).V(4.K(\'C-1a\')).V(4.K(\'C-1a-\'+i));a.1J(\'2V\',i);z a},K:9(c){z c+\' \'+c+(!4.5.Z?\'-2U\':\'-Z\')},S:9(e,d){8 a=e.2g!=J?e[0]:e;8 b=!4.5.Z?a.1x+r.Y(a,\'2f\')+r.Y(a,\'1l\'):a.2e+r.Y(a,\'2d\')+r.Y(a,\'1N\');6(d==J||b==d)z b;8 w=!4.5.Z?d-r.Y(a,\'2f\')-r.Y(a,\'1l\'):d-r.Y(a,\'2d\')-r.Y(a,\'1N\');$(a).y(4.N,w+\'T\');z 4.S(a)},1m:9(){z!4.5.Z?4.H[0].1x-r.M(4.H.y(\'2T\'))-r.M(4.H.y(\'2S\')):4.H[0].2e-r.M(4.H.y(\'2R\'))-r.M(4.H.y(\'3i\'))},2P:9(i,s){6(s==J)s=4.5.u;z 1k.2O((((i-1)/s)-1k.2N((i-1)/s))*s)+1}});r.16({3m:9(d){z $.16(q,d||{})},Y:9(e,p){6(!e)z 0;8 a=e.2g!=J?e[0]:e;6(p==\'1l\'&&$.2A.28){8 b={\'1y\':\'1A\',\'2M\':\'2L\',\'1H\':\'1q\'},1Y,1W;$.29(a,b,9(){1Y=a.1x});b[\'1l\']=0;$.29(a,b,9(){1W=a.1x});z 1W-1Y}z r.M($.y(a,p))},M:9(v){v=2K(v);z 2J(v)?0:v}})})(3v);', 62, 218, '||||this|options|if|null|var|function||||||||||||||||||||list|size||||css|return|first|wrap|jcarousel|container|lt|false|last|clip|length|undefined|className|get|intval|wh|tail|div|locked|buttonPrev|dimension|px|buttonNext|addClass|inTail|prevFirst|margin|vertical|else|prev|callback|prevLast|animating|visible|extend|next|circular|parent|item|each|scroll|timer|split|buttons|jcarouselstate|true|animate|initCallback|Math|marginRight|clipping|while|hasClass|break|auto|for|pos|setup|bind|fn|disabled|offsetWidth|display|before|block|create|stopAuto|placeholder|removeClass|li|reloadCallback|width|format|attr|animation|buttonPrevCallback|notify|marginBottom|buttonNextCallback|ceil|buttonPrevHTML|typeof|buttonNextHTML|scrollTail|funcResize|remove|oWidth2|after|oWidth|both|old|offset|unbind|top|left|start|height|window|safari|swap|init|funcPrev|easing|marginTop|offsetHeight|marginLeft|jquery|object|onAfterAnimation|startAuto|buttonPrevEvent|click|buttonNextEvent|ol|ul|itemVisibleOutCallback|reload|prepend|itemVisibleInCallback|nodeName|add|itemLastOutCallback|skin|itemLastInCallback|indexOf|itemFirstOutCallback|browser|itemFirstInCallback|empty|reset|resize|itemLoadCallback|funcNext|prototype|load|isNaN|parseInt|none|float|floor|round|index|swing|borderTopWidth|borderRightWidth|borderLeftWidth|horizontal|jcarouselindex|isFunction|normal|clearTimeout|1000|setTimeout|onBeforeAnimation|children|push|Aborting|loop|infinite|an|cause|will|This|items|set|No|jCarousel|alert|class|find|borderBottomWidth|append|html|string|defaults|OL|UL|new|has|unlock|lock|10px|0px|jQuery'.split('|'), 0, {}));
(function($) {
	var map = new Array();
	$.Watermark = {
		ShowAll: function() {
			for (var i = 0; i < map.length; i++) {
				if (map[i].obj.val() == "") {
					map[i].obj.val(map[i].text);
					map[i].obj.css("color", map[i].WatermarkColor);
				} else {
					map[i].obj.css("color", map[i].DefaultColor);
				}
			}
		},
		HideAll: function() {
			for (var i = 0; i < map.length; i++) {
				if (map[i].obj.val() == map[i].text) {
					map[i].obj.val("");
				}
			}
		}
	};
	$.fn.Watermark = function(text, color) {
		if (!color) color = "#aaa";
		return this.each(function() {
			var input = $(this);
			var defaultColor = input.css("color");
			map[map.length] = {
				text: text,
				obj: input,
				DefaultColor: defaultColor,
				WatermarkColor: color
			};

			function clearMessage() {
				if (input.val() == text) {
					input.val("");
				}
				input.css("color", defaultColor);
			}
			function insertMessage() {
				if (input.val().length == 0 || input.val() == text) {
					input.val(text);
					input.css("color", color);
				} else {
					input.css("color", defaultColor);
				}
			}
			input.focus(clearMessage);
			input.blur(insertMessage);
			input.change(insertMessage);
			insertMessage();
		});
	};
})(jQuery);