
function highlight(objId, colIndex, color)
{
	//alert("COoKIE :" + document.cookie );
	try
	{
		var obj = document.getElementById( objId );
		var query = unescape(location.search).substring(8);

		if( query == null || query.length < 1 )
		{
			var prefix = "HINT=";
			var cookieStartIndex = document.cookie.indexOf( prefix );
			if (cookieStartIndex < 0)
				return;

			var cookieEndIndex =  document.cookie.indexOf(";", cookieStartIndex + prefix.length);
			if (cookieEndIndex == -1)
				cookieEndIndex = document.cookie.length;

			query = document.cookie.substring(cookieStartIndex + prefix.length + 7, cookieEndIndex);

			var plusIdx = query.indexOf( "+" );
			while( plusIdx > -1 )
			{
				query = query.substring( 0, plusIdx ) + " " + query.substring( plusIdx+1, query.length );
				plusIdx = query.indexOf( "+", plusIdx );
			}
		}

		if( query == null || query.length < 1 )
			return;

		rows = obj.rows;
		for( i=0;i<rows.length;i++ )
		{
			hint = new String( rows[i].getAttribute( "hint" ) );
			if( hint != null && hint.length >= query.length && hint.substring(0,query.length) == query )
				{
					rows[i].cells[colIndex].innerHTML = "<font color=" + color + "><B>" + rows[i].cells[colIndex].innerHTML + "</B></font>" ;
					rows[i].className = 'tr4';
				}
		}
	} catch( err ) {}
}
function highlightROWID(objId, colIndex, color)
{
	//alert("COoKIE :" + document.cookie );
	try
	{
		var obj = document.getElementById( objId );
		var query = unescape(location.search).substring(8);

		if( query == null || query.length < 1 )
		{
			var prefix = "ROWID=";
			var cookieStartIndex = document.cookie.indexOf( prefix );
			if (cookieStartIndex < 0)
				return;

			var cookieEndIndex =  document.cookie.indexOf(";", cookieStartIndex + prefix.length);
			if (cookieEndIndex == -1)
				cookieEndIndex = document.cookie.length;

			query = document.cookie.substring(cookieStartIndex + prefix.length , cookieEndIndex);

			/*var plusIdx = query.indexOf( "+" );
			while( plusIdx > -1 )
			{
				query = query.substring( 0, plusIdx ) + " " + query.substring( plusIdx+1, query.length );
				plusIdx = query.indexOf( "+", plusIdx );
			}
			*/
		}

		if( query == null || query.length < 1 )
			return;

		//alert("hint is " + query);		

		rows = obj.rows;
		for( i=0;i<rows.length;i++ )
		{
			hint = new String( rows[i].getAttribute( "hint" ) );
			if( hint != null && hint.length >= query.length && hint.substring(0,query.length) == query )
				{
					rows[i].cells[colIndex].innerHTML = "<font color=" + color + "><B>" + rows[i].cells[colIndex].innerHTML + "</B></font>" ;
					rows[i].className = 'tr4';
				}
		}
	} catch( err ) {}
}
function goToPage( dropDown )
{
	location = "page_" + dropDown.value + ".html";
}
function drawNavButton( label, pgIdx, toolTip)
{
		document.write( '<table border="0" cellspacing="0" cellpadding="0" class=bh title="'+ toolTip +'">' );
		document.write( '	<tr onClick="location=\'page_'+ pgIdx + '.html\'">' );
		document.write( '		<td class="bl0"><img src="/2009/images/blank.gif" width="10" height="21"></td>' );
		document.write( '		<td class="bm0" nowrap><a href="page_'+ pgIdx +'.html">' + label + '</a></td>' );
		document.write( '		<td class="br0"><img src="/2009/images/blank.gif" width="10" height="1"></td>' );
		document.write( '	</tr>' );
		document.write( '</table>' );
}

function drawPrevButton()
{ try
  {
	if (pageNo>1)
		drawNavButton( "&lt;", (pageNo-1), "Pagina anterioară" );
  } catch( err ){}
}
function drawNextButton()
{ try
  {
	if (pageNo<noOfPages)
		drawNavButton( "&gt;", (pageNo+1), "Pagina următoare" );
  } catch( err ){}
}
function drawFirstButton()
{ try
  {
	if (noOfPages>2 && pageNo>2)
		drawNavButton( "&lt;&lt;", 1, "Prima pagină" );
  } catch( err ){}
}
function drawLastButton()
{ try
  {
	if (noOfPages>2 && (pageNo+1)<noOfPages)
		drawNavButton( "&gt;&gt;", noOfPages, "Ultima pagină" );
  } catch( err ){}
}

/////////for mouseover stuff
var prevClassName = '';
function tblOnMouseOver()
{
//mouseover highlight in netscape is not supported
	if(navigator.appName.indexOf("Netscape") >= 0 )
		return;

	var element = event.srcElement;

	while( element.tagName != "TABLE" )
	{
		element = element.parentElement;
		var currClassName = element.className;
		if ( currClassName == 'tr1' || currClassName == 'tr2' || currClassName == 'tr4' )
		{
			prevClassName = element.className;
			element.className = 'tr3';
			break;
		}
	}
}

function tblOnMouseOut()
{
//mouseover highlight in netscape is not supported
	if(navigator.appName.indexOf("Netscape") >= 0 )
		return;


	var element = event.srcElement;

	while( element.tagName != "TABLE" )
	{
		element = element.parentElement;

		var currClassName = element.className;
		if ( currClassName == 'tr3' )
		{
			element.className = prevClassName;
			break;
		}
	}
}

function lock()
{
	if(navigator.appName.indexOf("Netscape") >= 0 )
		return;


	var element = event.srcElement;

	

	while( element.tagName != "TABLE" )
	{
		element = element.parentElement;
	
	
		var currClassName = element.className;

		if( element.tagName == "TABLE" ) break;
		
		var mainTable = element.parentElement;
		while( mainTable.tagName != "TABLE" ){
			mainTable = mainTable.parentElement;
		}
		
		for (i = 0; i < mainTable.rows.length; i++)
		{
			if (mainTable.rows[i].className == 'tr6')
				mainTable.rows[i].className = 'tr2';

			if (mainTable.rows[i].className == 'tr5')
				mainTable.rows[i].className = 'tr1';
			if (mainTable.rows[i].className == 'tr7')
				mainTable.rows[i].className = 'tr4';
		}

		if ( currClassName == 'tr3' || currClassName == 'tr5' || currClassName == 'tr6' || currClassName == 'tr7')
		{
		
			    if (currClassName == 'tr5')
			    {
                    		element.className = 'tr1';
		                
		             }

			    if (currClassName == 'tr6')
			    {
			    element.className = 'tr2';
			    }
			    
			    if (currClassName == 'tr7')
			    {
			    	element.className = 'tr4';
			    }
			

			    if (prevClassName == 'tr2')
			    {
                    		element.className = 'tr6';
		                
                	     }
                	     if (prevClassName == 'tr1')
			     {
			     	element.className = 'tr5';
			     		                
                	     }

		
			break;
		}
	}
}

function showDetails( candId )
{
	wnd2 = window.open( "/titCandDetails/cand_"+candId+".html", "candDetails",
	"width=580,height=420,address=no,menubar=no,status=no,toolbar=no,resizable=yes, scrollbars=yes");
	wnd2.focus();
}

function showDetails2( candId )
{
	wnd2 = window.open( "/titCandDetails2/cand_"+candId+".html", "candDetails",
	"width=580,height=420,address=no,menubar=no,status=no,toolbar=no,resizable=yes, scrollbars=yes");
	wnd2.focus();
}

/////////load top frame if needed
function updateTopFrameCommon( topLocation )
{
	try
	{
		if ( top.frames.topFrame.location.href.indexOf( topLocation ) < 0 )
			top.frames.topFrame.location.replace( topLocation );
	}
	catch( terr )
	{
	}
}
function updateTopFrame() { updateTopFrameCommon( "/2009/staticRepI/j/top.html" ); }
function updateTopFrameN() { updateTopFrameCommon( "/2009/staticRepI/n/top.html" ); }
function updateTopFrame3() { 
	var query = unescape(location.search).substring(8);
	if( query == null || query.length < 1 )
	{
		var prefix = "KEEPTOP=";
		var cookieStartIndex = document.cookie.indexOf( prefix );
		//alert("cookie " + cookieStartIndex +" din " + document.cookie);

		if (cookieStartIndex < 0){
			updateTopFrameCommon( "/2009/searchRepI/top.html" ); 
			return;
		}

		var cookieEndIndex =  document.cookie.indexOf(";", cookieStartIndex + prefix.length);
		if (cookieEndIndex == -1)
			cookieEndIndex = document.cookie.length;

		query = document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex);
		//alert("found " + query + "de la " +cookieStartIndex + prefix.length + " pana la " + cookieEndIndex );
		if( query == "true")
			updateTopFrameCommon( "/2009/staticRepI/j/top.html" ); 
	
	}
	else
		updateTopFrameCommon( "/2009/searchRepI/top.html" ); 
}
function updateTopFrame4() { updateTopFrameCommon( "/2009/advSearch/top.html" ); }


function CautareLink(){
	var query = unescape(location.search).substring(8);
	if( query == null || query.length < 1 )
	{
		var prefix = "KEEPTOP=";
		var cookieStartIndex = document.cookie.indexOf( prefix );
		//alert("cookie " + cookieStartIndex +" din " + document.cookie);

		if (cookieStartIndex < 0){
			document.write("<td nowrap><a href=\"/2009/search/index.html\" target=\"_top\" >Căutare</a></td>");
			return;
		}

		var cookieEndIndex =  document.cookie.indexOf(";", cookieStartIndex + prefix.length);
		if (cookieEndIndex == -1)
			cookieEndIndex = document.cookie.length;

		query = document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex);
		//alert("found " + query + "de la " +cookieStartIndex + prefix.length + " pana la " + cookieEndIndex );
		if( query == "true")
			document.write("<td nowrap><a href=\"/2009/staticRepI/j/index.html\" target=\"_top\" >Vizualizare rapoarte pe județ</a></td>");

	
	}
	else
		document.write("<td nowrap><a href=\"/2009/searchRepI/index.html\" target=\"_top\" >Căutare</a></td>");
}


function Afiseaza( forma ){


	if( forma.R3[0].checked ) // alfabetic
	{
		if( forma.R2[0].checked ) // in
		{
			
				location = "cina/";
			
		}
		if( forma.R2[1].checked ) // out
				{
					
						location = "couta/";
					
		}
	
	}
	if( forma.R3[1].checked ) // medie
		{
			if( forma.R2[0].checked ) // in
			{
				if( forma.R1[0].checked ) // toti
					location = "cin/";
				if( forma.R1[1].checked ) // repartizati
					location = "ain/";
				if( forma.R1[2].checked ) // nerepartizati
					location = "rin/";
			}
			if( forma.R2[1].checked ) // out
					{
						if( forma.R1[0].checked ) // toti
							location = "cout/";
						if( forma.R1[1].checked ) // repartizati
							location = "aout/";
						if( forma.R1[2].checked ) // nerepartizati
							location = "rout/";
			}
	
	}
	
	
	return false;


}


function clickR1(){
	
	frm = document.forms["f1"];
		if( frm == null) return;
		
		
		if( ! frm.R1[0].checked ){
			frm.R3[1].checked = true;
			frm.R3[0].disabled = true;
		}
		else{
			frm.R3[0].disabled = false;
	}
}
