// JavaScript Document
$(document).ready(function(){
	twitter();
 });
function twitterSearch(obj) {	
    //this is the div I'm writing the content to	
    var tDiv = document.getElementById("twitter-home");	
    var user, bgcolor, tweet, postedAt, icon, userURL;	
    //start the ul	
    tDiv.innerHTML = "<ul>"	
    for (i=0;i<obj.results.length;i++) {	
    	//Look at me use the JavaScript modulus operator to do even/odd rows.
      	if(i % 2) {
        	bgcolor="#fff"
        } else {
       		bgcolor="#fff"	
        }
        //we need to get some data out of the object
        //and populate some variables.
        //i could do this inline in the string below, 
        //but this is way easier for you to read
        icon = obj.results[i].profile_image_url;
        user = obj.results[i].from_user;
        userURL = "http://twitter.com/"+user;
        tweet = obj.results[i].text;
        postedAt = obj.results[i].created_at;
	    //and here I mash it all up into a fancy li
   		//tDiv.innerHTML +="<li style='background-color:"+bgcolor+"; background-image: url("+icon+")'><strong><a href='"+userURL+"'>"+user+"</a></strong>: "+tweet+" <span class='time'>("+postedAt+" GMT)</span> </li>";
		 //tDiv.innerHTML +="<li style='background-color:"+bgcolor+"; background-image: url("+icon+")'><strong><a href='"+userURL+"'>"+user+"</a></strong><p id='p_tweet'>:"+tweet+"</p><span class='time'>("+postedAt+" GMT)</span> </li>";
		 tDiv.innerHTML +="<li style='background-color:"+bgcolor+"; background-image: url("+icon+")'><strong><a href='"+userURL+"'>"+user+"</a></strong><p class=''>:"+tweet+"</p><span class='time'>("+postedAt+" GMT)</span> </li>";
	}
    //and close the UL
    tDiv.innerHTML += "</ul>";
}
//this is basically the same function I was using before
//with the changed search URL
function twitter() { 
    var twitterJSON = document.createElement("script"); 
    twitterJSON.type="text/javascript" 
    //here's the search URL
    twitterJSON.src="http://search.twitter.com/search.json?callback=twitterSearch&q=from%3Agirlfriendology&rpp=4"
    document.getElementsByTagName("head")[0].appendChild(twitterJSON);
    return false;
}
	$(document).ready(function(){
		$("#rotator > ul").tabs({fx:{rotate: "toggle"}}).tabs("rotate", 4000, true);
	});

