function doRb() {

	var skyscraper = document.getElementById('skyscraper-banner');
	
	var scroll = document.documentElement.scrollTop ? document.documentElement.scrollTop :document.body.scrollTop ;
	
	var distance = scroll>97 ? scroll -95 : 16 ;
	
	skyscraper.style.top = distance+'px';
}

function initRb() {
	window.setTimeout('doRb()',10);
}

/*
function initTabs() {
	var tabList = document.getElementById('tabs-menu');
	tabs = tabList.getElementsByTagName('LI');
	tabs[0].className = "tab-menu-selected";
	for (var i = 0; i < tabs.length; i++) {
		tabs[i].onclick = function() {
			return showHideTab(this);
		};
		
	}
	var tabBoxesContainer = document.getElementById('tabs-box');
	var tabBoxesTemp = tabBoxesContainer.getElementsByTagName('DIV');
	
	tabBoxes = new Object();
	var cc = 0;
	for (var j = 0; j < tabBoxesTemp.length; j++) {
		if(tabBoxesTemp[j].className == 'tab-box tab-box-0') {
			tabBoxes[cc] = tabBoxesTemp[j];
			cc++;
		}
		
	}
	tabBoxes[0].style.display = "block";
	
	curTab = 0;
	
}

function showHideTab(el) {
	
	for (var i = 0; i < tabs.length; i++) {
		if(curTab != i && tabs[i]==el) {
			tabs[curTab].className = "tab-menu";
			tabBoxes[curTab].style.display = "none";
			
			el.className = "tab-menu-selected";
			tabBoxes[i].style.display = "block";
			tabBoxes[i].className = "tab-box tab-box-"+i;
			curTab = i;
			return false;
		} 
	}
}
*/

/**
 * Javascript functions from developer.mozilla.org
 * Many Thanks to those guys for these helpful functions!
 */

/**
 * Throughout, whitespace is defined as one of the characters
 *  "\t" TAB \u0009
 *  "\n" LF  \u000A
 *  "\r" CR  \u000D
 *  " "  SPC \u0020
 *
 * This does not use Javascript's "\s" because that includes non-breaking
 * spaces (and also some other characters).
 */


/**
 * Determine whether a node's text content is entirely whitespace.
 *
 * @param nod  A node implementing the |CharacterData| interface (i.e.,
 *             a |Text|, |Comment|, or |CDATASection| node
 * @return     True if all of the text content of |nod| is whitespace,
 *             otherwise false.
 */
function is_all_ws( nod )
{
  // Use ECMA-262 Edition 3 String and RegExp features
  return !(/[^\t\n\r ]/.test(nod.data));
}


/**
 * Determine if a node should be ignored by the iterator functions.
 *
 * @param nod  An object implementing the DOM1 |Node| interface.
 * @return     true if the node is:
 *                1) A |Text| node that is all whitespace
 *                2) A |Comment| node
 *             and otherwise false.
 */

function is_ignorable( nod )
{
  return ( nod.nodeType == 8) || // A comment node
         ( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}

/**
 * Version of |previousSibling| that skips nodes that are entirely
 * whitespace or comments.  (Normally |previousSibling| is a property
 * of all DOM nodes that gives the sibling node, the node that is
 * a child of the same parent, that occurs immediately before the
 * reference node.)
 *
 * @param sib  The reference node.
 * @return     Either:
 *               1) The closest previous sibling to |sib| that is not
 *                  ignorable according to |is_ignorable|, or
 *               2) null if no such node exists.
 */
function node_before( sib )
{
  while ((sib = sib.previousSibling)) {
    if (!is_ignorable(sib)) return sib;
  }
  return null;
}

/**
 * Version of |nextSibling| that skips nodes that are entirely
 * whitespace or comments.
 *
 * @param sib  The reference node.
 * @return     Either:
 *               1) The closest next sibling to |sib| that is not
 *                  ignorable according to |is_ignorable|, or
 *               2) null if no such node exists.
 */
function node_after( sib )
{
  while ((sib = sib.nextSibling)) {
    if (!is_ignorable(sib)) return sib;
  }
  return null;
}

/**
 * Version of |lastChild| that skips nodes that are entirely
 * whitespace or comments.  (Normally |lastChild| is a property
 * of all DOM nodes that gives the last of the nodes contained
 * directly in the reference node.)
 *
 * @param sib  The reference node.
 * @return     Either:
 *               1) The last child of |sib| that is not
 *                  ignorable according to |is_ignorable|, or
 *               2) null if no such node exists.
 */
function last_child( par )
{
  var res=par.lastChild;
  while (res) {
    if (!is_ignorable(res)) return res;
    res = res.previousSibling;
  }
  return null;
}

/**
 * Version of |firstChild| that skips nodes that are entirely
 * whitespace and comments.
 *
 * @param sib  The reference node.
 * @return     Either:
 *               1) The first child of |sib| that is not
 *                  ignorable according to |is_ignorable|, or
 *               2) null if no such node exists.
 */
function first_child( par )
{
  var res=par.firstChild;
  while (res) {
    if (!is_ignorable(res)) return res;
    res = res.nextSibling;
  }
  return null;
}

/**
 * Version of |data| that doesn't include whitespace at the beginning
 * and end and normalizes all whitespace to a single space.  (Normally
 * |data| is a property of text nodes that gives the text of the node.)
 *
 * @param txt  The text node whose data should be returned
 * @return     A string giving the contents of the text node with
 *             whitespace collapsed.
 */
function data_of( txt )
{
  var data = txt.data;
  // Use ECMA-262 Edition 3 String and RegExp features
  data = data.replace(/[\t\n\r ]+/g, " ");
  if (data.charAt(0) == " ")
    data = data.substring(1, data.length);
  if (data.charAt(data.length - 1) == " ")
    data = data.substring(0, data.length - 1);
  return data;
}


function getAbsPos( oId, tl ) {
	var o = ( typeof oId == 'String' ) ? document.getElementById( oId ) : oId;
	var val = 0;
	while ( o.nodeName != "BODY" ) {
		val += parseInt( ( tl == 'top' ) ? o.offsetTop : o.offsetLeft );
		o = o.parentNode;
		}
	return val;
}

/*
 * Wrapper per aggiungere eventi: cross-browser (si spera)
 */
 
function addEvent(obj, evType, fn){ 

	if (obj.addEventListener){ 
	  	obj.addEventListener(evType, fn, false); 
	  	return true; 
	} else if (obj.attachEvent){ 
	  	var r = obj.attachEvent("on"+evType, fn); 
	  	return r; 
	} else { 
	  	return false; 
	} 
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curtop,curleft];
}
function searchForm() {

	theForm = document.getElementById('search-form');
	
	radio_site = document.getElementById('search-where-0');
	
	radio_web = document.getElementById('search-where-1');
	
	radio_site.name='search-where';
	radio_web.name='search-where';
	
	addEvent(radio_site,'change',changeForm);
	addEvent(radio_web,'change',changeForm);
	
}
function changeForm() {


	if(radio_site.checked) {
	
		theForm.setAttribute("action", 'ricerca.html');
		theForm.setAttribute("method", 'post');
		theForm.removeAttribute("target");
		var searchWords = document.getElementById('sword');

		searchWords.setAttribute('name','tx_ablinklist_pi1[sword]');
	

	} else if (radio_web.checked) {
	
		theForm.setAttribute("action", 'http://www.google.com/search');
		theForm.setAttribute("method", 'get');
		theForm.setAttribute("target", '_blank');
		var searchWords = document.getElementById('sword');
		
		searchWords.setAttribute('name','q');
		
		var language = document.getElementById('hl');
		
		language.setAttribute('name','hl');

		
	}
}

function submitForm() {
	theForm.submit();
}
addEvent(window,'load',searchForm);


