

function scroll_selector_down(){
	var selector_moving_div_height = document.getElementById('selector_moving_div').offsetHeight;
	var selector_moving_div_top = document.getElementById('selector_moving_div').style.top;
	if(!selector_moving_div_top){ selector_moving_div_top = 0;}
	var selector_static_div_height = document.getElementById('selector_static_div').offsetHeight; 
	
	if(selector_moving_div_height + parseFloat(selector_moving_div_top) <= selector_static_div_height*2 ){
		var correctCoOrdinate = selector_static_div_height - selector_moving_div_height;
		$('#selector_moving_div').animate({top:correctCoOrdinate}, {duration: 500, easing: 'easeInOutQuad'});
		//alert('move to restricted coordinate '+correctCoOrdinate);	
	}else{
		var correctCoOrdinate = parseFloat(selector_moving_div_top) - selector_static_div_height;
		$('#selector_moving_div').animate({top:correctCoOrdinate}, {duration: 500, easing: 'easeInOutQuad'});

		//alert('move to coordinate '+correctCoOrdinate);		
	}
	
}

function scroll_selector_up(){
	var selector_moving_div_height = document.getElementById('selector_moving_div').offsetHeight;
	var selector_moving_div_top = document.getElementById('selector_moving_div').style.top;
	if(!selector_moving_div_top){ selector_moving_div_top = 0;}
	var selector_static_div_height = document.getElementById('selector_static_div').offsetHeight;	
	
	
	if(parseFloat(selector_moving_div_top) + selector_static_div_height >=0){
		var correctCoOrdinate = 0;
		$('#selector_moving_div').animate({top:correctCoOrdinate}, {duration: 500, easing: 'easeInOutQuad'});
	}else{
		var correctCoOrdinate = parseFloat(selector_moving_div_top) + selector_static_div_height;
		$('#selector_moving_div').animate({top:correctCoOrdinate}, {duration: 500, easing: 'easeInOutQuad'});
	}
	
}

function change_selector_image(img_src){
	$('#featured_system_product_div').animate({opacity:0}, {duration: 1200, easing: 'easeOutQuad',
			complete: function() { // the callback
				var featured = document.createElement("img");
				document.getElementById('featured_system_product_div').removeChild(document.getElementById('featured_system_product_img'));
				load_selector_image(img_src);
			}
	});	
	
}

function load_selector_image(img_src){
	
	//check_png_elements();
	
	var featured = document.createElement("img");
	featured.setAttribute('id', 'featured_system_product_img');
	//featured.setAttribute('height', '370');
	document.getElementById('featured_system_product_div').appendChild(featured);
	
	
	featured_img = new Image();
	featured.src = img_src;
	
	featured_img.onload = function(){
		
		//document.getElementById('featured_loading_box_div').style.visibility = 'hidden';
		$('#featured_system_product_div').animate({opacity:100}, {duration: 1200, easing: 'easeInQuart'});
		//document.getElementById('featured_system_text').innerHTML = 'FEATURED &nbsp;ITEM '+ (current_img+1) +'/'+ (last_img+1);
		//document.getElementById('featured_system_link').href = featured_system_link[current_img];
		
	}
	featured_img.src = img_src;
	
	
}

function change_selector_text(text_div_id){
	$('#featured_system_product_div').animate({opacity:0}, {duration: 1200, easing: 'easeOutQuad',
	complete: function() { // the callback
				var text = document.getElementById(text_div_id).innerHTML;
				document.getElementById('featured_system_product_div').innerHTML = text;
				$('#featured_system_product_div').animate({opacity:100}, {duration: 1200, easing: 'easeInOutQuad'});
			}
	});	
}
