function marquee(x,typ,p){
    typ={
        'up':[-1,'top','offsetHeight'],
        'down':[1,'top','offsetHeight'],
        'left':[-1,'left','offsetWidth'],
        'right':[1,'left','offsetWidth']
    }[typ];
    var m=this,mOut,mIn,turlaj,T,i=typ[0],j=0,p=p||30;
    (mOut=document.getElementById(x)).onmouseover=function(){T=clearInterval(T)};
        mOut.appendChild((mIn=mOut.childNodes)[0].cloneNode(1));
        mOut.onmouseout=function(e){
            e=e||event;e=e.toElement||e.relatedTarget;
            if(e)do{if(e==this)return!1}while(e=e.parentNode)
            T=setInterval(turlaj,p)
        };
    mOut=mIn[0][typ[2]];
    turlaj=function(){
        mIn[0].style[typ[1]]=(-2*i*(j+=i)<(i-1)*mOut?(j=(-i-1)/2*mOut+i):j)+'px';
        mIn[1].style[typ[1]]=j+mOut+'px';
    }
    T=setInterval(turlaj,p);    
}
function sprawdzFormularz(t,tekst)
{				
					if (t.value==tekst) t.value='';					
					
					t.onblur=function(){
								if (t.value=='') t.value=tekst;
					}
}


function divshow(elem)
{		
		var toshow  = document.body.getElementsByClass("advertTypeDetails");
		if(toshow[elem].style.display=='block')
		{	toshow[elem].style.display='none';}
		else
		{	toshow[elem].style.display='block';}
}

function showHide(elem,target)
{
	var toshows  = document.body.getElementsByClass("advertTypeDetails");
	if(toshows[target].style.display=='none')
	{	elem.innerHTML='pokaż szczegóły';}
	else
	{	elem.innerHTML='ukryj szczegóły';}
}

function randomString( strLen ) 
{
  RandStr = "";
  
  for (i = 0; i < strLen; i++) 
	{
			 RandSign = String.fromCharCode(Math.round(Math.random()*(122-48))+48);
       if (RandSign.match(/[0-9a-zA-Z]/)) RandStr += RandSign;
       else i--;
	}
	
	return RandStr;
}


function EventColor( t, defaultcolor, eventcolor )
{
			t.style.backgroundColor = eventcolor;
			
			t.onmouseout=function() 
			{
								t.style.backgroundColor = defaultcolor;
			}
}
