/* globals */
		// visit visitor status
var visit = 0,
		// unique visitor status
		unique = 0,
		// page impressions
		pi = 0,
		// cookie enabled status
		ce = 0,
		// window size
		ws = 0;
/* functions */
// cookies enabled?
if (typeof navigator.cookieEnabled == 'undefined') {
	document.cookie = 'tcookie';
	ce = (document.cookie.indexOf('tcookie') != -1) ? 1 : 0;
}
else if (navigator.cookieEnabled) {
	ce = 1;
}
// google 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);
}
// get element style (id, attribut)
function ges(e, a) {
	e = _$(e);
	return e.currentStyle ? e.currentStyle[a] : document.defaultView.getComputedStyle(e, null).getPropertyValue(a);
}
// show element (id, content)
function show(i, c) {
	var s = _$(i).style;
	s.display = 'inline';
	s.visibility = 'visible';
	if (typeof c != 'undefined') {
		c[0].innerHTML = c[2];
	}
}
// hide element (id, content)
function hide(i, c) {
	var s = _$(i).style;
	s.visibility = 'hidden';
	s.display = 'none';
	if (typeof c != 'undefined') {
		c[0].innerHTML = c[1];
	}
}
// toggle element (id, content)
function toggl(i, c) {
	if (ges(i, 'visibility') == 'hidden' || ges(i, 'display') == 'none') return show(i, c);
	return hide(i, c);
}
// 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) {
	var t = new Date();
	document.cookie = n + '=' + v + (d ? '; expires=' + (t.setTime(t.getTime()+(d * 24 * 60 * 60 * 1000))).toGMTString() : '') + '; path=/';
}
// get cookie (name)
function gc(n) {
	n += '=';
			// complete cookie string
	var s = document.cookie.split(';'),
			i, v;
	for(i = 0; i < s.length; i++) {
		// value
		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 null;
}
// delete cookie (name)
function dc(n) {
	sc(n, '', -1);
}
// array_unique (array)
function au(a){
	var s = {},
			i;
	for(i = 0, j = a.length; i < j; i++){
		s[a[i]] = a[i];
	}
	a = [];
	for(i in s){
		a.push(i);
	}
	return a;
}
// obtain window size
function ows () {
	ws = window.innerWidth ? window.innerWidth : document.body && document.body.offsetWidth ? document.body.offsetWidth : screen.width;
}
// shrink all images (start index of first image)
function sai(x) {
	if (document.images.length) {
		var i = document.images;
		for (x; 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'),
			q = f && f.q ? f.q : 0,
			n = navigator,
			l = location,
			b;
	if (q) {
		if (n.platform == 'Win32') {
			q.style.cssText = 'border:1px solid #7e9db9;padding:2px;';
		}
		b = function() {
			if (q.value == '') {
				q.style.background = '#fff url(img/1/google.gif) left no-repeat';
			}
		};
		q.onfocus = function() {
			q.style.background = '#fff';
		};
		q.onblur = b;
		if (!/[&?]q=[^&]/.test(l.search)) {
			b();
		}
	}
}
// get random number (min, max)
function mt_rand(a, z) {
	return Math.floor(Math.random() * (z - a + 1)) + a;
}
// check if variable is set
function isset(v) {
	if (typeof(v) == 'undefined' || v === null) {
		return 0;
	}
	return 1;
}
// get parent node of calling script (object)
function gpn(o) {
	o = !o ? document.documentElement : o.parentNode;
	while (o.lastChild) o = o.lastChild;
	return o.parentNode;
}
// body loader
function bl(a, b, c) {
	// shrink all images
	sai(a);
	// get icq status images
	if (typeof icq_status != 'undefined' && icq_status != null) {
		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 = ce ? gc('pi') : 1;
