// JavaScript Document


//////////
/////  Client functions
//////////
function clientsContSlide_setup(obj_thisElement)
{
	document.getElementById('inner_' + obj_thisElement.id).style.overflow = 'hidden';
}
function clientsContSlide_finish(obj_thisElement)
{
	document.getElementById('inner_' + obj_thisElement.id).style.overflow = 'auto';
}

function clientsContSlide(obj_thisElement, direction)
{
	clientsContSlide.up =	{from: {x:0 ,y:210, units: 'px'}, to: {x:0 ,y:0, units: 'px'}};
	clientsContSlide.down =	{from: {x:0 ,y:-210, units: 'px'}, to: {x:0 ,y:0, units: 'px'}};
	
	if(clientsContSlide.lastClientsCont && obj_thisElement.id != clientsContSlide.lastClientsCont.id)
	{
		clientsContSlide.lastClientsCont.doSlide.start();
		clientsMainContSlide(direction);
	}
	
	if(obj_thisElement.doSlide){
		obj_thisElement.elementIsOut = !obj_thisElement.elementIsOut;
		obj_thisElement.doSlide.start();
		clientsMainContSlide(direction);
	} else {
		Spry.Effect.makePositioned(obj_thisElement);
		obj_thisElement.doSlide = new Spry.Effect.Move(obj_thisElement.id, clientsContSlide[direction].from, clientsContSlide[direction].to,{duration: 1000, toggle: true, transition:Spry.sinusoidalTransition, setup:clientsContSlide_setup, finish:clientsContSlide_finish});
		obj_thisElement.elementIsOut = true;
		obj_thisElement.doSlide.start();
		clientsMainContSlide(direction);
	}
	
	if(clientsContSlide.lastClientsCont != obj_thisElement)clientsContSlide.lastClientsCont = obj_thisElement;
	else delete clientsContSlide.lastClientsCont;
}

function clientsMainContSlide(str_direction)
{
	var obj_thisElement = document.getElementById('mainCont');
	
	if(!obj_thisElement.moveElement)obj_thisElement['moveElement'] = new Spry.Effect.Move(obj_thisElement.id, {x: 52, y:325 , units: 'px'}, {x:52 , y:355 , units: 'px'},{duration: 1000, toggle: true, transition:Spry.sinusoidalTransition });
	
	if(str_direction == 'up' && !obj_thisElement.contIsDown)
	{
		obj_thisElement.moveElement.start();
		obj_thisElement.contIsDown = true;
	}
	if(str_direction == 'down' && obj_thisElement.contIsDown)
	{
		obj_thisElement.moveElement.start();
		obj_thisElement.contIsDown= false;
	}
}


function changeClientBoxesHlOpacity(obj_thisElement)
{
	var str_currClientBoxesHlId = 'clientBoxesHlBg_' + obj_thisElement.id;
	document.getElementById(str_currClientBoxesHlId).bol_isExpand = !document.getElementById(str_currClientBoxesHlId).bol_isExpand;
	
	for(i in changeClientBoxesHlOpacity.arr_clientBoxesHlId)
	{
		var obj_currThisElement = document.getElementById(changeClientBoxesHlOpacity.arr_clientBoxesHlId[i]);
		
		if(obj_currThisElement.id != str_currClientBoxesHlId)obj_currThisElement.bol_isExpand = false;
		
		if(document.getElementById(str_currClientBoxesHlId).bol_isExpand)
		{
			if(obj_currThisElement.id != str_currClientBoxesHlId && obj_currThisElement.int_opacityIs == 80)
			{
				obj_currThisElement.changeOpacity.start();
				obj_currThisElement.int_opacityIs = 50;
			}else if(obj_currThisElement.id == str_currClientBoxesHlId && obj_currThisElement.int_opacityIs != 80)
			{
				obj_currThisElement.changeOpacity.start();
				obj_currThisElement.int_opacityIs = 80;
			}
		} else
		{
			if(obj_currThisElement.int_opacityIs == 50)
			{
				obj_currThisElement.changeOpacity.start();
				obj_currThisElement.int_opacityIs = 80;
			}
		}
	}
}
changeClientBoxesHlOpacity.arr_clientBoxesHlId = new Array('clientBoxesHlBg_box1',
														   'clientBoxesHlBg_box2',
														   'clientBoxesHlBg_box3',
														   'clientBoxesHlBg_box4',
														   'clientBoxesHlBg_box5',
														   'clientBoxesHlBg_box6');
for(i in changeClientBoxesHlOpacity.arr_clientBoxesHlId)
{
	var obj_thisElement = document.getElementById(changeClientBoxesHlOpacity.arr_clientBoxesHlId[i]);
	obj_thisElement.changeOpacity = new Spry.Effect.Opacity(obj_thisElement.id, 0.8, 0.5, {duration: 1000, toggle: true, transition:Spry.sinusoidalTransition });
	obj_thisElement.int_opacityIs = 80;
	obj_thisElement.bol_isExpand = false;
}
														   


