document.write("<script type=\"text/javascript\" src=\"/webmanage_custom/public_panel/includes/javascript/common.js\"></script>");

$(document).ready(function(){
	$('div.photo-gallery').gallery({
		duration: 500,
		listOfSlides: '.tab-content',
		effect:true,
		switcher: '.tabset a'
	});
	$('div.main-gallery').gallery({
		duration: 500,
		listOfSlides: '.gallery .holder li',
		nextBtn: '.gallery a.link-next',
		prevBtn: '.gallery a.link-prev',
		switcher: '.gallery-inner .holder li'
	});
	$('div.main-gallery').gallery({
		duration: 500,
		listOfSlides: '.gallery-inner .holder li',
		nextBtn: '.gallery-inner a.link-next',
		prevBtn: '.gallery-inner a.link-prev'
	});
	$('select').customSelect();
	$('input:radio').customRadio();
	$('input:checkbox').customCheckbox();
	createMap();
	$('.lightbox-opener').simplebox();
	clearForms();
	initOpenClose();
	initValidation();

});
function initValidation(){
	var _errorClass = 'error';
	var _regEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var _regEmails = /^([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4})+([, ]+[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4})*$/;
	var _regUrl = /^(((ht|f){1}(tp:[/][/]){1})|((www.){1}))[-a-zA-Z0-9@:%_\+.~#?&//=]+$/;
	var _regPhone = /^[0-9\-\ \()]+$/;
	var _regNum = /^[0-9]+$/;
	var _regDay = /^(([0]{1}[1-9]{1})|([1-9]{1})|([1-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))$/;
	var _regMon = /^(([0]{1}[1-9]{1})|([1-9]{1})|([1]{1}[0-2]{1}))$/;
	var _regYear = /^[19]{2}[0-9]{2}$/;
	
	$('form.content-form,form.voucher-form,form.member').each(function(){
		var _form = $(this);
		function checkFields() {
			
			var _flag = false;
			_form.find('.'+_errorClass).removeClass(_errorClass);

			// fields validation
			_form.find('input.required-email').each(function(){
				if(!_regEmail.test($(this).val())) addError($(this));
			});
			_form.find('input.required-day').each(function(){
				if(!_regDay.test($(this).val())) addError($(this));
			});
			_form.find('input.required-mon').each(function(){
				if(!_regMon.test($(this).val())) addError($(this));
			});
			_form.find('input.required-year').each(function(){
				if(!_regYear.test($(this).val())) addError($(this));
			});
			_form.find('textarea.required-many-emails').each(function(){
				if(!_regEmails.test($(this).val())) addError($(this));
			});
			_form.find('input.required-phone').each(function(){
				if(!_regPhone.test($(this).val())) addError($(this));
			});
			_form.find('input.required-num').each(function(){
				if(!_regNum.test($(this).val())) addError($(this));
			});
			_form.find('input.required, textarea.required').each(function(){
				if(!$(this).val().length || $(this).val() == $(this).attr('alt')) addError($(this));
			});
			_form.find('select.required').each(function(){
				if(!$(this).val().length) addError($(this));
			});

			_form.find('input.required-chek').each(function(){
				if (!$(this).is(':checked')) {
					$(this).parent('span').addClass('error-chk');
					_flag=true;
				}
			});
			_form.find('div.required-radio').each(function(){
				var _test = false;
				$(this).find('input[type=radio]').each(function(){
					if ($(this).is(':checked')) _test = true;
				});
				if (!_test) {
					_flag=true;
				}
			});

			// error class adding
			function addError(_obj) {
				_obj.parents('div.row').addClass(_errorClass);
				_flag=true;
			}
			return _flag;
		}

		// catch form submit event
		_form.submit(function(){
			if(checkFields()) {
				return false;
			}
			else {
				_form.find('.submit').hide();
				_form.find('.processing').show();
			}
		});
	});
}
function initOpenClose(){
	var holder = jQuery('.slide-block');
	var _duration = 500;
	var openClass = 'opened';
	holder.each(function(){
		var _this = jQuery(this);
		var opener = _this.find('.open-close');
		var slide = _this.find('.block');
		var slideHeight = slide.height();
		slide.height(slideHeight);
		opener.click(function(){
			if (!_this.hasClass(openClass)) {
				_this.addClass(openClass);
				slide.animate({
					height: slideHeight
				},{
					queue:false,
					duration: _duration
				});
			} else {
				_this.removeClass(openClass);
				slide.animate({
					height: 0
				},{
					queue:false,
					duration: _duration
				});
			}
			return false;
		});
	});
}
Array.prototype.findIndex = function(value){
	var ctr = "";
	for (var i=0; i < this.length; i++) {
		if (this[i] == value) {
			return i;
		}
	}
	return ctr;
};
function createMap() {
	var states = ['', 'WA', 'NT', 'QLD', 'SA', 'NSW&ACT', 'VIC', 'TAS'];
	$('.location-box').each(function(){
		var mapHolder = $(this);
		var activeClass = 'activestate';
		var clickClass = 'clickstate';
		var select = mapHolder.find('select');
		var map = mapHolder.find('area');
		var lists = mapHolder.find('ul>li');
		select.change(function(){
			lists.removeClass(clickClass);
			var idx = states.findIndex($(this).val());
			$('#area' + idx).addClass(clickClass);
		});
		map.mouseenter(function(){
			$('#'+$(this).attr('alt')).addClass(activeClass);
		}).mouseleave(function(){
			$('#'+$(this).attr('alt')).removeClass(activeClass);
		});
		map.click(function(){
			lists.removeClass(clickClass);
			$('#'+$(this).attr('alt')).addClass(clickClass);
			var idx = $(this).attr('alt').substring(4,5);
			//select.find('option[title="'+$(this).attr('alt')+'"]').attr('selected', 'selected');
			select.val(states[idx]);
			select.change();
			$(".map-form #store-suburb").val('');
			$(".map-form").submit();
			return false;
		});
	});
}



// custom selects module
jQuery.fn.customSelect = function(_options) {
var _options = jQuery.extend({
	selectStructure: '<div class="selectArea"><span class="left"></span><span class="center"></span><a href="#" class="selectButton"></a><div class="disabled"></div></div>',
	hideOnMouseOut: false,
	copyClass: true,
	selectText: '.center',
	selectBtn: '.selectButton',
	selectDisabled: '.disabled',
	optStructure: '<div class="optionsDivVisible"><ul></ul></div>',
	optList: 'ul'
}, _options);
return this.each(function() {
	var select = jQuery(this);
	if(!select.hasClass('outtaHere')) {
		if(select.is(':visible')) {
			var hideOnMouseOut = _options.hideOnMouseOut;
			var copyClass = _options.copyClass;
			var replaced = jQuery(_options.selectStructure);
			var selectText = replaced.find(_options.selectText);
			var selectBtn = replaced.find(_options.selectBtn);
			var selectDisabled = replaced.find(_options.selectDisabled).hide();
			var optHolder = jQuery(_options.optStructure);
			var optList = optHolder.find(_options.optList);
			if(copyClass) optHolder.addClass('drop-'+select.attr('class'));

			if(select.attr('disabled')) selectDisabled.show();
			select.find('option').each(function(){
				var selOpt = $(this);
				var _opt = jQuery('<li><a href="#">' + selOpt.html() + '</a></li>');
				if(selOpt.attr('selected')) {
					selectText.html(selOpt.html());
					_opt.addClass('selected');
				}
				_opt.children('a').click(function() {
					optList.find('li').removeClass('selected');
					select.find('option').removeAttr('selected');
					$(this).parent().addClass('selected');
					selOpt.attr('selected', 'selected');
					
					select.change();
					optHolder.hide();
					return false;
				});
				optList.append(_opt);
			});
			select.change(function(){
				selectText.html($(this).find('option:selected').html());
			});
			replaced.width(select.outerWidth());
			replaced.insertBefore(select);
			optHolder.css({
				width: select.outerWidth(),
				display: 'none',
				position: 'absolute'
			});
			jQuery(document.body).append(optHolder);

			var optTimer;
			replaced.hover(function() {
				if(optTimer) clearTimeout(optTimer);
			}, function() {
				if(hideOnMouseOut) {
					optTimer = setTimeout(function() {
						optHolder.hide();
					}, 200);
				}
			});
			optHolder.hover(function(){
				if(optTimer) clearTimeout(optTimer);
			}, function() {
				if(hideOnMouseOut) {
					optTimer = setTimeout(function() {
						optHolder.hide();
					}, 200);
				}
			});
			selectBtn.click(function() {
				if(optHolder.is(':visible')) {
					optHolder.hide();
				}
				else{
					optHolder.children('ul').css({height:'auto', overflow:'hidden'});
					optHolder.css({
						top: replaced.offset().top + replaced.outerHeight(),
						left: replaced.offset().left,
						display: 'block'
					});
					if(optHolder.children('ul').height() > 200) optHolder.children('ul').css({height:200, overflow:'auto'});
				}
				return false;
			});
			select.addClass('outtaHere');
		}
	}
});
}

// custom radios module
jQuery.fn.customRadio = function(_options){
	var _options = jQuery.extend({
		radioStructure: '<div></div>',
		radioDisabled: 'disabled',
		radioDefault: 'radioArea',
		radioChecked: 'radioAreaChecked'
	}, _options);
	return this.each(function(){
		var radio = jQuery(this);
		if(!radio.hasClass('outtaHere') && radio.is(':radio')){
			var replaced = jQuery(_options.radioStructure);
			this._replaced = replaced;
			if(radio.is(':disabled')) replaced.addClass(_options.radioDisabled);
			else if(radio.is(':checked')) replaced.addClass(_options.radioChecked);
			else replaced.addClass(_options.radioDefault);
			replaced.click(function(){
				if($(this).hasClass(_options.radioDefault)){
					radio.attr('checked', 'checked');
					changeRadio(radio.get(0));
				}
			});
			radio.click(function(){
				changeRadio(this);
			});
			replaced.insertBefore(radio);
			radio.addClass('outtaHere');
		}
	});
	function changeRadio(_this){
		$(_this).change();
		$('input:radio[name='+$(_this).attr("name")+']').not(_this).each(function(){
			if(this._replaced && !$(this).is(':disabled')) this._replaced.removeClass().addClass(_options.radioDefault);
		});
		_this._replaced.removeClass().addClass(_options.radioChecked);
	}
}

// custom checkboxes module
jQuery.fn.customCheckbox = function(_options){
	var _options = jQuery.extend({
		checkboxStructure: '<div></div>',
		checkboxDisabled: 'disabled',
		checkboxDefault: 'checkboxArea',
		checkboxChecked: 'checkboxAreaChecked'
	}, _options);
	return this.each(function(){
		var checkbox = jQuery(this);
		if(!checkbox.hasClass('outtaHere') && checkbox.is(':checkbox')){
			var replaced = jQuery(_options.checkboxStructure);
			this._replaced = replaced;
			if(checkbox.is(':disabled')) replaced.addClass(_options.checkboxDisabled);
			else if(checkbox.is(':checked')) replaced.addClass(_options.checkboxChecked);
			else replaced.addClass(_options.checkboxDefault);

			replaced.click(function(){
				if(checkbox.is(':checked')) checkbox.removeAttr('checked');
				else checkbox.attr('checked', 'checked');
				changeCheckbox(checkbox);
			});
			checkbox.click(function(){
				changeCheckbox(checkbox);
			});
			replaced.insertBefore(checkbox);
			checkbox.addClass('outtaHere');
		}
	});
	function changeCheckbox(_this){
		_this.change();
		if(_this.is(':checked')) _this.get(0)._replaced.removeClass().addClass(_options.checkboxChecked);
		else _this.get(0)._replaced.removeClass().addClass(_options.checkboxDefault);
	}
}
;(function($) {
	$.fn.simplebox = function(options) { 
		return new Simplebox(this, options); 
	};
	
	function Simplebox(context, options) { this.init(context, options); };
	
	Simplebox.prototype = {
		options:{},
		init: function (context, options){
			this.options = $.extend({
				duration: $.browser.msie ? 0 : 300,
				linkClose: 'a.close, a.btn-close',
				divFader: 'fader',
				faderColor: 'black',
				opacity: 0.7,
				wrapper: '#wrapper',
				linkPopap: '.link-submit'
			}, options || {});
			this.btn = $(context);
			this.select = $(this.options.wrapper).find('select');
			this.initFader();
			this.btnEvent(this, this.btn);
		},
		btnEvent: function($this, el){
			el.click(function(){
				if ($(this).attr('href')) $this.toPrepare($(this).attr('href'));
				else $this.toPrepare($(this).attr('title'));
				return false;
			});
		},
		calcWinWidth: function(){
			this.winWidth = $('body').width();
			if ($(this.options.wrapper).width() > this.winWidth) this.winWidth = $(this.options.wrapper).width();
		},
		toPrepare: function(obj){
			this.popup = $(obj);
			this.btnClose = this.popup.find(this.options.linkClose);
			this.submitBtn = this.popup.find(this.options.linkPopap);
			
			if ($.browser.msie) this.select.css({visibility: 'hidden'});
			this.calcWinWidth();
			this.winHeight = $(window).height();
			this.winScroll = $(window).scrollTop();
			
			this.popupTop = this.winScroll + (this.winHeight/2) - this.popup.outerHeight(true)/2;
			if (this.popupTop < 0) this.popupTop = 0;
			this.faderHeight = $(this.options.wrapper).outerHeight();
			if ($(window).height() > this.faderHeight) this.faderHeight = $(window).height();
			
			this.popup.css({
				top: this.popupTop,
				left: this.winWidth/2 - this.popup.outerWidth()/2
			}).hide();
			this.fader.css({
				width: this.winWidth,
				height: this.faderHeight
			});
			this.initAnimate(this);
			this.initCloseEvent(this, this.btnClose, true);
			this.initCloseEvent(this, this.submitBtn, false);
			this.initCloseEvent(this, this.fader, true);
		},
		initCloseEvent: function($this, el, flag){
			el.click(function(){
				$('body > div.outtaHere').removeClass('optionsDivVisible').addClass('optionsDivInvisible')
				$this.popup.fadeOut($this.options.duration, function(){
					$this.popup.css({left: '-9999px'}).show();
					if ($.browser.msie) $this.select.css({visibility: 'visible'});
					$this.submitBtn.unbind('click');
					$this.fader.unbind('click');
					$this.btnClose.unbind('click');
					$(window).unbind('resize');
					if (flag) $this.fader.fadeOut($this.options.duration);
					else {
						if ($this.submitBtn.attr('href')) $this.toPrepare($this.submitBtn.attr('href'));
						else $this.toPrepare($this.submitBtn.attr('title'));
					}
				});
				return false;
			});
		},
		initAnimate:function ($this){
			$this.fader.fadeIn($this.options.duration, function(){
				$this.popup.fadeIn($this.options.duration);
			});
			$(window).resize(function(){
				$this.calcWinWidth();
				$this.popup.animate({
					left: $this.winWidth/2 - $this.popup.outerWidth(true)/2
				}, {queue:false, duration: $this.options.duration});
				$this.fader.css({width: $this.winWidth});
			});
		},
		initFader: function(){
			if ($(this.options.divFader).length > 0) this.fader = $(this.options.divFader);
			else{
				this.fader = $('<div class="'+this.options.divFader+'"></div>');
				$('body').append(this.fader);
				this.fader.css({
					position: 'absolute',
					zIndex: 999,
					left:0,
					top:0,
					background: this.options.faderColor,
					opacity: this.options.opacity
				}).hide();
			}
		}
	}
}(jQuery));
(function($) {
	$.fn.gallery = function(options) { return new Gallery(this.get(0), options); };
	
	function Gallery(context, options) { this.init(context, options); };
	
	Gallery.prototype = {
		options:{},
		init: function (context, options){
			this.options = $.extend({
				duration: 700,
				slideElement: 1,
				autoRotation: false,
				effect: false,
				listOfSlides: 'ul > li',
				switcher: false,
				disableBtn: false,
				nextBtn: 'a.link-next, a.btn-next, a.next',
				prevBtn: 'a.link-prev, a.btn-prev, a.prev',
				circle: true,
				direction: false,
				event: 'click',
				IE: false
			}, options || {});
			var _el = $(context).find(this.options.listOfSlides);
			if (this.options.effect) this.list = _el;
			else this.list = _el.parent();
			if (this.options.switcher) this.switcher = $(context).find(this.options.switcher);
			this.nextBtn = $(context).find(this.options.nextBtn);
			this.prevBtn = $(context).find(this.options.prevBtn);
			this.count = _el.index(_el.filter(':last'));
			
			if (this.options.switcher) this.active = this.switcher.index(this.switcher.filter('.active:eq(0)'));
			else this.active = _el.index(_el.filter('.active:eq(0)'));
			if (this.active < 0) this.active = 0;
			this.last = this.active;
			
			this.woh = _el.outerWidth(true);
			if (!this.options.direction) this.installDirections(this.list.parent().width());
			else {
				this.woh = _el.outerHeight(true);
				this.installDirections(this.list.parent().height());
			}
			
			if (!this.options.effect) {
				this.rew = this.count - this.wrapHolderW + 1;
				if (!this.options.direction) {
					if (this.list.parent().hasClass('holder')) this.list.css({marginLeft: -(this.woh * this.active)});
					if (this.list.parent().hasClass('frame') && this.active > 2) {
						this.list.css({marginLeft: - (this.woh * (this.active - 2))});
					}
				}
				else this.list.css({marginTop: -(this.woh * this.active)});
			}
			else {
				this.rew = this.count;
				this.list.css({opacity: 0}).removeClass('active').eq(this.active).addClass('active').css({opacity: 1}).css('opacity', 'auto');
				if (this.options.switcher) this.switcher.removeClass('active').eq(this.active).addClass('active');
			}
			
			if (this.options.disableBtn) {
				if (this.count < this.wrapHolderW) this.nextBtn.addClass(this.options.disableBtn);
				if (this.active == 0) this.prevBtn.addClass(this.options.disableBtn);
			}
			
			this.initEvent(this, this.nextBtn, this.prevBtn, true);
			this.initEvent(this, this.prevBtn, this.nextBtn, false);
			
			if (this.options.autoRotation) this.runTimer(this);
			
			if (this.options.switcher) this.initEventSwitcher(this, this.switcher);
		},
		installDirections: function(temp){
			this.wrapHolderW = Math.ceil(temp / this.woh);
			if (((this.wrapHolderW - 1) * this.woh + this.woh / 2) > temp) this.wrapHolderWwrapHolderW--;
		},
		fadeElement: function(){
			if ($.browser.msie && this.options.IE){
				this.list.eq(this.last).css({opacity:0});
				this.list.removeClass('active').eq(this.active).addClass('active').css({opacity:'auto'});
			}
			else{
				this.list.eq(this.last).animate({opacity:0}, {queue:false, duration: this.options.duration});
				this.list.removeClass('active').eq(this.active).addClass('active').animate({
					opacity:1
				}, {queue:false, duration: this.options.duration, complete: function(){
					$(this).css('opacity','auto');
				}});
			}
			if (this.options.switcher) this.switcher.removeClass('active').eq(this.active).addClass('active');
			this.last = this.active;
		},
		scrollElement: function(){
			if (!this.options.direction) this.list.animate({marginLeft: -(this.woh * this.active)}, {queue:false, duration: this.options.duration});
			else this.list.animate({marginTop: -(this.woh * this.active)}, {queue:false, duration: this.options.duration});
			if (this.options.switcher) {
				this.switcher.removeClass('active').eq(this.active).addClass('active');
				var product_id = this.switcher.eq(this.active).children().attr('rel');
				displayProductItems(product_id);
			}			
		},
		runTimer: function($this){
			if($this._t) clearTimeout($this._t);
			$this._t = setInterval(function(){
				$this.toPrepare($this, true);
			}, this.options.autoRotation);
		},
		initEventSwitcher: function($this, el){
			el.bind($this.options.event, function(){
				$this.active = $this.switcher.index($(this));
				if ($this.active == 0) {
					$this.prevBtn.addClass($this.options.disableBtn);
					$this.nextBtn.removeClass($this.options.disableBtn);
				}
				else if ($this.active == $this.count) {
					$this.nextBtn.addClass($this.options.disableBtn);
					$this.prevBtn.removeClass($this.options.disableBtn);
				}
				else {
					$this.prevBtn.removeClass($this.options.disableBtn);
					$this.nextBtn.removeClass($this.options.disableBtn);
				}
				if($this._t) clearTimeout($this._t);
				if (!$this.options.effect) $this.scrollElement();
				else $this.fadeElement();
				if ($this.options.autoRotation) $this.runTimer($this);
				return false;
			});
		},
		initEvent: function($this, addEventEl, addDisClass, dir){
			addEventEl.bind($this.options.event, function(){
				if($this._t) clearTimeout($this._t);
				if ($this.options.disableBtn &&($this.count > $this.wrapHolderW)) addDisClass.removeClass($this.options.disableBtn);
				$this.toPrepare($this, dir);
				if ($this.options.autoRotation) $this.runTimer($this);
				return false;
			});
		},
		toPrepare: function($this, side){
			if (($this.active == $this.rew) && $this.options.circle && side) $this.active = -$this.options.slideElement;
			if (($this.active == 0) && $this.options.circle && !side) $this.active = $this.rew + $this.options.slideElement;
			for (var i = 0; i < $this.options.slideElement; i++){
				if (side) {
					if ($this.active + 1 > $this.rew) {
						if ($this.options.disableBtn && ($this.count > $this.wrapHolderW)) $this.nextBtn.addClass($this.options.disableBtn);
					}
					else $this.active++;
				}
				else{
					if ($this.active - 1 < 0) {
						if ($this.options.disableBtn && ($this.count > $this.wrapHolderW)) $this.prevBtn.addClass($this.options.disableBtn);
					}
					else $this.active--;
				}
			};
			if ($this.active == $this.rew && side) if ($this.options.disableBtn &&($this.count > $this.wrapHolderW)) $this.nextBtn.addClass($this.options.disableBtn);
			if ($this.active == 0 && !side) if ($this.options.disableBtn &&($this.count > $this.wrapHolderW)) $this.prevBtn.addClass($this.options.disableBtn);
			if (!$this.options.effect) $this.scrollElement();
			else $this.fadeElement();
		},
		stop: function(){
			if (this._t) clearTimeout(this._t);
		},
		play: function(){
			if (this._t) clearTimeout(this._t);
			if (this.options.autoRotation) this.runTimer(this);
		}
	}
}(jQuery));
function clearForms(){
	var input = jQuery('input,textarea').not('[type="submit"]');
	input.focus(function(){
		var field = jQuery(this);
		var value = jQuery(this).val();
		field.attr('flag', value).val('');
	});
	input.blur(function(){
		var field = jQuery(this);
		var value = jQuery(this).val();
		if(value != ''){
			return false;
		}else{
			field.val(field.attr('flag'));
		}
	});
}


// Popup
(function($){ 		  
	$.fn.popupWindow = function(instanceSettings){
		
		return this.each(function(){
		
		$(this).click(function(){
		
		$.fn.popupWindow.defaultSettings = {
			centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
			centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
			height:500, // sets the height in pixels of the window.
			left:0, // left position when the window appears.
			location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
			menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
			resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
			scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
			status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
			width:500, // sets the width in pixels of the window.
			windowName:null, // name of window set from the name attribute of the element that invokes the click
			windowURL:null, // url used for the popup
			top:0, // top position when the window appears.
			toolbar:0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
		};
		
		settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
		
		var windowFeatures =    'height=' + settings.height +
								',width=' + settings.width +
								',toolbar=' + settings.toolbar +
								',scrollbars=' + settings.scrollbars +
								',status=' + settings.status + 
								',resizable=' + settings.resizable +
								',location=' + settings.location +
								',menuBar=' + settings.menubar;

				settings.windowName = this.name || settings.windowName;
				settings.windowURL = settings.windowURL || this.href;
				var centeredY,centeredX;
			
				if(settings.centerBrowser){
						
					if ($.browser.msie) {//hacked together for IE browsers
						centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
						centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
					}else{
						centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
						centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
					}
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
				}else if(settings.centerScreen){
					centeredY = (screen.height - settings.height)/2;
					centeredX = (screen.width - settings.width)/2;
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY).focus();
				}else{
					window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top).focus();	
				}
				return false;
			});
			
		});	
	};
})(jQuery);
