/*  52ore.net software creation
 *  (c) 2007 Marco Longhin
 *--------------------------------------------------------------------------*/
 
 var homeDescNumber = 2;
 
function homeDescLoad(){

	descNum = Math.floor(Math.random() * (homeDescNumber) +1);
	
	new Ajax.Updater('homeInfoBlockContainer', 'pages/homeDesc'+descNum+'.in', {
		method:'get'
	});
	

}

function showOverlay(name){

	new Ajax.Updater('overlayText', 'pages/services'+name+'Desc', {
		asynchronous:true,
		method:'post'
		});
	
	var altezza = 100;
	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;
	}
	
	document.getElementById('overlayBody').style.top = yScroll + altezza + "px";
	document.getElementById('overlayText').style.top = yScroll + altezza + 20 + "px";
	new Effect.Appear('overlayBody', { duration: 0.5, from: 0.0, to: 0.9 });
	new Effect.Appear('overlayText', { duration: 1.5 });
}

function closeOverlay(){

	new Effect.Fold('overlayBody', { duration: 1.0, from: 0.0, to: 0.9 });
	new Effect.Fold('overlayText', { duration: 1.0 });
}

function portfolioBox(page){
  new Effect.Fade('bigSiteBox', {duration:0.500});
  setTimeout("blockRequest('bigSiteBox', '"+page+"')", 600);
}

function trainingBox(page){
  new Effect.Fade('trainingDesc', {duration:0.500});
  setTimeout("blockRequest('trainingDesc', '"+page+"')", 600);
}

function blockRequest(div, page){
  document.getElementById(div).innerHTML = '<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p align="center"><img src="images/ajax-loader.gif"></p>';
  new Effect.Appear(div);
  //new Ajax.Updater(div, page, {onComplete:function(){ new Effect.Appear(div);},asynchronous:true, evalScripts:true, method:'post'}); 
  new Ajax.Updater(div, page, {asynchronous:true, evalScripts:true, method:'post'}); 
}

function prodotti_main(name){

  prodotti_hide_all_highlight();
  
  if(name=='left'){
    productDescribeChange('describeGemma');
    $('prodottiBigBox').innerHTML = '<img src="images/prodotti/gemmaSpot.jpg" />  ';
    div.style.backgroundImage = 'url(images/prodotti/bottomLeftHigh.jpg)';
  }
  else{
    productDescribeChange('describeFVS');
    $('prodottiBigBox').innerHTML = '<img src="images/prodotti/fvsSpot.jpg" />  ';
    div.style.backgroundImage = 'url(images/prodotti/bottomRightHigh.jpg)';
  }  
  
  
  div.onmouseover = function(){}
  div.onmouseout = function(){}
}

function prodotti_hide_all_highlight(){
  $('prodottiSmallBoxTop_left').style.backgroundImage = 'url(images/prodotti/bottomLeftHigh.jpg)';
  $('prodottiSmallBoxTop_right').style.backgroundImage = 'url(images/prodotti/bottomRightHigh.jpg)';

  $('prodottiSmallBoxTop_left').onmouseover = function(){$('prodottiSmallBoxTop_left').style.backgroundImage = 'url(images/prodotti/bottomLeftHigh.jpg)'}
  $('prodottiSmallBoxTop_right').onmouseover = function(){$('prodottiSmallBoxTop_right').style.backgroundImage = 'url(images/prodotti/bottomRightHigh.jpg)'}
  
  $('prodottiSmallBoxTop_left').onmouseout = function(){$('prodottiSmallBoxTop_left').style.backgroundImage = 'url(images/prodotti/bottomLeftOpaque.jpg)'}
  $('prodottiSmallBoxTop_right').onmouseout = function(){$('prodottiSmallBoxTop_right').style.backgroundImage = 'url(images/prodotti/bottomRightOpaque.jpg)'}
  
}

var productNowDescribed = 'describeGemma';
function productDescribeChange(div){
  $('describeContainer').style.display = 'none';
  setTimeout("$('describeContainer').innerHTML=$('"+div+"').innerHTML", 200);
  setTimeout("Effect.Appear('describeContainer')", 200);
  productNowDescribed = div;
}

