function gebi(id) {return document.getElementById(id);}
function $(id) {return document.getElementById(id);}
var browser = (function(){
	var ua = navigator.userAgent.toLowerCase();
	return {
		agent: ua,
		ie: ua.indexOf('msie')!=-1,
		ie5: ua.indexOf('msie 5')!=-1,
		ie6: ua.indexOf('msie 6')!=-1,
		ie7: ua.indexOf('msie 7')!=-1,
		ie8: ua.indexOf('msie 8')!=-1,
		ff: ua.indexOf('firefox')!=-1,
		ff1: ua.indexOf('firefox/1')!=-1,
		ff2: ua.indexOf('firefox/2')!=-1,
		ff3: ua.indexOf('firefox/3')!=-1,
		opera: ua.indexOf('opera')!=-1,
		op9: ua.indexOf('opera/9')!=-1,
		mrsputnik: ua.indexOf('mrsputnik')!=-1
	};
})();
function createElement(name,attr) {
	var e=document.createElement(name);
	if(attr){for(var x in attr){e.setAttribute(x,attr[x]);}}
	return e;
}
function absPosition(obj) {
	var ox=0,oy=0;
	while (obj) {
		ox += obj.offsetLeft;
		oy += obj.offsetTop;
		if (obj.offsetParent == null) obj = (obj.nodeName=="BODY")?null:obj.parentNode;
		if (obj!=null) obj = obj.offsetParent;
	}
	return {x:ox,y:oy};
}
function win2url(str) {
	var trans = [];
	for (var i=0x410; i<=0x44F; i++)
		trans[i] = i-0x350;
	trans[0x401] = 0xA8;
	trans[0x451] = 0xB8; // symbol ימ ;-)
	trans[0x023] = 0x23; // symbol #
	trans[0x026] = 0x26; // symbol &
	var ret = [];
	for (var i=0; i<str.length; i++) {
		var n = str.charCodeAt(i);
		if (typeof trans[n] != 'undefined')
			n = trans[n];
		if (n <= 0xFF)
			ret.push(n);
	}
	return escape(String.fromCharCode.apply(null, ret));
}
if (!window.encodeURIComponent) {
	window.encodeURIComponent = win2url;
}
function buildURL(a) {
	var i=0,u='';
	for (var x in a) {u+=(((i++)===0)?'':'&')+x+'='+a[x];}
	return u;
}
function redirect(u, ret) {
	document.location.href ? document.location.href = u : window.location = u;
	return ret || false;
}
/* EVENT */
function addHandler(o,e,h) {
	if(typeof o.addEventListener!='undefined')
		o.addEventListener(e,h,false);
	else if(typeof o.attachEvent!='undefined')
		o.attachEvent('on'+e,h);
	else
		throw "Incompatible browser";
}
function preventDefault(e) {
	e = e || window.event;
	if (typeof( e.preventDefault ) !== 'undefined') {
		e.preventDefault();
	} else {
		e.returnValue = false;
	}
	return e;
}
function stopPropagation(e) {
	e = e || window.event;
	if (e.stopPropagation) {
		e.stopPropagation();
	} else {
		e.cancelBubble = true;
	}
	return e;
}
function IN_SET() {
	var args = arguments,
		l = args.length,
		x = false;
	while (l--) {
		if (this.p === args[l]) {
			return x = args[l];
		}
	}
	return x;
}
function getParentElementByTagName(o, tag) {
	var x, y=false;
	while (o != null) {
		x = o.nodeName.toLowerCase();
		if (IN_SET.call({p:x}, tag)) {
			y=o;
			break;
		}
		o=o.parentNode;
	}
	return y;
}

function suggestON() {
	try {
		var s = gebi("XHR_CrossFrame").contentWindow._s;
		return s;
	}
	catch (e) {
		return false;
	}
}
function clickFromSuggest() {
	var s = suggestON();
	if (s) {
		s = (s.submitType === 'keydown' || s.submitType === 'click');	
	}
	return s;
}
function switchOnOffSuggest(t) {
	var s = suggestON();
	if (!s) return false;
	switch (t) {
		case "on":
			s.setIgnored(false);
		break;
		case "off":
			s.setIgnored(true);
		break;
	}
	return true;
}

/**
 * (c)2008 DriverX
 */