function num_2(num)
{	if (num<10)
		{num='0'+num;}
	return num;
	}
function car_image_over(num,current_num,type)
{
	for (var i_over=1; i_over<=num; i_over++)
	{
		if(num_2(i_over)==current_num)
			{	//alert('/images/image'+current_num+type.substr(0,1)+num);
				document.images['image'+current_num+type.substr(0,1)+'v'].src='/images/image'+current_num+type.substr(0,1)+'v.jpg';}
		else
			{
				//alert('/images/image'+num_2(i_over)+type.substr(0,1)+'v');
				document.images['image'+num_2(i_over)+type.substr(0,1)+'v'].src='/images/image'+num_2(i_over)+type.substr(0,1)+'s.jpg';}
	}
}
//根据车类和图片数量建立图片数组
function CreateGallery(type,total)
{
var Gallery = new Array();

for(var inc=1; inc <= total; inc++)
{ 
		{Gallery[inc]='/images/image'+num_2(inc)+type+'.jpg';}
}
return (Gallery);


}

function carimage(total,num,type)
{
document.images['imageb'].src='/images/'+num;
//alert(num.substr(5,2));
//car_image_over(total,num.substr(5,2),type);
}



//翻阅前一张图片
function carpre(type,num,math)
{	
var Gallery=CreateGallery(type,num);
for(var i=1; i < Gallery.length; i++)
{ 

//取图片名确切位置
var cl=document.images['imageb'].src.length-8;
var current=document.images['imageb'].src.substr(cl, 8);
//判断选定当前查看的图片
a=eval(i+math);
var current_num=current.substr(0,2);
//alert ("cu"+current);
//alert ("GA"+Gallery[i].substr(15,8));
//alert ("A="+a);
	if (current==Gallery[i].substr(13,8) && a>0 && a<=num )
	{
	//alert(current_num);
//alert('image'+current_num+type.substr(0,1)+'v');
	document.images['imageb'].src=Gallery[a];
	car_image_over(num,num_2(eval(i+math)),type);
	break;}
	
}
	
}

function car_pop_image(type,num,math)
{	
var Gallery=CreateGallery(type,num);
for(var i=1; i < Gallery.length; i++)
{ 

//取图片名确切位置
var cl=document.images['imageb'].src.length-8;
var current=document.images['imageb'].src.substr(cl, 2);
//判断选定当前查看的图片
var a=eval(i+math);
//alert(current);
//alert(Gallery[i].substr(13,2));
	if (current==Gallery[i].substr(13,2) && a>1 && a<num )
	{document.images['imageb'].src='/images/image'+num_2(a)+type.substr(0,1)+'l.jpg';
	document.images['imagesp'].src='/images/image'+num_2(a-1)+type.substr(0,1)+'s.jpg';
	document.images['imagesn'].src='/images/image'+num_2(a+1)+type.substr(0,1)+'s.jpg';
	break;}
	if (current==Gallery[i].substr(13,2) && a-1==0)
	{

//alert (a);
//alert (num);
document.images['imageb'].src='/images/image'+num_2(a)+type.substr(0,1)+'l.jpg';
	document.images['imagesp'].src='/images/image'+num_2(num)+type.substr(0,1)+'s.jpg';
	document.images['imagesn'].src='/images/image'+num_2(a+1)+type.substr(0,1)+'s.jpg';
	break;}	
	if (current==Gallery[i].substr(13,2) && a==num)
	{document.images['imageb'].src='/images/image'+num_2(a)+type.substr(0,1)+'l.jpg';
	document.images['imagesp'].src='/images/image'+num_2(a-1)+type.substr(0,1)+'s.jpg';
	document.images['imagesn'].src='/images/image'+num_2(1)+type.substr(0,1)+'s.jpg';
	break;}	
}
	
}
function carlarge(num)
{
		//detect screenresolution for PopUp size
	var PopScrnSize = "";
	var popWidth = 0;
	var popHeight= 0;
	PopScrnSize = screen.width + " x " + screen.height;
	switch(PopScrnSize) {
		case "800 x 600": 
		popWidth=669;
		popHeight=570;
		break;
		case "1024 x 768":
		popWidth=669;
		popHeight=570;
		break;
		case "1280 x 1024":
		popWidth=1094;
		popHeight=846;
		break;
		case "1600 x 1200":
		popWidth=1400;
		popHeight=1030;
		break;
		default:
		popWidth=669;
		popHeight=570;
		break;}
		
var popEnlargeImg;
var chosen;
if(popEnlargeImg!=null && !popEnlargeImg.closed)
{popEnlargeImg.close();}

var cl=document.images['imageb'].src.length-8;
var current=document.images['imageb'].src.substr(cl, 3);
var current_prev=parseFloat(current)-1;
var current_next=parseFloat(current)+1;
if (current_next>num)
{current_next=1;}
if (current_prev==0)
{current_prev=num;}

var URL = 'carlarge.asp?carnum=' + current + '&carpre=' + num_2(current_prev) + '&carnext=' + num_2(current_next);
var windowName = 'BigImageWindow';
var features = 'width=' + popWidth + ',height=' + popHeight + ', status=yes';
popEnlargeImg = window.open (URL, windowName, features);popEnlargeImg.focus();
}

function car_wallpaper(num)
{
		//detect screenresolution for PopUp size
	var PopScrnSize = "";
	var popWidth = 0;
	var popHeight= 0;
	PopScrnSize = screen.width + " x " + screen.height;
	switch(PopScrnSize) {
		case "800 x 600": 
		popWidth=600;
		popHeight=510;
		break;
		case "1024 x 768":
		popWidth=650;
		popHeight=510;
		break;
		case "1280 x 1024":
		popWidth=650;
		popHeight=510;
		break;
		case "1600 x 1200":
		popWidth=650;
		popHeight=510;
		break;
		default:
		popWidth=650;
		popHeight=510;
		break;}
		
var popEnlargeImg;
var chosen;
if(popEnlargeImg!=null && !popEnlargeImg.closed)
{popEnlargeImg.close();}

var cl=document.images['imageb'].src.length-8;
var carnum=document.images['imageb'].src.substr(cl, 3);
var URL = '/menu/carwallpaper.asp?carnum=' + carnum + '';
var windowName = 'BigImageWindow';
var features = 'width=' + popWidth + ',height=' + popHeight + ', status=yes, scrollbars=no';
popEnlargeImg = window.open (URL, windowName, features);popEnlargeImg.focus();
}