

	function over(id){
		targetElement = document.getElementById(id);
		targetElement.style.background = '#FF6000 url("/img/ddg_topmenu_bg.jpg")';
		
		targetElement = document.getElementById('s' + id);
		targetElement.style.color = '#000000';
		
	}
	function out(id){
		targetElement = document.getElementById(id);
		targetElement.style.background = 'none';
		
		targetElement = document.getElementById('s' + id);
		targetElement.style.color = '#ffffff';
	}
	
function show_menu (id)
 {
 	document.getElementById("sub"+curid).style.display="none";
	curid = id;
	idd=id;
 	//alert(id);
 	//fadeIn();
 	document.getElementById("sub"+id).style.display="block";
 } 
 function show_menu1 (id)
 {
 	//idd=id;
 	//alert(id);
 	//fadeIn();
 	document.getElementById("sub"+id).style.display="block";
 }
 function hide_menu (id)
 {
	//alert(id);
	idd=id;
 	//window.setTimeout('document.getElementById("sub"+idd).style.display="none";',1000);
 	//setTimeout(1000);
 	document.getElementById("sub"+id).style.display="none";
 	//clearTimeout(timer);
 	op=95;
 	//fadeOut();
 	//op=0;
 	
 }
 
 
 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 changeState(layerRef, state)
{ 
	var blockElement = document.getElementById(layerRef);
	blockElement.style.visibility = state;
}

  function ChangeFoto(sImg, imgSrc) 
  { 
     var img = document.getElementById('CarIDF'); 
     img.src = sImg; 
   } 
function openWindow(theURL,winName,features) 
{ 
  window.open(theURL,winName,features);
}

function open_win7(url)
{
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 &&  (navigator.userAgent.indexOf("Windows 3.1") == -1)) 
{
window.open(url,'clubculturewin','fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0 ,resizable=no,width=300,height=500, top=10, left=10');
}
}
function Calclear() 
{
Payment.value=""
MonthlyPayment.value=""
LoanAmount.value=""
}

function InitVal()
{
var ex_url=location.search.substring(1);
if (ex_url.length==0) {
priceVal=100;
}
else {
priceVal=parseInt(ex_url,10);

}
window.document.CarPrice.value=priceVal
}

function Price()
{
var ex_url=location.search.substring(1);
if (ex_url.length==0) {
priceVal=100;
}
else {
priceVal=parseInt(ex_url,10);
}
CarPrice.value=priceVal;
}

function Calc() 
{
b1=CarPrice.value
fp=ForePaym.value/100
 b2=b1*fp
 b3=b1-b2
b4=Term.value
d1=InterestRate.value/100
d2=b2<b1*fp?"":b3*(d1/12)/(1-Math.pow(1+d1/12,-b4*12))
//window.alert(d1)
d3=b2<b1*fp?"":b3*0.07
d4=b2<b1*fp?"":d2/0.4
d5=b2<b1*fp?"":d2*b4*12-b3
 d6=b2<b1*fp?"":d5/b1*100
 Payment.value=b2 
 LoanAmount.value=b3 
 MonthlyPayment.value=Math.round(d2)
 CarPrice.value=b1 
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ChangeSt (name, count)
{
	for (i=1;i<=count;i++)
	{
		obj = document.getElementById ('item' + i);
		obj.style.visibility = 'hidden';
	}
	obj = document.getElementById ('default');
	obj.style.visibility = 'hidden';
	obj = document.getElementById (name);
	obj.style.visibility = 'visible';
}



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;
	}
}



var oLastImg = null;
function imgOver (obj, img){
	obj.src = img;
}

function imgOut (obj, img){
	obj.src = img;
}

function changeImg (obj, img){
	var oImg = document.getElementById ('CarIDF');
	var oDiv = obj.parentNode;
	oImg.src = img;
	if (oLastImg)
		oLastImg.style.background = 'none';
	oLastImg = oDiv;
	oDiv.style.background = 'url(\'/img/ddg_ramka_gallery.gif\') no-repeat';
}


var oLast;



function showMenu(obj){

    var oMenu = document.getElementById(obj);

    if (oLast)

        oLast.style.display = 'none';

    oLast = oMenu;

    oMenu.style.display = 'block';

}



function hideMenu(obj){

    var oMenu = document.getElementById(obj);

    oMenu.style.display = 'none';

}





var oLastImg = null;

function imgOver (obj, img){

 obj.src = img;

}



function imgOut (obj, img){

 obj.src = img;

}



function changeImg1 (obj, img){

 var oImg = document.getElementById ('photo');

 var oDiv = obj.parentNode;

 oImg.src = img;

 if (oLastImg)

 oLastImg.style.background = 'none';

oLastImg = oDiv;

 oDiv.style.background = 'url(\'/img/ddg_ramka_gallery.gif\') no-repeat';

}





function KuzovColor(src, obj){

     

    var img = document.getElementById('photo');

    img.src = src;

    document.getElementById('nID1').innerHTML = obj.alt;



    if (oLast)

        oLast.style.border = '1px solid #D5C39D';

    oLast = obj.parentNode;

    obj.parentNode.style.border = '1px solid #CC6601';

    oLast3 = '';

}



var oLast2;

function Obivka(src, obj){

     

    var img = document.getElementById('photo');

    img.src = src;

    document.getElementById('nID2').innerHTML = obj.alt;

    

    if (oLast2)

        oLast2.style.border = '1px solid #D5C39D';

    oLast2 = obj.parentNode;

    obj.parentNode.style.border = '1px solid #CC6601';

    oLast3 = '';

}



var oLast3;

function Koleso(src, obj){

     

    var img = document.getElementById('photo');

    img.src = src;

    document.getElementById('nID3').innerHTML = obj.alt;

    

    if (oLast3)

        oLast3.style.border = '1px solid #D5C39D';

    oLast3 = obj.parentNode;

    obj.parentNode.style.border = '1px solid #CC6601';

}





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 getCurrency(cur) { document.write ('<div id="price' + flag + '" style="position:relative; display: inline;">' + 'руб' + '</div><div id="hideprice' + flag + '" style="position:relative; display: none;">' + 'usd' + '</div>'); flag ++;}
