function createSlider(showAutoslide, timeInterval, blocksSelector, navigateSelector) {
	var blockNums = $('#' + blocksSelector + ' >div').size();
	var currentBlockIndex = 0;
	$('#' + blocksSelector).attr('autoslide', 'stop');
	
	$('#' + navigateSelector + ' >ul>li').hover(function() {
		$('#' + blocksSelector).attr('autoslide', 'stop');
		selectSlide($(this).index()+1, blocksSelector, navigateSelector);
	});
	
	$('#' + navigateSelector + ' >ul>li').mouseout(function() {
		$('#' + blocksSelector).attr('autoslide', 'go');
	});
	
	
	$('#' + blocksSelector).attr('block_index', 1);
	//selectSlide(1, blocksSelector, navigateSelector);
	
	if (showAutoslide) {
		$('#' + blocksSelector).attr('autoslide', 'go');
		setInterval(function(){ autoslide(blocksSelector, navigateSelector, blockNums); }, timeInterval);
	}	
}

function selectSlide(blockIndex, blocksSelector, navigateSelector) {
	var currentBlockIndex = $('#' + blocksSelector).attr('block_index') * 1;
	if (blockIndex != currentBlockIndex) {
		$('#' + blocksSelector + ' .slider_cont:nth-child(' + currentBlockIndex + ')').hide();
		$('#' + blocksSelector + ' .slider_cont:nth-child(' + blockIndex + ')').show();
		$('#' + navigateSelector + ' >ul>li').removeClass("on");

		$('#' + navigateSelector + ' >ul :nth-child(' + blockIndex + ')').addClass("on");;
		$('#' + blocksSelector).attr('block_index', blockIndex);
	}
	return true;

}

function autoslide(blocksSelector, navigateSelector, blockNums) {
	var autoslide = $('#' + blocksSelector).attr('autoslide');

	if (autoslide == 'go') {
		var currentBlockIndex = $('#' + blocksSelector).attr('block_index') * 1;
		var nextBlockIndex = currentBlockIndex + 1;
		
		if (currentBlockIndex < 1) {
			nextBlockIndex = 2;	
		} 
		if (currentBlockIndex >= blockNums) {
			nextBlockIndex = 1;
		}
		selectSlide(nextBlockIndex, blocksSelector, navigateSelector);
	} else {
		return true;
	}
	//alert(nextBlockIndex);
}	

