//Prototype & Scriptalicious

document.observe("dom:loaded", function() {
Event.observe(window, "resize", adjustLayout);
adjustLayout();



var str = document.referrer;

if ((str.match("http://www.satnews.com") != null) || (str.match("http://satnews.com") != null)) {
$('google').appear({ duration: 0 });
}
else {
$('google').appear({ duration: 2 });
var slide_offset = document.viewport.getWidth()-150; 
new Effect.Move('google', { x: -slide_offset, y: 0, mode: 'relative', duration: 0 });
new Effect.Move('google', { x: slide_offset, y: 0, mode: 'relative', duration: 1.5 });
}
 

$('google').fade({ duration: 2, delay: 5 });
$('twitter').appear({ duration: 2, delay: 5 });
$('twitter').fade({ duration: 2, delay: 10 });
$('rss').appear({ duration: 2, delay: 10 });
$('rss').fade({ duration: 2, delay: 15 });
$('google').appear({ duration: 2, delay: 15 });

setInterval("fade_services()", 20000);
});


function adjustLayout()
{


$( 'middle' ).setStyle({
  top: 210+'px',
  left: 150+'px'
});


var viewport = document.viewport.getWidth(); 
var mid_width = viewport-360;

$( 'middle' ).setStyle({
  width: mid_width+'px'
});

var mid_width = $('middle').getStyle('width');

  // Get content heights
  var cHeight = $('middlecontent').getHeight();
  var lHeight = $('leftcontent').getHeight();
  var rHeight = $('rightcontent').getHeight();


  // Find the maximum height
  var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));
  
  // Assign maximum height to all columns
$( 'middle' ).setStyle({height: maxHeight+'px'});
$( 'left' ).setStyle({height: maxHeight+'px'});
$( 'right' ).setStyle({height: maxHeight+'px'});


  // Show
$('middlecontent').show();
var goog_width = viewport-105;
new Effect.Move('google', { x: goog_width, y: 189, mode: 'absolute', duration: 0 });

}

function fade_services() {

$('google').fade({ duration: 2 });
$('twitter').appear({ duration: 2 });
$('twitter').fade({ duration: 2, delay: 5 });
$('rss').appear({ duration: 2, delay: 5 });
$('rss').fade({ duration: 2, delay: 10 });
$('google').appear({ duration: 2, delay: 10 });

return false;
}


