/*no-js show hide*/
$(document).ready(function() {
        $(".js").show();
        $(".non-js").hide();
});

/*add target = blank to external links*/
$(function() {
			$(".external").attr("target","_blank");
});

/*add class to fields without focus*/
$(document).ready(function() {
    $('input[type="text"]').addClass("idleField");
	$('input[type="text"]').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
        if (this.value == this.defaultValue){
        	this.value = '';
    	}
        if(this.value != this.defaultValue){
	    	this.select();
        }
    });
    $('input[type="text"]').blur(function() {
    	$(this).removeClass("focusField").addClass("idleField");
        if ($.trim(this.value == '')){
        	this.value = (this.defaultValue ? this.defaultValue : '');
    	}
    });
});

function nav(sel) {
   if (sel.selectedIndex == -1) return;
   var opt = sel.options[sel.selectedIndex];
   if (opt && opt.value)
      location.href = opt.value;
}


$(document).ready(function() {
	$("#twitter").getTwitter({
		userName: "publishingtalk",
		numTweets: 1,
		loaderText: "Loading tweets...",  
		slideIn: false,
		showHeading: false,
		showProfileLink: false
	});
});     




$(function () {
  $('#tweetsjobs').twitter({ query: 'publishingjobs', loadInterval: 30000, showInterval: 1000, maxTweets: 4 });
}); 

$(function () {
  $('#tweets').twitter({ query: 'publishingtalk', loadInterval: 30000, showInterval: 1000, maxTweets: 4 });
}); 


/* global variables */
var itemList = "";

$(document).ready(function() {
  var content = "";
  $.getJSON("/blog/wp-content/themes/pubtalk/javascripts/pipes.php",
   function(json){
     if(json.count > 0) {
       content = output_feed_items(json);
     } else {
       content = "The request did not return results.";
     }
     $("#jobs-feed").html(content);
   }
  );
});

function output_feed_items(json) {
  for (i=0;i<json.count;i++) {
    itemList += make_feed_item(json.value.items[i], i);
  }
  return itemList;
}

function make_feed_item(item, item_id) {
  return '<div class="job-summary pb14"><h4 id="heading-' + item_id + '">' +
      '<a href="' + item.link + '">' +
      item.title + '</a></h4></div>';
}




     


