// JavaScript Document

// Author: Andrei Dumitru Zona-AdStudio.ro

var limit_block = '';

var ul_id_setter = '';


function next_move(direction) {
	
	if ( direction == 'right' ) {
		
		if ( menu_contor.length == 0 ) { menu_contor = menu_slides; } else {}
		
		//alert(menu_contor);
		
		get_margin_left = document.getElementById('menu_band').style.marginLeft.replace('px',''); 
		
		slide_pos = get_margin_left;
		
		get_margin_left = get_margin_left + '';
		
		get_margin_left = get_margin_left.replace('-',''); 
		
		position_rap = get_margin_left / menu_slider_size;
		
		position_rap = position_rap + '';
		
		//alert(get_margin_left);
		
		if ( position_rap.match(/\D/g) == '.' ) { 
		
			// nu s-a ajsezat pe pozitie 
			
			//alert(position_rap);
			
		} else { 
			
			if ( menu_contor > 1 ) {
				
				
		
				$("#move_ind").animate({"margin-left": '+=' + indicator_width  + 'px'}, menu_slider_speed_h);
				$("#menu_band").animate({"margin-left": '-=894px'}, menu_slider_speed_h);
				
				//alert(menu_contor);
			
				menu_contor = menu_contor - 1;
				
				//alert(menu_contor);
				
				if ( menu_contor == 1 ) {
				
					$(".menu_reset_arrow").show(10);
					$(".menu_right_arrow").hide(10);
					
					menu_contor = menu_slides; 
					
				} else {}
				
			
			} else {}
		
		}
		
	} else if ( direction == 'reset' ) {
		
		$("#move_ind").animate({"margin-left": '0px'}, 1000);
		$("#menu_band").animate({"margin-left": '0px'}, 1000);
		$(".menu_reset_arrow").hide(10);
		$(".menu_right_arrow").show(10);
		
	} else { }

	//alert(direction);
	
}



function set_ul_setup() {
	
	
	var menu = $("#menu_container");
	
	var menu_offset = menu.offset();
	
	//alert(menu_offset.left);
	
	var button = $("#"+ul_id_setter);
	
	var button_offset = button.offset();
	
	diff = button_offset.left - menu_offset.left;
	
	//alert(diff);
	
	if ( diff > 750 ) {
		
		identif = ul_id_setter.replace("last", "ul");
		
		//alert(identif);
		
		margin_left = ( 1000 - diff + 20 ) - 255;
	
		document.getElementById(identif).style.marginLeft = margin_left+'px';
		
	} else {
		
		identif = ul_id_setter.replace("last", "ul");
	
		document.getElementById(identif).style.marginLeft = '0px';
		
	}
	
	//alert(document.getElementById(ul_id_setter).clientLeft)
	
	//var idd = idn+'';
	
	//alert(document.getElementById(idn).clientWidth);
	
	//setTimeout("alert(document.getElementById('test-1').offsetParent.offsetLeft)",10);

	//setTimeout("alert(document.getElementById(idn).clientWidth);",500);
	
}

function set_ul_space(idn) { 

	
	
	var idd = idn+'';
	
	ul_id_setter = idn;
	
	setTimeout("set_ul_setup()", 10); 
	
}




