/* PLUGINS.js */



/* BACKGROUNDS & IMAGES ************************************************************/



/* animate background-position */

	(function($) {
		if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8
			var oldCurCSS = jQuery.curCSS;
			jQuery.curCSS = function(elem, name, force){
				if(name === 'background-position'){
					name = 'backgroundPosition';
				}
				if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
					return oldCurCSS.apply(this, arguments);
				}
				var style = elem.style;
				if ( !force && style && style[ name ] ){
					return style[ name ];
				}
				return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
			};
		}
	
		var oldAnim = $.fn.animate;
		$.fn.animate = function(prop){
			if('background-position' in prop){
				prop.backgroundPosition = prop['background-position'];
				delete prop['background-position'];
			}
			if('backgroundPosition' in prop){
				prop.backgroundPosition = '('+ prop.backgroundPosition;
			}
			return oldAnim.apply(this, arguments);
		};
	
		function toArray(strg){
			strg = strg.replace(/left|top/g,'0px');
			strg = strg.replace(/right|bottom/g,'100%');
			strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
			var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
			return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
		}
	
		$.fx.step. backgroundPosition = function(fx) {
			if (!fx.bgPosReady) {
				var start = $.curCSS(fx.elem,'backgroundPosition');
			
				if(!start){//FF2 no inline-style fallback
					start = '0px 0px';
				}
			
				start = toArray(start);
			
				fx.start = [start[0],start[2]];
			
				var end = toArray(fx.options.curAnim.backgroundPosition);
				fx.end = [end[0],end[2]];
			
				fx.unit = [end[1],end[3]];
				fx.bgPosReady = true;
			}
			//return;
			var nowPosX = [];
			nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
			nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
			fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

		};
	})(jQuery);



/* imgJustify */

		(function($){

			$.fn.imgJustify = function( p ){

				o = $.extend({
					minMargin : 5,
					width : this.width(),
					autoFloat : false
				}, p);

				g = {
					allImg : this.find('img').length - 1,
					curImg : 0,
					firstImg : 0,
					lastImg : null,
					tempAllWidth : -o.minMargin,
					tempImgWidth : 0
				}

				var c = this;
				this.css({
					'overflow-x' : 'hidden'
				});

				var inner = document.createElement('div');
				$(inner).css({
					'width' : o.width + 20
				})
				this.contents().wrapAll( inner );

				loadImages();

				function loadImages(){
					var lastwidth, tempmargin;
					for(x=g.firstImg;( o.width > g.tempAllWidth && x < g.allImg+1 );x++){
						last = c.find('img:eq('+x+')');
						if(o.autoFloat == true){
							last.css({'float' : 'left'});
						}	
						lastwidth = last.width();
						g.tempImgWidth += lastwidth;
						g.tempAllWidth += lastwidth + o.minMargin;
						g.lastImg = x;
					}
					g.tempImgWidth -= lastwidth;
					if(g.lastImg < g.allImg){
						g.lastImg -= 1;
					}
					tempmargin = g.lastImg < g.allImg ? Math.ceil((o.width - g.tempImgWidth) / (g.lastImg - g.firstImg)) : o.minMargin;
					for(x=g.firstImg;x<g.lastImg;x++){
						c.find('img:eq('+x+')').css({
							'margin-right' : tempmargin
						});
					}	
					if(g.lastImg<g.allImg-1){
						g.tempAllWidth = -o.minMargin;
						g.tempImgWidth = 0;
						g.firstImg = g.lastImg+1;
						loadImages();
					}	
				}			
			}	
		})(jQuery);



/* imgPreload */

	( function($){

		$.fn.imgPreload = function( p ){

      		o = $.extend({
				fadeTime : 350,
				fadeIn : false,
				imgFadeTime : 200,
				imgFadeDelayTime : 1500,
				each : function(){},
				callback : function(){ $('#imgpreloadoverlay').fadeOut( o.fadeTime ); }
			}, p);
			
			if(!$('#imgpreloadoverlay').length){
				var ipo = document.createElement('div');
				$(ipo).attr('id','imgpreloadoverlay');
				$('body').append(ipo);
			}
			
			if( o.fadeIn == true){
				$('#imgpreloadoverlay').css({
					'display' : 'none'
				});
			}

			var loadedImages = 0;

			if( !o.images ){
				var images = [];
				$(this).find('*').each(function(){
					if( $(this).css('background-image') != 'none' ){
						_t = $(this).css('background-image').split('url(')[1].split(')')[0];
						if( _t.indexOf('"') != -1){
							_t = _t.split('"')[1]
						}
						images.push( _t );
					}
					if( $(this).attr('src') ){
						src = $(this).attr('src');
						if( src.indexOf('js') == -1 ){
							if( src.indexOf( 'http' ) == -1 ){
								src = 'http://' + document.location.href.split('http://')[1].split('/')[0] + '/' + src;
							}
							if(o.fadeIn == true){
								$(this).css({
									'opacity' : 0
								}).load(function(){
									$(this).delay( Math.round(Math.random()*o.imgFadeDelayTime) ).animate({
										'opacity' : 1
									}, o.imgFadeTime);
								}).attr('src',src);
							}
							images.push( src );
						}
					}
				});
			}else{
				var images = o.images;
			}

			var ob = this;

			if(images.length>0){
				for(x=0;x<images.length;x++){
					$('<img>').load(function(){
						o.each();
						loadedImages += 1;
						if(loadedImages >= images.length){
							o.callback();
						}
					}).attr( 'src', images[x] );
				}
			}else{
				o.callback();					
			}	
		};
	})(jQuery);



/**
* DD_roundies, this adds rounded-corner CSS in standard browsers and VML sublayers in IE that accomplish a similar appearance when comparing said browsers.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_roundies/
* Version: 0.0.2a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_roundies/#license
*
* Usage:
* DD_roundies.add('#doc .container', '10px 5px'); // selector and multiple radii
* DD_roundies.add('.box', 5, true); // selector, radius, and optional addition of border-radius code for standard browsers.
* 
* Just want the PNG fixing effect for IE6, and don't want to also use the DD_belatedPNG library?  Don't give any additional arguments after the CSS selector.
* DD_roundies.add('.your .example img');
**/

var br = {

	ns: 'br',
	
	IE6: false,
	IE7: false,
	IE8: false,
	IEversion: function() {
		if (document.documentMode != 8 && document.namespaces && !document.namespaces[this.ns]) {
			this.IE6 = true;
			this.IE7 = true;
		}
		else if (document.documentMode == 8) {
			this.IE8 = true;
		}
	},
	querySelector: document.querySelectorAll,
	selectorsToProcess: [],
	imgSize: {},
	
	createVmlNameSpace: function() { /* enable VML */
		if (this.IE6 || this.IE7) {
			document.namespaces.add(this.ns, 'urn:schemas-microsoft-com:vml');
		}
		if (this.IE8) {
			document.writeln('<?import namespace="' + this.ns + '" implementation="#default#VML" ?>');
		}
	},
	
	createVmlStyleSheet: function() { /* style VML, enable behaviors */
		/*
			Just in case lots of other developers have added
			lots of other stylesheets using document.createStyleSheet
			and hit the 31-limit mark, let's not use that method!
			further reading: http://msdn.microsoft.com/en-us/library/ms531194(VS.85).aspx
		*/
		var style = document.createElement('style');
		document.documentElement.firstChild.insertBefore(style, document.documentElement.firstChild.firstChild);
		if (style.styleSheet) { /* IE */
			try {
				var styleSheet = style.styleSheet;
				styleSheet.add(this.ns + '\\:*', '{behavior:url(#default#VML)}');
				this.styleSheet = styleSheet;
			} catch(err) {}
		}
		else {
			this.styleSheet = style;
		}
	},
	
	/**
	* Method to use from afar - refer to it whenever.
	* Example for IE only: DD_roundies.add('div.boxy_box', '10px 5px');
	* Example for IE, Firefox, and WebKit: DD_roundies.add('div.boxy_box', '10px 5px', true);
	* @param {String} selector - REQUIRED - a CSS selector, such as '#doc .container'
	* @param {Integer} radius - REQUIRED - the desired radius for the box corners
	* @param {Boolean} standards - OPTIONAL - true if you also wish to output -moz-border-radius/-webkit-border-radius/border-radius declarations
	**/
	add: function(selector, rad, standards) {
		if (typeof rad == 'undefined' || rad === null) {
			rad = 0;
		}
		if (rad.constructor.toString().search('Array') == -1) {
			rad = rad.toString().replace(/[^0-9 ]/g, '').split(' ');
		}
		for (var i=0; i<4; i++) {
			rad[i] = (!rad[i] && rad[i] !== 0) ? rad[Math.max((i-2), 0)] : rad[i];
		}
		if (this.styleSheet) {
			if (this.styleSheet.add) { /* IE */
				var selectors = selector.split(','); /* multiple selectors supported, no need for multiple calls to this anymore */
				for (var i=0; i<selectors.length; i++) {
					this.styleSheet.add(selectors[i], 'behavior:expression(br.roundify.call(this, [' + rad.join(',') + ']))'); /* seems to execute the function without adding it to the stylesheet - interesting... */
				}
			}
			else if (standards) {
				var moz_implementation = rad.join('px ') + 'px';
				this.styleSheet.appendChild(document.createTextNode(selector + ' {border-radius:' + moz_implementation + '; -moz-border-radius:' + moz_implementation + ';}'));
				this.styleSheet.appendChild(document.createTextNode(selector + ' {-webkit-border-top-left-radius:' + rad[0] + 'px ' + rad[0] + 'px; -webkit-border-top-right-radius:' + rad[1] + 'px ' + rad[1] + 'px; -webkit-border-bottom-right-radius:' + rad[2] + 'px ' + rad[2] + 'px; -webkit-border-bottom-left-radius:' + rad[3] + 'px ' + rad[3] + 'px;}'));
			}
		}
		else if (this.IE8) {
			this.selectorsToProcess.push({'selector':selector, 'radii':rad});
		}
	},
	
	readPropertyChanges: function(el) {
		switch (event.propertyName) {
			case 'style.border':
			case 'style.borderWidth':
			case 'style.padding':
				this.applyVML(el);
				break;
			case 'style.borderColor':
				this.vmlStrokeColor(el);
				break;
			case 'style.backgroundColor':
			case 'style.backgroundPosition':
			case 'style.backgroundRepeat':
				this.applyVML(el);
				break;
			case 'style.display':
				el.vmlBox.style.display = (el.style.display == 'none') ? 'none' : 'block';
				break;
			case 'style.filter':
				this.vmlOpacity(el);
				break;
			case 'style.zIndex':
				el.vmlBox.style.zIndex = el.style.zIndex;
				break;
		}
	},
	
	applyVML: function(el) {
		el.runtimeStyle.cssText = '';
		this.vmlFill(el);
		this.vmlStrokeColor(el);
		this.vmlStrokeWeight(el);
		this.vmlOffsets(el);
		this.vmlPath(el);
		this.nixBorder(el);
		this.vmlOpacity(el);
	},
	
	vmlOpacity: function(el) {
		if (el.currentStyle.filter.search('lpha') != -1) {
			var trans = el.currentStyle.filter;
			trans = parseInt(trans.substring(trans.lastIndexOf('=')+1, trans.lastIndexOf(')')), 10)/100;
			for (var v in el.vml) {
				el.vml[v].filler.opacity = trans;
			}
		}
	},
	
	vmlFill: function(el) {
		if (!el.currentStyle) {
			return;
		} else {
			var elStyle = el.currentStyle;
		}
		el.runtimeStyle.backgroundColor = '';
		el.runtimeStyle.backgroundImage = '';
		var noColor = (elStyle.backgroundColor == 'transparent');
		var noImg = true;
		if (elStyle.backgroundImage != 'none' || el.isImg) {
			if (!el.isImg) {
				el.vmlBg = elStyle.backgroundImage;
				el.vmlBg = el.vmlBg.substr(5, el.vmlBg.lastIndexOf('")')-5);
			}
			else {
				el.vmlBg = el.src;
			}
			var lib = this;
			if (!lib.imgSize[el.vmlBg]) { /* determine size of loaded image */
				var img = document.createElement('img');
				img.attachEvent('onload', function() {
					this.width = this.offsetWidth; /* weird cache-busting requirement! */
					this.height = this.offsetHeight;
					lib.vmlOffsets(el);
				});
				img.className = lib.ns + '_sizeFinder';
				img.runtimeStyle.cssText = 'behavior:none; position:absolute; top:-10000px; left:-10000px; border:none;'; /* make sure to set behavior to none to prevent accidental matching of the helper elements! */
				img.src = el.vmlBg;
				img.removeAttribute('width');
				img.removeAttribute('height');
				document.body.insertBefore(img, document.body.firstChild);
				lib.imgSize[el.vmlBg] = img;
			}
			el.vml.image.filler.src = el.vmlBg;
			noImg = false;
		}
		el.vml.image.filled = !noImg;
		el.vml.image.fillcolor = 'none';
		el.vml.color.filled = !noColor;
		el.vml.color.fillcolor = elStyle.backgroundColor;
		el.runtimeStyle.backgroundImage = 'none';
		el.runtimeStyle.backgroundColor = 'transparent';
	},
	
	vmlStrokeColor: function(el) {
		el.vml.stroke.fillcolor = el.currentStyle.borderColor;
	},
	
	vmlStrokeWeight: function(el) {
		var borders = ['Top', 'Right', 'Bottom', 'Left'];
		el.bW = {};
		for (var b=0; b<4; b++) {
			el.bW[borders[b]] = parseInt(el.currentStyle['border' + borders[b] + 'Width'], 10) || 0;
		}
	},
	
	vmlOffsets: function(el) {
		var dims = ['Left', 'Top', 'Width', 'Height'];
		for (var d=0; d<4; d++) {
			el.dim[dims[d]] = el['offset'+dims[d]];
		}
		var assign = function(obj, topLeft) {
			obj.style.left = (topLeft ? 0 : el.dim.Left) + 'px';
			obj.style.top = (topLeft ? 0 : el.dim.Top) + 'px';
			obj.style.width = el.dim.Width + 'px';
			obj.style.height = el.dim.Height + 'px';
		};
		for (var v in el.vml) {
			var mult = (v == 'image') ? 1 : 2;
			el.vml[v].coordsize = (el.dim.Width*mult) + ', ' + (el.dim.Height*mult);
			assign(el.vml[v], true);
		}
		assign(el.vmlBox, false);
		
		if (br.IE8) {
			el.vml.stroke.style.margin = '-1px';
			if (typeof el.bW == 'undefined') {
				this.vmlStrokeWeight(el);
			}
			el.vml.color.style.margin = (el.bW.Top-1) + 'px ' + (el.bW.Left-1) + 'px';
		}
	},
	
	vmlPath: function(el) {
		var coords = function(direction, w, h, r, aL, aT, mult) {
			var cmd = direction ? ['m', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'qx', 'l'] : ['qx', 'l', 'qy', 'l', 'qx', 'l', 'qy', 'l', 'm']; /* whoa */
			aL *= mult;
			aT *= mult;
			w *= mult;
			h *= mult;
			var R = r.slice(); /* do not affect original array */
			for (var i=0; i<4; i++) {
				R[i] *= mult;
				R[i] = Math.min(w/2, h/2, R[i]); /* make sure you do not get funky shapes - pick the smallest: half of the width, half of the height, or current value */
			}
			var coords = [
				cmd[0] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT),
				cmd[1] + Math.floor(R[0]+aL) +','+ Math.floor(0+aT),
				cmd[2] + Math.ceil(w-R[1]+aL) +','+ Math.floor(0+aT),
				cmd[3] + Math.ceil(w+aL) +','+ Math.floor(R[1]+aT),
				cmd[4] + Math.ceil(w+aL) +','+ Math.ceil(h-R[2]+aT),
				cmd[5] + Math.ceil(w-R[2]+aL) +','+ Math.ceil(h+aT),
				cmd[6] + Math.floor(R[3]+aL) +','+ Math.ceil(h+aT),
				cmd[7] + Math.floor(0+aL) +','+ Math.ceil(h-R[3]+aT),
				cmd[8] + Math.floor(0+aL) +','+ Math.floor(R[0]+aT)
			];
			if (!direction) {
				coords.reverse();
			}
			var path = coords.join('');
			return path;
		};
	
		if (typeof el.bW == 'undefined') {
			this.vmlStrokeWeight(el);
		}
		var bW = el.bW;
		var rad = el.DD_radii.slice();
		
		/* determine outer curves */
		var outer = coords(true, el.dim.Width, el.dim.Height, rad, 0, 0, 2);
		
		/* determine inner curves */
		rad[0] -= Math.max(bW.Left, bW.Top);
		rad[1] -= Math.max(bW.Top, bW.Right);
		rad[2] -= Math.max(bW.Right, bW.Bottom);
		rad[3] -= Math.max(bW.Bottom, bW.Left);
		for (var i=0; i<4; i++) {
			rad[i] = Math.max(rad[i], 0);
		}
		var inner = coords(false, el.dim.Width-bW.Left-bW.Right, el.dim.Height-bW.Top-bW.Bottom, rad, bW.Left, bW.Top, 2);
		var image = coords(true, el.dim.Width-bW.Left-bW.Right+1, el.dim.Height-bW.Top-bW.Bottom+1, rad, bW.Left, bW.Top, 1);
		
		/* apply huge path string */
		el.vml.color.path = inner;
		el.vml.image.path = image;
		el.vml.stroke.path = outer + inner;
		
		this.clipImage(el);
	},
	
	nixBorder: function(el) {
		var s = el.currentStyle;
		var sides = ['Top', 'Left', 'Right', 'Bottom'];
		for (var i=0; i<4; i++) {
			el.runtimeStyle['padding' + sides[i]] = (parseInt(s['padding' + sides[i]], 10) || 0) + (parseInt(s['border' + sides[i] + 'Width'], 10) || 0) + 'px';
		}
		el.runtimeStyle.border = 'none';
	},
	
	clipImage: function(el) {
		var lib = br;
		if (!el.vmlBg || !lib.imgSize[el.vmlBg]) {
			return;
		}
		var thisStyle = el.currentStyle;
		var bg = {'X':0, 'Y':0};
		var figurePercentage = function(axis, position) {
			var fraction = true;
			switch(position) {
				case 'left':
				case 'top':
					bg[axis] = 0;
					break;
				case 'center':
					bg[axis] = 0.5;
					break;
				case 'right':
				case 'bottom':
					bg[axis] = 1;
					break;
				default:
					if (position.search('%') != -1) {
						bg[axis] = parseInt(position, 10) * 0.01;
					}
					else {
						fraction = false;
					}
			}
			var horz = (axis == 'X');
			bg[axis] = Math.ceil(fraction ? (( el.dim[horz ? 'Width' : 'Height'] - (el.bW[horz ? 'Left' : 'Top'] + el.bW[horz ? 'Right' : 'Bottom']) ) * bg[axis]) - (lib.imgSize[el.vmlBg][horz ? 'width' : 'height'] * bg[axis]) : parseInt(position, 10));
			bg[axis] += 1;
		};
		for (var b in bg) {
			figurePercentage(b, thisStyle['backgroundPosition'+b]);
		}
		el.vml.image.filler.position = (bg.X/(el.dim.Width-el.bW.Left-el.bW.Right+1)) + ',' + (bg.Y/(el.dim.Height-el.bW.Top-el.bW.Bottom+1));
		var bgR = thisStyle.backgroundRepeat;
		var c = {'T':1, 'R':el.dim.Width+1, 'B':el.dim.Height+1, 'L':1}; /* these are defaults for repeat of any kind */
		var altC = { 'X': {'b1': 'L', 'b2': 'R', 'd': 'Width'}, 'Y': {'b1': 'T', 'b2': 'B', 'd': 'Height'} };
		if (bgR != 'repeat') {
			c = {'T':(bg.Y), 'R':(bg.X+lib.imgSize[el.vmlBg].width), 'B':(bg.Y+lib.imgSize[el.vmlBg].height), 'L':(bg.X)}; /* these are defaults for no-repeat - clips down to the image location */
			if (bgR.search('repeat-') != -1) { /* now let's revert to dC for repeat-x or repeat-y */
				var v = bgR.split('repeat-')[1].toUpperCase();
				c[altC[v].b1] = 1;
				c[altC[v].b2] = el.dim[altC[v].d]+1;
			}
			if (c.B > el.dim.Height) {
				c.B = el.dim.Height+1;
			}
		}
		el.vml.image.style.clip = 'rect('+c.T+'px '+c.R+'px '+c.B+'px '+c.L+'px)';
	},
	
	pseudoClass: function(el) {
		var self = this;
		setTimeout(function() { /* would not work as intended without setTimeout */
			self.applyVML(el);
		}, 1);
	},
	
	reposition: function(el) {
		this.vmlOffsets(el);
		this.vmlPath(el);
	},
	
	roundify: function(rad) {
		this.style.behavior = 'none';
		if (!this.currentStyle) {
			return;
		}
		else {
			var thisStyle = this.currentStyle;
		}
		var allowed = {BODY: false, TABLE: false, TR: false, TD: false, SELECT: false, OPTION: false, TEXTAREA: false};
		if (allowed[this.nodeName] === false) { /* elements not supported yet */
			return;
		}
		var self = this; /* who knows when you might need a setTimeout */
		var lib = br;
		this.DD_radii = rad;
		this.dim = {};

		/* attach handlers */
		var handlers = {resize: 'reposition', move: 'reposition'};
		if (this.nodeName == 'A') {
			var moreForAs = {mouseleave: 'pseudoClass', mouseenter: 'pseudoClass', focus: 'pseudoClass', blur: 'pseudoClass'};
			for (var a in moreForAs) {
				handlers[a] = moreForAs[a];
			}
		}
		for (var h in handlers) {
			this.attachEvent('on' + h, function() {
				lib[handlers[h]](self);
			});
		}
		this.attachEvent('onpropertychange', function() {
			lib.readPropertyChanges(self);
		});
		
		/* ensure that this elent and its parent is given hasLayout (needed for accurate positioning) */
		var giveLayout = function(el) {
			el.style.zoom = 1;
			if (el.currentStyle.position == 'static') {
				el.style.position = 'relative';
			}
		};
		giveLayout(this.offsetParent);
		giveLayout(this);
		
		/* create vml elements */
		this.vmlBox = document.createElement('ignore'); /* IE8 really wants to be encased in a wrapper element for the VML to work, and I don't want to disturb getElementsByTagName('div') - open to suggestion on how to do this differently */
		this.vmlBox.runtimeStyle.cssText = 'behavior:none; position:absolute; margin:0; padding:0; border:0; background:none;'; /* super important - if something accidentally matches this (you yourseld did this once, Drew), you'll get infinitely-created elements and a frozen browser! */
		this.vmlBox.style.zIndex = thisStyle.zIndex;
		this.vml = {'color':true, 'image':true, 'stroke':true};
		for (var v in this.vml) {
			this.vml[v] = document.createElement(lib.ns + ':shape');
			this.vml[v].filler = document.createElement(lib.ns + ':fill');
			this.vml[v].appendChild(this.vml[v].filler);
			this.vml[v].stroked = false;
			this.vml[v].style.position = 'absolute';
			this.vml[v].style.zIndex = thisStyle.zIndex;
			this.vml[v].coordorigin = '1,1';
			this.vmlBox.appendChild(this.vml[v]);
		}
		this.vml.image.fillcolor = 'none';
		this.vml.image.filler.type = 'tile';
		this.parentNode.insertBefore(this.vmlBox, this);
		
		this.isImg = false;
		if (this.nodeName == 'IMG') {
			this.isImg = true;
			this.style.visibility = 'hidden';
		}
		
		setTimeout(function() {
			lib.applyVML(self);
		}, 1);
	}
	
};

try {
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
br.IEversion();
br.createVmlNameSpace();
br.createVmlStyleSheet();

if (br.IE8 && document.attachEvent && br.querySelector) {
	document.attachEvent('onreadystatechange', function() {
		if (document.readyState == 'complete') {
			var selectors = br.selectorsToProcess;
			var length = selectors.length;
			var delayedCall = function(node, radii, index) {
				setTimeout(function() {
					br.roundify.call(node, radii);
				}, index*100);
			};
			for (var i=0; i<length; i++) {
				var results = document.querySelectorAll(selectors[i].selector);
				var rLength = results.length;
				for (var r=0; r<rLength; r++) {
					if (results[r].nodeName != 'INPUT') { /* IE8 doesn't like to do this to inputs yet */
						delayedCall(results[r], selectors[i].radii, r);
					}
				}
			}
		}
	});
}



/* DOM & SCROLL ************************************************************/



/* pageCut */

	(function($){
	
		$.fn.pageCut = function( p ){
			
			var o = $.extend({
				animTimeOut : 500,
				animTimeIn : 400,
				animTypeOut : 'easeInOutQuad',
				animTypeIn : 'easeOutQuad',
				callback_show : function(){},
				callback_hide : function(){},
				width : 800,
				clickToHide : '.pc_close',
				source : 'default.php',
				clickToHide : '.pc_close'
			}, p);
			
			 var g = {
				loaded : false,
				htmlOriginal : null,
				fbURL : null
			}

			return this.click(function(event){
				event.preventDefault();
				h = $('body').height() < $(window).height() ? $(window).height() : $('body').height();

				$('.fbiframe').each(function(){
					$(this).attr('oldsrc', $(this).attr( 'src' ));
					$(this).attr('src','').css({
						'visibility' : 'hidden'
					});
				});	
				
				g.htmlOriginal = $('#dim').html();
				
				$('#dim').css({
					'visibility' : 'hidden'
				})
				
				$('<div><div id="pc_inner"></div></div>').attr({
					'id' : 'pc_container'
				}).css({
					'width' : '100%',
					'height' : h,
					'position' : 'absolute',
					'top' : 0,
					'left' : 0,
					'z-index' : 1000,
					'overflow' : 'hidden'
				}).appendTo('body');

				$('#pc_inner').css({
					'width' : '200%',
					'height' : '100%'
				});

				$('<div><div class="pc_orig"></div></div>').attr({
					'id' : 'pc_left',
					'class' : 'pc_side'
				}).css({
					'left' : 0
				}).appendTo('#pc_inner');

				$('<div></div>').attr({
					'id' : 'pc_content'
				}).css({
					'width' : 0,
					'height' : '100%',
					'background' : '#000',
					'float' : 'left',
					'overflow' : 'hidden'
				}).appendTo('#pc_inner');

				$('<div><div class="pc_orig"></div></div>').attr({
					'id' : 'pc_right',
					'class' : 'pc_side'
				}).css({
					'right' : 0
				}).appendTo('#pc_inner');

				$('.pc_side').css({
					'width' : '25%',
					'height' : '100%',
					'float' : 'left',
					'overflow' : 'hidden'
				});

				$('.pc_orig').css({
					'width' : '200%',
					'position' : 'absolute',
					'top' : 0
				}).html( g.htmlOriginal );
									
				
				$('<div></div>').attr({
					'class' : 'pc_close'
				}).css({
					'width' : '100%',
					'height' : '100%',
					'position' : 'absolute',
					'left' : '0px',
					'top' : '0px',
					'cursor' : 'pointer',
					'z-index' : 1000
				}).appendTo('.pc_side');
				
				$('#pc_left .pc_orig').css({
					'left' : 0
				});

				$('#pc_right .pc_orig').css({
					'right' : 0
				});
									
				$('#pc_left').animate({
					'margin-left' : -o.width / 2
				}, o.animTimeOut, o.animTypeOut, function(){
					if($.browser.msie){
						$('.pc_side .pc_close').css({
							'background' : 'white',
							'opacity' : .01
						})							
					}
				});

				$('#pc_content').animate({
					'width' : o.width
				}, o.animTimeOut, o.animTypeOut);
				
				if(g.loaded == false){
					$(window).bind( 'resize', function(){
						h = $('#pc_left .pc_orig').height() < $(window).height() ? $(window).height() : $('#pc_left .pc_orig').height();
						$('#pc_container').height(h);
					});
				}
				
				$( o.clickToHide ).click( function(){

					if($.browser.msie){
						$('.pc_side .pc_close').css({
							'background' : '',
							'opacity' : ''
						})							
					}

					$('#pc_left').animate({
						'margin-left' : 0
					}, o.animTimeIn, o.animTypeIn);

					$('#pc_content').animate({
						'width' : 0
					}, o.animTimeIn, o.animTypeIn, function(){
						$('#pc_container').remove();
						$('#dim').css({
							'visibility' : 'visible'
						});

						$('.fbiframe').each(function(){
							$(this).attr('src', $(this).attr( 'oldsrc' ));
							$(this).removeAttr('oldsrc').css({
								'visibility' : 'visible'
							});
						});							
					});
				});
			});			
		};
	})(jQuery);



/* pageSlide */

	(function($){
		
		$.fn.pageSlide = function( p ){
		
			var o = $.extend({
				animTime : 500,
				animType : 'easeInOutQuad',
				callback_show : function(){},
				callback_hide : function(){},
				width : 300,
				source : 'default.php',
				clickToHide : '#ps_overlay, .ps_close',
				bgOverlay : '#000',
				bgSidebar : '#000'
			}, p);
			
			if( !$('#ps_sidebar').length ){
				$('<div></div>').attr({
					'id' : 'ps_sidebar'
				}).css({
					'top' : 0,
					'right' : 0,
					'width' : 0,
					'height' : '100%',
					'display' : 'none',
					'position' : 'fixed',
					'background' : o.bgSidebar,
					'z-index' : 1000
				}).appendTo('body');
				$('<div></div>').attr({
					'id' : 'ps_inner'
				}).css({
					'width' : o.width,
					'height' : '100%',
					'display' : 'none'
				}).appendTo('#ps_sidebar');
				if( $('body').css('position') == 'static' ){
					$('body').css('position' , 'relative' );
				}
			}
			
			return this.each(function(){

				var s = $(this).attr('href') ? $(this).attr('href') : o.source;				
				$(this).click(function(event){
					var ml = parseInt( $('body').css( 'margin-left' ));
					event.preventDefault();
					$('<div></div>').attr({
						'id' : 'ps_overlay'
					}).css({
						'top' : '0px',
						'left' : '0px',
						'width' : '100%',
						'height' : '100%',
						'position' : 'fixed',
						'z-index' : 900,
						'opacity' : 0,
						'background' : o.bgOverlay
					}).appendTo('body');	
					$.get( s, function(data){
						$('#ps_inner').html(data).delay( o.animTime / 3 * 1 ).fadeIn( o.animTime / 3 * 2, o.animType );
					});
					$('body').css({
						'width' : $('body').width()
					}).animate({
						'margin-left' : ( ml - o.width ) + 'px'
					}, o.animTime, o.animType, o.callback_show );	
					$('#ps_sidebar').css({
						'display' : 'block'
					}).animate({
						'width' : o.width
					}, o.animTime, o.animType, function(){
						$('#ps_overlay').animate({
							'opacity' : .3
						}, o.animTime / 2, o.animType);
						$( o.clickToHide ).click( function(){
							$('#ps_overlay').css({
								'background' : 'transparent',
								'opacity' : 1
							})
							$('#ps_inner').fadeOut( o.animTime / 3 * 2, o.animType );
							$(this).unbind('click');
							$('body').animate({
								'margin-left' : ml + 'px'
							}, o.animTime, o.animType, o.callback_hide );
							$('#ps_sidebar').animate({
								'width' : 0								
							}, o.animTime, o.animType, function(){
								$(this).css({
									'display' : 'none'			
								});
								$('#ps_overlay').remove();
								$('body').css({
									'width' : 'auto'
								});
							});
						});
					});
				});
			});	
		};
	})(jQuery);



/* scrollBar */

	var _sb = {
			
		o : {
			where : null,
			what : null,
			type : 'vertical',
			sbid : null,
			animTime: 200,
			scrollTime: 400,
			scrollType: 'easeOutBack',
			minSize: 75,
			scrpx : 60,
			opacity : .5
		},

		init : function( o ){
		
			if( !$(o.sbid).length ){
				$( o.where ).append( '<div class="sb '+ o.type +'" id="' + o.sbid.split('#')[1] + '"><div class="sb_ '+ o.type +'"></div></div>' );
			}

			$(o.sbid).data('o', $.extend( {}, _sb.o , o ));
			_sb.create( o.sbid );

		},
		
		create : function(sbid){
		
			o = $(sbid).data('o');

			o.mt = parseInt( $( sbid ).css( 'margin-top' ));
			o.mr = parseInt( $( sbid ).css( 'margin-right' ));
			o.mb = parseInt( $( sbid ).css( 'margin-bottom' ));
			o.ml = parseInt( $( sbid ).css( 'margin-left' ));

			_w = $( o.where ).css( 'position' );
			if ( _w != 'absolute' && _w != 'relative' ){
				_w = $( o.where ).css( 'position', 'relative' );
			}
			
			if( o.type == 'vertical' ){
				$( o.what ).parent().add( sbid ).mousewheel( function(e, d){
					e.preventDefault();
					_sb.mouseScroll( d,  sbid );  
				});
			}	

			$( o.what ).parent().css( 'overflow', 'hidden' );
			
			if( o.type == 'vertical' ){
				$( sbid ).css({
					'right' : o.mr,
					'top' : o.mt
				}).css({
					'margin' : 0
				});
			}else{
				$( sbid ).css({
					'left' : o.ml,
					'bottom' : o.mb
				}).css({
					'margin' : 0
				});			
			}

			_sb.setDim( sbid );

			$(window).bind( 'resize', function(){
				_sb.setDim( sbid );
			});

			$( sbid + ' .sb_' ).mousedown( function( e ){
				e.preventDefault();
				_sb.startDrag( sbid, e.pageX, e.pageY );
				$( sbid ).unbind( 'mouseout' );
				return false;
			});			
		},

		scrollTo : function( sbid, obj ){
			
			if(sbid && obj){
				o = $( sbid ).data('o');
				o.wmt = -( $( o.what ).find('a[name="' + obj.attr('href').split('#')[1] + '"]').position().top );
				if( o.wmt < o.sh - o.wh ){
					o.wmt = o.sh - o.wh;
				}
				_sb.setMarginTop(sbid);
				$( o.what ).stop().animate({
					'margin-top' : o.wmt
				}, o.scrollTime, o.scrollType);
				$( sbid + ' .vertical').stop().animate({
					'margin-top' : o.ssmt
				}, o.scrollTime, o.scrollType);
			}
		},
		
		setMarginTop : function( sbid, h ){
			
			o = $( sbid ).data('o');

			if(!h){
				h = o.ssh;
			}
			
			return o.ssmt = -o.wmt / ( o.wh - o.wph ) * ( o.sh - h );
		},

		setMarginLeft : function( sbid, w ){
			
			o = $( sbid ).data('o');

			if(!w){
				w = o.ssw;
			}
			
			return o.ssml = -o.wml / ( o.ww - o.wpw ) * ( o.sw - w );
		},
		
		setDim : function( sbid ){

			o = $( sbid ).data('o');

			if( o.type == 'vertical' ){				
				o.sh = $( o.where ).height() - o.mt - o.mb;
				o.wph = $(o.what).parent().height(); 
				o.wh = $(o.what).height();
				o.wmt = parseInt($(o.what).css('margin-top'));
				
				$( sbid ).height( o.sh );
				a = o.wph / o.wh;
				k = o.wph - o.wh;
				k2 = o.wh - o.wph;
				
				if( o.wmt < k && k < 0 ){
					$(o.what).css('margin-top', k );
					o.wmt = k;
				}

				if ( a < 1 ){
					h = a * o.sh;
					if(h < o.minSize){
						h = o.minSize;
					}
					o.ssh = h;
					$( sbid + ' .sb_' ).stop().animate({
						'margin-top' : _sb.setMarginTop(sbid, h),
						'height' : h
					}, o.animTime );
					$( sbid ).fadeTo( 500, o.opacity );
//					$( sbid ).fadeIn( o.animTime );
				}else{
					o.ssmt = 0
					$( sbid + ' .sb_').css ( 'margin-top', o.ssmt );
					o.wmt = 0
					$( o.what ).css ( 'margin-top', o.wmt );
					o.ssh = o.sh;
					$( sbid + ' .sb_' ).height( o.ssh );
					$( sbid ).fadeOut( o.animTime );
				}
			}else{				
				o.sw = $( o.where ).width() - o.ml - o.mr;
				o.wpw = $(o.what).parent().width(); 
				o.ww = $(o.what).width();
				o.wml = parseInt($(o.what).css('margin-left'));
				
				$( sbid ).width( o.sw );
				a = o.wpw / o.ww;
				k = o.wpw - o.ww;
				k2 = o.ww - o.wpw;
				
				if( o.wml < k && k < 0 ){
					$(o.what).css('margin-left', k );
					o.wml = k;
				}

				if ( a < 1 ){
					w = a * o.sw;
					if(w < o.minSize){
						w = o.minSize;
					}
					o.ssw = w;
					$( sbid + ' .sb_' ).stop().animate({
						'margin-left' : _sb.setMarginLeft(sbid, w),
						'height' : w
					}, o.animTime );
					$( sbid ).fadeTo( 500, o.opacity );
//					$( sbid ).fadeIn( o.animTime );
				}else{
					o.ssml = 0
					$( sbid + ' .sb_').css ( 'margin-left', o.ssml );
					o.wml = 0
					$( o.what ).css ( 'margin-left', o.wml );
					o.ssw = o.sw;
					$( sbid + ' .sb_' ).width( o.ssw );
					$( sbid ).fadeOut( o.animTime );
				}
			}
		},
		
		startDrag : function( sbid, mX, mY ){
			
			o = $( sbid ).data('o');
			
			o.myk = mY;			
			o.tk = o.ssmt;
			o.mxk = mX;			
			o.lk = o.ssml;
			_sb.onDrag( sbid );			
		},
		
		onDrag : function( sbid ){
			
			o = $( sbid ).data('o');
			
			$(document).mousemove( function(e){
				if( o.type == 'vertical' ){
					var cst = e.pageY - o.myk + o.tk;
					if( cst < 0 ){
						cst = 0;
					}else if( cst > o.sh - o.ssh ){
						cst = o.sh - o.ssh;
					}
					o.ssmt = cst;
					$( sbid + ' .sb_' ).css ( 'margin-top', o.ssmt );
					ct = ( - cst / ( o.sh - o.ssh ) * ( o.wh - o.wph ) );
					if ( -ct >  o.wh - o.wph ){
						ct = o.wph - o.wh;
					}
					o.wmt = ct;
					$( o.what ).css( 'margin-top', o.wmt );
				}else{
					var csl = e.pageX - o.mxk + o.lk;
					if( csl < 0 ){
						csl = 0;
					}else if( csl > o.sw - o.ssw ){
						csl = o.sw - o.ssw;
					}
					o.ssml = csl;
					$( sbid + ' .sb_' ).css ( 'margin-left', o.ssml );
					cl = ( - csl / ( o.sw - o.ssw ) * ( o.ww - o.wpw ) );
					if ( -cl >  o.ww - o.wpw ){
						cl = o.wpw - o.ww;
					}
					o.wml = cl;
					$( o.what ).css( 'margin-left', o.wml );
				}
			});
			$(document).mouseup( function(){

				$(this).unbind( 'mousemove' );
				$(this).unbind( 'mouseup' );
			});
		},
		
		mouseScroll : function( d, sbid ){

			o = $( sbid ).data('o');		
			k = o.wph - o.wh;
			t = o.wmt + (d * o.scrpx);

			if( t 	> 0 ){
				t = 0;
			}else if( t < k ){
				t = k;
			}

			if( o.wph - o.wh < -1 ){
				o.wmt = t;
				$( o.what ).css( 'margin-top', o.wmt );
				$( sbid + ' .sb_' ).css ( 'margin-top', _sb.setMarginTop(sbid) );
			}	
		}
	};



/* scrollTo */

	(function($){
		
		$.fn.scrollTo = function( p ){
		
      		o = $.extend({					
				addHash : true,
				animTime : 750,
				animType : 'easeInOutQuart'
      		}, p);
        
			return this.find('a[href*="#"]').each(function(){
				$(this).unbind('click');
				$(this).click(function(event){
					event.preventDefault();				
					var href = $(this).attr('href');
					var num = href.split('#')[1];
					$('html:not(:animated),body:not(:animated)').animate({ scrollTop :  $('html a[name="'+ num +'"]').offset().top }, o.animTime, o.animType, function(){
						if( o.addHash == true ){
							window.location.hash = href;
						}
					});
				});	
			});	
		};
	})(jQuery);



/* mousewheel */

	(function($) {

		var types = ['DOMMouseScroll', 'mousewheel'];

		$.event.special.mousewheel = {
	    	setup: function() {
	        	if ( this.addEventListener )
	            	for ( var i=types.length; i; )
					this.addEventListener( types[--i], handler, false );
	        	else
	            	this.onmousewheel = handler;
	    	},
    
	    	teardown: function() {
	        	if ( this.removeEventListener )
	            	for ( var i=types.length; i; )
					this.removeEventListener( types[--i], handler, false );
				else
					this.onmousewheel = null;
	    	}
		};

		$.fn.extend({
	    	mousewheel: function(fn) {
				return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
	    	},
			unmousewheel: function(fn) {
	        	return this.unbind("mousewheel", fn);
	    	}
		});

		function handler(event) {
		    var args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true;
    
		    event = $.event.fix(event || window.event);
		    event.type = "mousewheel";
    
		    if ( event.wheelDelta ) delta = event.wheelDelta/120;
		    if ( event.detail     ) delta = -event.detail/3;
    
		    // Add event and delta to the front of the arguments
		    args.unshift(event, delta);

		    return $.event.handle.apply(this, args);
		}
	})(jQuery);



/* FORMS & INPUTS ************************************************************/



/* repCheckbox */

	( function($) {
		$.fn.repCheckbox = function() {
	
			return this.each(function() {
				
				// Create the replacement element ....
				var tmp = $('<div></div>').insertAfter($(this));
				
				// Store some neccesary datas ...
				$(tmp).data('name', $(this).attr('name') );
				$(tmp).data('status', $(this).attr('checked') );
				
				// Remove the original checkbox ...
				$(this).remove();
				
				// Here we comes ....
				$(tmp).toggle(
					function() { 
						
						// Add the 'active' class
						$(this).attr('class', 'ch_active');
						
						// Create the hidden input field
						var rep = $('<input type="hidden" value="1" />').insertAfter( $(this) );
						
						// Set original params ...
						$(rep).attr('name', $(this).data('name') );
					}, 
					
					function() { 
						$(this).attr('class', 'ch_inactive');
						$(this).next('input[type=hidden]').remove();
					}
				);
				
				// Finally, check for original status
				if( $(tmp).data('status') == true ) {
					$(tmp).click();
				} else {
					$(tmp).attr('class', 'ch_inactive');
				}
				
			});
		};
	})( jQuery );



/* repRadiobutton */

	( function($) {
		$.fn.repRadioButton = function() {
			
			return this.each(function() {
				
				// Create the replacement element ....
				var tmp = $('<div></div>').insertAfter($(this));
				
				// Store some neccesary datas ...
				$(tmp).data('name', $(this).attr('name') );
				$(tmp).data('value', $(this).attr('value') );
				$(tmp).addClass('rad_inactive');
				$(tmp).addClass('radio_'+$(this).attr('name')+'');
				
				// Remove the original checkbox ...
				$(this).remove();
				
				// Here we comes ....
				$(tmp).click(function() {
					
					// Remove active style and remove existing hidden fields ...
					$(this).parent('form').find('div.radio_'+$(this).data('name')+'').each(function() {
						$(this).removeClass('rad_active');
						$(this).addClass('rad_inactive');
						
						if( $(this).next().is('input[name='+$(this).data('name')+']') ) {
							$(this).next().remove();
						}
					});
					
				// Maintain styles ...
				$(this).removeClass('rad_inactive');
				$(this).addClass('rad_active');
					
				var rep = $('<input type="hidden">').insertAfter($(this));
				$(rep).attr('name', $(this).data('name') );
				$(rep).attr('value', $(this).data('value') );
				});
			
				// Set the default
				if ($(this).attr('checked') ) {
					$(tmp).click();
				}
			
			});
		};
	})( jQuery );



/* repSelectbox */

	( function($) {
		$.fn.repSelectbox = function() {
	
			return this.each(function() {
				
				// Create the replacement element ....
				var tmp = $('<ul class="select_box"></ul>').insertAfter($(this));
				var hid = $('<input type="hidden" name="'+$(this).attr('name')+'">').insertAfter($(tmp));

				
				// Iterate over the original select box
				$(this).children().each(function() {
					var tmpOpt = $('<li>'+$(this).text()+'</li>').appendTo( $(tmp) );
						$(tmpOpt).data('val', $(this).val());
						
						// Make selected on click
						$(tmpOpt).click(function() {
							$(this).parent('ul').children('li:first').text( $(this).text() );
							$(hid).attr('value', $(tmpOpt).data('val'));
						});
				});
				
				// Set the selected item by default
				$('<li>'+$(this).children(':selected').text()+'</li>').prependTo( $(tmp) );
				$(hid).attr('value', $(this).children(':selected').attr('value'));
				
				// Hover effect
				$(tmp).mouseover(function(){ $(this).css('height', 'auto'); });
				$(tmp).mouseout(function(){ $(this).css('height', '20px'); });
				
				// Remove original element
				$(this).remove();
			});
		};
	})( jQuery );



/* inputClick */
		
		( function($) {
			$.fn.inputClick = function() {

				this.each(function() {
					$(this).data('val', $(this).val());
				});

				this.focus(function() {
					if($(this).val() == $(this).data('val')) {
						$(this).val('');
					}
				});

				this.blur(function() {
					if($(this).val() == '') {
						$(this).val( $(this).data('val') );
					}
				});

				return this;

			};
		})( jQuery );	



/* LINKS ************************************************************/



/* gMapAppend */

	(function($){
	
		$.fn.gMapAppend = function( p ){
		
			var o = $.extend({
				lng : 'hu',
				timeOut : 1,
				zoom : 15,
				outerZoom : 17,
				width : 270,
				height : 130,
				mapType : 'terrain',
				outerMapType : 'roadmap',
				showBubble : true,
				marker : {
					color : 'red',
					label : 'o'					
				},
				gMapObj : this
			}, p);
			
			o.iwloc = o.showBubble ? '' : '&amp;iwloc=';

			switch(o.outerMapType){
				case 'roadmap':
				o.t = '';
				break;
				case 'terrain':
				o.t = 'p';
				break;
				case 'satellite':
				o.t = 'h';
				break;			
				default:
				o.t = '';
			}
			
			if( !o.address ){
				o.address = this.html();
			}			
						
			function gmapappend(){
				o.gMapObj.html('<a class="gmap" target="_blank" href="http://maps.google.com/maps?t='+o.t+o.iwloc+'&amp;hl='+o.lng+'&amp;q='+o.address+'&amp;ie=UTF8&amp;hnear='+o.address+'&amp;z='+o.outerZoom+'&amp;output=embed"><img src="http://maps.google.com/maps/api/staticmap?center='+o.address+'&amp;zoom='+o.zoom+'&amp;size='+o.width+'x'+o.height+'&amp;maptype='+o.mapType+'&amp;markers=color:'+o.marker.color+'|label:'+o.marker.label+'|'+o.address+'&amp;sensor=false"></a>').css({
					'visibility' : 'visible'
				}).css({
					'opacity' : .3
				}).hover(
					function(){
						$(this).stop().animate({
							'opacity' : 1
						});
					},
					function(){
						$(this).stop().animate({
							'opacity' : .3
						});						
					}				
				);
			}

			setTimeout( function(){ gmapappend(); }, o.timeOut);

			return this;
		};
	})(jQuery);



/* fbAppend */

	(function($){
	
		$.fn.fbAppend = function( p ){
		
			var o = $.extend({
				lng : 'hu_HU',
				layout : 'button_count',
				faces : 'true',
				width : 100,
				height : 21,
				action : 'like',
				color : 'light',
				timeOut : 1000,
				fbObj : this
			}, p);
			
			if( !o.url ){
				o.url = this.html();
			}
						
			function fbappend(){
				o.fbObj.html('<iframe class="fbiframe" src="http://www.facebook.com/plugins/like.php?href='+ o.url +'&amp;layout='+ o.layout +'&amp;show_faces='+ o.faces +'&amp;width='+ o.width +'&amp;action='+ o.action +'&amp;colorscheme='+ o.color +'&amp;height='+ o.height +'" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:'+ o.width +'px; height:'+ o.height +'px;" allowTransparency="true"></iframe>').css({
					'visibility' : 'visible',
					'opacity' : .3
				}).hover(
					function(){
						$(this).stop().animate({
							'opacity' : 1
						});
					},
					function(){
						$(this).stop().animate({
							'opacity' : .3
						});						
					}				
				);
			}

			setTimeout( function(){ fbappend(); }, o.timeOut);

			return this;
		};
	})(jQuery);



/* noSpam */

	(function($){
		
		$.fn.noSpam = function(){
		
			return this.find(' .mapson').each(function(){

				if($(this).html().indexOf('href') == -1){
					var _temp = $(this).html().split(',,');
					var _eadd = _temp[1] + '@' + _temp[0] + '.' + _temp[2]; 
					var _etxt = _temp[3] ? _temp[3] : _eadd;
					$(this).html('<a href="mailto:' + _eadd + '">' + _etxt + '</a>');
				}				
			});
		};
	})(jQuery);
		


/* setBlank */

	(function($){
		
		$.fn.setBlank = function(){

			return this.find('a[href*="http:"]').each(function(){
				if(!$(this).attr( 'target' )){
					$(this).attr({ 'target' : '_blank' });
				}
			});	
		};
	})(jQuery);

