jQuery.fn.menuWork = function(opts) {

	opts = opts || {};
	opts.menu = opts.menu || 'div#menu';
	opts.submenu = opts.submenu || 'div#submenu';
	opts.menuItem = opts.menuItem || 'li';
	opts.submenuItem = opts.submenuItem || 'div.sub';
	opts.triggerOff = opts.triggerOff || 'a#home';

	return this.each(function() {

		var mCont = jQuery(this).find(opts.menu);
		var sCont = jQuery(this).find(opts.submenu);
		var mItem = jQuery(mCont).find(opts.menuItem);
		var sItem = jQuery(sCont).find(opts.submenuItem);
		jQuery(sItem).addClass('virgin');
		
		jQuery(mItem).each(function() {
			var that = this;
			var ind = jQuery(mItem).index(that);
			jQuery(that).hoverIntent({
				over: function() {
					jQuery(sItem).hide();
					var it = jQuery(sItem).eq(ind).show();
					if(jQuery(it).hasClass('virgin')) {
						var ul = jQuery(it).find('ul').not('ul ul');
						var max = 0;
						var h = 0;
						jQuery(ul).each(function() {
							h = jQuery(this).innerHeight();
							if(h > max) {
								max = h;
							}
						}).css('height',max+'px');
						
						max = jQuery(opts.submenu).outerWidth();
						var wide = jQuery(it).outerWidth();
						if(wide < max) {
							
							var left = jQuery('a#home').outerWidth();
							jQuery(that).prevAll().each(function() {
								left += jQuery(this).outerWidth();
							});
							if(left+wide > max) {
								left = max-wide;
							}
							jQuery(it).css('marginLeft',left+'px');
							
						}
						
						if(jQuery.ie7_biatch()) {
						
							jQuery(it).find('div.top,div.bottom').each(function() {
								var w = jQuery(it).innerWidth();
								var p = parseInt(jQuery(this).css('padding-left'));
								jQuery(this).find('div').css({
									width: (w-p)+'px'
								});
							});
						
						}
						
						jQuery(it).removeClass('virgin');
					}
				}, timeout: 500,
				out: function() {}
			});
		}).find('a').hover(function() {
			jQuery(mCont).find('li.hovered').removeClass('hovered');
			jQuery(this).parents('li').addClass('hovered');
		},function() {});
		
		jQuery(this).hover(function() {}, function() {
			jQuery(sItem).hide();
			jQuery(mCont).find('li.hovered').removeClass('hovered');
		}).find(opts.triggerOff).hover(function() {
			jQuery(sItem).hide();
			jQuery(mCont).find('li.hovered').removeClass('hovered');
		}, function() {}); 
	
	});
};

jQuery.fn.faqWork = function() {
	return this.each(function() {
		var num = 0;
		var hash = window.location.hash;
		if(hash.length > 1) {
			hash = parseInt(hash.substring(1));
			if(hash > 0) {
				num = hash-1;
			}
		}
		jQuery(this).accordion({
			header: 'h4',
			autoheight: false,
			active: num
		});
	});
};

jQuery.fn.tabs = function(opts) {

	opts = opts || {};
	opts.tabNav = opts.tabNav || 'div.tabNav';
	opts.tabHolder = opts.tabHolder || 'div.tabHolder';
	opts.tabNavItem = opts.tabNavItem || 'li';
	opts.tabHolderItem = opts.tabHolderItem || 'div.tab';
	opts.tabNavClass = opts.tabNavClass || 'active';
	opts.tabHolderClass = opts.tabHolderClass || 'active';
	
	return this.each(function() {

		var nav = jQuery(this).find(opts.tabNav);
		var hold = jQuery(this).find(opts.tabHolder);
		var nItem = jQuery(nav).find(opts.tabNavItem);
		var hItem = jQuery(hold).find(opts.tabHolderItem);
		
		jQuery(nItem).each(function() {
			var that = this;
			jQuery(that).click(function() {
				var ind = jQuery(nItem).index(that);
				jQuery(hItem).hide().removeClass(opts.tabHolderClass).eq(ind).show().addClass(opts.tabHolderClass);
				jQuery(nav).find(opts.tabNavItem+'.'+opts.tabNavClass).removeClass(opts.tabNavClass);
				jQuery(that).addClass(opts.tabNavClass);
				return false;
			}).find('a').click(function() { jQuery(this).parents('li:first').click(); return false; });
		});
		jQuery(nItem).eq(0).click();
	
	});
	
}

jQuery.fn.homeNews = function(opts) {

	opts = opts || {};
	opts.scroller = opts.scroller || 'div.scroller';
	opts.holder = opts.holder || 'div.holder';

	return this.each(function() { 
		var that = this;	
		var ul = jQuery(this).find('ul:first');
		var scroller = jQuery(this).find(opts.scroller);
		var holder = jQuery(this).find(opts.holder);
		
		var cnt = jQuery(ul).find('li').length;
		var ind = 0;
		var working = false;
		var animating = false;
		var inside = false;
		var step = jQuery(ul).find('li:first').outerHeight();
		
		var tOut = null;
		
		var animTime = 500;
		var stepTime = 3000;
		
		jQuery(holder).css('left',(jQuery(scroller).prev('p').innerWidth()-10)+'px');
		
		var doStep = function() {
			working = true;
			var mt = parseInt(jQuery(ul).css('marginTop'));
			jQuery(ul).animate({
				marginTop: (mt-step)+'px'
			},animTime, function() {
				ind++;
				if(ind == cnt) {
					jQuery(ul).css('marginTop',0);
					ind = 0;
				}
				working = false;
				if(inside) {
					showMore();
				} else {
					tOut = setTimeout(doStep,stepTime);
				}
			});
		};
		
		var populate = function(src,trg,eq) {
			var li = jQuery(src).find('li').eq(eq);
			jQuery(li).nextAll().each(function() {
				if(!jQuery(this).hasClass('extra')) {
					jQuery(trg).append('<li>'+jQuery(this).html()+'</li>');
				}
			});
			jQuery(li).prevAll().each(function() {
				jQuery(trg).append('<li>'+jQuery(this).html()+'</li>');
			});
		}
		
		var showMore = function() {
			animating = true;
			var div = jQuery(holder).find('div').show();
			populate(ul,jQuery(div).find('ul').empty(),ind);
			jQuery(holder).animate({
				height: jQuery(div).outerHeight()+'px'
			},animTime,function() {				
				if(!inside) {
					hideMore();
				} else {
					animating = false;
				}
			});
		}
		
		var hideMore = function() {
			animating = true;
			var div = jQuery(holder).find('div').show();
			populate(ul,jQuery(div).find('ul').empty(),ind);
			jQuery(holder).animate({
				height: 0
			},animTime,function() {
				if(inside) {
					showMore();
				} else {
					tOut = setTimeout(doStep,stepTime);
					animating = false;
				}
			});
		}
		
		jQuery(that).find('div.scroller').hover(function() {
			inside = true;
			clearTimeout(tOut);
			if(working) return false;
			if(animating) return false;
			showMore();
		},function() {});
		jQuery(that).hover(function() {},function() {
			inside = false;
			if(working) return false;
			if(animating) return false;
			hideMore();
		});
		  
		jQuery(ul).append('<li></li>').find('li:last').addClass('extra').text(jQuery(ul).find('li:first').text());
		
		tOut = setTimeout(doStep,stepTime);
	
	});

}

jQuery.fn.clientInfo = function(opts) {

	return this.each(function() {
	
		opts = opts || {};
		opts.target = opts.target || 'p.show';
		opts.callback = opts.callback || null;
	
		var animating = false;
		var dump = false;
	
		jQuery(this).find(opts.target).find('a').click(function() {
			
			dump = false;
		
			if(jQuery('div#clientInfo').length == 0) {			
				jQuery('body').append('<div id="clientInfo"><div class="outer"><div class="inner"><a class="x"></a><div class="loader"></div><div class="target"></div></div></div></div><div id="poltergeist"></div>');
				jQuery('div#poltergeist').css({
					opacity: 0,
					height: (jQuery('body').height() > jQuery(window).height() ? jQuery('body').height() : jQuery(window).height())+'px'
				});
				jQuery('div#clientInfo').css('opacity',0).find('a.x').click(function() {
					if(animating) return false;
					animating = true;
					dump = true;
					jQuery('div#poltergeist').animate({
						opacity: 0
					},500,function() {
						animating = false;
						jQuery('div#poltergeist').hide();
					});
					jQuery('div#clientInfo').animate({
						opacity: 0
					},400,function() {
						animating = false;
						jQuery('div#clientInfo').hide();
					});
					window.location.hash = null;
					return false;
				});							
			}

      var href = jQuery(this).attr('href');
      var rel = jQuery(this).attr('rel');
			animating = true;      
      jQuery('div#clientInfo div.loader').show();
      jQuery('div#clientInfo div.target').empty().hide();
			jQuery('div#poltergeist').show().animate({
				opacity: 0.75
			},500,function() {
				animating = false;
			});
			jQuery('div#clientInfo').show().css('top',jQuery(window).scrollTop()+'px').animate({
				opacity: 1
			},400,function() {
				animating = false;
				jQuery(this).ajaxSubmit({
					type: 'post',
					contentType:'application/x-www-form-urlencoded',
					url: href,
					success: function(re) {
						window.location.hash = rel;
						if(!dump) {
							jQuery('div#clientInfo div.loader').hide();
							jQuery('div#clientInfo div.target').show().html(re);
							if(opts.callback) {
								opts.callback();
							}
							jQuery('div#poltergeist').css('height',(jQuery('body').height() > jQuery(window).height() ? jQuery('body').height() : jQuery(window).height())+'px');
							var ph = jQuery('div#poltergeist').outerHeight();
							var ch = jQuery('div#clientInfo').outerHeight();
							var ct = parseInt(jQuery('div#clientInfo').css('top'));
							var cm = parseInt(jQuery('div#clientInfo').css('marginTop'));
							var cc = ch+ct+cm 
							if(ph < cc) {
								jQuery('div#poltergeist').css('height',cc+'px');
							}
						}
					},
					error: function() {
						jQuery('div#clientInfo div.loader').hide();
						jQuery('div#clientInfo div.target').show().html('<p class="error">Wystąpiły problemy techniczne. Spróbuj później.</p>');
						window.location.hash = null;
					}
				});
				
			});
			
			return false;
		
		});
		if(window.location.hash.length > 1) {
			var id = window.location.hash.substring(1);
			jQuery(this).find('a.client'+id).click();
		}
	
	});
	
}

jQuery.fn.clientsBar = function(opts) {

	return this.each(function() {

		var that = this;
		var ul = jQuery(that).find('ul:first');
		var li = jQuery(ul).find('li:first');
				                                                                    
		var uw = jQuery(ul).outerWidth()+parseInt(jQuery(ul).css('marginLeft'));
		var iw = jQuery(li).outerWidth();
		
		var atPage = Math.floor(uw/iw);
		li = jQuery(ul).find('li').length;
		var pc = Math.ceil(li/atPage);
		jQuery(ul).css('width',(pc*uw)+'px');
		var diff = pc*atPage - li;
		
		if(pc < 2) return false;
		
		var page = 0;
		var margin = parseInt(jQuery(ul).css('marginLeft'));
		var animating = false;
		var animTime = 500;
		
		jQuery(that).find('span#clientsPrev em').click(function() {
			if(animating) return false;
			if(page == 0) return false;
			var em = this;
			animating = true;
			margin += uw;
			jQuery(ul).animate({
				marginLeft: margin+'px'
			},animTime,function() {
				animating = false;
				page--;
				jQuery(that).find('span em').show();
				if(page == 0) {
					jQuery(em).hide();
				}
			});
		}).hide();
		jQuery(that).find('span#clientsNext em').click(function() {
			if(animating) return false;
			if(page == pc-1) return false;
			var em = this;
			animating = true;
			margin -= uw;
			jQuery(ul).animate({
				marginLeft: margin+'px'
			},animTime,function() {
				animating = false;
				page++;
				jQuery(that).find('span em').show();
				if(page == pc-1) {
					jQuery(em).hide();
				}
			});
		});

	});
	
}

jQuery.fn.formPopup = function() {

	return this.each(function() {
	
		var that = this;
		var cl = jQuery(that).attr('class');
		if(cl != null) {
			cl = cl.replace(/Trigger/,'Popup');
		} else return false;
		var targ = jQuery('div#'+cl);
		if(targ.length < 1) return false;
		
		jQuery(that).click(function() {
		
			if(jQuery('div#poltergeist').length < 1) {
				jQuery('body').append('<div id="poltergeist"></div>');
				jQuery('div#poltergeist').css({
					opacity: 0,
					height: (jQuery('body').height() > jQuery(window).height() ? jQuery('body').height() : jQuery(window).height())+'px'
				});
			}
			jQuery(targ).css({
				opacity: 0,
				top: jQuery(window).scrollTop()+'px'
			}).show();
			jQuery(targ).find('div.ctrl').show();
			jQuery(targ).find('p.success').empty().hide();
			var h = parseInt(jQuery(targ).outerHeight()) + parseInt(jQuery(targ).css('marginTop')) + parseInt(jQuery(targ).css('marginBottom')) + jQuery(window).scrollTop();
			if(h > jQuery('div#poltergeist').outerHeight()) {
				jQuery('div#poltergeist').css('height',h+'px');
			}
			jQuery('div#poltergeist').show().animate({
				opacity: 0.75
			},500,function() {
				animating = false;
			});
			jQuery(targ).animate({
				opacity: 1
			},500);
			
			return false;
		
		});
		jQuery(targ).find('a.x').click(function() {
			if(animating) return false;
			if(jQuery(this).parents('div.popup').find('form').hasClass('working')) return false;
			animating = true;
			jQuery('div#poltergeist').animate({
				opacity: 0
			},500,function() {
				animating = false;
				jQuery('div#poltergeist').hide();
			});
			jQuery(targ).animate({
				opacity: 0
			},500,function() {
				animating = false;
				jQuery(targ).hide();
			});
			return false;
		});
	
	});

}

jQuery.fn.workForm = function() {

	return this.each(function() {

  	jQuery(this).find('p.error').addClass('virgin').prepend('<em></em>');
		jQuery(this).ajaxForm({
			dataType: 'json',
			beforeSubmit: function(d,f,o) {
				if(jQuery(f).hasClass('working')) return false;
				jQuery(f).addClass('working').find('span.loader').show();
				jQuery(f).find('p.globalError').hide();
				o.success = function(re,st) {
					jQuery(f).removeClass('working').find('span.loader').hide();
					jQuery(f).find('div.error').removeClass('error');
					if(re.status == 'error') {
						if(re.message) {
							jQuery(f).find('p.globalError').html(re.message).show();
						}
						var err = re.errors;
						for(i in err) {
							jQuery(f).find('#'+err[i]['name']).parents('.row').addClass('error').find('.errorTarget').html(err[i]['message']);
							jQuery(f).find('#'+err[i]['name']).parents('.row').find('p.virgin').each(function() {
								var er = jQuery(this).parent();
								var par = jQuery(er).parent();
								var hp = jQuery(par).innerHeight() - parseInt(jQuery(par).css('paddingTop')) - parseInt(jQuery(par).css('paddingBottom'));
								jQuery(er).css('height',hp+'px');
								var p = this;
								var em = jQuery(p).find('em');
								var span = jQuery(p).find('span:first');
								jQuery(em).css({
									width: jQuery(p).css('paddingLeft'),
									right: jQuery(span).outerWidth()+'px'
								});
								if(jQuery.ie7_biatch()) {
									var ph = jQuery(this).innerHeight();
									var span = jQuery(this).children('span:first');
									jQuery(span).css('height',ph+'px');
									var span2 = jQuery(span).children('span:first');
									var sh = jQuery(span2).innerHeight();
									jQuery(span2).css('margin-top',((ph-sh)/2)+'px');
								}
								jQuery(p).removeClass('virgin');
							});
						}
					} else if(re.status == 'success') {
						if(re.message) {
							jQuery(f).find('div.ctrl').hide()
							jQuery(f).find('p.success').show().html(re.message).find('a').click(function() {
								jQuery(f).parents('div.popup').find('a.x').click();
								return false;
							});
						} else if(re.show) {
							var targ = 'div#'+re.show;
							if(jQuery(targ).length > 0) {
								if(jQuery('div#poltergeist').length < 1) {
									jQuery('body').append('<div id="poltergeist"></div>');
									jQuery('div#poltergeist').css({
										opacity: 0,
										height: (jQuery('body').height() > jQuery(window).height() ? jQuery('body').height() : jQuery(window).height())+'px'
									});
								}
								jQuery(targ).find('a.x').unbind();
								jQuery(targ).find('a.x').click(function() {
									if(animating) return false;
									if(jQuery(this).parents('div.popup').find('form').hasClass('working')) return false;
									animating = true;
									jQuery('div#poltergeist').animate({
										opacity: 0
									},500,function() {
										animating = false;
										jQuery('div#poltergeist').hide();
									});
									jQuery(targ).animate({
										opacity: 0
									},500,function() {
										animating = false;
										jQuery(targ).hide();
									});
									return false;
								});
								jQuery(targ).css({
									opacity: 0,
									top: jQuery(window).scrollTop()+'px'
								}).show();
								var h = parseInt(jQuery(targ).outerHeight()) + parseInt(jQuery(targ).css('marginTop')) + parseInt(jQuery(targ).css('marginBottom')) + jQuery(window).scrollTop();
								if(h > jQuery('div#poltergeist').outerHeight()) {
									jQuery('div#poltergeist').css('height',h+'px');
								}
								jQuery('div#poltergeist').show().animate({
									opacity: 0.75
								},500,function() {
									animating = false;
								});
								jQuery(targ).animate({
									opacity: 1
								},500);
							}
						} else {
							jQuery(f).parents('div.popup').find('a.x').click();
						}
						jQuery(f).resetForm().find('span.jNiceChecked').removeClass('jNiceChecked');
						jQuery(f).find('div.jNiceSelectWrapper ul a:first').click();
					}
				};
				o.error = function(a,b,c) {
					jQuery(f).removeClass('working').find('span.loader').hide();
					jQuery(f).find('p.globalError').html('Wystąpiły problemy techniczne. Proszę spróbować później.').show();
				};
			}
		});	
	});
}

jQuery.fn.clientFilter = function(opts) {
	return this.each(function() {
	
		opts = opts || {};
		opts.target = opts.target || 'ul#clientList';
		opts.src = opts.src || 'p span';
		
		var that = jQuery(this);
		
		jQuery(opts.target).find('li').each(function() {			
			var cl = jQuery(this).find(opts.src).text().substr(0,1).toUpperCase();
			jQuery(this).addClass('show'+cl);
			if(jQuery(that).find('li.'+cl).length < 1) {
				jQuery(that).append('<li class="'+cl+'"><a href="#">'+cl+'</a></li>');
			}			
		});
		
		jQuery(that).find('li a').click(function() {
			var cl = jQuery(this).parent().attr('class');
			if(cl == 'all') {
				jQuery(opts.target).find('li').show();
			} else {
				jQuery(opts.target).find('li').hide();
				jQuery(opts.target).find('li.show'+cl).show();
			}
			return false;
		});
	
	});
}

jQuery.fn.doPager = function(opts) {
	return this.each(function() {
	
		var cont = jQuery(this);
	
		opts = opts || {};
		opts.page = opts.page || 1;
		opts.atPage = opts.atPage || 10;
		opts.grace = opts.grace || 2;
		opts.target = opts.target || 'li';
		opts.elem = opts.elem || jQuery(this).nextAll('div.pager'); 
	
		jQuery(opts.elem).empty();
		var length = jQuery(cont).find(opts.target).length;
		var offsetMore = 0;
		if(opts.target == 'tr') {
			length++;
			offsetMore = 1;
		}
	
		var total = Math.ceil(length/opts.atPage);
		var range = opts.grace*2
		
		if(total < 2) return false;
		
		var limitFrom = (opts.page - opts.grace) > 0 ? (opts.page - opts.grace) : 1;
		var limitTo = limitFrom + range;
		
		if(limitTo > total) {
			limitTo = total;
			limitFrom = (limitTo - range) > 0 ? (limitTo - range) : 1;			
		}
		if(opts.page > 1) {
			jQuery(opts.elem).append('<a class="prev">Poprzednia</a>');
		}
		if(limitFrom > 1) {
			jQuery(opts.elem).append('<a>1</a>');
		}
		if(limitFrom > 2) {
			jQuery(opts.elem).append('<span>...</span>');
		}
		for(var i = limitFrom; i <= limitTo; i++) {
			if(i == opts.page) {
				jQuery(opts.elem).append('<a class="current">'+i+'</a>');
			} else {
				jQuery(opts.elem).append('<a>'+i+'</a>');
			}
		}
		if(limitTo < total-1) {
			jQuery(opts.elem).append('<span>...</span>');
		}
		if(limitTo < total) {
			jQuery(opts.elem).append('<a>'+total+'</a>');
		}
		if(opts.page < total) {
			jQuery(opts.elem).append('<a class="next">Następna</a>');
		}
		
		var items = jQuery(cont).find(opts.target);
		jQuery(items).hide();
		if(offsetMore > 0) {
			jQuery(items).eq(0).show();
		}
		var offset = (opts.page-1)*opts.atPage;
		for(var i = 0; i < opts.atPage; i++) {
			jQuery(items).eq(offset+i+offsetMore).show();
		}
		
		jQuery(opts.elem).find('a').click(function() {
			var val = jQuery(opts.elem).find('a.current');
			if(jQuery(this).hasClass('current')) {
			} else if(jQuery(this).hasClass('prev')) {
				val = jQuery(val).prev('a');
			} else if(jQuery(this).hasClass('next')) {
				val = jQuery(val).next('a');
			} else {
				val = jQuery(this);
			}
			val = parseInt(jQuery(val).text());
			opts.page = val;
			jQuery(cont).doPager(opts);
			return false;
		});
		
	});
}

jQuery.fn.clientPaging = function(opts) {
	return this.each(function() {
	
		opts = opts || {};
		opts.lines = opts.lines || 15;
		opts.target = opts.target || 'div.paged';
		
		var that = jQuery(this);
		var tg = jQuery(opts.target)
		var pr = jQuery(tg).parent();
		var lh = parseInt(jQuery(tg).find('p:first').css('line-height'));
		if(lh) {
			
			var max = lh*opts.lines;
			var h = jQuery(pr).innerHeight();
			if(h < max) return false;
			
			jQuery(pr).css({
				overflow: 'hidden',
				height: max+'px'
			});
			
			jQuery(pr).after('<div class="pager"><div><span class="prev"><a href="#"><em>Poprzednia</em></a></span><ul></ul><span class="next"><a href="#"><em>Następna</em></a></span></div></div>');
			var ul = jQuery(pr).next('div.pager').find('ul');
			var h = jQuery(tg).innerHeight();
			var pages = Math.ceil(h/max);
			for(var i=0;i<pages;i++) {
				jQuery(ul).append('<li><a href="#">'+(i+1)+'</a></li>');
			}
			jQuery(ul).prev('span.prev').hide();
			jQuery(ul).find('li:first').addClass('active');
			var currPage = 0;
			jQuery(pr).next('div.pager').find('a').click(function() {
				jQuery(ul).prev('span.prev').show();
				jQuery(ul).next('span.next').show();
				if(jQuery(this).parents('span.prev').length > 0) {
					if(currPage > 0) {
						currPage--;
					}
					jQuery(tg).css('marginTop','-'+(max*currPage)+'px');
					if(currPage == 0) {
						jQuery(ul).prev('span.prev').hide();
					}
				} else if(jQuery(this).parents('span.next').length > 0) {
					if(currPage < pages-1) {
						currPage++;
					}
					jQuery(tg).css('marginTop','-'+(max*currPage)+'px');
					if(currPage == pages-1) {
						jQuery(ul).next('span.next').hide();
					}
				} else {
					var np = parseInt(jQuery(this).text())-1;
					currPage = np;
					jQuery(tg).css('marginTop','-'+(max*currPage)+'px');
					if(currPage == 0) {
						jQuery(ul).prev('span.prev').hide();
					}
					if(currPage == pages-1) {
						jQuery(ul).next('span.next').hide();
					}
				}
				jQuery(ul).find('li.active').removeClass('active');
				jQuery(ul).find('li').eq(currPage).addClass('active');
				return false;
			});
			
		}
	
	});
}

jQuery.fn.addBookmark = function() {
	return this.each(function() {	
		jQuery(this).click(function() {
			var url = window.location;
			if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
				window.sidebar.addPanel(jQuery(this).attr('rel'), window.location,"");
			} else if ((typeof window.external == "object") && (typeof window.external.AddFavorite == "function")) {
				window.external.AddFavorite(jQuery(this).attr('rel'), window.location);
			} else {
	    	alert(jQuery(this).attr('rel'));
	  	}
	  	return false;
	  });
	});
}

jQuery.fn.printMe = function() {
	return this.each(function() {	
		jQuery(this).click(function() {
			window.open(jQuery(this).attr('href'));
	  	return false;
	  });
	});
}

jQuery.ie7_biatch = function() {
	return jQuery.browser.msie && parseInt(jQuery.browser.version) == 7;
}
