// JavaScript Document
$(document).ready( function() {
	
	var rootPath = 'http://media2.telecoms.com/loader_flash/speakersTETRA/';
	
	$('#speaker_flash_content').flash( {
		id:'speakerFlashContent',
		swf:rootPath+'speakers.swf',
		width:335,
		height:207,
		allowScriptAccess:'always',
		allowFullScreen:'false',
		quality:'high',
		wmode:'window',
		expressInstaller:'http://media2.telecoms.com/jqueryplugins/expressInstall.swf',
		flashvars:{'url':rootPath, 'infoWidth':335}
	});

	if('ontouchstart' in document.documentElement === false) {
		$('#speaker_flash_content').mousewheel( function(event, delta) {
			
			var flash = document.getElementById('speakerFlashContent');
			flash.mouseWheelHandler(delta*5);
			event.preventDefault();
		});
	}else{
		var isMousedown = false;
		var mousedownlocation;
		var headBar = document.getElementById('spakers');
		var flash = document.getElementById('speakerFlashContent');
		headBar.addEventListener('touchstart', function(e) {
			//isMousedown = true;
			//mousedownlocation = e.pageX;
			e.preventDefault();
		}, false);
		headBar.addEventListener('touchend', function(e) {
			//isMousedown = false;
		}, false);
		headBar.addEventListener('touchmove', function(e) {
			//flash.mouseWheelHandler(mousedownlocation - e.pageX);
			e.preventDefault();
		});
		
	}
	
});
