if( !General ) var General = {};

/*SCRIPT TO RUN AFTER DOM IS LOADED*/
General.subscript = {
	init: function(){
		this.preparePng();
		this.prepareNavigation();
		this.prepareCheckboxes();
	},
	preparePng: function(){
		if( typeof( ddpngfix ) !== 'undefined' ){
			$( 'img[src$=.png]:not(.opaque), #header a' ).each( function(){
				ddpngfix.fixPng( this );					
			} );			
			if( !General.flash.hasFlashVersion() ){
				ddpngfix.fix( 'div#tagcloud' );
			}
		}
	},
	prepareNavigation: function(){
		$( '#nav-next' ).click( function(){
			$( 'form' ).trigger( 'submit' );
			return false;
		} );
	},
	prepareCheckboxes: function(){
		$( 'input[type=checkbox]' ).each( function(){
			var custom_checkbox = $( '<span class="custom-checkbox"></span>' );
			if( $( this ).attr( 'checked' ) ){
			   custom_checkbox.addClass( 'checked-custom-checkbox' );	
			}
			$( this ).before( custom_checkbox );	
		} ).click( function(){
			if( $( this ).attr( 'checked' ) ){
				$( this ).prev().addClass( 'checked-custom-checkbox' );	
			}else{
				$( this ).prev().removeClass( 'checked-custom-checkbox' );			   
			}		
		} );
	}
}
$( 'document' ).ready( function(){
	General.subscript.init();
} );
