﻿/*页面主菜单*/
function c(i){
	var i;
	document.getElementById("tab").className="tabD"+i;
	window.name=i;//window.name版
}
onload=function(){
	var a=document.links;
	for(var i=0;i<a.length;i++)
	{
		a[i].onfocus=function(){this.blur();}
	}
}


/*更多城市*/
var MoreTex1="MoreTex1";
function show(checkbox_list){ 
var checkbox_list = document.getElementById(checkbox_list); 
checkbox_list.style.display = "block"; 
document.getElementById(MoreTex1).className="MoreTxtHover";

} 
function hidden(checkbox_list){ 
var checkbox_list = document.getElementById(checkbox_list); 
checkbox_list.style.display = "none"; 
document.getElementById(MoreTex1).className="MoreTxt";
}

function DealersOver(box){
var box = document.getElementById(box); 
document.getElementById(box).className="DearlerBoxB"
}

/*举报*/
function Hidelight(e){
	document.getElementById(e).style.display="none";
	if(document.getElementById('back')!=null)
	{
	document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
	}
}
function getPosition() { 
	var top = document.documentElement.scrollTop; 
	var left = document.documentElement.scrollLeft; 
	var height = document.documentElement.clientHeight; 
	var width = document.documentElement.clientWidth; 
	return {top:top,left:left,height:height,width:width}; 
	} 
	
function getRealStyle(id,styleName) { 
	var element = document.getElementById(id); 
	var realStyle = null; 
	if (element.currentStyle) 
	realStyle = element.currentStyle[styleName]; 
	else if (window.getComputedStyle) 
	realStyle = window.getComputedStyle(element,null)[styleName]; 
	return realStyle; 
	} 
	


function showlight(e){ 
	var sWidth,sHeight; 
	sWidth=screen.width; 
	sHeight=screen.height; 
	
	var obj = document.getElementById(e);
	obj.style.display = "block"; 
	obj.style.position = "absolute"; 
	obj.style.zIndex = "999";
	var width = parseInt(getRealStyle(e,'width')); //弹出框的宽度 
	var height = parseInt(getRealStyle(e,'height')); //弹出框的高度
	if(!height){
		height =parseInt(obj.offsetHeight); //弹出框的高度 
	}
	obj.style.width = width + "px";
	obj.style.height = height + "px"; 
	var Position = getPosition(); 
	leftadd = (Position.width-width)/2; 
	topadd = (Position.height-height)/2; 
	obj.style.top = (Position.top + topadd) + "px"; 
	obj.style.left = (Position.left + leftadd) + "px"; 
	
	window.onscroll = function (){ 
	var Position = getPosition(); 
	obj.style.top = (Position.top + topadd) +"px"; 
	obj.style.left = (Position.left + leftadd) +"px"; 
	}; 
	
	var bgObj=document.createElement("div"); 
		bgObj.setAttribute('id','bgDiv'); 
		bgObj.style.position="absolute"; 
		bgObj.style.top="0"; 
		bgObj.style.background="#cccccc"; 
		bgObj.style.filter="alpha(opacity=60)"; 
		bgObj.style.opacity="0.6"; 
		bgObj.style.left="0"; 
		bgObj.style.top="0"; 
		bgObj.style.width=document.body.clientWidth + "px"; 
		bgObj.style.height=document.body.scrollHeight + "px"; 
		if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
		bgObj.style.position="fixed"; 
		}
		bgObj.style.zIndex = "998"; 
		document.body.appendChild(bgObj); 
}

function hidePop(e){ 
	if(document.getElementById(e)!=null) 
	{ 
		document.getElementById(e).style.display = "none"; 
	}
	document.body.removeChild(document.getElementById('bgDiv'));
	} 
/********************/
function getParam(paramName)
{
        paramValue = "";
        isFound = false;
        if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=")>1)
        {
            arrSource = unescape(this.location.search).substring(1,this.location.search.length).split("&");
            i = 0;
            while (i < arrSource.length && !isFound)
            {
                if (arrSource[i].indexOf("=") > 0)
                {
                     if (arrSource[i].split("=")[0].toLowerCase()==paramName.toLowerCase())
                     {
                        paramValue = arrSource[i].split("=")[1];
                        isFound = true;
                     }
                }
                i++;
            }   
        }
   return paramValue;
}
function MoreSiteMOver(){
	document.getElementById("MoreSiteM1").className="MoreSiteMHover";
	document.getElementById("MoreSiteBox1").className="MoreSiteBox1";
	}
function MoreSiteMOut(){
	document.getElementById("MoreSiteM1").className="MoreSiteM";
	document.getElementById("MoreSiteBox1").className="MoreSiteBox";
	}
	
function Marquee()
{
	this.ID = document.getElementById(arguments[0]);
	if(!this.ID)
	{
		alert("您要设置的\"" + arguments[0] + "\"初始化错误\r\n请检查标签ID设置是否正确!");
		this.ID = -1;
		return;
	}
	this.Direction = this.Width = this.Height = this.DelayTime = this.WaitTime = this.Correct = this.CTL = this.StartID = this.Stop = this.MouseOver = 0;
	this.Step = 1;
	this.Timer = 30;
	this.DirectionArray = {"top":0 , "bottom":1 , "left":2 , "right":3};
	if(typeof arguments[1] == "number")this.Direction = arguments[1];
	if(typeof arguments[2] == "number")this.Step = arguments[2];
	if(typeof arguments[3] == "number")this.Width = arguments[3];
	if(typeof arguments[4] == "number")this.Height = arguments[4];
	if(typeof arguments[5] == "number")this.Timer = arguments[5];
	if(typeof arguments[6] == "number")this.DelayTime = arguments[6];
	if(typeof arguments[7] == "number")this.WaitTime = arguments[7];
	if(typeof arguments[8] == "number")this.ScrollStep = arguments[8]
	this.ID.style.overflow = this.ID.style.overflowX = this.ID.style.overflowY = "hidden";
	this.ID.noWrap = true;
	this.IsNotOpera = (navigator.userAgent.toLowerCase().indexOf("opera") == -1);
	if(arguments.length >= 7)this.Start();
}


Marquee.prototype.Start = function()
{
	if(this.ID == -1)return;
	if(this.WaitTime < 800)this.WaitTime = 800;
	if(this.Timer < 20)this.Timer = 20;
	if(this.Width == 0)this.Width = parseInt(this.ID.style.width);
	if(this.Height == 0)this.Height = parseInt(this.ID.style.height);
	if(typeof this.Direction == "string")this.Direction = this.DirectionArray[this.Direction.toString().toLowerCase()];
	this.HalfWidth = Math.round(this.Width / 2);
	this.BakStep = this.Step;
	this.ID.style.width = this.Width;
	this.ID.style.height = this.Height;
	if(typeof this.ScrollStep != "number")this.ScrollStep = this.Direction > 1 ? this.Width : this.Height;
	//this.ID.innerHTML += this.ID.innerHTML;
	var msobj = this;
	var timer = this.Timer;
	var delaytime = this.DelayTime;
	var waittime = this.WaitTime;
	msobj.StartID = function(){msobj.Scroll()}
	msobj.Continue = function()
				{
					if(msobj.MouseOver == 1)
					{
						setTimeout(msobj.Continue,delaytime);
					}
					else
					{	clearInterval(msobj.TimerID);
						msobj.CTL = msobj.Stop = 0;
						msobj.TimerID = setInterval(msobj.StartID,timer);
					}
				}

	msobj.Pause = function()
			{
				msobj.Stop = 1;
				clearInterval(msobj.TimerID);
				setTimeout(msobj.Continue,delaytime);
			}

	msobj.Begin = function()
		{
			msobj.ClientScroll = msobj.Direction > 1 ? msobj.ID.scrollWidth : msobj.ID.scrollHeight;
			if((msobj.Direction <= 1 && msobj.ClientScroll <msobj.Height) || (msobj.Direction > 1 && msobj.ClientScroll <msobj.Width))return;
			msobj.ID.innerHTML += msobj.ID.innerHTML;
			msobj.TimerID = setInterval(msobj.StartID,timer);
			if(msobj.ScrollStep < 0)return;
			msobj.ID.onmousemove = function(event)
						{
							if(msobj.ScrollStep == 0 && msobj.Direction > 1)
							{
								var event = event || window.event;
								if(window.event)
								{
									if(msobj.IsNotOpera)
									{
										msobj.EventLeft = event.srcElement.id == msobj.ID.id ? event.offsetX - msobj.ID.scrollLeft : event.srcElement.offsetLeft - msobj.ID.scrollLeft + event.offsetX;
									}
									else
									{
										msobj.ScrollStep = null;
										return;
									}
								}
								else
								{
									msobj.EventLeft = event.layerX - msobj.ID.scrollLeft;
								}
								msobj.Direction = msobj.EventLeft > msobj.HalfWidth ? 3 : 2;
								msobj.AbsCenter = Math.abs(msobj.HalfWidth - msobj.EventLeft);
								msobj.Step = Math.round(msobj.AbsCenter * (msobj.BakStep*2) / msobj.HalfWidth);
							}
						}
			msobj.ID.onmouseover = function()
						{
							if(msobj.ScrollStep == 0)return;
							msobj.MouseOver = 1;
							clearInterval(msobj.TimerID);
						}
			msobj.ID.onmouseout = function()
						{
							if(msobj.ScrollStep == 0)
							{
								if(msobj.Step == 0)msobj.Step = 1;
								return;
							}
							msobj.MouseOver = 0;
							if(msobj.Stop == 0)
							{
								clearInterval(msobj.TimerID);
								msobj.TimerID = setInterval(msobj.StartID,timer);
							}
						}
		}
	setTimeout(msobj.Begin,waittime);
}

Marquee.prototype.Scroll = function()
{
	switch(this.Direction)
	{
		case 0:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop >= this.ClientScroll)
				{
					this.ID.scrollTop -= this.ClientScroll;
				}
				this.ID.scrollTop += this.Step;
			}
		break;

		case 1:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop <= 0)
				{
					this.ID.scrollTop += this.ClientScroll;
				}
				this.ID.scrollTop -= this.Step;
			}
		break;

		case 2:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft >= this.ClientScroll)
				{
					this.ID.scrollLeft -= this.ClientScroll;
				}
				this.ID.scrollLeft += this.Step;
			}
		break;

		case 3:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft <= 0)
				{
					this.ID.scrollLeft += this.ClientScroll;
				}
				this.ID.scrollLeft -= this.Step;
			}
		break;
	}
}
onload=function ChangeLiBg()
{
	for(j=1;j<=7;j++){
		var CarListid="CarListChange"+j;
		var obj=document.getElementById(CarListid);
		if(obj){
		var changeLi=document.getElementById(CarListid).getElementsByTagName("li");
		for(i=0;i<changeLi.length;i++)
		{
		  changeLi[i].className=(i%2>0)?"t1":"t2";
		  changeLi[i].temp=changeLi[i].className;
		  changeLi[i].onmouseover=function(){
					 this.className='t3';        
		  }
		  changeLi[i].onmouseout=function(){
					 this.className=this.temp;        
		  }
		}
	}
	}
}


function MaxImage(ImgD){
    var image=new Image();
    var iwidth = 120; //定义允许宽度，当宽度大于这个值时等比例缩小
    var iheight = 140; //定义允许高度，当高度大于这个值时等比例缩小
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
        flag=true;
        if(image.width/image.height >= iwidth/iheight){
			ImgD.height=iheight;
			ImgD.width=(image.width*iheight)/image.height;
        }else if(image.width/image.height < iwidth/iheight){
			ImgD.width=iwidth;
			ImgD.height=(image.height*iwidth)/image.width;
        }
    }
} 
/*选项卡*/
function CarVTag(Tag,TagContent,Count,Num) {
    for(i=1; i<=Count; i++) {
	var TagId=document.getElementById(Tag+i);
	var TagContentId=document.getElementById(TagContent+i);
	if(TagId&&TagContentId){
		if (i==Num) {
			TagId.className="D";
			TagContentId.style.display="block";
			}
		else {
			TagId.className="UD";
			TagContentId.style.display="none";
			}
		}
	}
}
//-->
/*首页FLASH图片*/
<!-- 
function FlashImg(pics,texts,links,focus_width,focus_height,text_height){
var interval_time=5 ;
var text_mtop = 0;
var text_lm = 0;
var textmargin = text_mtop+"|"+text_lm;
var textcolor = "#ffffff|0xffffff";
var text_align= 'center'; 
var swf_height = focus_height+text_height+text_mtop; 
var text_size = 0;
var borderStyle="0|0xffffff|100";
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/FlashImg.swf"> <param name="quality" value="high"><param name="Wmode" value="transparent">');
document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&textmargin='+textmargin+'&textcolor='+textcolor+'&borderstyle='+borderStyle+'&text_align='+text_align+'&interval_time='+interval_time+'&textsize='+text_size+'">');
document.write('<embed src="images/FlashImg.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&textmargin='+textmargin+'&textcolor='+textcolor+'&borderstyle='+borderStyle+'&text_align='+text_align+'&interval_time='+interval_time+'&textsize='+text_size+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');	document.write('</object>');
}
//-->


function OrderMOver(){
	document.getElementById("MenuOrder").style.display="block";
	}
function OrderMOut(){
	document.getElementById("MenuOrder").style.display="none";
	}




