function validacjaTYP(cel,typ)
{
	if($(cel))
	{ 
		var vartosc = $(cel).value;
		
		if(typ=='tekst')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				$(cel).style.backgroundColor="#ECFFEC";
				return true;
			}	
		}
		if(typ=='email')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				if(vartosc.indexOf('@')>-1 && vartosc.indexOf('.')>-1)
				{
					$(cel).style.backgroundColor="#ECFFEC";
					return true;		
				}
				else
				{
					$(cel).style.backgroundColor="#FFD9D9";
					return false;
				}
			}	
		}
		if(typ=='liczba')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				vartosc = parseFloat(vartosc );
				if(isNaN(vartosc))
				{
					$(cel).style.backgroundColor="#FFD9D9";
					return false;	
				}
				else
				{
					$(cel).style.backgroundColor="#ECFFEC";
					return true;	
				}
			}	
		}
	}
}
function wybierz_punktSprz(punkt)
{
	uaktualnij_daneZEWN('AJAX-PS-'+punkt,'Punkty sprzedazy - '+punkt);
	var linkus="include/ajax.php";
	var czym="post";
	var par="operacja=punktSprz&punkt="+punkt;
	var id2='punkt_sprzedazy';	
	var myAjax = new Ajax.Updater( id2, linkus, { method: czym, parameters: par });	
	
}
function humm(typ,zaw,wys,szer,tlo)
{
		var obiekt = $('ddz');
		if(obiekt)
		{
			document.onmousemove=function(e)
			{
				var obW = obiekt.offsetWidth;
				var obH = obiekt.offsetHeight;
				var skroll=document.documentElement.scrollTop;
				if (parseInt(navigator.appVersion)>3)
				{
					if (navigator.appName=="Netscape")
					{
					  var winW = window.innerWidth;
					  var winH = window.innerHeight;
					}
					if (navigator.appName.indexOf("Microsoft")!=-1)
					{
					  var winW = document.body.offsetWidth;
					  var winH = document.body.offsetHeight;
					 }
				}
				
				
				
				
					
				var Y=(e=e||event).clientY;
				Y = Y + skroll;
				var X=(e=e||event).clientX;	
				if((X+obW)>(winW-10))
				{
					var newX=(X+obW)-(winW-10);
					X = X-newX;
				}
				//obiekt.innerHTML =  'TOP: '+(Y+10)+" LEFT: "+X+' obW:'+obW+" obH:"+obH+" winW:"+winW+" winH:"+winH;
				obiekt.style.top=(Y+20)+'px';
				obiekt.style.left=X+'px';
				
				//if(tlo!='')
				//	{obiekt.style.backgroundColor=tlo;}
					
				if(typ=='img')
				{
					obiekt.innerHTML= '<img src="'+zaw+'"/>';
					obiekt.style.display='';
				}
				else if(typ=='txt')
				{
					obiekt.innerHTML= zaw;
					obiekt.style.backgroundColor=tlo;
					obiekt.style.width=szer+'px';
					obiekt.style.display='';
					obiekt.style.border='solid 1px #194107';
				}
				else if(typ=='0')
				{
					obiekt.innerHTML= '';
					obiekt.style.display='none';
					obiekt.style.width='';
					obiekt.style.border='';
					///obiekt.style.backgroundColor='';
				}
				else { obiekt.innerHTML=zaw; }
			}
		}
}
function punkty_sprzedazy(id, miasto)
{
		//loading(1);
		loaderekk(1);
		var linkus='ajax.php';
		var czym="post";
		var par="operacja=punkty_sprzedazy&id="+id+"&miasto="+miasto;
		var id2='trescPH';	
		var myAjax = new Ajax.Updater( id2, linkus, { method: czym, parameters: par ,  onComplete:function(){
																										   		loaderekk(0);
																												window.scroll(0,680);
																										   		//pozycja(600,50,'');
																												//$('div_zamknij').style.display = 'block';
																										   		//loading(0);
																												//window.setTimeout('pokaz_tlo(1)',1000);																							
																										
																											    }});
}
function getPageScroll()
{

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}
function pageSize() 
{
	        
	    var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight,windowWidth,windowHeight,yScroll];
}
function loaderekk(stan)
{
	if(stan == '1')
	{
		var wysSer = pageSize() ;
		var szer_dok = wysSer[0];
		var wys_dok = wysSer[3];
		var scrl = getPageScroll();	
	
		var szer_info = 100;
		var wys_info = 100;
		
		var poz_pozioma=400;
		var poz_pionowa=(wys_dok/2)-(wys_info/2)+scrl[1] ;
		
		$('loaderek').style.top=poz_pionowa+"px";
		$('loaderek').style.left=poz_pozioma+"px";	
		
		$('loaderek').style.display = 'block';		
	}
	else
	{$('loaderek').style.display = 'none';}
}
