<?php 

add_action('widgets_init','Lioit_newsletter');

function Lioit_newsletter() {
	register_widget('Lioit_newsletter');
	}

class Lioit_newsletter extends WP_Widget {
	function Lioit_newsletter() {
			
		$widget_ops = array('classname' => 'newsletter','description' => __('Widget display the Subscribe box','lioit'));

	
		$this->WP_Widget('newsletter',__('( LioIT ) Newsletter','lioit'),$widget_ops);

		}
		
	function widget( $args, $instance ) {
		extract( $args );
		/* User-selected settings. */
		$feed_url = $instance['feed_url'];
?>

								<div class="widget">
                        	<div class="subscribeBox">
                            	<form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $feed_url; ?>', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true" id="subscribe">
                                    <input type="text" id="mail-forum" value="<?php _e('Your Email' , 'lioit') ?>" onfocus="if (this.value=='<?php _e('Your Email' , 'lioit') ?>') this.value       = '';" onblur="if (this.value=='') this.value='<?php _e('Your Email' , 'lioit') ?>';" />
                                    <input type="hidden" name="loc" value="en_US"/>
									<input type="hidden" value="<?php echo $feed_url; ?>" name="uri"/>
                                    <input type="submit" id="mail-submit" value="" />
                                </form>
                            </div><!--End SubscribeBox-->
                        </div><!--End Widget-->

<?php 
		/* After widget (defined by themes). */
	}
	
	function update( $new_instance, $old_instance ) {
		$instance = $old_instance;

		/* Strip tags (if needed) and update the widget settings. */
		$instance['feed_url'] = $new_instance['feed_url'];

		return $instance;
	}
	
function form( $instance ) {

		/* Set up some default widget settings. */
		$defaults = array( 
			'title' => __('Subscribe to our newsletter', 'lioit'),
			'feed_url' => 'Lioit'
 			);
		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
	
    	<p>
		<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('title:', 'lioit'); ?></label>
		<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>"  class="widefat" />
		</p>

		<p>
		<label for="<?php echo $this->get_field_id( 'feed_url' ); ?>"><?php _e('feedburner name: (your name without http://feeds.feedburner.com/) ', 'lioit'); ?></label>
		<input id="<?php echo $this->get_field_id( 'feed_url' ); ?>" name="<?php echo $this->get_field_name( 'feed_url' ); ?>" value="<?php echo $instance['feed_url']; ?>" class="widefat" />
		</p>


   <?php 
}
	} //end class