var menuArrowPositions=new Array(27,120,228,320,424,530,622,703); //pozycje Arrowa dla strony glownej
var menuArrowPositionsAdmin=new Array(25,97,190,285,370,507); //pozycje Arrowa dla administracji

function doerror(e,a,x,js) {
	try {
		if(!top.userDebugMode && !top.adminDebugMode) return true;
		if(js) {
			if(typeof(e)=="object") {
				var tmpE='';
				for(var fi in e) tmpE+=fi+'_'+e[fi]+'_';
				e=tmpE;
			};
		};
		var se="?jsError"+jsVersion+"="+((!js)?0:1)+"&f="+escape(a)+"&err="+escape(e)+"&l="+escape(x)+"&agn="+escape(navigator.userAgent)+"&u="+escape(userLoginId);
		if(top.adminDebugMode) alert(unescape(se));
		if(top.userDebugMode) {
			var ErrImg=new Image();
			ErrImg.src= mainurl + "ModDebug/ReportJSError/"+se;
		}
		return true;
	} catch(exex) { return true; };
};
if (top.userDebugMode) window.onerror=doerror;


function getBrowserInfo() {
	try {
		this.agt=navigator.userAgent.toLowerCase();
		this.apv=navigator.appVersion.toLowerCase();
		if(this.apv.indexOf("msie 6") != -1 ) this.version=6;
		else if(this.apv.indexOf("msie 5.5") != -1 ) this.version=5.5;
		else if(this.apv.indexOf("msie 5.2") != -1 ) this.version=5.2;
		else if(this.apv.indexOf("msie 5.1") != -1 ) this.version=5.1;
		else if(this.apv.indexOf("msie 5.0") != -1 ) this.version=5;
		else this.version=parseInt(navigator.appVersion);
		this.dom=(document.getElementById)?1:0;
		this.ns=(document.layers);
		this.ns4up=(this.ns && this.version >=4);
		this.ns6=(this.dom&&navigator.appName=="Netscape");
		this.op=(window.opera? 1:0);
		this.ie=(document.all&&navigator.appVersion.indexOf('MSIE')!=-1&&!this.op);
		this.ie4=(this.ie&&!this.dom)?1:0;
		this.ie4up=(this.ie&&this.version>=4);
		this.ie5=(this.ie&&this.dom);
		this.ie6=(this.ie&&document.getElementById&&navigator.appVersion.indexOf('MSIE 6')!=-1);
		this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
		this.mac=(this.agt.indexOf("mac")!=-1);
	} catch(e) { doerror(e,'getresponse.js-getBrowserInfo','',1); };
};
try {
	//var oBw=new getBrowserInfo();
	//if( !oBw.dom || !document.getElementById || !oBw.agt || oBw.mac ) top.location.href='JSerror.html';
} catch(e) { doerror(e,'getresponse.js-getBrowserInfo_init','',1); };


function switchTabs(tab,ileJest) {
	var i = 0;
	try {
		for(i=1;i<=ileJest;i++) {
			var stat = ''; ;
			if (i!=tab) {
				var cls = document.getElementById('ti'+i+'L').parentNode.className.split(' ');
				for (var a in cls)
				{
					if (cls[a] == 'off') { stat = '_off'; break; }
				}
			}
			var add=(i==tab)?'a':'';
			document.getElementById('ti'+i+'L').src='img/tabs/tab_l'+add+stat+'.gif';
			document.getElementById('ti'+i+'R').src='img/tabs/tab_r'+add+stat+'.gif';
			document.getElementById('ti'+i+'S').className='tabS'+add.toUpperCase()+stat;
			if(document.getElementById('tab'+i)) document.getElementById('tab'+i).style.display=(i==tab)?'block':'none';
		};
		if(window.showPersFields) showPersFields('pers1',0);
	} catch(e) { doerror(e,'getresponse.js-switchTabs(i='+i+')','',1); };
};


function showContextHelp(file, width, height) {
	try {
		if (typeof width == 'undefined') width = 500;
		if (typeof height == 'undefined') height = 550;
		contextHelp=window.open(mainurl + file,'contextHelp','height='+height+',width='+width+',resizable=yes,scrollbars=yes');
		contextHelp.focus();
		return false;
	} catch(e) { doerror(e,'getresponse.js-showContextHelp','',1); };
};


function addOpenEvent(func) {
	try {
		var oldonopen = window.onload;
		if (typeof window.onload != 'function')
		{
			window.onload = func;
		}
		else
		{
			window.onload = function()
			{
				oldonopen();
				func();
			}
		}
	} catch(e) { doerror(e,'getresponse.js-addOpenEvent','',1); };
}

/*
 * @param useCapture - If true, useCapture indicates that the user wishes to initiate capture.
 * After initiating capture, all events of the specified type will be dispatched to the registered EventListener
 * before being dispatched to any EventTargets beneath them in the tree.
 * Events which are bubbling upward through the tree will not trigger an EventListener designated to use capture.
*/
function addEvent(elm, evType, func, useCapture) {
	try {
		if (!elm.attachEvent) //elm.addEventListener) //Mozilla & all other
		{
			// causes unknown exception: null in my case
			// elm.addEventListener(evType, func, useCapture);

			var oldfunction = elm['on' + evType];
			if (typeof oldfunction != 'function')
			{
				elm['on' + evType] = func;
			}
			else
			{
				elm['on' + evType] = function()
				{
					oldfunction();
					func();
				}
			}

			return true;
		}
		else if (elm.attachEvent) //IE
		{
			var r = elm.attachEvent('on' + evType, func);
			return r;
		}
		else
		{
			elm['on' + evType] = func;
		}
	} catch(e) { doerror(e,'getresponse.js-addEvent','',1); };
}

/* SPRAWDZANIE ZALADOWANIA CSS */
var chc=1;
function checkCss() {
	try {
	        if(document.getElementById('cTlgh').offsetLeft<100) {
					if(chc==1) document.write('<style type="text/css" media="all">@import "/css/getresponse2.css";</style>');
	                else top.location.href="index.html?css=off";
	                if(chc==1) setTimeout("checkCss()",3000);
	                chc++;
	        };
	} catch(e) { doerror(e,'getresponse.js-checkCss','',1); };
};
