//http://deziddon.com/mkiscript
(function() {
	var ieP = '/media/js/';

	var uA = ' js';
	var ie = /*@cc_on!@*/false;

	if (ie) {
		if (!document.querySelectorAll) {
			document.write('<scri'+'pt src="'+ ieP + 'mkie.js"></scri'+'pt>')
			document.write('<scri'+'pt src="'+ ieP + 'mkiScript.js"></scri'+'pt>');
			return;
		}
		var re = new RegExp('MSIE ([0-9]{1,}[\.0-9]{0,})');
		if (re.exec(navigator.userAgent) != null) var rv = parseInt(RegExp.$1);	
		uA += ' ie ie'+ rv;		
	}

	var $ = function(s) {
		if (typeof s === 'string') return document.querySelectorAll(s);
		return s;
	};

	var distinct = function(a) {
		var r = [];
		o:for (var i = 0, n = a.length; i < n; i++) {
			for (var x = 0, y = r.length; x < y; x++) {
				if (r[x] == a[i]) continue o;
			}
			r[r.length] = a[i];
		}
		return r;
	};

	var addEvent = function(el, t, f) {
		t = t.toLowerCase();
		if (window.addEventListener) {
			if (t === 'mouseenter' || t === 'mouseleave') {
				var mEnter = function(f) {
					return function(e) {
						var targ = e.relatedTarget;
						if (el === targ || isChild(el, targ)) return;
						f.call(el, e);
					}
				};
				var isChild = function(p, c) {
					if (p === c) return false;
					while (c && c !== p) { 
						c = c.parentNode;
					}
				   return c === p;
				};		
				t = t.replace('enter', 'over').replace('leave', 'out');
			 	f = mEnter(f);
			}
			if (t === 'domcontentloaded') t = 'DOMContentLoaded';
			try {el.removeEventListener(t, f, false);} catch(e) {}
			el.addEventListener(t, f, false);
		} else if (window.attachEvent) {
			if (t === 'domcontentloaded') {
				(function() {
					try {document.documentElement.doScroll('left');} catch (e) {setTimeout(arguments.callee, 50);return;}
					f();
				})();
			} else {
				if (el[t + f]) {
					el.detachEvent('on' + t, el[t + f]);
					el['x' + t + f] = null;
				}				
				el['x' + t + f] = f;
			    el[t + f] = function() {
			    	el['x' + t + f ](window.event);
			    };
				el.attachEvent('on' + t, el[t + f]);
			}
		}	
	};
	
	var push = function(l, a) {
		for (var i = 0, j = l.length; i < j; i++) {
			if (typeof l[i] === 'string') {
				var s = $(l[i]);
				for (var x = 0, z = s.length; x < z; x++) {
					a.push(s[x]);
				}
			} else {
				a.push(l[i]);
			}
		}
		a = distinct(a);
	};	

	var M = function(l) {
		this.els = [];
		this.fns = [];		
		this.s = [];
		this.s.push(l);
		this.stopAnim = false;
		push(l, this.els);
		return this;
	};

	var p = M.prototype;
	p.ie = ie;
	p.$ = $;
	p.distinct = distinct;
	p.DOM = false;

	addEvent(document, 'DOMContentLoaded', function() {
		p.DOM = true;
	});
	addEvent(window, 'load', function() {
		p.DOM = true;
	});

	p.push = function(l) {
		this.s.push(l);	
		push(l, this.els);
		return this;
	};

	p.each = function(f) {
		for (var i = 0, x = this.els.length; i < x; ++i) {
			f.call(this, this.els[i], i);
		}
		return this;
	};

	p.on = function(t, f) {
		this.each(function(el) {
			addEvent(el, t, f);
		});
		this.fns.push([t, f]);		
		return this;
	};
	
	p.fire = function(t, o) {
		if (document.createEvent) {
			var e = document.createEvent('HTMLEvents');
			e.initEvent(t, true, true );
			return !o.dispatchEvent(e);
		}
		var e = document.createEventObject();
		return o.fireEvent('on'+ t, e)
	};	
	
	p.style = function(p, v) {
		this.each(function(el) {
			var u = v;
			if (p === 'opacity') {
				el.style['filter'] = 'alpha(opacity='+ u +')';
				u = u / 100;
			}
			el.style[p] = u;
		});
		return this;
	};

	p.css = function(o) {
		for (var p in o) {
			this.style(p, o[p]);
		}
		return this;
	};

	p.currentStyle = function(s, l) {
		if (!l) l = this.get();
		if (l.currentStyle) return l.currentStyle[s];
		if (window.getComputedStyle) return document.defaultView.getComputedStyle(l, null).getPropertyValue(s);
	};

	p.anim = function(f, b, e, t, c) {
		var d = this;
		var nd = new Date().getTime() + t;
		for (var p in b) {
			e[p] -= b[p];
		}
		(function() {
			if (d.stopAnim) return;
			var k = (t - (nd - new Date().getTime()));
			if (t <= k) k = t;	
			for (var p in b) {
				if (p === 'scrollLeft' || p === 'scrollTop') {
					d.each(function(el) {
						el[p] = f(k, b[p], e[p], t);
					});
				} else {
					var m = (p === 'opacity') ? '' : 'px';
					d.style(p, f(k, b[p], e[p], t) + m);
				}
			}
			if (k === t) {
				if (c) c();
			} else {
				setTimeout(arguments.callee, 20);
			}
		})();
		return this;
	};

	p.stop = function(b) {
		if (!b) b = true;
		this.stopAnim = b;
		return this;
	};

	p.easeCubic = function(t, b, c, d) {
		if ((t /= d / 2) < 1) return (c / 2 * t * t * t + b) * 1;
		return (c / 2 * ((t -= 2) * t * t + 2) + b) * 1;
	};

	p.xhr = function(u, p, s, f) {
		var x = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
		if (p == '') {
			x.open('GET', u, true);
		} else {
			x.open('POST', u, true);
			x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
		}
		x.onreadystatechange = function() {
			if (x.readyState === 4) {
				var r = x.responseText;
				if (x.status === 200) {
					if (s) s(r, x);
				} else {
					if (f) f(r, x);
				}
			}
		};
		x.send(p);
		return this;
	};
	
	p.load = function(s, c) {
		var h = $('head')[0];
		var f = document.createElement('script');
		f.type = 'text/javascript';
		f.setAttribute('async', 'true');
		f.onloadDone = false;
		if (c) {
			f.onload = function() {
				f.onloadDone = true;
				c();
			};
			f.onreadystatechange = function() {
				if ((f.readyState === 'loaded' || f.readyState === 'complete') && !f.onloadDone) {
					f.onloadDone = true;
					c();
				}
			};
		}
		f.src = s;
		h.insertBefore(f, h.firstChild);
	};	

	p.html = function(t) {
		var h = this.get();
		if (t) h.innerHTML = t;
		return h.innerHTML;
	};

	p.text = function(t) {
		var h = this.get();
		if (h.innerText) {
			if (t) h.innerText = t;
			return h.innerText;
		}
		if (t) h.textContent = t;
		return h.textContent;
	};

	p.get = function(i) {
		if (!i) i = 0;
		return this.els[i];
	};	
	
	p.offset = function(o) {
		if (!o) o = this.get();
		o = $(o);
		var l = 0, t = 0, w = o.offsetWidth, h = o.offsetHeight;
		do {
			l += o.offsetLeft;
			t += o.offsetTop;
		} while (o = o.offsetParent);
		return {left: l, top: t, width: w, height: h};
	};

	p.preventDefault = function(e) {
		if (!e) e = window.event;
		e.cancelBubble = true;
		e.returnValue = false;
		if (e.preventDefault) e.preventDefault();
		return this;
	};

	p.plugin = function(n, f) {
		p[n] = f;
		return this;
	};

	p.requery = function() {
		for (var i = 0, j = this.s.length; i < j; i++) {
			push(this.s[i], this.els);
		}
		this.els = distinct(this.els);
		this.each(function(el) {
			for (var i = 0, j = this.fns.length; i < j; i++) {
				addEvent(el, this.fns[i][0], this.fns[i][1]);	
			}
		});		
		return this;
	};

	p.ready = function(f) {
		(function() {
			if (p.DOM) return f();
			setTimeout(arguments.callee, 1);
		})();
		return this;
	};

	window.M$ = function() {
		return new M(arguments);
	};

	document.documentElement.className += uA;
})();

try {

	var PFQ = M$('body');
	
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-9564324-1']);
	_gaq.push(['_trackPageview']);	
	
	
	PFQ.load(('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js');
	
	PFQ.ready(function() {	
		var $i = function(o) {
			if (typeof o === 'string') return document.getElementById(o);
			return o;
		};
		
		if (! PFQ.ie) {
			var contactEmail = $i('email');
			if (contactEmail) {
				contactEmail.focus();
			}
			var youremail = $i('youremail');
			if (youremail) {
				youremail.focus();
			}	
		}
			
		setTimeout(function() {
			var hdr = $i('header');
			if (hdr) {
				$i('header').innerHTML = '<object type="application/x-shockwave-flash" data="http://pfq.ie/media/fla/top.swf" width="988" height="158"><param name="movie" value="http://pfq.ie/media/fla/top.swf" /><param name="wmode" value="transparent" /></object>';
			}
					
			var propertyPage = M$('.photoGallery');
			if (propertyPage.els.length > 0) {	
				gPlus = document.createElement('li');
				$gPlus = M$(gPlus);
				$gPlus.css({opacity: 0, backgroundImage: 'none', marginLeft: '-27px', marginTop: '4px'});				
				gPlus.innerHTML = '<g:plusone size="small"></g:plusone> <fb:like show_faces="false" layout="button_count" width="80"></fb:like>';
				$i('ops').appendChild(gPlus);
				PFQ.load('https://apis.google.com/js/plusone.js', function() {
					setTimeout(function() {
						$gPlus.anim(PFQ.easeCubic, {opacity: 0}, {opacity: 100}, 1100);
					}, 250);
				});								
				PFQ.load('http://connect.facebook.net/en_US/all.js#xfbml=1');
			}
			
			PFQ.load('/media/js/photogallery.js');
		}, 500);	
	});
} catch(e) {}
