

function select_archive()
{
	var x = document.getElementById("myselect");
	if(x.options[x.selectedIndex].text == "2011")
	{
	window.location.href='http://www.star-board-sup.com/2011/';
	}
	if(x.options[x.selectedIndex].text == "2010")
	{
	window.location.href='http://www.star-board-sup.com/2010/';
	}
	else if(x.options[x.selectedIndex].text== "2009")
	{
	window.location.href='http://2009.star-board-sup.com/';
	}
}

function init_input_box(name, text){ //alert('xx');
	$('#'+name).val(text).focus(function(){
		if($(this).val()==text) $(this).val('');
	}).blur(function(){
		if($(this).val()=='') $(this).val(text);
	});;
}



$(document).ready(function(){
	init_news_tabs();
	init_scroller();
	init_thumb();
	init_icon_tech();
	init_product_video();
	init_article_review('#product_articles');

	init_input_box('address','City, Country');
	init_input_box('address_f','City, Country');
	init_input_box('mce-EMAIL','Enter Your E-Mail');
	init_input_box('site_search','Search articles and news');
	
	
});


function init_article_review(sel){
	//alert($(sel).attr('rel'));
	$(sel).load($(sel).attr('rel'),function(){
		//alert('xx');
		$(this).livePaging({
			items_per_page:5,
			image_prev_button:'images/arrow_back.gif',
			image_next_button:'images/arrow_readmore.gif',
			callBack:function(){ //alert('Highlight');
				//alert($(ui.panel).find('.item_list > ul').html());
				//$(ui.panel).find('.item_list > ul').highLight();
				//$(this).find('.pos-4').css('background','none');
			}
		});
	});
}

function init_product_video(){
	$('#product_video_icon').click(function(){
		var video_url = $(this).children('img').attr('rel'); //alert($(this).html());
		var container = $('#board_gallery_wrap'); //alert(container.html());
		var player_id = 'product_video_player';
		var player_wrap = $(document.createElement('div')).css({
			position:'absolute', left:0, top:0, width:container.width(), height:container.height()
		}).appendTo(container);
		var player = $(document.createElement('div')).attr('id',player_id).css({
			position:'absolute', left:0, top:0, width:container.width(), height:container.height()
		}).appendTo(player_wrap);
		//alert(video_url);
		jwplayer('product_video_player').setup({
			skin: "http://content.longtailvideo.com/skins/glow/glow.zip",
			stretching: "uniform", //uniform,fill,exactfit,none
			flashplayer: 'http://player.longtailvideo.com/player.swf',
			autostart:true,
			file:video_url+'?autoplay=1',
			width:player.width(),
			height:player.height(),
			autoplay:true,
			events:{
				onComplete:function(){
					player.remove();
					player_wrap.remove();
				}
			}
		});
	});
}

function init_icon_tech(){
	$('.icon_construction').toggle(function(){
			$(this).html("Show Dimension");
			$id = $(this).attr('id'); //alert($id);
			//$('.board_con_wrap').css('visibility','hidden'); //Hide construction info
			$('.board_image_medium').css('visibility','hidden'); //Hide board medium
			$('.technology_spec_wrap').css('visibility','hidden'); //Hide tech spec
			$('#board_spec_right_wrap').css('visibility','hidden'); //Hide right panel (spec)
			$('#'+$id+'_wrap').css('visibility','visible');
	}, function(){
			$(this).html("Show Construction");
			$id = $(this).attr('id'); //alert($id);
			$('.board_image_medium').css('visibility','hidden'); //Hide board medium
			$('.technology_spec_wrap').css('visibility','hidden'); //Hide tech spec
			$('#board_spec_right_wrap').css('visibility','visible'); //Hide right panel (spec)
			$('.'+$id+'_medium').css('visibility','visible');
	});
}

function init_thumb(){
	$('.board_thumbnail').click(function(){
		$id = $(this).attr('id');
		//alert($id);
		$('.board_con_wrap').css('visibility','hidden'); //Hide construction info
		$('.board_image_medium').css('visibility','hidden'); //Hide board medium
		$('.technology_spec_wrap').css('visibility','hidden'); //Hide tech spec
		$('#board_spec_right_wrap').css('visibility','visible'); //Show right panel (spec)
		$('#'+$id).css('visibility','visible');
		$('#medium_'+$id).css('visibility','visible');
		$('.icon_construction').html("Show Construction");
	});
}

function init_scroller(){
	$('.scroll-pane').jScrollPane({
		verticalDragMinHeight: 20,
		horizontalDragMinWidth: 20,
		horizontalDragMaxWidth: 20,
		verticalDragMaxHeight: 20,
		showArrows:true
	});
}

function init_news_tabs(){
	$('#news_tabs_wrap').tabs({ cookie: { expires: 30 } });
	//Extract anchor from url and select tab
	//http://www.devguru.com/technologies/ecmascript/quickref/link.html
	$('#news_tabs_wrap').tabs('select',document.location.hash);
	//$('#news_tabs_wrap > div > div.tab_scroll').jScrollPane();
    $(window).hashchange(function(){
		//Change tab when hash change
		$('#news_tabs_wrap').tabs('select',document.location.hash);
	});
};


function init_paging(sel,items_per_page){ //alert('xx');
	var tab = $(sel);
	tab.bind('tabsload', function(event, ui) { //alert($(ui.panel).html());
		//$(ui.panel).livePaging({
		$(ui.panel).livePaging({
			items_per_page:items_per_page,
			image_prev_button:'/2011/img/arrow_back.gif',
			image_next_button:'/2011/img/arrow_readmore.gif',
			callBack:function(){ //alert('Highlight');
				//alert($(ui.panel).find('.item_list > ul').html());
				$(ui.panel).find('.item_list > ul').highLight();
			}
		});
	});
}



