function change2(rub, usd, id) 
{
	if(document.getElementById('usedprice'+id).value == 'usd') 
	{
		document.getElementById('divusedprice'+id).innerHTML = usd; 
		setCookie('currency','USD');
	}
	else
	{
		document.getElementById('divusedprice'+id).innerHTML = rub;
		setCookie('currency','RUB');
	}
}

function wopen(imgName, w , h, Title)
{
	var wo = window.open("", "abc", "width = " + w + " , height = " + h + ", scrollbars=0, status=0");
	wo.document.open();
	var win = "";
	win = "<html><head><title>";
	win += Title;
	win += "</title></head>"
	win += "<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' rightmargin='0' bottommargin='0' marginwidth='0' marginheight='0'>";
	win += "<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center'>";
	win += "<a href='#' onClick='self.window.close();'><img src='" + imgName + "' width='" + w + "' height='" + h + "' border='0' alt='" + Title + "'></a>";
	win += "</td></tr></table>";
	win += "</body></html>";
	w += 8;
	h += 26;
	wo.window.resizeTo(w, h);
	wo.document.write(win);
	wo.window.focus();
	wo.document.close();	
}

function WKWinOpen(imgPath)
	{	
		var w = 500;
		var h = 335;
		var Title = "Распродажа (неликвиды)";
		
		var wo = window.open("", "abc", "width = " + (w+8) + " , height = " + (h+26) + ", scrollbars=0, status=0");
		wo.document.open();
		
		var win = "";
		win = "<html><head><title>";
		win += Title;
		win += "</title></head>"
		win += "<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' rightmargin='0' bottommargin='0' marginwidth='0' marginheight='0'>";
		win += "<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'><tr><td align='center'>";
		win += "<a href='#' onClick='self.window.close();'><img src='" + imgPath + "' width='" + w + "' height='" + h + "' border='0' alt='" + Title + "'></a>";
		win += "</td></tr></table>";
		win += "</body></html>";
		
		
		wo.document.write(win);
		wo.window.focus();
		wo.document.close();
	}


/*Дичь для меню*/
function leftMenuOver(obj)
{
	obj.style.background = 'url(\'/img/OrangeArrow.gif\') no-repeat 10px 7px #ECECEC';
	obj.childNodes[0].style.color = '#00ADEF';
}
function leftMenuOut(obj)
{
	obj.style.background = 'url(\'/img/GreyArrow.gif\') no-repeat 10px 7px ';
	obj.childNodes[0].style.color = '';
}

function leftMenuOverA(obj)
{
	obj.style.background = 'url(\'/img/OrangeArrow.gif\') no-repeat 10px 7px #ECECEC';
	obj.childNodes[0].style.color = '#00ADEF';
}
function leftMenuOutA(obj)
{
	obj.style.background = 'url(\'/img/GreyArrowA.gif\') no-repeat 10px 7px';
	obj.childNodes[0].style.color = '';
}

function leftMenuOver2(obj)
{
	obj.style.background = 'url(\'/img/OrangeArrow.gif\') no-repeat 20px 7px #ECECEC';
	obj.childNodes[0].style.color = '#00ADEF';
}
function leftMenuOut2(obj)
{
	obj.style.background = 'url(\'/img/GreyArrow.gif\') no-repeat 20px 7px';
	obj.childNodes[0].style.color = '';
}

function leftMenuOver2A(obj)
{
	obj.style.background = 'url(\'/img/OrangeArrow.gif\') no-repeat 20px 7px #ECECEC';
	obj.childNodes[0].style.color = '#00ADEF';
}
function leftMenuOut2A(obj)
{
	obj.style.background = 'url(\'/img/GreyArrowA.gif\') no-repeat 20px 7px';
	obj.childNodes[0].style.color = '';
}

function leftMenuOver3(obj)
{
	obj.style.background = 'url(\'/img/OrangeArrow.gif\') no-repeat 30px 7px #ECECEC';
	obj.childNodes[0].style.color = '#00ADEF';
}
function leftMenuOut3(obj)
{
	obj.style.background = 'url(\'/img/GreyArrow.gif\') no-repeat 30px 7px';
	obj.childNodes[0].style.color = '';
}


<!-- Добавляем--!>
function topMenuOver(obj)
{
	obj.style.background = 'url(\'/img/ArrowBigh.gif\') #FFFFFF no-repeat 6px 3px';
	obj.childNodes[0].style.color = '';
}
function topMenuOut(obj)
{
	obj.style.background = 'url(\'/img/ArrowBig.gif\') no-repeat 6px 3px #F8F8F8';
	obj.childNodes[0].style.color = '';
}

function mainMenuOver(obj)
{
	obj.style.background = 'url(\'/img/menuSep.gif\') #FFFFFF no-repeat 0px 3px';
    obj.childNodes[0].style.color = '';
    }

function mainMenuOut(obj)
{
	obj.style.background = 'url(\'/img/menuSep.gif\') no-repeat 0px 3px ';
	obj.childNodes[0].style.color = '';
}
/*конец дичи*/


function anonsOver(obj)
{
	obj.style.background = 'url(\'/img/OrangeArrow.gif\') no-repeat 0 5px';
	obj.childNodes[0].style.color = '#00ADEF';
}

function anonsOut(obj)
{
	obj.style.background = 'url(\'/img/BlueArrow.gif\') no-repeat 0 5px';
	obj.childNodes[0].style.color = '';
}

// фотогалерея
var arr = new Array("id0", "id1", "id2", "id3", "id4", "id5", "id6", "id7", "id8", "id9", "id10", "id11", "id12", "id13", "id14", "id15", "id16", "id17", "id18", "id19", "id20");

function ChangeFoto(sImg, imgSrc)
{
	 
	var img = document.getElementById('CarIDF');
	img.src = sImg;
	
	for(var i=0; i<arr.length; i++)
	{
		var julia = document.getElementById('id' + i);
		
		if(julia != null)
		{
			julia.style.background = 'url(\'img/galBgrNo.gif\')';
		}
	}
	
	imgSrc.style.background = 'url(\'img/galBgr.gif\')';
	//imgSrc.style.borderStyle = "solid";
	//imgSrc.style.borderColor = "#EE7815";
}

function ChangeColor(sImg, imgSrc)
{
	 
	var img = document.getElementById('CarIDF');
	img.src = sImg;
	
	for(var i=0; i<arr.length; i++)
	{
		var julia = document.getElementById('id' + i);
		
		if(julia != null)
		{
			julia.style.background = 'url(\'img/galBgrNo.gif\')';
		}
	}
	
	imgSrc.style.background = 'url(\'img/galBgr.gif\')';
}

function ChangeName( imgSrc)
{
	document.getElementById('nID').innerHTML = imgSrc.alt;	
}


function ChangeFoto2(sImg)
	{
		var img = document.getElementById('CarIDF');
		img.src = sImg;
	}
	
	
	
	

function checkCredit(obj)
{
	var Platezh        = document.getElementById('Platezh');
	var Dohod         = document.getElementById('Dohod');
	var PlatezhNum = parseFloat(Platezh.value);
	var DohodNum   = parseFloat(Dohod.value);

	if(PlatezhNum > DohodNum)
	{
		var bool = window.confirm('Ваш ежемесячный доход меньше ежемесячного платежа!\nВы хотите продолжить?');
		if(!bool)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
	return true;
	}
}

function change_span2() 
	{
	var stFlag = document.getElementById('mbprice').value;
	
	var span = document.getElementsByTagName('span');
		for (i = 0; i < span.length; i ++)
		if(span[i].className == 'RUB' || span[i].className== 'EUR') {
			
			span[i].style.display = 'none';}
			
			
		for (i = 0; i < span.length; i ++) {
		if(span[i].className == stFlag) 
			{
				
				//USD показать
				//RUB скрыть
				
				span[i].style.display = 'block';
			}		
		}
	}





function change_span()

	{

	var stFlag = document.getElementById('price_state').value;



	var span = document.getElementsByTagName('span');

		for (i = 0; i < span.length; i ++)

		if(span[i].className == 'RUB' || span[i].className== 'USD') {



			span[i].style.display = 'none';}





		for (i = 0; i < span.length; i ++) {

		if(span[i].className == stFlag)

			{



				//USD показать

				//RUB скрыть



				span[i].style.display = 'inline';

			}

		}

	}
function getCurrency(cur) { document.write ('<span class="RUB" style="position:relative; display: inline;">' + 'руб' + '</span><span class="USD" style="position:relative; display: none;">' + 'usd' + '</span>'); flag ++;}

function change2(rub, usd, id) 
{
	if(document.getElementById('usedprice'+id).value == 'usd') 
	{
		document.getElementById('divusedprice'+id).innerHTML = usd; 
		setCookie('currency','USD');
	}
	else
	{
		document.getElementById('divusedprice'+id).innerHTML = rub;
		setCookie('currency','RUB');
	}
}

function change() 
	{
	var stFlag = document.getElementById('usedprice').value;
	
	var span = document.getElementsByTagName('span');
		for (i = 0; i < span.length; i ++)
		if(span[i].className == 'RUB' || span[i].className== 'USD' || span[i].className== 'ORIG') 
			span[i].style.display = 'none';
			
		for (i = 0; i < span.length; i ++) {
		if(span[i].className == stFlag) 
			{
				
				//USD показать
				//RUB скрыть
				
				span[i].style.display = 'block';
			}		
		}
		setCookie('currency',stFlag);
	}
	
function setCookie (name, value){
      document.cookie = name + '=' + escape(value) + '; path=/; expires=Fri, 01-Jan-2025 00:00:01 GMT;';
}