$(document).ready(function(){
	
	// -- create mailto links for email addresses
	$(".msging").defuscate();
	
	// -- Create the homepage flash file
	if( $('#homeplayer').length > 0 ){
		$("#homeplayer").flash({
			"src":"assets/templates/venn/swf/homeplayer.swf", 
			"width": 1010, 
			"height": 373, 
			"wmode":"transparent", 
			"base":"/", 
			"flashvars": {vidurl:"http://www.vennlifesciences.com/assets/templates/venn/flv/venn_v3_short.flv"}
		});
	}
	
	// -- Create the footer featured items ticker
	if( $("#featured_items").length > 0 ) {
		$("#featured_items").flash({
			"src":"assets/templates/venn/swf/featured_items_player.swf", 
			"width": 415, 
			"height": 208, 
			"wmode":"transparent", 
			"flashvars": {feedurl:"http://www.vennlifesciences.com/featured_items.xml"}
		})
	}
	
	// -- Perform sifr substitutions
	$.sifr({
		path: 'assets/templates/venn/swf/',
		save: true, 
		style: 'margin: 0'
	});

	$('h2 span').sifr({ font: 'helvetica_neue', fontSize: 30 });
	$('h3 span').sifr({ font: 'helvetica_neue', fontSize: 15 });
	
	// -- Should we hide the send to a friend form
	if( $('.validation').length > 0 ){
		
		var validation_html = new String($('.validation').html());
		validation_html = validation_html.replace(/^\s*/, "").replace(/\s*$/, "");
		if( validation_html == '' )
			$('#email_form').css('display', 'none');
		else 
			$('#email_form').css('display', 'block');
		
	}
	
	// -- Setup the click function for the send to a friend form
	if( $('#email_form').length > 0 ) {
		$('.emailpage_btn').click(function(){
			var onoroff = ($('#email_form').css('display') == 'block')?'none':'block';
			$('#email_form').css('display', onoroff);
			return false;
		});
	}
	
	// Apply pngFix for IE6
	if($.browser.msie && /6.0/.test(navigator.userAgent)){ 
		$(document).pngFix();
	}

});