<!--//

/**
* Position fixed in ie < 7
*/
if ((navigator.userAgent.search('MSIE') > 0) && (navigator.userAgent.search('MSIE 7') < 0)) {

	var login_bar = document.getElementById('login_bar');
	var login_bar_ext = document.getElementById('login_bar_ext');

	login_bar.style.position = 'absolute';
	login_bar.style.left = '50%';
	login_bar.style.marginLeft = '-450px';
	login_bar_ext.style.position = 'absolute';

	login_bar.style.top = (document.body.clientHeight - 39) + 'px';
	login_bar_ext.style.top = (document.body.clientHeight - 39) + 'px';
	

	login_bar_execution = function () {
		login_bar.style.top = (document.body.clientHeight - 39) + document.documentElement.scrollTop + 'px';
		login_bar_ext.style.top = (document.body.clientHeight - 39) + document.documentElement.scrollTop + 'px';
	}

	window.onscroll = login_bar_execution;
	window.onload = login_bar_execution;
	window.onresize = login_bar_execution;

}
else
{
	/**
	* Prevents login password to be shown in clear if a login error occurs
	*/
		if (document.getElementById('login_pass'))
		{
			if(document.getElementById('login_pass').value=='password') {
				document.getElementById('login_pass').type = 'text';
			}
		}
}




/**
* Effects for preview mode
*/

function mode1_raw (path) {
document.getElementById('anteprima_scalato').style.display='none';
document.getElementById('perspective').style.display='block';
document.getElementById('anteprima_centrato').style.backgroundImage='url('+path+')';
}

function mode1 (path,formato) {

  if (formato=='standard') {
    var altezza = 537;
  }

  if (formato=='quadrato') {
    var altezza = 700;
  }

  if (document.getElementById('fake_perspective').width/document.getElementById('fake_perspective').height > 700/altezza) {
    mode1_raw(path);
  }
  else {
    mode3_raw(path);
  }
}

function mode2 () {
  document.getElementById('anteprima_scalato').style.display='block';
  document.getElementById('perspective').style.display='none';
  document.getElementById('anteprima_scalato').style.width='700px';
  document.getElementById('anteprima_scalato').style.marginLeft='0px';
  document.getElementById('anteprima_centrato').style.backgroundImage='';
}

function mode3 (path,formato) {

  if (formato=='standard') {
    var altezza = 537;
  }

  if (formato=='quadrato') {
    var altezza = 700;
  }

  if (document.getElementById('fake_perspective').width/document.getElementById('fake_perspective').height > 700/altezza) {
    mode3_raw(path);
  }
  else {
    mode1_raw(path);
  }

}

function mode3_raw () {
  document.getElementById('anteprima_scalato').style.display='block';
  document.getElementById('perspective').style.display='none';
  var new_width = Math.round(700*document.getElementById('anteprima_scalato').height/document.getElementById('fake_perspective').height);
  document.getElementById('anteprima_scalato').style.width=new_width+'px';
  document.getElementById('anteprima_scalato').style.marginLeft=(700 - new_width)/2 + 'px';
  document.getElementById('anteprima_centrato').style.backgroundImage='';
}


barre = function ()
{
// 	var ajax1 = document.getElementById('ajax_content2') ? document.getElementById('ajax_content2').offsetHeight : 0;
// 	var ajax2 = document.getElementById('ajax_content3') ? document.getElementById('ajax_content3').offsetHeight : 0;
	var content_block = document.getElementById('content_block') ? document.getElementById('content_block').getHeight() : 0;
	var add = content_block + 150 + 'px';
	new Effect.Morph('left_size_margin', { style: 'height:'+add+';', duration: 0.5 });
	new Effect.Morph('right_size_margin', { style: 'height:'+add+';', duration: 0.5 });
};



if (window.attachEvent) {
window.attachEvent('onload' , barre);
}
else
{
window.addEventListener('load' , barre , false);
}

