$(document).ready(Init);

function Init() {
	
	N2C.Init();
	
}

var N2C = {
	
	Init : function() {
	
		N2C.Email();
		N2C.Layout();
		N2C.Splash();
	},
	
	Splash : function() {
	
		if( $('#splash_flash').is('div') ) {
			var flashvars = {
  			wmode: "transparent"			
			};
			var params = {
  			menu: "false",
  			wmode: "transparent"
			};
			var attributes = {
  			wmode: "transparent" 	 			 	 			
			};

			swfobject.embedSWF("/wp-content/themes/Need2Code/swf/Splash.swf", "splash_flash", "996", "277", "9.0.0", flashvars, params, attributes);
		}
	
	},
	
	// Decode email back to regular from SPAM-filter
	Email : function() {
		$('#wrapper .email').each(
			function(i) {
				m = $(this).text();
				m = m.replace('[at]','@');
				m = m.replace('[dot]','.');
				$(this).html('<a href="mailto:' + m + '">' + m + '</a>');
			}
		);
	},
	
	Layout : function() {
		
		// Remove line from last post on startpage
		if( $('body.home:first').is('body') ) {
			$('#content div.post:last').css('borderBottom','none');
		} else if( $('body.page-template-page-blog-php:first').is('body') ) {
			$('#content div.post:last').css('borderBottom','none');
		} else if( $('body.archive:first').is('body') ) {
			$('#content div.post:last').css('borderBottom','none');
		}
		
		// Remove line from last comment on post
		if( $('#commentlist').is('ol') ) {
			$('#commentlist li:last').css('borderBottom','none');
		}
		
		// Add the VB to the top
		$('#wrapper').append('<div id="vb_code">VB</div>');
			
	}

}
