   var ajaxbase = '/!cms_mediq'

function ao1(obj){obj.style.backgroundColor='#FFFFFF'}
function ao2(obj){obj.style.backgroundColor='#F3F2F0'}
function ao0(obj){obj.style.backgroundColor=''}
function alltrim( str ){ return str.replace( /^\s+|\s+$/g, '' )}

function aob(obj, ok ){ ok ? obj.className += ' button_over' : obj.className=obj.className.replace( ' button_over', '' ) }

/*
background: -moz-linear-gradient(center top, #b8d8f2, #92bde0 25%, #3282c2 50%, #92bde0 75%, #b8d8f2);
background: -webkit-gradient(linear, center top, center bottom, from(#b8d8f2), color-stop(25%, #92bde0), color-stop(50%, #3282c2), color-stop(75%, #92bde0), to(#b8d8f2)); 
filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');


   color: #fef4e9;
	border: solid 1px #da7c0c;
	background: #f78d1d;
	background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));
	background: -moz-linear-gradient(top,  #faa51a,  #f47a20);
	filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');
-ms-filter: “progid:DXImageTransform.Microsoft.gradient(startColorstr=’#faa51a’, endColorstr=’#f47a20')”;
}




.blue {
color: #d9eef7;
border: solid 1px #0076a3;
background: #0095cd;
background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5));
background: -moz-linear-gradient(top, #00adee, #0078a5);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');

-webkit-transition: background 1s linear;
-moz-transition: background 1s linear;
transition: background 1s linear;
}




*/



function myscroll(){

   obj = getO( 'form_error_div' )
   x   = getT( obj )
   window.scrollTo( 0, x-20 )
   alert( 'Popraw pola zaznaczone na czerwono\n(opis błędu w "dymku" pod nazw± pola)' )
}

function setorder( nam, ord, lnk ){
   writecookie( nam, ord )
   document.location.href = document.location.href
//   document.location.href = lnk
}

function prompt_date( obj, on ){

   obj.title = 'dd.mm.rrrr'
   if( on && obj.title == obj.value ) obj.value = ''
   else if( !on && !obj.value ) obj.value = obj.title 
   if( obj.value == obj.title ) obj.className = 'input ss'
   else                         obj.className = 'input'
}

function zapisz( btn ){
   form = btn.form

   btn.style.cursor = 'wait'
   if( btn.value == 'czekaj...' ){
      alert( 'Trwa zapisywanie danych...' )
      return false
   }
   else {
      btn.disabled = true
      btn.value    = 'czekaj...'
      form.target = '_self'
      form.submit()
      return false
   }
}

//---------------------------------------------------------------
function label_show( obj, id, form, inline ){

   document.forms[form][id].setAttribute ( 'wrap', 'soft' );
   fldobj = 'fld_check_' + id
   fldobj = getO( fldobj )

   t = getT( obj ) + getH( obj )

   if( inline ){ l = getL( obj ) - 42; t += 1 }
   else        { l = getL( obj ) + getW( obj ) - 36 }
   setPos( fldobj, t, l )
   obj.onmouseover = ''

}
function label_wrap( form, id ){

   obj2 = document.forms[form][id]

   if( document.all ){
      if( obj2.wrap == 'soft' ){ obj2.wrap = 'off'  }
      else                     { obj2.wrap = 'soft' }
   }
	else {
      wrap = obj2.getAttribute( 'wrap' ) == 'soft' ? 'off' : 'soft'
      obj2.setAttribute( "wrap", wrap );
      var nextElem = obj2.nextSibling;
      var paren = obj2.parentNode;
      paren.removeChild (obj2);
      paren.insertBefore (obj2, nextElem);
   }
}

//---------------------------------------------------------------
function storeCaret( obj ) {

   if( obj.createTextRange ) obj.caretPos = document.selection.createRange().duplicate()
   top.copycont = obj
}
function insertAtCaret( textObj, textFieldValue ){

   if( document.all ){  
      if( textObj.createTextRange && textObj.caretPos ){
         var caretPos  = textObj.caretPos;
         caretPos.text = caretPos.text.charAt( caretPos.text.length - 1 ) == ' ' ? textFieldValue + ' ' : textFieldValue;
      }
      else {
         textObj.value = textFieldValue;
      }
   }
   else if( textObj.setSelectionRange ){
      var rangeStart = textObj.selectionStart;
      var rangeEnd   = textObj.selectionEnd;
      var tempStr1   = textObj.value.substring( 0, rangeStart );
      var tempStr2   = textObj.value.substring( rangeEnd );
      textObj.value  = tempStr1 + textFieldValue + tempStr2;
   }
   else {
      alert( 'tutaj niemożliwe' )
   }
}

//---------------------------
oldobj = ''
function post_utils_select( btn ){
   if( oldobj ) oldobj.style.display = 'none'
   if( !btn.value ){ return }
   document.forms.post.txt.focus()
   oldobj = getO( 'post_utils_' + btn.value )
   oldobj.style.display = 'block'
}

function post_utils_txt( obj, txt ){
   obj.blur()
   insertAtCaret( document.forms.post.txt, txt )
   document.forms.post.txt.focus()
   return false
}

function post_utils_link( what, txt1, txt2 ){
   txt1 = alltrim( txt1 )
   txt2 = alltrim( txt2 )
   if( !txt2 || ( what == 'link' && txt2 == 'http://' )){
      if( what == 'link' ){ alert( 'Podaj adres url' );     document.forms.post.utils_link_url.focus()}
      else                { alert( 'Podaj adres e-mail' );  document.forms.post.utils_mail_url.focus()}
      return
   }
   if( txt1 ) txt1 = '=' + txt1
   insertAtCaret( document.forms.post.txt, '[' + what + txt1 + ']' + txt2 + '[/' + what + ']' )
   document.forms.post.txt.focus()
}


//---------------------------------------------------------------
var forum_button_clicked = false
function post_preview( w ){

   x = getPS()
   h = Math.max( 300, parseInt( 0.8 * x[3] ))

   fixed_open( 'div_tmp_white', w, h, 1 )

   form   = document.forms.post
   params = fixed_params( form, 'preview' )
   url    = ajaxbase + '/ajax_post.php?' + Math.random()
   httpPOST( url, fixed_response, params )
   return false

}

//---------------------------
function post_edit( site, id ){

   if( !id ){ return false }

   w = 580
   h = 300

   fixed_open( 'div_tmp', w, h, 1 )
   url = ajaxbase + '/ajax_post.php?' + site + '/edit/' + id + '/' + Math.random()
   httpGET( url, fixed_response )

   return false

}
//---------------------------
function post_save( form, action ){

   params = fixed_params( form, 'edit-' + action )
   url    = ajaxbase + '/ajax_post.php?' + Math.random()
   fixed_wait()
//alert( params )
   httpPOST( url, fixed_response, params )


}

//---------------------------
function post_cite( site, id ) {

   if( !id ){ return false }
   url = ajaxbase + '/ajax_post.php?' + site + '/cite/' + id + '/' + Math.random()
   httpGET( url, post_cite_response )
   return false
}
function post_cite_response( err, txt ){

   if( err != 'ok' ){
      alert( err + txt )
   }
   else {
      form = document.forms['post']
      window.scrollTo( 0, getT( form ))
      if( form.txt.value ) txt = '\n\n' + txt
      form.txt.value += txt
   }
}

//---------------------------
function post_del( site, id ) {

   if( forum_button_clicked ){
      alert( 'Chwileczkę...' )
      return false
   }

   if( confirm( 'PotwierdĽ, że zgłaszasz ten post do usunięcia.' )){
      forum_button_clicked = true
      url = ajaxbase + '/ajax_post.php?' + site + '/del/' + id + '/' + Math.random()
      httpGET( url, post_del_response )
   }
   return false
}
function post_del_response( err, txt ){
   forum_button_clicked = false
   alert( err+txt )
}


//---------------------------
function ajax_open( div, w, h, url, wait ){

   url += '/' + Math.random()
   fixed_open( div, w, h, wait )
   if( url ) httpGET( url, fixed_response )
   return false 

}

function ajax_login( site, action, form, h ){

   url = ajaxbase + '/ajax_login.php?' + site + '/' + action + '/' + Math.random()
   if( action == 'open' ){
      fixed_open( 'div_tmp', form, h, 1 )
      httpGET( url, ajax_login_response )
   }
   else if( action == 'logout' ){
      if( confirm( 'Are you sure na pewno?' )){
         httpGET( url, ajax_login_response )
      }
   }
   else {
      form.action.value = action
      params = fixed_params( form )
//alert( params )
      fixed_wait()
      httpPOST( url, ajax_login_response, params )
   }
   return false
}

function ajax_login_response( err, txt ){

   if( err == 'login' || err == 'forever' || err == 'logout' ){
      fixed_close()
      err   = err == 'forever'
      pos   = txt.indexOf( '-' )
      name  = txt.substr( 0, pos )
      value = txt.substr( pos+1)
      writecookie( name, value, err )
      document.location.href = document.location.href
//      history.go( 0 )
   }
   else {
      fixed_response( err, txt )
      prompt_date( document.forms['login_form_div'].born, 0 )
   }

}
function writecookie( name, value, forever )
{
   if( forever ) forever = "; expires=Fri, 31 Dec 2060 12:00:00 GMT;"
   else          forever = '';
   if( value ) document.cookie = name + '=' + escape( value ) + '; path=/' + forever
   else        document.cookie = name + '=; path=/'
}


fixed_div = ''
fixed_bcg = ''

function fixcenterH0( obj ){
   if( !fixed_div ) return
   X = obj.offsetWidth
   fixed_div.style.marginLeft = 0
   W = document.body.clientWidth
   S = document.body.scrollLeft
	X = Math.max( 0, parseInt(( W-X )/2 ) + S )
   return X + 'px' 
}

function fixcenterV0( obj ){
   if( !fixed_div ) return
   fixed_div.style.marginTop = 0
   X = obj.offsetHeight
   W = document.body.clientHeight
   S = document.body.scrollTop
	X = Math.max( 0, parseInt(( W-X )/2 ) + S )
   return X + 'px' 
}

function fixcenterH(){
   if( fixed_div ) fixed_div.style.marginLeft = ( document.body.scrollLeft - parseInt( fixed_div.offsetWidth/2 )) + 'px'
   return 0 
}
function fixcenterV(){
   if( fixed_div ) fixed_div.style.marginTop = ( document.body.scrollTop - parseInt( fixed_div.offsetHeight/2 )) + 'px'
   return 0 
}


function fixcenterVO(){
   if( !fixed_div ) return
   return document.body.scrollTop + 'px' 
}
function fixcenterHO(){
   if( !fixed_div ) return
   return document.body.scrollLeft + 'px' 
}

function fixed_open( id, w, h, wait ){

   menuclose()
   fixed_div = getO( id )
   if( w ) setW( fixed_div, w )
   if( h ) setH( fixed_div, h ) 

   w = getW( fixed_div )
   h = getH( fixed_div )

   fixed_div.style.marginLeft = '-' + parseInt( w/2 ) + 'px'
   fixed_div.style.marginTop  = '-' + parseInt( h/2 ) + 'px'

   if( wait ) fixed_wait()
   fixed_div.style.display = 'block'

   fixed_bcg = getO( 'div_fixed_overlay' )
   fixed_bcg.style.display = 'block'

   return false

}
function fixed_close(){
   if( fixed_div ){
      fixed_div.style.display = 'none';    fixed_div = ''
      fixed_bcg.style.display = 'none';    fixed_bcg = ''
   }
   return false
}
function fixed_wait( txt ){
   if( !txt ) txt = '<img src="images/loading.gif">'
   w = getW( fixed_div ) - 8
   h = getH( fixed_div ) - 8
   fixed_div.innerHTML = '<table cellpadding=0 cellspacing=0 border=0><tr><td width='+w+' height='+h+' align=center valign=middle>' + txt + '</td></tr></table>'
}

function fixed_response( err, txt ){

   if( err == 'go' ){
      fixed_close()
      if     ( txt == 'reftop' ){ parent.wtop.history.go( 0 )}
      else if( txt == 'ref' )   { history.go( 0 )}
//    else if( txt == 'ref' )   { document.location.reload()}
      else                      { document.location.href = txt }
   }
   else if( err == 'gotop' ){
      fixed_close()
      parent.wtop.location.href = txt
   }
   else if( err == 'alert' ){
      fixed_close()
      alert( txt )
   }
   else if( err == 'alertref' ){
      fixed_close()
      alert( txt )
      history.go( 0 )
   }

   else if( err.substr( 0, 4 ) == 'info' ){
      fixed_div.innerHTML = txt
      alert( err.substr( 5 ) )
   } 

   else if( err == 'ok' ) fixed_div.innerHTML = txt
   else fixed_wait( "<strong style='color:red'>" + err + txt + "</strong>" )
}

function fixed_params( form, action ){
   params = ''
   for( i=0; i<form.elements.length; i++ ){
      el   = form.elements[i]
      name = el.name
      if( name == 'action' && action ){
         params += '&action=' + action
      }
      else if( name ){
         v = encodeURIComponent( el.value )
         if     ( el.type == 'radio'    ){ if( el.checked ){ params += '&' + name + '=' + v }}
         else if( el.type == 'checkbox' ){ params += '&' + name + '=' + ( el.checked ? v : 0 )}
         else { params += '&' + name + '=' + v }
      }
   }
   return params
}
//---------------------------------------------------------------

function getO( e, doc ){
   if( !doc ){ doc = document }
   return doc.getElementById( e )
}

function setW( e, w ){ e.style.width  = w + 'px' }
function setH( e, h ){ e.style.height = h + 'px' }

function setPos( e, t, l ){
   e.style.top  = t + 'px'
   e.style.left = l + 'px'
}

function getT( e ){
   var curtop = 0;
   if ( e.offsetParent ){
      while( e.offsetParent ){
         curtop += e.offsetTop
         e = e.offsetParent;
      }
   }
   else if ( e.y ) curtop += e.y
   return curtop
}

function getL( e ){
   var curtop = 0;
   if( e.offsetParent ){
      while( e.offsetParent ){
         curtop += e.offsetLeft
         e = e.offsetParent;
      }
   }
   else if ( e.x ) curtop += e.x;
   return curtop;
}

function getW( e ){
//   return parseInt( e.style.width )

   result = 0
   if      ( e.offsetWidth ) result = e.offsetWidth
   else if ( e.clip && e.clip.width ) result = e.clip.width
   else if ( e.style && e.style.pixelWidth ) result = e.style.pixelWidth
   else if ( e.style && e.style.width ) result = e.style.width
   return parseInt( result )
}
function getH( e ) {

   result = 0
   if      ( e.offsetHeight ) result = e.offsetHeight
   else if ( e.clip && e.clip.height ) result = e.clip.height
   else if ( e.style && e.style.pixelHeight ) result = e.style.pixelHeight
   else if ( e.style && e.style.height ) result = e.style.height
   return parseInt( result )
}

function getPS(){

/*
		var viewWidth = (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) + $(document).scrollLeft();
		var viewHeight = (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) + $(document).scrollTop();

		var browserWidth = window.innerWidth || document.documentElement.clientWidth ||	document.body.clientWidth;
		var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
		var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
		var scrollY = document.documentElement.scrollTop || document.body.scrollTop;

*/

//alert( document.body.clientWidth )

   if( window.innerHeight && window.scrollMaxY ){
//alert( 1 )
      xScroll = document.body.scrollWidth
      yScroll = window.innerHeight + window.scrollMaxY
   }
   else if( document.body.scrollHeight > document.body.offsetHeight ){
//alert( 2 )   
      xScroll = document.body.scrollWidth
      yScroll = document.body.scrollHeight
   }
   else {
//alert( 3 )   
      xScroll = document.body.offsetWidth
      yScroll = document.body.offsetHeight
   }



//alert( xScroll + ':' + yScroll )
   
/*
if( window.innerHeight && window.scrollMaxY ){
   pageWidth = window.innerWidth + window.scrollMaxX;
   pageHeight = window.innerHeight + window.scrollMaxY;
}
else if( document.body.scrollHeight > document.body.offsetHeight ){
   pageWidth = document.body.scrollWidth;
   pageHeight = document.body.scrollHeight;
}
else{ 
   pageWidth = document.body.offsetWidth + document.body.offsetLeft; 
   pageHeight = document.body.offsetHeight + document.body.offsetTop;
}

alert( document.body.offsetWidth )
alert( pageWidth + ":" + pageHeight )
*/

	windowWidth  = window.innerWidth  || document.documentElement.clientWidth  ||	document.body.clientWidth
   windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight

   if( window.innerWidth ){ windowWidth -= 16 }

//      if( self.innerHeight ){
//        windowWidth  = self.innerWidth
//        windowHeight = self.innerHeight
//     }
//  //   else if( document.documentElement && document.documentElement.clientHeight ){
//  //      windowWidth  = document.documentElement.clientWidth
//  //      windowHeight = document.documentElement.clientHeight
//  //   }
//     else {
//  //xScroll = document.body.clientWidth
//  //yScroll = document.body.clientHeight
//  
//        windowWidth  = document.body.clientWidth
//        windowHeight = document.body.clientHeight
//     }   

   if( yScroll < windowHeight ){ pageHeight = windowHeight } else { pageHeight = yScroll }
   if( xScroll < windowWidth  ){ pageWidth  = windowWidth  } else { pageWidth  = xScroll }

   return new Array( pageWidth, pageHeight, windowWidth, windowHeight ) 
}

//function viewport(){
//var e = window, a = 'inner';
//
//if ( !( 'innerWidth' in window ) )
//{
//a = 'client';
//e = document.documentElement || document.body;
//}
//
//return { width : e[ a+'Width' ] , height : e[ a+'Height' ] }
//}

//function scrollbarWidth() { 
//	// Scrollbalken im Body ausschalten 
//	document.body.style.overflow = 'hidden'; 
//	var width = document.body.clientWidth; 
//  
//	// Scrollbalken 
//	document.body.style.overflow = 'scroll'; 
//  
//	width -= document.body.clientWidth; 
//  
//	// Der IE im Standardmode 
//	if(!width) width = document.body.offsetWidth-document.body.clientWidth; 
//  
//	// ursprüngliche Einstellungen wiederherstellen 
//	document.body.style.overflow = ''; 
//  
//	return width; 
//} 



function getST(){
   x = 0;
   if      ( self.pageYOffset ) x = self.pageYOffset
   else if ( document.documentElement && document.documentElement.scrollTop ) x = document.documentElement.scrollTop
   else if ( document.body ) x = document.body.scrollTop
   return parseInt( x )
}
function getSL(){
   x = 0;
   if      ( self.pageXOffset ) x = self.pageXOffset
   else if ( document.documentElement && document.documentElement.scrollLeft ) x = document.documentElement.scrollLeft
   else if ( document.body ) x = document.body.scrollLeft
   return parseInt( x )
}

function setOpacity( o, opa ){
   o.style.filter  = "alpha( opacity=" + opa + " )";
   o.style.filter  = "progid:DXImageTransform.Microsoft.Alpha( opacity=" + opa + " )";
   o.style.opacity = opa/100;
}


var httpOBJ = undefined
//---------------------------------------------------------------
function makeHTTP(){

   if( window.XMLHttpRequest ){
      httpOBJ = new XMLHttpRequest()
      if( httpOBJ.overrideMimeType ) httpOBJ.overrideMimeType('text/html')
   }
   else if( window.ActiveXObject ){
      try {
         httpOBJ = new ActiveXObject( "Msxml2.XMLHTTP" );
      } catch( e ) {
         try {
            httpOBJ = new ActiveXObject( "Microsoft.XMLHTTP" );
         } catch ( e ) {}
      }
   }
   if( !httpOBJ ){
      alert( "Brak polaczenia http" )
   }
   return httpOBJ
}

function abortHTTP(){
	if( httpOBJ ){
      if( httpOBJ.readyState != 4 && httpOBJ.readyState != 0 ){ httpOBJ.abort() }
      httpOBJ = undefined
   }
}

function httpGET( url, func ){

   obj = makeHTTP()
   obj.onreadystatechange = function(){
      if( obj.readyState == 4 && obj.status == 200 ){
         pos  = obj.responseText.indexOf( ':' )
         mess = obj.responseText.substr( 0, pos )
         txt  = obj.responseText.substr( pos+1 )
         func( mess, txt )
      }
   }
   obj.open( 'GET', url, true );
   obj.send( null );
}
function httpPOST( url, func, params ){
   obj = makeHTTP()
   obj.onreadystatechange = function(){
      if( obj.readyState == 4 && obj.status == 200 ){
         pos  = obj.responseText.indexOf( ':' )
         mess = obj.responseText.substr( 0, pos )
         txt  = obj.responseText.substr( pos+1 )
         while( mess.substr( 0, 1 ) == "\n" || mess.substr( 0, 1 ) == "\r" || mess.substr( 0, 1 ) == " " ){ mess = mess.substr( 1 )}
         func( mess, txt )
      }
   }
   obj.open( 'POST', url, true );
   obj.setRequestHeader( "Content-type", "application/x-www-form-urlencoded; charset=iso-8859-2");
   obj.setRequestHeader( "Content-length", params.length );
   obj.setRequestHeader( "Connection", "close" );
   obj.send( params );
}

function load_event( func ) {
   var oldonload = window.onload;
   if( typeof window.onload != 'function' ) window.onload = func
   else window.onload = function(){ oldonload(); func()}
}
function load_resize( func ) {
   var oldresize = window.onresize;
   if( typeof window.onresize != 'function' ) window.onresize = func
   else window.onresize = function(){ oldresize(); func()}
}
function addE( elem, sType, fn, capture ){
   capture = capture ? true : false
   if( elem.addEventListener ){ elem.addEventListener( sType, fn, capture )}
   else if( elem.attachEvent ){ elem.attachEvent( "on" + sType, fn )
}

}
function removeE( elem, sType, fn, capture ){
   capture = capture ? true : false
   if( window.removeEventListener ){ elem.removeEventListener( sType, fn, capture )}
   else if( window.detachEvent )   { elem.detachEvent( "on" + sType, fn )}
}

istip  = false
tipdiv = ''
function tip( obj, onoff ){

   if( onoff ){
      t = obj.getAttribute( 'title' )
      if( !t ){ return false }
      obj.setAttribute( 'title', '' )
      obj.setAttribute( 'oldtitle', t )
      x = getT( obj )
      y = getL( obj )
      if( !tipdiv ){
//       tipdiv = getO( 'tooltip' )
         tipdiv = document.createElement( 'div' );
         tipdiv.className = 'tooltip'
         document.body.insertBefore( tipdiv, document.body.firstChild )
         document.onmousemove = positiontip
      }
      tipdiv.innerHTML = t
//    addE( document, 'mousemove', positiontip )
      istip = true
   }
   else if( istip ){
      istip = false
      obj.setAttribute( 'title', obj.getAttribute( 'oldtitle' ) )
//    obj = getO( 'tooltip' )
      tipdiv.style.visibility = 'hidden'
   }
   return false
}

function positiontip( ev ){

   if( !istip ){ return }

   ev = ev || window.event
   if( ev.pageX || ev.pageY ){
      l = ev.pageX
      t = ev.pageY
   }
   else {
      l = ev.clientX + document.body.scrollLeft + document.documentElement.scrollLeft
      t = ev.clientY + document.body.scrollTop  + document.documentElement.scrollTop
   }

// obj = getO( 'tooltip' )
   w   = getW( tipdiv )
   mx  = getPS()
   mx  = mx[2] + getSL()

   if( l + w > mx ) l = mx - w
   setPos( tipdiv, t+15, l )
   tipdiv.style.visibility = 'visible'

}

function fivestar_write( prompts ){
   txt  = "<div style='display:block; cursor:hand' onmouseout='fivestar_out( this )'>"
   cp   = ''
   for( i=1; i<=5; i++ ){
      ip = arguments[i-1]
      txt += "<div class='fivestar_off' fivestar_title='"+ip+"' onmouseover='fivestar_over( this, " + i + " )' onclick='fivestar_click( this, " + i + " )'></div>"
   }
	txt += "<div class='fivestar_prompt'></div></div>"
   document.write( txt )
}

function fivestar_over( obj, v ){
   p = obj.parentNode.getElementsByTagName('div')
   p[5].innerHTML = v > 0 ? p[v-1].getAttribute( 'fivestar_title' ) : ''
   for( i=0; i<5; i++ ){
      fclass = i < v ? 'fivestar_on' : 'fivestar_off'
      p[i].className = fclass
   }
}
function fivestar_click( obj, v ){
   old = obj.parentNode.onmouseout
   obj.parentNode.onmouseout = ''
   if     ( v == 1 ) v = '1 gwiazdkę'
   else if( v == 5 ) v = '5 gwiazdek'
   else              v = v + ' gwiazdki' 
   if( confirm( 'PotwierdĽ, że chesz przyznać ' + v )){
   }
   obj.parentNode.onmouseout = old
}
function fivestar_out( obj ){
   p = obj.getElementsByTagName('div')
   fivestar_over( p[0], 0 )
}

function ibop_votes( site, action, id, wmax, btn ){
   btn.blur()

   params = ''
   if( action == 'vote' ){
      form   = btn.form
      for( i=0; i<form.elements.length; i++ ){
         el = form.elements[i]
         if( el.name == 'vote[]' && el.checked ){
            params += '-' + el.value 
         }
      }
      if( !params ){
         alert( 'Zaznacz odpowiedĽ' )
         return false
      }
      ibop_votes_response( 'wait' )
      params = 'site=' + site + '&action=vote&par=' + id + '-' + wmax + '&votes=' + params.substr( 1 )
      httpPOST( ajaxbase + '/ajax_ibop.php?' + Math.random(), ibop_votes_response, params )
   }
	else {
      ibop_votes_response( 'wait' )
      params = ajaxbase + '/ajax_ibop.php?' + site + '/votes/' + id + '-' + wmax + '/' + Math.random()
      httpGET( params, ibop_votes_response )
   }
}

function ibop_votes_response( err, txt ){

   obj = getO( 'div_ibop_inner' )
   w   = getW( obj )
   h   = getH( obj )
   if( err == 'wait' ){
      txt = '<TABLE cellpadding=0 cellspacing=0 border=0 width='+w+' height='+h+'><TR><TD align=center valign=middle><img src=\"images/loading.gif\" width=16 height=16></TD></TR></TABLE>';
   }
   else if( err == 'vote' ){
      txt = '<TABLE cellpadding=0 cellspacing=0 border=0 width='+w+' height='+h+'><TR><TD align=center valign=middle class=s>' + txt + '</TD></TR></TABLE>';
   }
   obj.innerHTML = txt
}


