$(function()
{
	//var params = getParameter(); 
	var mysrc = getParameter('source');
	if (mysrc != null)
		document.getElementById('innerpage').src = mysrc;
});

function getParameter(parName) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
      var pair = vars[i].split("=");
      if (pair[0].toLowerCase() == parName.toLowerCase()) {
        return pair[1];
      }
    }
  }











function hn_resize()
{
	//alert('resizzato');
	var ulmargintop = $('#indexnews').contents().find('ul#ticker').offset().top + 20;
	var frameHeight = $('#indexnews').height() - ulmargintop;
	var itemHeight = $('#indexnews').contents().find('ul#ticker li').outerHeight(true);
	var num = (frameHeight - (frameHeight % itemHeight)) / itemHeight;
	var newulheight = 0;
	if (num >= 2)
	{
		newulheight = num * itemHeight;
		$('#indexnews').contents().find('ul#ticker').height(newulheight);
	}
}


function tabselect(obj)
{
	$(obj.parentNode).addClass('selectedTab');
	return true;
}

function tabdeselect(obj)
{
	$(obj.parentNode).removeClass('selectedTab');
	return true;
}


function setBackground()
{
	var i = Math.floor(Math.random() * 4) + 1; //Genero un numero da 0 a 3 e lo incremento di 1
	document.images.background.src = 'images/index/bkg_' + i + '.jpg';
}


