var move_right = -633;
var move_left = -0;
var move = 0;
function moveElement(elementID,final_x,final_y,interval) {
  if (!document.getElementById) return false;
  if (!document.getElementById(elementID)) return false;
  var elem = document.getElementById(elementID);
  if (elem.movement) {
    clearTimeout(elem.movement);
  }
  if (!elem.style.left) {
    elem.style.left = "0px";
  }
  if (!elem.style.top) {
    elem.style.top = "0px";
  }
  var xpos = parseInt(elem.style.left);
  var ypos = parseInt(elem.style.top);
  if (xpos == final_x && ypos == final_y) {
    return true;
  }
  if (xpos < final_x) {
    var dist = Math.ceil((final_x - xpos)/10);
    xpos = xpos + dist;
  }
  if (xpos > final_x) {
    var dist = Math.ceil((xpos - final_x)/10);
    xpos = xpos - dist;
  }
  if (ypos < final_y) {
    var dist = Math.ceil((final_y - ypos)/10);
    ypos = ypos + dist;
  }
  if (ypos > final_y) {
    var dist = Math.ceil((ypos - final_y)/10);
    ypos = ypos - dist;
  }
  elem.style.left = xpos + "px";
  elem.style.top = ypos + "px";
  var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";
  elem.movement = setTimeout(repeat,interval);
}

function newPos(direction){
	if(direction == 'left'){
		switch(move){
			case 1:
				move_left = 0;
				move_right = -633;
				move = 0;
			break;
			
			case 2:
				move_left = -0;
				move_right = -1266;
				move = 1;
			break;
			
		}
		
	} else if(direction == 'right'){
		switch(move){
			case 0:
				move_left = 0;
				move_right = -1266;
				move = 1;
			break;
			
			case 1:
				move_left = -633;
				move_right = -1266;
				move = 2;
			break;
			
		}
	}
}

/*
$(window).ready(function () {
  //$('div.sliderGallery').each(function () {
	var container = $('div#featured');
    var ul = $('div#slidein');
    var productWidth = ul.innerWidth() - container.outerWidth();
	
	var current = 0;
	var step = 211*2;
	
	$('#pict_left').css('FILTER','alpha(Opacity=50)');
	$('#pict_left').css('-moz-opacity','0.50');
	$('#pict_left').css('opacity','0.50');
	
	$('#pict_left').click(function(){
			if(current >= step){
				var move = current - step;
				current = move;
				ul.animate({ 'left' : move*-1 + 'px' }, 500, 'linear');
			}
			if(current < step){
				$('#pict_left').css('FILTER','alpha(Opacity=50)');
				$('#pict_left').css('-moz-opacity','0.50');
				$('#pict_left').css('opacity','0.50');
				}else{
					$('#pict_right').css('FILTER','alpha(Opacity=100)');
					$('#pict_right').css('-moz-opacity','1.00');
					$('#pict_right').css('opacity','1.00');
					}
		});
	
	$('#pict_right').click(function(){
			if(current < productWidth)	{				
				var move = current + step;
				current = move;
				ul.animate({ 'left' : move*-1 + 'px' }, 500, 'linear');
			}
			if(current >= productWidth){
				$('#pict_right').css('FILTER','alpha(Opacity=50)');
				$('#pict_right').css('-moz-opacity','0.50');
				$('#pict_right').css('opacity','0.50');
				}else{
					$('#pict_left').css('FILTER','alpha(Opacity=100)');
					$('#pict_left').css('-moz-opacity','1.00');
					$('#pict_left').css('opacity','1.00');
					}
			
		});
	});
*/
		