function sampleSave(){
    if (ViewCurrent == 2)
      toggleView();
    document.forms['sampleSave'].HTMLContent.value = cleanup(document.all.ewe.innerHTML);
    document.forms['sampleSave'].submit();
  }
var caution = false;
var now = new Date();
fixDate(now);
now.setTime(now.getTime() + 1000 * 60 * 60 * 24 * 31);

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "")
	if (!caution || (name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie
	else
		if (confirm("Cookie превышает 4KB и будет вырезан !"))
			document.cookie = curCookie
}

function getCookie(name) {
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)
		return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function deleteCookie(name, path, domain) {
	if (getCookie(name)) {
		document.cookie = name + "=" + 
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT"
	}
}

function fixDate(date) {
	var base = new Date(0)
	var skew = base.getTime()
	if (skew > 0)
	date.setTime(date.getTime() - skew)
}

function getTime() {
	var now = new Date()
	var hour = now.getHours()
	var minute = now.getMinutes()
	now = null
	var ampm = "" 
	if (hour >= 12) {
		hour -= 12
		ampm = "PM"
	} else
		ampm = "AM"
	hour = (hour == 0) ? 12 : hour
	if (minute < 10)
		minute = "0" + minute // do not parse this number!
	return hour + ":" + minute + " " + ampm
}

function MM_reloadPage(init) { 
  	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
 	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
MM_reloadPage(true);

function MM_preloadImages() {
 	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 Timer () {
	nowtime = new Date()
	if (nowtime.getHours() > 9) { var nowtimeHours = nowtime.getHours()} else { var nowtimeHours = nowtime.getHours() }
	if (nowtime.getMinutes() > 9) { var nowtimeMinutes = nowtime.getMinutes()} else { var nowtimeMinutes = '0' + nowtime.getMinutes() }
	if (nowtime.getSeconds() > 9) { var nowtimeSeconds = nowtime.getSeconds()} else { var nowtimeSeconds = '0' + nowtime.getSeconds() }
	if (nowtime.getDate() > 9) { var nowtimeDay = nowtime.getDate() } else { var nowtimeDay = '0' +(nowtime.getDate()) }
	if (nowtime.getMonth() > 9) { var nowtimeMonth = nowtime.getMonth() + 1} else { var nowtimeMonth = '0' + (nowtime.getMonth() + 1) }
	var TimeString = nowtimeHours + ':' + nowtimeMinutes + ':' + nowtimeSeconds
	document.getElementById('Timer').innerHTML = TimeString;
	setTimeout("Timer()", 1000);
	}
function MM_swapImgRestore() { 
        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) { 
 	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 && d.getElementById) x=d.getElementById(n); return x;
	}

function MM_swapImage() { 
  	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 MM_openBrWindow(theURL,winName,features) { 
 	window.open(theURL,winName,features);
	}
function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_jumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { 
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ 
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
function MM_goToURL() {
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_set_value(NS,selObj){
  setCookie(NS,selObj.value,now,'/','www.auto-mag.ru');
}
function tabshow() {
	if (document.getElementById && document.createTextNode) {
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++) {
			if(tables[i].className=='show') {
				var trs=tables[i].getElementsByTagName('tr');
				for(var j=0;j<trs.length;j++) {
					if(trs[j].parentNode.nodeName=='TBODY') {
						trs[j].onmouseover=function() {
							this.className='txt_back';return false
							}
						trs[j].onmouseout=function() {
							this.className='txt';return false
							}
						}
					}
				}
			}
		}
	}