var bg = new Image(950,1500)
bg.src = "../img/bg_rndbackground_950x1500.png";

$(document).ready(function(){

	$('#article .post .section h3:first').addClass('nomrg'); 
	$('#article .post .section #compbio h3').addClass('nomrg');

	$('span.mailme').mailme(); // SPAM bot email hide function
	$('#header ul.child li:last').addClass('last');	// find the last item in the nav and declare it as the last

	
	if ((navigator.userAgent.indexOf('BlackBerry') != -1)) {
		$('body#collaboration .post h2.title').text('Working with Us');	
	}
	
	$('#news #newsNav li:first').addClass('selected');
	$('#news #content').load('http://www.onset.com/category/pressreleases/?random=' + unique_requestid() + ' #article .section',function(){
		$('#news #content').append('<div class="seeall"><a href="http://www.onset.com/category/pressreleases/">See all Press Releases</a></div>');
	});
		
	$('#news ul#newsNav a').each(function(){
		$(this).click(function(){
			var parent = $(this).text();
			//alert(parent);
			var a =	 $(this).attr('href'); // GET LINK
			$('#news #content').load(a+'?random=' + unique_requestid() + ' #article #gallery #content .section', function(){
				if(parent == 'Press Releases') {
					$('#news #content').append('<div class="seeall"><a href="http://www.onset.com/category/press-releases/">See all Press Releases</a></div>');
				} else if(parent == 'Media Coverage') {
					$('#news #content').append('<div class="seeall"><a href="http://www.onset.com/category/media-coverage/">See all Media Coverage</a></div>');
				}
			});
			$('#news ul#newsNav li.selected').removeClass('selected');
			$(this).parent('li').addClass('selected');
			return false;			
		});
	}); /* */
	
	$('#portfolio-bb ul.hidenav').show().attr('style','');
});

function unique_requestid() {
	var timestamp = Number(new Date()).toString();
	var random = Math.random() * (Math.random() * 100000 * Math.random() );
	var unique = new String();
	unique = timestamp + random;
	return unique;
}
	


