// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
$current = 0
function switch_to_page(number)
{
	$$('.pages').each(
		function(customer_list) {
			customer_list.hide()
		}
	)
	if ($('customer_list' + number) != null) {
		$('customer_list' + number).show();
		$('page_'+ $current.toString()).style.color='#4c5ebc';
		$('page_'+ number.toString()).style.color='red';
		$current = number
	} else {
		switch_to_page(0)
	}
	
	
}

function next_page()
{
	switch_to_page($current+1)
}

function prev_page()
{
	switch_to_page($current-1)	
}

function scaleIt(v) {
	if (scalePhotos == null){
		var scalePhotos = document.getElementsByClassName('scale_product');

	}
	if (actions == null){
		var actions = document.getElementsByClassName('scale_action');
	}

	 coeff_minimum = .25;
	 coeff_maximum = 3.0;
	 oldvalue = v;
	 v = coeff_minimum + (v * (coeff_maximum - coeff_minimum));
	 width_height = (v*128)+'px';
	
	for (i=0; i < scalePhotos.length; i++) {
	    scalePhotos[i].style.width = width_height;
		scalePhotos[i].style.height = width_height;
	
		if (oldvalue >= 0.21) {
			actions[i].style.visibility = 'visible';
		} else {
			actions[i].style.visibility = 'hidden';
		}
	}
}