function disableAuto()
{ 
	var formCollection = document.getElementsByTagName( 'form' ); 
	
	for ( var i = 0; i < formCollection.length; i++ ) 
		{ 
			//formCollection[i].autocomplete = 'off';
			formCollection[i].setAttribute("autocomplete","off"); 
		} 
}

function openWindowScroll(dest,name,width,height,fullscreen)
{
		var x,y;
		if(fullscreen==1) {
				width=screen.availWidth; height=screen.availHeight;
				x = 0;y = 0;}
		else {   
				x = (screen.availWidth-width)/2; y = (screen.availHeight-height)/2;}
		wnd = window.open (dest,name,"resizable=1,left="+x+",top="+y+",width="+width+", height="+height+", scrollbars=1");
		wnd.focus();
}

function OpenHelp( helpitem )
{
	wnd = window.open(helpitem, 'help', 'menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,width=300,height=200');
	wnd.focus();
}

function OpenGraph( graphitem )
{
	wnd = window.open(graphitem, 'Analiza tehnica', 'menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=1010,height=760');
	wnd.focus();
}

function ShowIndexGlobal (myIndex)
{
	var i;
	var arrayIndex = new Array();
	// use a hidden field with symbol value - qs


	arrayIndex[1] = document.getElementById('gr_index_cac');
	arrayIndex[2] = document.getElementById('gr_index_dax');
	arrayIndex[3] = document.getElementById('gr_index_ftse');
	arrayIndex[4] = document.getElementById('gr_index_500');

	for (i in arrayIndex)
	{
	 if ( arrayIndex[i] == myIndex)
	 {
		arrayIndex[i].style.display = 'block';
		
	 } else {
		arrayIndex[i].style.display = 'none';
	 }
	
	}
}

function ShowIndexEmergent (myIndex)
{
	var i;
	var arrayIndex = new Array();
	// use a hidden field with symbol value - qs


	arrayIndex[1] = document.getElementById('gr_index_bux');
	arrayIndex[2] = document.getElementById('gr_index_px');
	arrayIndex[3] = document.getElementById('gr_index_rtsi');
	arrayIndex[4] = document.getElementById('gr_index_wig');

	for (i in arrayIndex)
	{
	 if ( arrayIndex[i] == myIndex)
	 {
		arrayIndex[i].style.display = 'block';
		
	 } else {
		arrayIndex[i].style.display = 'none';
	 }
	
	}
}


function ToggleFastOrder ()
{
	divFastOrder = document.getElementById('fast_order');
	divRegularOrder = document.getElementById('regular_order');
	myLink = document.getElementById('fast_link');
	if (divFastOrder.style.display == 'block' )
	{
		divFastOrder.style.display = 'none';
		divRegularOrder.style.display = 'block';
		myLink.innerHTML = 'Ordin Rapid';
	} else {
		divFastOrder.style.display = 'block';
		divRegularOrder.style.display = 'none';
		myLink.innerHTML = 'Ordin Normal';
	}
}



var scrolling = true;
var scrolli;

function HomeScroll(offset) {
	scrolli = offset;
	scrolli  = scrolli  + scrollSpeed ;
	var div = document.getElementById("scrollNews");
	div.scrollTop = scrolli; 
	if (scrolli > div.scrollHeight - 160) 
		{
			scrolli = 0;
		}
	if ( scrolling )
	{
		t1=setTimeout("HomeScroll("+scrolli+")",100);
	}	
}

function toggleHomeScroll ()
{
	scrolling = scrolling ? false : true;

	var element = document.getElementById("toggleAnchor");
	element.innerHTML = scrolling ? 'Stop scroll' : 'Start scroll';
	
	HomeScroll(scrolli);
}

function startHomeScroll()
{
	if ( !scrolling )
	{
		scrolling = true;
		HomeScroll(scrolli);
	}
	

}
function stopHomeScroll()
{
	scrolling = false;
	//HomeScroll(scrolli);
}


var isDom = document.getElementById?true:false;
var isIE  = document.all?true:false;
var isNS4 = document.layers?true:false;
var counter = 60;
var time;

function listsTimedRefresh( listID )
{
	if ( counter >= 0 )
	{
		if ( document.getElementById( 'counterID' ) )
		{
			var value = counter;

			if ( isDom )
			{
				document.getElementById('counterID').innerHTML = value;				
			} else if ( isNS4 ) 
			{
				document.layers['counterID'].firstChild.nodeValue = value;
			}
			
			counter=counter-1;
		}

		time=setTimeout( "listsTimedRefresh(" + listID + ")", 1000 );
	}
	else
	{
		//reload
		counter = 60;
		time=setTimeout( "listsTimedRefresh(" + listID + ")", 1000 );
		RefreshLists( listID );

		
	}
	
}

function checkDays(someString, someOtherString)
{
	
	if ( someString != '' )
	{
		var anum=/(^\-?\d+\.?\d*$)/
		if (anum.test(someString))
			testresult=true
		else
		{
			if ( someOtherString == 'from')
			{
				alert("Verificati valoarea introdusa in campul zilei pentru startul intervalului de raportare!")
			}else
			{
				alert("Verificati valoarea introdusa in campul zilei pentru sfarsitul intervalului de raportare!")
			}
			
			testresult=false
		}
		return (testresult)
	}

	return true;
	
}

function openMbp(source, width, height)
{
	var window_name = 'name'+ Math.round(Math.random()*100000);


//	window.open(source, window_name,'toolbar=0, menubar=0, location=0, scrollbars=0, resizable=0, width='+w+', height='+h);
	var winHandle = window.open( source ,window_name ,'toolbar=0,menubar=0,location=0,scrollbars=0,width=500,height=330,left=' + ( ( screen.width - 500 ) / 2 ) + ',top=' + ( ( screen.height - 330 ) / 2 ) ); 
	winHandle.focus();
}
