function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
	    return window[movieName];
	} else {
	    return document[movieName];
	}
}

function changemovie(type, directory, cdn) {
  if (thisMovie("fljs")) {
		thisMovie("fljs").changemovie(type, directory, cdn);
	}
	HighlightThumb(directory, 1);
}

function HighlightThumb(directory, count_view) {
	// flag selected
	list = $$('dl.preview dd.now-playing');
	list.each(function(e) {
		$(e.id).hide();
	});
	$('now-playing' + directory).show();
	
	// call controller script for new info
	var url    = '/home/update_preview';
	//var pars   = 'directory=' + directory;
	var myAjax = new Ajax.Request(url, {
		method:'post',
		parameters:{directory:directory, count_view:count_view},
		
		// get back info
		onSuccess:function(transport) {
			// get data
			var data = transport.responseJSON;
			
			// update
			$('preview-bids').update(data.bids);
			$('preview-price').update(data.price);
			$('preview-title').update(data.title);
			$('preview-views').update(data.views);
			$('preview-endtime').update(data.endtime);
			$('preview-directory').href = '/auction/' + data.auction_id;
			$('preview-bid').href = '/auction/' + data.auction_id;
		}
	});
}
