// JavaScript Document
hs.outlineType = 'rounded-white';
hs.wrapperClassName = 'draggable-header';
hs.align = 'center';
hs.fadeInOut = true;

function styles(id, sty, value)
{
	eval("document.getElementById('"+id+"').style."+sty+" = '"+value+"'");	 
}

function attribut(id, att, name)
{ 
	eval("document.getElementById('"+id+"').setAttribute('"+att+"', '"+name+"')");	
}

function show_hide(id)
{
	if(document.getElementById(id).style.display == 'none')
		document.getElementById(id).style.display = 'block';
	else
		document.getElementById(id).style.display = 'none';
}

function spalvos_keitimas(id, value, color)
{
	if(document.getElementById(id).value == value)
		styles(id, 'color', color)
	
}

function keisti_value(id, value, def_value)
{
	
	var keista = true;
	
	if(document.getElementById(id).value == '')
	{
		document.getElementById(id).value = def_value;
		keista = false;
	}
	
	if(def_value == document.getElementById(id).value && keista)
		document.getElementById(id).value = value;			
}

function trinti_value(id)
{
	
	document.getElementById(id).value = '';
}

function keisti_aktyvus(op, viso)
{
  if(op=='+')
	  aktyvus++;
  else
	  aktyvus--;
  
  if(aktyvus>viso) aktyvus = viso;
  if(aktyvus<1) aktyvus = 1;
  
  
  if(aktyvus==viso)
  {
	  styles('next', 'color', '#CCCCCC');	
	  styles('next_r', 'color', '#CCCCCC');	
  }
  else
  {
	  styles('next', 'color', '');	
	  styles('next_r', 'color', '');	
  }
  
  if(aktyvus==1)
  {
	  styles('back', 'color', '#CCCCCC');	
	  styles('back_r', 'color', '#CCCCCC');
  }
  else
  {
	  styles('back', 'color', '');	
	  styles('back_r', 'color', '');	
  }				
}


function ar_keisti(sk)
{
	if(sk<=3)
		return true;
	else
		false;
}
	
function popup(url) {
	newwindow=window.open(url,'name','height=710,width=1000,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}

function keisti_nuotrauka(viso, aktyvi, id)
{
	
	i = 0;
	while(i<viso)
	{
		document.getElementById(id+i).style.display = 'none';	
		i++;
	}
	document.getElementById(id+aktyvi).style.display = 'block';
}

$(function() {
	$("div#akcijos div.scrollableArea").append($("div#akcijos div.scrollableArea").html());
	
	if(typeof($("div#akcijos").smoothDivScroll) != "undefined") {
		$("div#akcijos").smoothDivScroll({
								autoScroll: "always", 
								autoScrollDirection: "endlessloopright", 
								autoScrollStep: 1, 
								autoScrollInterval: 30 
							});
		
		$("div#akcijos").hover(function() {
			$(this).smoothDivScroll("stopAutoScroll");
		}, function() {
			$(this).smoothDivScroll("startAutoScroll");
		});
	}
});
