var flag=false;
function DrawImage(ImgD,iwidth,iheight){
    //参数(图片,允许的宽度,允许的高度)
    var image=new Image();
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= iwidth/iheight){
        if(image.width>iwidth){  
        ImgD.width=iwidth;
        ImgD.height=(image.height*iwidth)/image.width;
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        //ImgD.alt=image.width+"×"+image.height;
        }
    else{
        if(image.height>iheight){  
        ImgD.height=iheight;
        ImgD.width=(image.width*iheight)/image.height;        
        }else{
        ImgD.width=image.width;  
        ImgD.height=image.height;
        }
        //ImgD.title=image.width+"×"+image.height;
        }
    }
} 
function RdChecked(RdIndex){  
	document.forms[1].Rb_Type[RdIndex].checked=true;
}


function showDate(){
	var enabled = 0; today = new Date();
	var day; var date;
	if(today.getDay()==0) day = " 星期日"
	if(today.getDay()==1) day = " 星期一"
	if(today.getDay()==2) day = " 星期二"
	if(today.getDay()==3) day = " 星期三"
	if(today.getDay()==4) day = " 星期四"
	if(today.getDay()==5) day = " 星期五"
	if(today.getDay()==6) day = " 星期六"
	date = "今天是：" + (today.getFullYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日" + day +"";
	document.write(date);
}
function dijiaopanduan(){
	var wrong = 0;
	var strWrong = "";
	
	if(document.forms[1].Rb_Type[0].checked == true && document.forms[1].Txt_FZ.value == "") {
		strWrong = strWrong + "·发站名不能为空\n"
		document.forms[1].Txt_FZ.OnFocus = true;
	}
		
	if(document.forms[1].Rb_Type[0].checked == true && document.forms[1].Txt_DZ.value == "") {
		strWrong = strWrong + "·到站名不能为空\n"
	}
	
	if(document.forms[1].Rb_Type[1].checked == true && document.forms[1].Txt_CC.value == "") {
		strWrong = strWrong + "·车次不能为空\n"
	}
		
	if(document.forms[1].Rb_Type[2].checked == true && document.forms[1].Txt_CZ.value == "") {
		strWrong = strWrong + "·车站不能为空\n"
	}

	if (strWrong != "") {
		alert(strWrong);
		return false;
	}
	

}

//GIDOT 2007-8-7 UPDATE.