<?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. */
		$title = apply_filters('widget_title', $instance['title'] );
		$feed_url = $instance['feed_url'];
		echo $before_widget;
		if ( $title )
			echo $before_title . $title . $after_title; ?>


				
                        	<div class="newsletterForm">
                            <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" class="newsletterForms">
                            	<input type="text" class="newslettermail"  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 name="submit" id="mail-submit" class="newslettersubmit btn buttonShadow" type="submit" />
                            </form><!--End forms-->
                            <i class="icon-rss"></i>
                        </div><!--End newsletterForm-->
                  

<?php 
		echo $after_widget;
	}
	
	function update( $new_instance, $old_instance ) {
		$instance = $old_instance;
		$instance['title'] = strip_tags( $new_instance['title'] );
		/* 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', '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' ); ?>" type="text"  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' ); ?>" type="text"  value="<?php echo $instance['feed_url']; ?>" class="widefat" />
		</p>


   <?php 
}
	} //end class