// JavaScript Document
$(document).ready(function() {
 // put all your jQuery goodness in here.
 
 //Remove wordSearch when clicked
 $('.default-value').each(function() {
    var default_value = this.value;
    $(this).focus(function() {
        if(this.value == default_value) {
            this.value = '';
        }
    });
    $(this).blur(function() {
        if(this.value == '') {
            this.value = default_value;
        }
    });
	});
 
 $('a.externalLink_listing').click(function(){
									
									var listingID = $('input[name="listingID"]').val();
									// Ajax request sent to the CodeIgniter controller "ajax" method "updateClikThrough"
					    			
									$.post('/index.php/ajax/updateViewersSent',
										   {'listingID':listingID }
										   )
									});
 
 //
  $('div.listing_simple a.externalLink').click(function(){
									
									var listingID = $(this).attr( 'id' );
									// Ajax request sent to the CodeIgniter controller "ajax" method "updateClikThrough"
					    			
									$.post('/index.php/ajax/updateViewersSent',
										   {'listingID':listingID }
										   )
									
									});
  
  $('a.externalLink_premiumListing').click(function(){
									
									var premiumID = $('input[name="premiumID"]').val();
									// Ajax request sent to the CodeIgniter controller "ajax" method "updateClikThrough"externalLink_premiumListing
					    			
									$.post('/index.php/ajax/updateViewersSentPremiumListing',
										   {'premiumListingId':premiumID }
										   )
									
									});
});



