$(document).ready(function () {

/* This is the code that controlls the homepage tabs and auto rotator*/

$(function() {
	$('#tabcontent > ul').tabs();
});


// Top right slides //

$('#tabs .imagescroll').cycle({ 
    fx:      'fade', 
    speed:    800, 
    timeout:  4000,
    pause:  1
});

/*This is the code that controlls the news section tabs */

$(function () {
    var tabContainers = $('div#sidebar #newsblog > div');
    
    $('div#newsblog ul.navigation a').click(function () {
        tabContainers.hide().filter(this.hash).show();
        
        $('div#newsblog ul.navigation a').removeClass('active');
        $(this).addClass('active');
        
        return false;
    }).filter(':first').click();
});

/*Free trial and compare rollovers*/

// Preload all rollovers
$("#topimages img").each(function() {
	// Set the original src
	rollsrc = $(this).attr("src");
	rollON = rollsrc.replace('OFF', 'ON');
	newImg = new Image(); // create new image obj
	$(newImg).attr("src", rollON); // set new obj's src
});


// Navigation rollovers
$("#topimages a").mouseover(function(){
	imgsrc = $(this).children("img").attr("src");
	
	if (typeof(imgsrc) != 'undefined') {
	imgsrcON = imgsrc.replace('OFF', 'ON');
	$(this).children("img").attr("src", imgsrcON);
	}
	
});

// Handle mouseout
$("#topimages a").mouseout(function(){
	if (typeof(imgsrc) != 'undefined') {
	$(this).children("img").attr("src", imgsrc);
	}
});		



// spotlight controller //

$('.scroll').cycle({ 
    fx:      'scrollHorz', 
    speed:    800, 
    timeout:  10000,
    next:   '#next', 
    prev:   '#prev',
    pause:  1
});

// spotlight Logo hovers //

$("img#hp").hover(function(){
  $("p.hp").toggle();
},function(){
  $("p.hp").toggle();
}); 

$("img#fedex").hover(function(){
  $("p.fedex").toggle();
},function(){
  $("p.fedex").toggle();
}); 

$("img#volvo").hover(function(){
  $("p.volvo").toggle();
},function(){
  $("p.volvo").toggle();
}); 

$("img#icann").hover(function(){
  $("p.icann").toggle();
},function(){
  $("p.icann").toggle();
}); 




$("img#virgin").hover(function(){
  $("p.virgin").toggle();
},function(){
  $("p.virgin").toggle();
}); 

$("img#esa").hover(function(){
  $("p.esa").toggle();
},function(){
  $("p.esa").toggle();
}); 

$("img#symantec").hover(function(){
  $("p.symantec").toggle();
},function(){
  $("p.symantec").toggle();
}); 

$("img#icq").hover(function(){
  $("p.icq").toggle();
},function(){
  $("p.icq").toggle();
}); 


$("img#princeton").hover(function(){
  $("p.princeton").toggle();
},function(){
  $("p.princeton").toggle();
}); 

$("img#nasdaq").hover(function(){
  $("p.nasdaq").toggle();
},function(){
  $("p.nasdaq").toggle();
}); 

$("img#wbr").hover(function(){
  $("p.wbr").toggle();
},function(){
  $("p.wbr").toggle();
}); 

$("img#pipex").hover(function(){
  $("p.pipex").toggle();
},function(){
  $("p.pipex").toggle();
}); 



$("img#vodafone").hover(function(){
  $("p.vodafone").toggle();
},function(){
  $("p.vodafone").toggle();
}); 

$("img#homeland").hover(function(){
  $("p.homeland").toggle();
},function(){
  $("p.homeland").toggle();
}); 

$("img#ziff").hover(function(){
  $("p.ziff").toggle();
},function(){
  $("p.ziff").toggle();
}); 

$("img#skype").hover(function(){
  $("p.skype").toggle();
},function(){
  $("p.skype").toggle();
}); 



});