jQuery(document).ready(function(){
	jQuery("#search-input").focus(function() {
		jQuery("#search-input").css("background","#ffffff");
	});	
	jQuery("#search-input").blur(function() {
		if(jQuery("#search-input").val()=='') 
			jQuery("#search-input").css("background","#fff url(/fls/18100/site_graphics/2010/search-bg.png) 0px 1px no-repeat");
	});

	jQuery("#Login_ID").focus(function() {
		jQuery("#Login_ID").css("background","#ffffff");
	});	
	jQuery("#Login_ID").blur(function() {
		if(jQuery("#Login_ID").val()=='') 
			jQuery("#Login_ID").css("background","#fff url(/fls/18100/site_graphics/2010/enews-input-bg.png) no-repeat");
	});

/*rotator*/
if(jQuery("#rotator-box").length>0) {    
	jQuery("#rotator-box").show();
	jQuery('#scroller').cycle({
		fx:     'fade', 
		speed:  'slow', 
		timeout: 6000, 
		prev:    '#GoPrev',
		next:    '#GoNext',     
		pager:  '#thumbs', 
		after: showOverlay,
		pagerAnchorBuilder: function(idx, slide) { 
		// return selector string for existing anchor 
			return '#thumbs li:eq(' + idx + ') a'; 
		}                     
	});   

	jQuery('.play-button').click(function(){
		jQuery('#rotator .main-image').fadeOut(500,function(){
			var item = jQuery(this);
			jQuery('#neulion-video').show();
			jQuery('#scroller').cycle('pause',true);
			jQuery('.video-close').show();
			var video_id = jQuery('.video-id',item).html();
			neulionPlayer(video_id);
		});
	});

}
jQuery('.video-close').click(function(){
	stopVideo();
});

jQuery('.play-button').click(function(){
	jQuery('#article-image .main-image').fadeOut(500,function(){
		var item = jQuery(this);
		jQuery('#neulion-video').show();
		jQuery('#scroller').cycle('pause',true);
		jQuery('.video-close').show();
		var video_id = jQuery('.video-id',item).html();
		neulionPlayer(video_id);
	});
});

function showOverlay(){
	jQuery('#scroller .overlay').hide();
	jQuery('.overlay',this).animate({
		height:"show"
	},750);
	stopVideo();
}
function stopVideo(){
	jQuery('#neulion-video').fadeOut(500,function(){
		jQuery('#rotator .main-image').fadeIn(250);
		jQuery('#article-image .main-image').fadeIn(250);
	});
	jQuery('.video-close').hide();
	if(jQuery("#jtvshlembed").length>0 && jQuery('#neulion-video').css('display') =='block') {
		try {document.getElementById('jtvshlembed').pauseVideo();}
		catch(ex) {
			/*setTimeout("stopVideo()",1000);*/	
		}
	
	} 
}
	jQuery("#marketplace .slider").easySlider({
		speed: 1000,
		prevId: "prev",
		nextId: "next",
		prevText: "",
		nextText: "",
		continuous: true
	});

});


