// JavaScript Document
var service;
function show_popup() {
	var links=document.getElementById('classes-list').getElementsByTagName('a');
	var popup=document.getElementById('popup');
	var isIE=document.all?1:0;
	for (var i=0; i<links.length;i++) {
		
		links[i].onmouseover=function() {
			var pic=popup.getElementsByTagName('img')[0];
			var id = this.id;
			id = id.substring(3, id.length);
			id = Math.round(id);
//			alert(picsArr.length);
			pic.src = picsArr[id];	
//			alert(picsArr[id]);
			pic.style.top=Math.floor(popup.offsetHeight/2-pic.height/2)+'px';
			pic.style.left=Math.floor(popup.offsetWidth/2-pic.width/2)+'px';
//			alert(pic.src);
				/*!!!!!!!!!!!!find picture!!!!!!!!!!!!!!*/

			if (isIE) {
				var offsetLeft = 0;
				var offsetTop = 0;
				var offsetparent=this.parentNode;
				while(offsetparent) {
				offsetLeft += offsetparent.offsetLeft;
				offsetTop += offsetparent.offsetTop;
				offsetparent = offsetparent.offsetParent;
				}
				offsetLeft+=parseInt(this.parentNode.currentStyle.paddingLeft);
				
				if (document.documentElement.scrollTop >= offsetTop-this.offsetHeight-popup.offsetHeight) {
					offsetTop+=this.offsetHeight;
					popup.style.marginTop='0.7em';
				}
				else {
				offsetTop-=popup.clientHeight;
				popup.style.marginTop='-0.7em';
				}
				
				popup.style.top=offsetTop+'px';
				popup.style.left=offsetLeft+'px';
			}
			else {
				var offsetLeft = this.offsetLeft;
				var offsetTop = this.offsetTop;
				
				if (window.scrollY >= this.offsetTop-this.offsetHeight-popup.offsetHeight) {
					offsetTop+=this.offsetHeight;
					popup.style.marginTop='0.7em';
				}
				else {
				offsetTop-=popup.offsetHeight;
				popup.style.marginTop='-0.7em';
				}
				/*displaying popup*/
				popup.style.left=offsetLeft+'px';
				popup.style.top=offsetTop+'px';
			}
			/*popup.style.display='block';*/
		}
		links[i].onmouseout=function() {
			popup.style.top='-5000px';
		}
	}
	
}

function submit_query(formName, actionName, actionValue) {
	var form_obj = eval("document."+formName);
	eval("window.document."+formName+"."+actionName).value = actionValue;
	return true;
}
function submit_query_prompt(formName, actionName, actionValue, msg) {
	if ((msg != "") && (!window.confirm(msg))) {
		return false;
	}
	return submit_query(formName, actionName, actionValue);
}
function clearInput(formName, inputName) {
	eval("document."+formName+"."+inputName).value = '';
}
function view_image(path, width, height, id) {
	//window.confirm(path);
	//window.location = "admin/popup/view_image.php?"+path;
	pop = popup("units/catalog/view_image.php?file="+path+"&id="+id, "popup", width, height, false, false, 50, 150);
}
function popup(url){
	xPos = window.screenLeft+10;
	yPos = window.screenTop+20;
	win = window.open(url, 'filepopup', "width=400,height=300,left="+xPos+",top="+yPos+",scrollbars=yes,resizable=yes,toolbars=no");
}
function popupbyname(url){
	xPos = window.screenLeft+10;
	yPos = window.screenTop+20;
	win = window.open(siteURL + '/objects/editor/viewpopup.php?url='+url, 'filepopup', "width=400,height=230,left="+xPos+",top="+yPos+",scrollbars=no,resizable=no,toolbars=no");
}
function toggleDiv(id){
	obj = document.getElementById(id);
	tmp = obj.style.display;
	if (tmp == 'none') obj.style.display='block';
	else obj.style.display='none';
}
function show_basket() {
	param = "top=150,left=150,width=630,height=500,scrollbars,resizable";
	popupwindow = window.open("func_const('DIR')/basket/", "BasketWindow", param);
}

function showhide(arr) {
	if (arr.length > 0) {
		for (var i=0; i<arr.length; i++) {
			toggleDiv(arr[i]);
		}
	}
}

function hideNote()
{
var div = document.getElementById('current_footnote');
div.className = 'footnote_new';
div.style.display = 'none';
return false;
}

function getElementPosition(offsetTrail)
{
var offsetLeft = 0;
var offsetTop = 0;
while(offsetTrail) {
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
offsetTrail = offsetTrail.offsetParent;
}
return { left:offsetLeft, top:offsetTop }
}


function showNote(img, id, img_src)
{
	var note = document.getElementById(id);
	var div = document.getElementById('current_footnote');
	var o = document.getElementById(img);
	var coords = getElementPosition(o); 
	div.innerHTML = '<a href="#" onclick="return hideNote()"><img src="'+img_src+'" height="13" width="13" border="0" id="x_image" /></a><div style="float: right; width: 17px; height: 17px"></div><div style="padding: 7px">' + note.innerHTML + '</div>';
	div.className = 'footnote_new_active';
	div.style.top = (coords.top + o.offsetHeight) + 'px';
	div.style.left = coords.left + 'px';
	div.style.display = 'none';
	div.style.display = 'block';
}

function ttt(evt) {
//	alert('test')
	alert(evt.clientX+' : '+evt.clientY+"\n"+window.scrollX+" : "+window.scrollY);
}

function InitNavigationMenu() {
	var child = document.getElementById('avto-menu').childNodes;
	var fci = 0;
	for(i=0; i<child.length; i++){
		if(child[i].nodeType == 1) {
			fci=i;
			break;
		}
	}
	dk_JsHttpRequest_navigation(child[fci]);
	
	return false;
}

function InitServiceMenu() {
//	var child = document.getElementById('service-menu').childNodes;
//	var fci = -1;
//	var j=0;
//	for(i=0; i<child.length; i++){
//		if(child[i].nodeType == 1) {
//			child[i].id = 'lis'+(++j);
//			if(fci<0) fci=i;
//		}
//	}
//	service_transfer(child[fci]);
//	return false;
}

function dk_JsHttpRequest_service(elem) {
	//alert(elem.id);
	var child = elem.parentNode.childNodes;
	for(i=0; i<child.length; i++){
		if (child[i].nodeType == 1 && child[i].className == 'b-item selected') {
			child[i].className = 'b-item non-selected';
			var span = child[i].getElementsByTagName('SPAN')[0];
			var html = span.innerHTML;
			child[i].removeChild(span);
		    var a = document.createElement('a');
		    a.innerHTML = html;
		    child[i].appendChild(a);
		}
	}
	elem.className = 'b-item selected';
	var a = elem.getElementsByTagName('A')[0];
	var html = a.innerHTML;
	elem.removeChild(a);
    var span = document.createElement('SPAN');
    span.innerHTML = html;
    elem.appendChild(span);
	//calculate_summary(); 
}

function dk_JsHttpRequest_navigation(elem) {
	//alert(elem.id);
	var child = elem.parentNode.childNodes;
	for(i=0; i<child.length; i++){
		if (child[i].nodeType == 1 && child[i].className == 'b-item selected') {
			child[i].className = 'b-item non-selected';
			var span = child[i].getElementsByTagName('SPAN')[0];
			var html = span.innerHTML;
			child[i].removeChild(span);
		    var a = document.createElement('a');
		    a.innerHTML = html;
		    child[i].appendChild(a);
		}
	}
	elem.className = 'b-item selected';
	var a = elem.getElementsByTagName('A')[0];
	var html = a.innerHTML;
	elem.removeChild(a);
    var span = document.createElement('SPAN');
    span.innerHTML = html;
    elem.appendChild(span);
    
    
    
//    var child = document.getElementById('service-menu').childNodes;
//	var fci = -1;
//	var j=0;
//	for(i=0; i<child.length; i++){
//		if(child[i].nodeType == 1) {
//			j++;
//			if(child[i].className == 'selected')
//				this.service = j;
//		}
//	}
	
	try {
		var div = document.getElementById('cars-list');
		var uls = div.getElementsByTagName('UL');
		for (i=0; i<uls.length; i++) {
			uls[i].style.display='none';
		}
		var ul_cars = document.getElementById('ul'+elem.id);
		ul_cars.style.display='block';
//		var cli = ul_cars.getElementsByTagName('LI')[0];
//		var pid = cli.className.substring(3, cli.className.length);
//		var min_hours = document.getElementById('min_hours');
//		var min_drive = document.getElementById('min_drive');
//		min_hours.innerHTML = ServiceArr[pid][2][1];
		
//		min_drive.innerHTML = ServiceArr[pid][this.service][2];
//		try {var min_hours_2 = document.getElementById('min_hours_2'); min_hours_2.innerHTML = ServiceArr[pid][2][1];} catch(e) {}
//		try {var min_drive_2 = document.getElementById('min_drive_2'); min_drive_2.innerHTML = ServiceArr[pid][this.service][2];} catch(e) {}
//		var zalog = document.getElementById('zalog');
//		zalog.innerHTML = ServiceArr[pid][4][1];
//		try {
//			var desc = document.getElementById('descr');
//			if (desc.innerHTML == '' || desc.innerHTML.indexOf('Залог') != -1) {
//				desc.innerHTML = '';
//				if (ServiceArr[pid][4][1] != '') desc.innerHTML = 'Залог '+ServiceArr[pid][4][1]+' рублей.';;
//			} 
//		} catch(e) {}

//		var hand_hours = document.getElementById('hand_hours').innerHTML;
//		var hours = document.getElementById('hours').value;
//		if (Math.round(hours) == 2) { 
//			if (Math.round(hours) < Math.round(min_hours.innerHTML)) {
//				document.getElementById('hours').value = '';
//			} 
//		}
//		alert(hours);
//		alert(hand_hours);
//		if (hours == '' && hand_hours != '') {
//			if (Math.round(hand_hours) >= Math.round(min_hours.innerHTML)) {
//				document.getElementById('hours').value = hand_hours;
//			} 
//		}
		calculate_prices();
		
		
	} catch(e) {
	// Load cars
//		var lis = document.getElementById('service-menu').childNodes;
//		for (i=0; i<lis.length; i++) {
//			if (lis[i].nodeType == 1 && lis[i].className == 'selected') {
//				var sm_li = lis[i].id;
//			}
//		}
		var progress = document.getElementById('progress');
		progress.style.display = 'block';
		
		var req = new Subsys_JsHttpRequest_Js();
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				var content = req.responseJS.content;
				var div = document.getElementById('cars-list');
				var old_content = div.innerHTML;
				div.innerHTML = old_content+content;
	//			elem.style.display='block';
				var uls = div.getElementsByTagName('UL');
				for (i=0; i<uls.length; i++) {
					uls[i].style.display='none';
				}
				
				
//				var child = document.getElementById('service-menu').childNodes;
//				var fci = -1;
//				var j=0;
//				for(i=0; i<child.length; i++){
//					if(child[i].nodeType == 1) {
//						j++;
//						if(child[i].className == 'selected')
//							this.service = j;
//					}
//				}
				
				
				
				var ul_cars = document.getElementById('uln'+req.responseJS.id);
				ul_cars.style.display='block';
				var cli = ul_cars.getElementsByTagName('LI')[0];
				var pid = cli.className.substring(3, cli.className.length);
//				var min_hours = document.getElementById('min_hours');
//				var min_drive = document.getElementById('min_drive');
//				min_hours.innerHTML = ServiceArr[pid][2][1];
//				//alert(ServiceArr[pid][this.service][2]);
//				min_drive.innerHTML = ServiceArr[pid][this.service][2];
//				try {var min_hours_2 = document.getElementById('min_hours_2'); min_hours_2.innerHTML = ServiceArr[pid][2][1];} catch(e) {}
//				try {var min_drive_2 = document.getElementById('min_drive_2'); min_drive_2.innerHTML = ServiceArr[pid][this.service][2];} catch(e) {}
//
//				var zalog = document.getElementById('zalog');
//				zalog.innerHTML = ServiceArr[pid][4][1];
//				try {
//					var desc = document.getElementById('descr');
//					if (desc.innerHTML == '' || desc.innerHTML.indexOf('Залог') != -1) {
//						desc.innerHTML = '';
//						if (ServiceArr[pid][4][1] != '') desc.innerHTML = 'Залог '+ServiceArr[pid][4][1]+' рублей.';;
//					} 
//				} catch(e) {}

//				alert(zalog.innerHTML);
				
//				var hand_hours = document.getElementById('hand_hours').innerHTML;
//				var hours = document.getElementById('hours').value;
//				if (Math.round(hours) == 2) { 
//					if (Math.round(hours) < Math.round(min_hours.innerHTML)) {
//						document.getElementById('hours').value = '';
//					} 
//				}
		//		alert(hours);
		//		alert(hand_hours);
//				if (hours == '' && hand_hours != '') {
//					if (Math.round(hand_hours) >= Math.round(min_hours.innerHTML)) {
//						document.getElementById('hours').value = hand_hours;
//					} 
//				}
				var progress = document.getElementById('progress');
				progress.style.display = 'none';
				
				calculate_prices();
			}
		}
		
		req.caching = false;
	    file = siteURL+'/cars_JsHttpRequest.php';
	    req.open('GET', file, true);
	    req.send({ 
	    			id: elem.id
//	    			lid: sm_li,
//	    			hours: document.getElementById('hours').value, 
//	    			distance: document.getElementById('distance').value, 
//	    			days: document.getElementById('days').value
	    });
	// /Load cars
	}
	
	// Recalculate price
	// /Recalculate price
	
}

function service_transfer(elem){
	var sid = 1;
	this.service = 1;
	dk_JsHttpRequest_service(elem);
	var desc = document.getElementById('descr');
	desc.innerHTML = 'Встреча или проводы в любой аэропорт или вокзал Москвы, отдельно оплачивается стоимость парковки.';
	document.getElementById('hours_block').style.display = 'none';
	document.getElementById('distance_block').style.display = 'none';
	document.getElementById('days_block').style.display = 'none';
	calculate_prices();
}

function service_driver(elem){
	var sid = 2;
	this.service = 2;
	dk_JsHttpRequest_service(elem);	
	var desc = document.getElementById('descr');
	var min_hours = document.getElementById('min_hours').innerHTML;
	var min_drive = document.getElementById('min_drive').innerHTML;
	desc.innerHTML = 'Минимальное время аренды автомобиля — <span id="min_hours_2">'+min_hours+'</span> часа фактической поездки + <span id="min_drive_2">'+min_drive+'</span> час на подачу и отгон авто.';
	document.getElementById('hours_block').style.display = 'block';
	document.getElementById('distance_block').style.display = 'none';
	document.getElementById('days_block').style.display = 'none';
	calculate_prices();
}

function service_countryside(elem) {
	var sid = 3;
	this.service = 3;
	dk_JsHttpRequest_service(elem);	
	var desc = document.getElementById('descr');
	var min_hours = document.getElementById('min_hours').innerHTML;
	var min_drive = document.getElementById('min_drive').innerHTML;
	desc.innerHTML = 'Аренда с водителем по городу + за каждый километр от МКАД в обе стороны.';
	desc.innerHTML += ' Минимальное время аренды автомобиля — <span id="min_hours_2">'+min_hours+'</span> часа фактической поездки + <span id="min_drive_2">'+min_drive+'</span> час на подачу и отгон авто.';
	document.getElementById('hours_block').style.display = 'block';
	document.getElementById('distance_block').style.display = 'block';
	document.getElementById('days_block').style.display = 'none';
	calculate_prices();
}

function service_rent(elem) {
	var sid = 4;
	this.service = 4;
	dk_JsHttpRequest_service(elem);	
	var desc = document.getElementById('descr');
	var zalog = document.getElementById('zalog').innerHTML;
	desc.innerHTML = (zalog == '') ? '' : 'Залог <span id="zalog_2">'+zalog+'</span> рублей.';
	document.getElementById('hours_block').style.display = 'none';
	document.getElementById('distance_block').style.display = 'none';
	document.getElementById('days_block').style.display = 'block';
	calculate_prices();
}

	function calculate_prices() {
//		var lis = document.getElementById('service-menu').childNodes;
//		for (i=0; i<lis.length; i++) {
//			if (lis[i].nodeType == 1 && lis[i].className == 'selected') {
//				var lid = lis[i].id;
//				lid = lid.substring(3, lid.length);
//			}
//		}
		
		var lid = 2;

		var div = document.getElementById('cars-list');
		var uls = div.getElementsByTagName('UL');
		for (i=0; i<uls.length; i++) {
			var lis = uls[i].getElementsByTagName('LI');
			for (j=0; j<lis.length; j++) {
				id = lis[j].className.substring(3, lis[j].className.length);
//				alert(id);
				var price = calculate_price(id, lid);
//				alert(Math.round(price));
				if (Math.round(price) == 0) {
					lis[j].style.display = 'none';
				} else {
					lis[j].style.display = 'inline';
					var child_div = lis[j].getElementsByTagName('DIV');
					for(k=0; k<child_div.length; k++){
						if (child_div[k].className == 'price_div') {
							var span_price = child_div[k].getElementsByTagName('SPAN')[0];
							var strong = span_price.getElementsByTagName('STRONG')[0];
							strong.innerHTML = Math.round(price);
						}
					}
				}
//				alert(lis[j].style.display);
			}
		}
		//calculate_summary(); 
	}
	
	function calculate_price(id, lid) {
		
		price = 0;
		
		try {
//			hours = document.getElementById('hours').value; 
//			distance = document.getElementById('distance').value; 
//			days = document.getElementById('days').value;
			if (id == 0 || lid == 0) return price;
		} catch(e) {
			return price;
		}
		
		
		lid = Math.round(lid);
		price = ServiceArr[id][2][0];
				
//		switch  (lid) {
//			case 1:
//			default:
//				price = Math.round(ServiceArr[id][1][0]);
//				break;
//			case 2:
//				hours = (hours == '') ? ServiceArr[id][2][1] : hours;
//				hours = Math.round(hours);
//				if (hours < ServiceArr[id][2][1]) {
//					hours = ServiceArr[id][2][1];
//				}
//				hours = Math.round(hours);
//				hours_ = parseInt(hours) + parseInt(ServiceArr[id][2][2]);
//				//alert(hours_);
//				//price = ServiceArr[id][2][0] * (hours + 1);
//				price = ServiceArr[id][2][0] * hours_;
//				break;
//			case 3:
//				hours = (hours == '') ? ServiceArr[id][3][1] : hours;
//				hours = Math.round(hours);
//				if (hours < ServiceArr[id][3][1]) {
//					hours = ServiceArr[id][3][1];
//				}
//				hours = Math.round(hours);
//				distance = (distance == '') ? 0 : distance;
//				//alert(parseInt(hours) + parseInt(ServiceArr[id][3][2]))
//				hours_ = parseInt(hours) + parseInt(ServiceArr[id][3][2]);
//				price = (ServiceArr[id][2][0] * hours_) + (2 * distance * ServiceArr[id][3][0]);
//				//price = (ServiceArr[id][2][0] * (hours + 1)) + (2 * distance * ServiceArr[id][3][0]);
//				break;
//			case 4:
//				days = (days == '') ? 1 : Math.round(days);
//				sid = (days > 31) ? 5 : 4;
//				price = Math.round(ServiceArr[id][sid][0] * days) ;//+ Math.round(ServiceArr[id][4][1])
//				break;
//		}
		return price;
	}
	
	ff1=function(t){
		var min_hours = document.getElementById('min_hours').innerHTML;
		var hand_hours = document.getElementById('hand_hours');
		if (min_hours == '') min_hours = 2;
		min_hours = Math.round(min_hours);
		//alert(min_hours);|| t.value < min_hours
		t.className=(!(/^\d*$/.test(t.value)) )?'err':'valid';
	//  	alert(t.className);|| t.value < min_hours
	  	if (!(/^\d*$/.test(t.value)) ) { 
	  		t.value=t.defaultValue;
	    	if(self.ww)clearTimeout(ww);
	    	o=t;
	    	ww=setTimeout("o.className='valid';",999);
	  	} else {
	  		t.defaultValue=t.value;
	  		hand_hours.innerHTML = t.value;
	  		calculate_prices();	
	  	}
	}
	

	ff2=function(t){
		t.className=(!(/^\d*$/.test(t.value)))?'err':'valid';
	//  	alert(t.className);
	  	if (!(/^\d*$/.test(t.value))) { 
	  		t.value=t.defaultValue;
	    	if(self.ww)clearTimeout(ww);
	    	o=t;
	    	ww=setTimeout("o.className='valid';",999);
	  	} else {
	  		t.defaultValue=t.value;
	  		calculate_prices();	
	  	}
	}
	
	ff3=function(t){
		t.className=(!(/^\d*$/.test(t.value)))?'err':'valid';
	//  	alert(t.className);
	  	if (!(/^\d*$/.test(t.value))) { 
	  		t.value=t.defaultValue;
	    	if(self.ww)clearTimeout(ww);
	    	o=t;
	    	ww=setTimeout("o.className='valid';",999);
	  	} else {
	  		t.defaultValue=t.value;
	  		calculate_prices();	
	  	}
	}
	
	function calculate_summary() {
		//alert(this.service)
//		var id = cid;
//		var div = document.getElementById('cars-list');
//		var uls = div.getElementsByTagName('UL');
//		for (i=0; i<uls.length; i++) {
//			if ( uls[i].style.display == 'block'  ) {
//				var lis = uls[i].getElementsByTagName('LI');
//				for (j=0; j<lis.length; j++) {
//					id = lis[j].className.substring(3, lis[j].className.length);
//	//				alert(id);
//				}
//			}
//		}
		
//		var param = document.getElementById('param');
//		var service_param = '';
//		var lis = document.getElementById('service-menu').childNodes;
//		for (i=0; i<lis.length; i++) {
//			if (lis[i].nodeType == 1 && lis[i].className == 'selected') {
//				var lid = lis[i].id;
//				service_param = '<span id="service_param">'+lis[i].innerHTML+'.</span>';
//				lid = lid.substring(3, lid.length);
//			}
//		}
//		
//		param.innerHTML = service_param;
		
//		lid = Math.round(lid);
//		try {
//			hours = document.getElementById('hours').value; 
//			distance = document.getElementById('distance').value; 
//			days = document.getElementById('days').value;
//		} catch(e) {
//		}
		
//				hours = (hours == '') ? ServiceArr[id][lid][1] : hours;
//				hours = Math.round(hours);
//				if (hours < ServiceArr[id][lid][1]) {
//					hours = ServiceArr[id][lid][1];
//				}
//				hours = Math.round(hours);
//				hour = hours + Math.round(ServiceArr[id][this.service][2]);
//				hour = hour.toString();
//				//alert(hour);
//				hourl = hour.substring(hour.length-1, hour.length);
//				
//				//echo "dn1 = $dn1<br>";
//				
//				switch (hourl) {
//					case '1':
//						hour_ = 'час';
//						break;
//					case '2':
//					case '3':
//					case '4':
//						hour_ = 'часа';
//						break;
//					default:
//						hour_ = 'часов';
//						break;
//				}
//				
//			switch (hour) {
//					case '11':
//					case '12':
//					case '13':
//					case '14':
//						hour_ = 'часов';
//						break;
//				}
				
				
//		try {var min_hours_2 = document.getElementById('min_hours_2'); min_hours_2.innerHTML = ServiceArr[id][lid][1];} catch(e) {}
//		try {var min_drive_2 = document.getElementById('min_drive_2'); min_drive_2.innerHTML = ServiceArr[id][lid][2];} catch(e) {}
		
//		price = Math.round(ServiceArr[id][2][0]);
		
//		switch (lid) {
//			case 1:
//			default:
//				break;
//			case 2:
//				//param.innerHTML += ' <span id="hours_param">Продолжительность — <strong>'+(hour)+'</strong> '+hour_+'.</span> <br />';
//				break;
//			case 3:
//				distance = (distance == '') ? 0 : distance;
//				//param.innerHTML += ' <span id="hours_param">Продолжительность — <strong>'+(hour)+'</strong> '+hour_+'.</span> <br />';
//				//param.innerHTML += ' <span id="distance_param">Удаленность от МКАД — <strong>'+distance+'</strong> км.</span>';
//				break;
//			case 4:
//				days = (days == '' || days == '0') ? 1 : Math.round(days);
//				sid = (days > 31) ? 5 : 4;
//				price = Math.round(ServiceArr[id][sid][0] * days) + Math.round(ServiceArr[id][4][1]);
//				days = days.toString();
//				var dn1 = days.substring(days.length-1, days.length);
//				
//				//echo "dn1 = $dn1<br>";
//				
//				switch (dn1) {
//					case '1':
//						day = 'день';
//						break;
//					case '2':
//					case '3':
//					case '4':
//						day = 'дня';
//						break;
//					default:
//						day = 'дней';
//						break;
//				}
//				
//				param.innerHTML = ' <span id="arenda_param"> Аренда авто без водителя на <strong>'+days+'</strong> '+day+'.</span>';
//				break;
//		}
	}
	
function order_click(path, car_id) {
	var href = '';
	href += path;
	href += '?car='+car_id;

//	var lis = document.getElementById('service-menu').childNodes;
//	for (i=0; i<lis.length; i++) {
//		if (lis[i].nodeType == 1 && lis[i].className == 'selected') {
//			var sm_li = lis[i].id;
//			var lid = sm_li.substring(3, sm_li.length);
//		}
//	}
	
	var lid = 2;

	href += '&service_type='+lid;
//	href += '&hours='+document.getElementById('hours').value;
//	href += '&distance='+document.getElementById('distance').value;
//	href += '&days='+document.getElementById('days').value;
		
//	alert(href);
	window.location.href = href;
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function styleParametrsList() {
	var pl = document.getElementById('parametrs-list');
	
	if(pl) {
		var lis = pl.getElementsByTagName('LI');
		var sep = document.createElement('LI');
		sep.className = 'separator';
		lis[0].parentNode.insertBefore(sep, lis[4]);
	}
}
addLoadEvent(styleParametrsList);
