function i(param){
	return true;
}

function o(param){
	return true;
}

function img1(name) {
	img=new Image();
    img.src = '/i_wp/'+name+'.gif';
	document.images[name].src=img.src;
}

function img2(name) {
	img=new Image();
    img.src = '/i_wp/'+name+'b.gif';
	document.images[name].src=img.src;
}

function pay_submit() {
	if(document.pay_form.id_delivery[0]) {
		for(var i = 0; i < document.pay_form.id_delivery.length; i++) {
			if(document.pay_form.id_delivery[i].checked) {
				document.form.id_delivery.value=document.pay_form.id_delivery[i].value;
			}
		}
	}
}

var iceId='JSICEPROD';
var iceOldOnResize, iceOldOnScroll;
var iceImgPath='/i_domzdrowia/';

function iceOnScroll(e)
{
	iceMove();
	if(iceOldOnScroll)
		iceOldOnScroll(e);
}

function iceResize()
{
	var e=document.getElementById(iceId);
	if(e) {
		var es=e.style;
		if(es.display!='none') {
			es.display='none';
			es.width=document.body.scrollWidth+'px';
			es.height=(document.body.scrollHeight>document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight)+'px';
			es.display='';
		}
		iceMove();
	}
}

function iceOnResize(e)
{
	iceResize();
	if(iceOldOnResize)
		iceOldOnResize(e);
}

function iceReadyState()
{
	if(event.srcElement.readyState=='complete')
		iceMove();
}

function iceMove()
{
	var e=document.getElementById(iceId+'_window');
	if(e) {
		var es=e.style;
		var mx=document.body.scrollLeft;
		var my=document.body.scrollTop;
		var cx=document.body.clientWidth;
		var cy=document.body.clientHeight;

		var x=Math.floor(cx/2-e.offsetWidth/2)+mx;
		var y=Math.floor(cy/2-e.offsetHeight/2)+my;
//		alert('my: '+my+' cy: '+cy+' offsetHeight: '+e.offsetHeight+' y: '+y);
		if(y<0)
			y=0;
		if(x<0)
			x=cx-e.offsetWidth;
		es.marginLeft=x+'px';
		es.marginTop=y+'px';
	}
}

function iceClose()
{
	var e=document.getElementById(iceId);
	if(e) {
		e.style.display='none';
	}
	iceActive=null;
}



function dlg_url(u)
{
	if(typeof(u)=='object') {
		var s=u[0];
		if(typeof(u[1])=='object') {
			var k;
			var sp='?';
			for (k in u[1]) {
				s+=sp+encodeURIComponent(k)+'='+encodeURIComponent(u[1][k]);
				sp='&';
			}
		}
		if(typeof(u[2])!='undefined')
			s+='#'+u[2];
		return s;
	}
	return u;
}

function dlg_get(u,cb,cbp)
{
	return dlg_xmlhttprequest(u,'GET','','',cb,cbp);
}


function dlg_xmlhttprequest(u,m,d,c,cb,cbp)
{
	u=dlg_url(u);
	var r=false;
    if(window.XMLHttpRequest) {
    	try {
			r=new XMLHttpRequest();
        }
		catch(e) {
			r=false;
        }
    }
	else if(window.ActiveXObject) {
       	try {
        	r=new ActiveXObject("Msxml2.XMLHTTP");
      	}
		catch(e) {
        	try {
          		r=new ActiveXObject("Microsoft.XMLHTTP");
        	}
			catch(e) {
          		r=false;
        	}
		}
    }

	if(r) {
		r.onreadystatechange=function() {
			if(r.readyState==4) {
				if(r.status==200)
					cb(r.responseText,cbp);
			}
		};
		r.open(m,u);
		if(c!='')
			r.setRequestHeader('Content-Type',c);
		r.send(d);
		return true;
	}
	return false;
}
