ddaccordion.init({ //top level headers initialization
	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
	contentclass: "categoryitems", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen:false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

ddaccordion.init({ //2nd level headers initialization
	headerclass: "subexpandable", //Shared CSS class name of sub headers group that are expandable
	contentclass: "subcategoryitems", //Shared CSS class name of sub contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate:false, //persist state of opened contents within browser session?
	toggleclass: ["opensubheader", "closedsubheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

ddaccordion.init({ //3rd level headers initialization
	headerclass: "subsubexpandable", //Shared CSS class name of sub headers group that are expandable
	contentclass: "subsubcategoryitems", //Shared CSS class name of sub contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["opensubheader", "closedsubheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function reloadWindow()
{
	window.location=window.location;
	
	return;
}

function updateOptions(sel, id, sel_label)
{
	switch (id)
	{
		case "marci":
			if (sel.value != '0')
			{
				arr1 = marci[sel.value].split('$');
				resetSelect('marci');
				insertOption('marci',sel_label,0);
				for (i=0;i<arr1.length;i++)
				{
					if (arr1[i] != '')
					{
						arr2 = arr1[i].split('|');
						insertOption('marci',arr2[1],arr2[0]);
					}
				}
				selectOption('marci',0);
			}
			else 
			{
				resetSelect('marci');
				insertOption('marci',sel_label,0);
				resetSelect('modele');
				insertOption('modele',sel_label,0);
			}
			break;
		case "modele":
			if (sel.value != '0')
			{
				arr1 = modele[sel.value].split('$');
				resetSelect('modele');
				insertOption('modele',sel_label,0);
				for (i=0;i<arr1.length;i++)
				{
					if (arr1[i] != '')
					{
						arr2 = arr1[i].split('|');
						insertOption('modele',arr2[1],arr2[0]);
					}
				}
				selectOption('modele',0);
			}
			else 
			{
				resetSelect('modele');
				insertOption('modele',sel_label,0);
			}
			break;
	}
}

function insertOption(sId, txt, val)
{
	select = obiect(sId);
	var opt = document.createElement('OPTION');
	opt.text = txt;
	opt.value = val;
	try 
	{
		select.add(opt, null);
	}
  	catch(ex) 
  	{
    	select.add(opt);
	}
}

function resetSelect(sId)
{
	select = obiect(sId);
	for (i=select.length-1;i>=0;i--) 
	{
		select.remove(i);
	}
}

function selectOption(sId, index)
{
	select = obiect(sId);
	select[index].selected = 1;
}

/*pop image*/
PositionX = 10;
PositionY = 10;
defaultWidth  = '';
defaultHeight = '';
var AutoClose = true;
var opt='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function pop(src,imageTitle){
imageURL=src;
imageTitle=((imageTitle!='') ? imageTitle : 'IMPULS-LEASING');
imgWin=window.open('about:blank','',opt);
with (imgWin.document){
writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
writeln('<html><head><title>Loading...</title><style type="text/css">body{margin:0; padding:0;}</style>');
writeln('<sc'+'ript type="text/javascript">');
writeln('function reSizeToImage(){');
writeln('window.resizeTo(100,100);');
writeln('width=100+document.images[0].width;');
writeln('height=100+document.images[0].height;');
writeln('window.resizeTo(width,height);}');
writeln('function doTitle(){document.title="'+imageTitle+'";document.getElementById(\'loading\').style.display="none";}');
writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor="#ffffff" onload="reSizeToImage();doTitle();self.focus()">');
writeln('<table width="100%"><tr><td align="center" valign="middle"><p id="loading">Loading...</p><img name="IMPULS-LEASING" sr' + 'c='+imageURL+' style="display:block" onclick="self.close()" /></td></tr></table></body></html>');
close();		
}}

function stripPath(loc)
{
	return loc.replace(/^(((.+)\/)+)?(([\w\-_]+\.)+\w{3})$/, '$4');
}
/*end pop image*/

function showContact(sel)
{
	var elId = sel.value;
	var harta = obiect('harta');
	var dateContact = obiect('dateContact');
	if (elId != 0)
	{
		for (var i=1;i<=harta.childNodes.length;i++)
		{
			if (obiect('l'+i)) hide('l'+i);
		}
		if (obiect('l'+elId)) show('l'+elId);
		for (var i=1;i<=dateContact.childNodes.length;i++)
		{
			if (obiect('d'+i)) hide('d'+i);
		}
		if (obiect('d'+elId)) show('d'+elId);
	}
	else
	{
		for (var i=1;i<=harta.childNodes.length;i++)
		{
			if (obiect('l'+i)) hide('l'+i);
		}
		for (var i=1;i<=dateContact.childNodes.length;i++)
		{
			if (obiect('d'+i)) hide('d'+i);
		}
	}
}

function changePage(pag)
{
	obiect('page').value=pag;
	obiect('caut-masini').submit();
}

function textCounter(field,cntfield,maxlimit)
{
	if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit);
	else obiect(cntfield).value = maxlimit - field.value.length;
}

function markFields(campuri)
{
	var vector = new Array;
	vector = campuri.split("%");
	for (i=0;i<vector.length;i++)
	if (obiect(vector[i]))
	{
		obiect(vector[i]).style.backgroundColor = '#F9E5E5';
	}
}
