//---------------------------------------------------------------------
function show_hide(id)
{
	obj = document.getElementById(id);
	if (obj.style.display == 'block')
		obj.style.display = 'none';
	else
		obj.style.display = 'block';
}
//---------------------------------------------------------------------
function load_img(id, h, w)
{
	var l = (screen.width  - w)/2;
 	var t = (screen.height - h)/2;
	window.open('/img.php?img='+id, '', 'resizable=yes,scrollbars=yes,height='+h+',width='+w+',top='+t+',left='+l);
}
//---------------------------------------------------------------------
	hs.graphicsDir = '/highslide/graphics/';
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.outlineType = 'rounded-white';
	hs.fadeInOut = true;
	hs.dimmingOpacity = 0.75;

	// define the restraining box
	hs.useBox = true;
	hs.width = 640;
	hs.height = 480;

	// Add the controlbar
	hs.addSlideshow({
		//slideshowGroup: 'group1',
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: 'fit',
		overlayOptions: {
			opacity: 1,
			position: 'bottom center',
			hideOnMouseOut: true
		}
	});

//---------------------------------------------------------------------

var OrdersImpColor = '#FF0000';
var OrdersColor = '#000000';
var ExtraImp = new Number();
var MyElementType = new Array();
//Extra
//Extra


function assocCount(Assoc)
{
	c=0;
	for (MyElement in Assoc) c++;
	return c;
}
function assocTrueCount(Assoc)
{
	c=0;
	for (MyElement in Assoc) if (Assoc[MyElement]) c++;
	return c;
}
function Clear ()
{
	for (MyElement in ExtraImp) 
	{
		bool = false;
		if (MyElementType[MyElement] == 'select')
		{
			if (document.getElementById(MyElement).selectedIndex > -1)
				bool = true;
		}
		else if (MyElementType[MyElement] == 'checkbox')
		{
			for (i = 0; ; i++)
			{
				if (!(obj = document.getElementById('extra['+MyElement+']['+i+']')))
					break;
				if (obj.checked)
				{	bool = true; break;	}
			}
		}
		else if (MyElementType[MyElement] == 'text')
		{
			if (document.getElementById(MyElement).value.length > 3)
				bool = true;
		}
		if (bool)
		{
			ExtraImp[MyElement] = 1;
			document.getElementById('div_'+MyElement).style.color=OrdersColor;
		}
		else
		{
			ExtraImp[MyElement] = 0;
			document.getElementById('div_'+MyElement).style.color=OrdersImpColor;
		}
	}
	CheckFields();
}
function CheckGroup(id)
{
	bool = false;
	for (i = 0; ; i++)
	{
		if (!(obj = document.getElementById('extra['+id+']['+i+']')))
			break;
		if (obj.checked)
		{	bool = true; break;	}
	}
	divobj = document.getElementById('div_'+id);
	if (bool)
	{
		ExtraImp[id] = 1;
		divobj.style.color=OrdersColor;
	}
	else
	{
		ExtraImp[id] = 0;
		divobj.style.color=OrdersImpColor;
	}
	CheckFields();
}
function CheckTextField (id, bool)
{
	res = 0;
	if (document.getElementById(id).value.length > 3)
	{
		document.getElementById('div_'+id).style.color= OrdersColor;
		res = 1;
	}
	else document.getElementById('div_'+id).style.color=OrdersImpColor;
	if (bool)
		return res;
	else
	{
		ExtraImp[id] = res;
		CheckFields();
	}
	
}
function CheckSelectField (id)
{
	if (document.getElementById(id).selectedIndex > -1)
	{
		document.getElementById('div_'+id).style.color= OrdersColor;
		ExtraImp[id] = 1;
	}
	else 
	{
		document.getElementById('div_'+id).style.color=OrdersImpColor;
		ExtraImp[id] = 1;
	}
	CheckFields();
}

function CheckFields()
{
	names = new Array('name', 'phone');
	var empt = 0;
	for (i = 0; i < names.length; i++)
		empt+=CheckTextField(names[i], true);
	Count = names.length+assocCount(ExtraImp);
	res = empt + assocTrueCount(ExtraImp);
	if (res == Count)
		document.getElementById('button').disabled = false;
	else
		document.getElementById('button').disabled = true;
}
//---------------------------------------------------------------------


