// stats
var visit, unique = pi = 0;
// cookies enabled?
var ce =(navigator.cookieEnabled) ? 1 : 0;
if (typeof navigator.cookieEnabled == 'undefined' && !ce) {
	document.cookie = 'tcookie';
	ce = (document.cookie.indexOf('tcookie') != -1) ? 1 : 0
};
// framebreaker
if (self != top && document.referrer.indexOf('google.') > 0) {
	top.location.href = self.location.href;
};
// shorten document.getElementById (very short dollar function)
function _$(i) {
	return document.getElementById(i);
};
// show element (id)
function show(i) {
	m = _$(i).style;
	m.visibility = 'visible';
	m.display = 'inline';
};
// hide element (id)
function hide(i) {
	m = _$(i).style;
	m.visibility = 'hidden';
	m.display = 'none';
};
// set mouseover title (title, element_id)
function st(t, i) {
	t.title = _$(i).firstChild.nodeValue;
};
// set cookie (name, value, days)
function sc(n, v, d) {
	// expires
	var e = '';
	if (d) {
		var t = new Date();
		t.setTime(t.getTime()+(d * 24 * 60 * 60 * 1000));
		e = '; expires=' + t.toGMTString();
	}
	document.cookie = n + '=' + v + e + '; path=/';
};
// get cookie (name)
function gc(n) {
	n += '=';
	// string
	var s = document.cookie.split(';');
	for(var i = 0; i < s.length; i++) {
		// value
		var v = s[i];
		while (v.charAt(0) == ' ') {
			v = v.substring(1, v.length);
		}
		if (v.indexOf(n) == 0) {
			return v.substring(n.length, v.length);
		}
	}
	return false;
};
// delete cookie (name)
function dc(n) {
	sc(n, '', -1);
};
// array_unique (array)
function au(a){
	var s = {};
	for(var i=0,j=a.length;i<j;i++){
		s[a[i]] = a[i];
	}
	a = [];
	for(var i in s){
		a.push(i);
	}
	return a;
}
// obtain window size
var ws = '';
function ows () {
	ws = window.innerWidth ? window.innerWidth : document.body && document.body.offsetWidth ? document.body.offsetWidth : screen.width;
}
// shrink all images (index of first image)
function sai(s) {
	if (document.images.length) {
		var i = document.images;
		for (var x = s; x < i.length; x++) {
			if (i[x].width * 2 > ws) {
				if (typeof i[x].ow == 'undefined') {
					i[x].ow = i[x].width;
					i[x].oh = i[x].height;
				}
				i[x].width = i[x].ow / (i[x].ow / (ws / 2));
				if (i[x].height == i[x].oh) {
					i[x].height = i[x].height / (i[x].ow / (ws / 2));
				}
				if (i[x].parentNode.nodeName != 'A') {
					i[x].onclick = ri;
					i[x].title = i[x].src;
					i[x].className = 'resized';
				}
			}
		}
	}
};
// restore image (element)
function ri(e) {
	var o = window.event ? window.event.srcElement : e.target;
	o.width = o.ow;
	if (o.height != o.oh) {
		o.height = o.oh;
	}
	o.onclick = si;
};
// shrink image (element)
function si(e) {
	var o = window.event ? window.event.srcElement : e.target;
	o.width = o.ow / (o.ow / (ws / 2));
	if (o.height == o.oh) {
		o.height = o.height / (o.ow / (ws / 2));
	}
	o.onclick = ri;
};
// show google background image for search box
function sgbi() {
	var f = _$('cse-search-box');
	if (!f) {
		f = _$('searchbox_demo');
	}
	if (f && f.q) {
		var q = f.q;
		var n = navigator;
		var l = location;
		if (n.platform == 'Win32') {
			q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;';
		}
		var b = function() {
			if (q.value == '') {
				q.style.background = '#FFFFFF url(img/1/google.gif) left no-repeat';
			}
		};
		var f = function() {
			q.style.background = '#ffffff';
		};
		q.onfocus = f;
		q.onblur = b;
		if (!/[&?]q=[^&]/.test(l.search)) {
			b();
		}
	}
};
// get random number
function mt_rand(min, max) {
	return Math.floor(Math.random() * (max - min + 1)) + min;
}
// check if variable is set
function isset(v) {
	if (typeof(v) == 'undefined' || v === null) {
		return false;
	}
	return true;
};
// get parent node of calling script
function gpn($n) {
	var $n = !$n ? document.documentElement : $n.parentNode;
	while ($n.lastChild) $n = $n.lastChild;
	return $n.parentNode;
}
// body loader
function bl(a, b, c) {
	// shrink all images
	sai(a);
	// get icq status images
	if (typeof icq_status != 'undefined') {
		icq_status.display_status();
	}
};
// footer loader
function fl(a, b, c) {
	// refresh session by interval
	if (document.images) {
		setInterval(function() {
			(new Image).src = '/rs.php?s=' + a + '#d=' + (new Date).getTime();
		}, 295000);
	}
};
// get page impression
pi = gc('pi');