
$(document).ready(function(){
	// slideshow
	$('#homeSlideshow').cycle({
		height:  '304px',	// container height
		fade:     1,		// true for fade, false for slide 
		speed:    2000,		// any valid fx speed value 
		timeout:  4000,		// ms duration for each slide 
		random:   0,       	// true for random, false for sequence 
		fit:      1,       	// force slides to fit container 
		pause:    0,       	// true to enable "pause on hover" 
		autostop: 0        	// true to end slideshow after X slides have been shown (where X == slide count) (note that if random == true not all slides are guaranteed to have been shown) 
	});
	
	// lightbox
	$('#slideshow a,a.lightbox').lightBox();
	
	// twitter feed
	//$('#twitterSearch').liveTwitter('bacon', {limit: 5, rate: 5000});
	$('#twitterUserTimeline').liveTwitter('saritaloudance', {limit: 5, refresh: false, mode: 'user_timeline'});
	
	// Changing the query
	$('#searchLinks a').each(function(){
		var query = $(this).text();
		$(this).click(function(){
			// Update the search
			$('#twitterSearch').liveTwitter(query);
			// Update the header
			$('#searchTerm').text(query);
			return false;
		});
	});
	
	$.Juitter.start({
		searchType:"fromUser", // needed, you can use "searchWord", "fromUser", "toUser"
		searchObject:"saritaloudance", // needed, you can insert a username here or a word to be searched for, if you wish multiple search, separate the words by comma.
		// The values below will overwrite the ones on the Juitter default configuration.
		// They are optional here.		// I'm changing here as a example only		
		lang:"en", // restricts the search by the given language		
		live:"live-15", // the number after "live-" indicates the time in seconds to wait before request the Twitter API for updates.
		placeHolder:"juitterContainer", // Set a place holder DIV which will receive the list of tweets example <div id="juitterContainer"></div>
		loadMSG: "Loading messages...", // Loading message, if you want to show an image, fill it with "image/gif" and go to the next variable to set which image you want to use on 		
		imgName: "loader.gif", // Loading image, to enable it, go to the loadMSG var above and change it to "image/gif"		
		total: 20, // number of tweets to be show - max 100		
		readMore: "Read it on Twitter", // read more message to be show after the tweet content		
		nameUser:"image", // insert "image" to show avatar of "text" to show the name of the user that sent the tweet 		
		openExternalLinks:"newWindow", // here you can choose how to open link to external websites, "newWindow" or "sameWindow"                filter:"sex->*BAD word*,porn->*BAD word*,fuck->*BAD word*,shit->*BAD word*"  // insert the words you want to hide from the tweets followed by what you want to show instead example: "sex->censured" or "porn->BLOCKED WORD" you can define as many as you want, if you don't want to replace the word, simply remove it, just add the words you want separated like this "porn,sex,fuck"... Be aware that the tweets will still be showed, only the bad words will be removed	});	
	});
});


/* drop down menu */
function dropdown(obj,stat) {
	idx=fDOM(obj);
	idx.style.visibility=(stat) ? "visible" : "hidden";
}
function fDOM(obj) {
	if (document.getElementById) return (document.getElementById(obj));
	else return (0);
}

/* generic pop-up window */
function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=825,height=618,left=200,top=200');");
}

/* image swap on hover */
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

