/*script document*/
/*
 * csair.com v0.1
 * http://csair.com/
 *
 * Copyright (c) 2009 csair.com
 *
 * @author Gangrock
 * 
 * Date: 2009-05-18 11:14:14 (GMT+08:00)
 * Revision: 1
 */

var strInternational = new Array("BKK","FUK","JKT","KUL","NGO","KIX","PEN","PUS","SDJ","SEL","SIN","NRT","AMS","PAR","LAX","HKG","CVG","CRK","DXB","DFW","TAE","FKS","HAN","SGN","FKS","HNA","BDL","HNL","LAO","LAS","LON","LAD","MFM","MNL","MEL","OIT","OKJ","MCO","PNH","FNJ","HKT","REP","RGN","SHJ","SYD","HSG","SLC","REP","TOY","TAK","THK","YVR","JIN","YNY","ALA","ASB","ATL","BAK","FRU","BWN","BOS","CJJ","CNX","CGK","DYU","DEL","HIJ","ISB","IKT","KKJ","KOJ","KHV","BKI","KCH","KMJ","KTM","KWJ","MOW","MMJ","NYC","KIJ","OVB","SPN","SPK","SEL","TAE","TAS","VTE","VVO","TPE","CJU","MIL","THR","IKA","JED","OSS","ATH","BCN","BER","BHX","BRU","CPH","DUS","EDI","FRA","GVA","HAM","HEL","LIS","MAD","MAN","MIL","MUC","NCL","ROM","STO","VIE","WAW","ZRH","LOS","ORD","CLE","IAH","JAX","FLL","MEM","EWR","TPA","LIM");

var language ="zh";

function clearchildnodes(parentnodenames){//清除节点
 var parentnodes = $(parentnodenames);
 var childnodecounts = parentnodes.childNodes.length;
 if(parentnodes.hasChildNodes()){
 for (i=0 ; i<childnodecounts;i++){
 parentnodes.removeChild(parentnodes.childNodes[0]);
 }
 }
}
function clearpresentnode(presentnode){//删除当前节点
 var mypresentnode = document.getElementById(presentnode);
 mypresentnode.parentNode.removeChild(mypresentnode);
}

/*国际航班*/
function internationalCheck(){
	var temp =false;
	for(var k=1; k<6; k++){
		var strcity2 = $("city"+k).value;
			for (var i= 0; i<strInternational.length; i++){
				if(strcity2 == strInternational[i]){
					temp = true;
					break;
				}
			}
		if(temp){
			break;
		}
	}
	return temp;
}

/*国际航线限制选择儿童*/
function internationalChild(city){
	var temp = true;
	if(temp){
		adultchild();
	}
}

/*成人儿童选择关系*/
function adultchild(){
	var strAdult = $("adult").value;
	var strcity2 = $("city2").value;
	var strcity1 = $("city1").value;
	var temp = true;
	for (var i= 0; i<strInternational.length; i++){
		if((strcity2 == strInternational[i])||(strcity1 == strInternational[i])){
			temp = false;
		}
	}
}

/* 默认时间*/
function setDefaultTime(dateEle){
	var nowDate = new Date();
	var nowYear = nowDate.getFullYear();
	var nowMonth = nowDate.getMonth()+1;
	if (nowMonth < 10){
		nowMonth = "0"+nowMonth;
	}	
	var nowday = nowDate.getDate();
	if (nowday < 10){
		nowday = "0"+nowday;
	}	
	var strDate=nowYear+"-"+nowMonth+"-"+nowday;
	$(dateEle).value = strDate;
}

function setDefaultTimeBack(dateEle){
	var nowDate;
	nowDate = stringToDateNew($("date1").value);
	if(nowDate==null||nowDate==""){
		nowDate = new Date();
	}
	nowDate.setDate(nowDate.getDate() + 1);
	var nowYear = nowDate.getFullYear();
	var nowMonth = nowDate.getMonth()+1;
	if (nowMonth < 10){
		nowMonth = "0"+nowMonth;
	}	
	var nowday = nowDate.getDate();
	if (nowday < 10){
		nowday = "0"+nowday;
	}	
	var strDate=nowYear+"-"+nowMonth+"-"+nowday;
	$(dateEle).value = strDate;
}

//字符串("2008-10-25")转换为日期格式
function stringToDateNew(sDate)
{	var year, month, day;
	var iaDate = new Array(3);
	
	if (isDateStringNew(sDate))
	{  iaDate = sDate.toString().split("-")
		year = parseFloat(iaDate[0])
		month = parseFloat(iaDate[1]) - 1
		day=parseFloat(iaDate[2])
		return (new Date(year,month,day));
	}
	else
	{
		alert("传入字符串格式错误");
		return (new Date(1900,1,1))
	}
}


//机票预订表单验证
function fltForm(){
	for(var c=1;c<3;c++){
		if($("cname_city"+c)&&$("city"+c)){
		  var cityName=$("cname_city"+c).value;
		  if(cityName==""||cityName=="全拼/简拼/汉字"){
				$("city"+c).value="";
				if(c==1){
					try{$("bFlight").style.height = "auto"}catch(e){}
					$("iInfo").innerHTML="请选择出发城市";
				}else{
					try{$("bFlight").style.height = "auto"}catch(e){}
					$("iInfo").innerHTML="请选择到达城市";
					$("cname_city"+c).focus();	      
					return false;
				}
		  }else{
			if(showCityIframe.getSanByCityName(cityName)==""){
			   try{$("bFlight").style.height = "auto"}catch(e){}
			   $("iInfo").innerHTML="第"+c+"航段出发城市错误";
			   $("cname_city"+c).focus();	      
				return false;
			}else{
				$("city"+c).value=showCityIframe.getSanByCityName(cityName);
			}
		  }	
		}	
   	}

	var arrSegtype = document.getElementsByName("segtype");
	var segtype="";
	for(var i = 0; i<arrSegtype.length; i++){
		if(arrSegtype[i].checked){
			segtype = arrSegtype[i].value; 
		}
	}
	var adultno = $("adult").value;
	var childno = $("child").value;
	var cabinorder = $("cabinorder").value;
	var isDirect = "1";
	if($("addon").checked){
		isDirect = "0";	
	}
	var isIetDirect="1";
	if($("iet").checked){
		isIetDirect="0";
	}
	var language = $("language").value;
	var city1 = $("city1").value;
	var city2 = $("city2").value;
	var date1 = $("date1").value;
	var date2 ="222";
	var date3 ="";
	var date4 ="";
	var date5 ="";
	var date22;
	var date33;
	var date44;
	var date55;
	date11 = (date1.replace("-","")).replace("-","");
	if($("date2")){
		if(segtype=="S"){
			date22 = (date1.replace("-","")).replace("-","");
		}else{
			date2 = $("date2").value;
			date22 = (date2.replace("-","")).replace("-","");
		}
	}
	if($("date3")){
		date3 = $("date3").value;
		date33 = (date3.replace("-","")).replace("-","");
		date4 = $("date4").value;
		date44 = (date4.replace("-","")).replace("-","");
		date5 = $("date5").value;
		date55 = (date5.replace("-","")).replace("-","");
	}
	var city3="";
	var city4="";
	var city5="";
	var city6="";
	if($("city3")){
		city3 = $("city3").value;
		city4 = $("city4").value;
		city5 = $("city5").value;
		city6 = $("city6").value;
	}
	
	var cityStr="";
	var dateCount = 1;
	var cityCount = 2;
	if(segtype == "S"){
			cityStr = "@"+city1+"@"+city2;
	}else if(segtype == "R"){
			cityStr = "@"+city1+"@"+city2+"@"+city1;
			dateCount = 2;
	}else if(segtype == "M"){
		for(var i = 1; i<= 6; i++){
			if(eval("city"+i)!="" && eval("city"+i)!= null && eval("city"+i)!= "undefined"){
					cityStr +="@"+eval("city"+i)
			}
		}
		dateCount = 5;
		cityCount = 6;
	}else{
		$("iInfo").innerHTML="航程选择出错！";
		return false;
	}
	cityStr = cityStr.substring(1);
	
	var inter ="";
	for (var k = 1 ; k <= cityCount; k++){
		for (var i= 0; i<strInternational.length; i++){
			if(eval("city"+k)!="" && eval("city"+k)!= null && eval("city"+k)!= "undefined"){
				if(eval("city"+k) == strInternational[i]){
					inter = "Y";
				}
			}
		}
	}
	
	var dateStr="";
	for(var i = 1; i<= dateCount; i++){
		if(eval("date"+i)!="" && eval("date"+i)!= null && eval("date"+i)!= "undefined"){
				dateStr +="#"+eval("date"+i)
			}	
	}
	dateStr = dateStr.substring(1);
	
	var nowDate = new Date();
	var nowYear = nowDate.getFullYear();
	var nowMonth = nowDate.getMonth()+1;
	if (nowMonth < 10){
		nowMonth = "0"+nowMonth;
	}	
	var nowday = nowDate.getDate();
	if (nowday < 10){
		nowday = "0"+nowday;
	}
	var strDate=nowYear+""+nowMonth+""+nowday;

	var entryno = "";
	if(inter=="Y"){
		entryno="0";
	}else{
		entryno="1";
	}
	
	var flightInfo ="";
	flightInfo+=entryno+"%"+segtype+"%"+cabinorder+"%"+isDirect+"%"+isIetDirect+"%"+adultno+"%"+childno+"%"+cityStr+"%"+dateStr;
	/*var flightInfoIet ="";
	flightInfoIet+=entryno+"%"+segtype+"%"+cabinorder+"%"+isIetDirect+"%"+adultno+"%"+childno+"%"+cityStr+"%"+dateStr;
	*/
	
	var  bookInterCity="N";
	if(inter == "Y"){
           if(segtype=="S"){
           if(city1=="CAN"){
                    if("HKGSINLAXJKTPAR".indexOf(city2)==-1)  bookInterCity="Y";
           }else{
                    if(city2=="CAN"){
                             if("HKGSINLAXJKTPAR".indexOf(city1)==-1)  bookInterCity="Y";
                    }else{
                             bookInterCity="Y";
                    }
           }
}else if(segtype=="R"){
           if(city1=="CAN"){
                    if("HKG".indexOf(city2)==-1)  bookInterCity="Y";
           }else{
                    if(city2=="CAN"){
                              if("HKG".indexOf(city1)==-1)  bookInterCity="Y";
                    }else{
                             bookInterCity="Y";
                    }
           }
}else{
                    bookInterCity="Y";
           }
}
	
	
	if (city1 == city2){
		$("iInfo").innerHTML = "<!--tt-->";
		$("iInfo").innerHTML="起始和到达城市不能相同，请重选！";
		return false;
	}else if(date11 < strDate){
		$("iInfo").innerHTML = "<!--tt-->";
		$("iInfo").innerHTML="出发日期不能晚于今天，请重选！";
		return false;
	}else if(segtype == "R"){
			if(date11=="" || date22 == ""){
				$("iInfo").innerHTML = "<!--tt-->";
				$("iInfo").innerHTML="日期不能为空，请选择！";
				return false;
			}else if(date11>date22){
				$("iInfo").innerHTML = "<!--tt-->";
				$("iInfo").innerHTML="航班返回日期不能早于出发日期，请重选！";
				return false;
			}else{
	if(inter == "Y"){
		     $("guoji_OK").disabled=true;
			 $("guoji_cancel").disabled=true;
			 international_link(segtype,adultno,childno,cityStr,dateStr,language);
             return false;
		}else{
				if(language=="zh"){
					$("conditionStrInternalZH").value=flightInfo;
					$("conditionStrFormInternalZH").submit();					
				}else if(language=="en"){
					if(isDirect == "0"){
					alert("对不起，系统尚未支持英文版国内中转客票的预订，请重新选择！");
					return false;
					}
					$("conditionStrInternalEN").value=flightInfo;
					$("conditionStrFormInternalEN").submit();			
				}else{
					
				}
		}	

}
	}else if(segtype == "M"){
		var cityint = 0;
		var dateint = 0;
		var date6;
		for (var i=1;i<=6;i++){
			if(eval("city"+i)){
				cityint+=1;	
			}
			if(eval("date"+i)){
				dateint	+=1;
			}
		}
		if(date11 == ""){
			$("iInfo").innerHTML = "<!--tt-->";
			$("iInfo").innerHTML="出发日期不能为空，请选择！";
			return false;
		}else if(cityint<=dateint){
			$("iInfo").innerHTML = "<!--tt-->";
			$("iInfo").innerHTML="请选择到达城市！";
			return false;
		}else if(date11>date22){
			$("iInfo").innerHTML = "<!--tt-->";
			$("iInfo").innerHTML="多航段第二个出发日期不能晚于第一个出发日期，请重选！";
			return false;
		}else if(!(date33=="")&&date22>date33){
			$("iInfo").innerHTML = "<!--tt-->";
			$("iInfo").innerHTML="多航段第三个出发日期不能晚于第二个出发日期，请重选！";
			return false;
		}else if(!(date44=="")&&date33>date44){
			$("iInfo").innerHTML = "<!--tt-->";
			$("iInfo").innerHTML="多航段第四个出发日期不能晚于第三个出发日期，请重选！";
			return false;
		}else if(!(date55=="")&&date44>date55){
			$("iInfo").innerHTML = "<!--tt-->";
			$("iInfo").innerHTML="多航段第五个出发日期不能晚于第四个出发日期，请重选！";
			return false;
		}else if(cityint==3&&city2==city3){
				$("iInfo").innerHTML = "<!--tt-->";
				$("iInfo").innerHTML="出发和到达城市不能相同，请重选！";
				return false;
		}else if(cityint==4&&city3==city4){
				$("iInfo").innerHTML = "<!--tt-->";
				$("iInfo").innerHTML="出发和到达城市不能相同，请重选！";
				return false;
		}else if(cityint==5&&city4==city5){
				$("iInfo").innerHTML = "<!--tt-->";
				$("iInfo").innerHTML="出发和到达城市不能相同，请重选！";
				return false;
		}else if(cityint==6&&city5==city6){
				$("iInfo").innerHTML = "<!--tt-->";
				$("iInfo").innerHTML="出发和到达城市不能相同，请重选！";
				return false;
		}else{
				if(inter == "Y"){
				 international_link(segtype,adultno,childno,cityStr,dateStr,language);
				 return false;
		}else{
				if(language=="zh"){
					//if(isDirect=="1"&&isIetDirect=="1"){//直达
						$("conditionStrInternalZH").value=flightInfo;
						$("conditionStrFormInternalZH").submit();		
					/*}else if(isDirect=="0"&&isIetDirect=="1"){//addon
						$("conditionStrAddon").value=flightInfo;
						$("conditionStrFormAddon").submit();
					}else if(isDirect=="1"&&isIetDirect=="0"){//iet直达
                        $("conditionStrIetSimple").value=flightInfoIet;
						$("conditionStrFormIetSimple").submit();
                    }else if(isDirect=="0"&&isIetDirect=="0"){//ite_addon
					    $("conditionStrIetAddon").value=flightInfoIet;
						$("conditionStrFormIetAddon").submit();
					}*/		
					
				}else if(language=="en"){
					if(isDirect == "0"){
					alert("对不起，系统尚未支持英文版国内中转客票的预订，请重新选择！");
					return false;
					}
					$("conditionStrInternalEN").value=flightInfo;
					$("conditionStrFormInternalEN").submit();			
				}else{
					
				}
		}	
		}
	}else{
			if(inter == "Y"){
			 international_link(segtype,adultno,childno,cityStr,dateStr,language);
             return false;
		}else{
				if(language=="zh"){
					//if(isDirect=="1"&&isIetDirect=="1"){//直达
						$("conditionStrInternalZH").value=flightInfo;
						$("conditionStrFormInternalZH").submit();		
					/*}else if(isDirect=="0"&&isIetDirect=="1"){//addon
						$("conditionStrAddon").value=flightInfo;
						$("conditionStrFormAddon").submit();
					}else if(isDirect=="1"&&isIetDirect=="0"){//iet直达
                        $("conditionStrIetSimple").value=flightInfoIet;
						$("conditionStrFormIetSimple").submit();
                    }else if(isDirect=="0"&&isIetDirect=="0"){//ite_addon
					    $("conditionStrIetAddon").value=flightInfoIet;
						$("conditionStrFormIetAddon").submit();
					}*/		
					
				}else if(language=="en"){
					if(isDirect == "0"){
					alert("对不起，系统尚未支持英文版国内中转客票的预订，请重新选择！");
					return false;
					}
					$("conditionStrInternalEN").value=flightInfo;
					$("conditionStrFormInternalEN").submit();			
				}else{
					
				}
		}	
	}	
}

function international_link (segtype,adultno,childno,cityStr,dateStr,language){
                            //var urlString="http://siteacceptance.wftc3.e-travel.com/plnext/CAZG/Override.action?";
							var urlString="http://wftc3.e-travel.com/plnext/CAZG/Override.action?";
                            urlString += (language == "zh")?"LANGUAGE=CN&":"LANGUAGE=GB&";
                            urlString += (segtype == "S")?"TRIP_TYPE=O&":((segtype =="R")?"TRIP_TYPE=R&":"TRIP_TYPE=M&");
                            urlString += (segtype == "M")?"EMBEDDED_TRANSACTION=AirComplexAvailability&":"EMBEDDED_TRANSACTION=AirAvailability&";
                            var cityarr = cityStr.split("@");
                            for(i=0;i<cityarr.length-1;i++){
                                     urlString += "B_LOCATION_"+(i+1)+"="+cityarr[i]+"&"+"E_LOCATION_"+(i+1)+"="+cityarr[i+1]+"&";
                            }
                            var datearr = dateStr.split("#");
                            for(i=0;i<cityarr.length-1;i++){
                                     urlString += "B_DATE_"+(i+1)+"="+datearr[i].substring(0,4)+datearr[i].substring(5,7)+datearr[i].substring(8,10)+"0000&";
                                     urlString += "B_ANY_TIME_"+(i+1)+"=true&";
                                     urlString += "AIRLINE_"+(i+1)+"_1=CZ&";
                            }
                            for(i=0;i<adultno;i++){
                                     urlString += "TRAVELLER_TYPE_"+(i+1)+"=ADT&";
                            }
                            for(i=0;i<childno;i++){
                                     urlString += "TRAVELLER_TYPE_"+(adultno*1+i*1+1*1)+"=CHD&";
                            }
                            urlString += "SITE=CAZGCAZG&SO_SITE_POINT_OF_SALE=PEK&TRIPFLOW=YES&EXTERNAL_ID=US&DIRECT_LOGIN=NO&HAS_INFANT_1=FALSE&HAS_INFANT_2=FALSE&SO_SITE_MOP_CALL_ME=FALSE&SO_SITE_ET_CODE_SHARE=00";
                            urlString += "&SO_GL=%3C%3Fxml+version%3D%271.0%27+encoding%3D%27iso-8859-1%27%3F%3E%3CSO_GL%3E%0D%0A%3CGLOBAL_LIST+mode%3D%27complete%27%3E%3CNAME%3ESO_SINGLE_MULTIPLE_COMMAND_BUILDER%3C%2FNAME%3E%0D%0A%3CLIST_ELEMENT%3E%0D%0A%3CCODE%3E1%3C%2FCODE%3E%0D%0A%3CLIST_VALUE%3E%3C%21%5BCDATA%5BOS+YY+IP+%3CCLIENT_IP_ADDRESS%3E%5D%5D%3E%3C%2FLIST_VALUE%3E%0D%0A%3CLIST_VALUE%3EM%3C%2FLIST_VALUE%3E%0D%0A%3C%2FLIST_ELEMENT%3E%0D%0A%3CLIST_ELEMENT%3E%0D%0A%3CCODE%3E2%3C%2FCODE%3E%0D%0A%3CLIST_VALUE%3E%3C%21%5BCDATA%5BAPE-%3CUSERMAIL_COMPLETE%3E%5D%5D%3E%3C%2FLIST_VALUE%3E%0D%0A%3CLIST_VALUE%3EM%3C%2FLIST_VALUE%3E%0D%0A%3C%2FLIST_ELEMENT%3E%0D%0A%3CLIST_ELEMENT%3E%0D%0A%3CCODE%3E3%3C%2FCODE%3E%0D%0A%3CLIST_VALUE%3E%3C%21%5BCDATA%5BSRCKIN-CHECK+ID+AND+CREDIT+CARD+AT+CHK-IN%5D%5D%3E%3C%2FLIST_VALUE%3E%0D%0A%3CLIST_VALUE%3EM%3C%2FLIST_VALUE%3E%0D%0A%3C%2FLIST_ELEMENT%3E%0D%0A%3C%2FGLOBAL_LIST%3E%0D%0A%3C%2FSO_GL%3E%0D%0A";
window.location.href=urlString;
}


function removeObj(){//点击标题栏触发的事件
clearpresentnode("bgIframe");//删除背景层iframe
clearpresentnode("bgDiv");//删除背景层Div
clearpresentnode("msgDiv");//删除提示框层
}

function alertInfo(){
	
	for(var c=1;c<3;c++){
		if($("cname_city"+c)&&$("city"+c)){
		  var cityName=$("cname_city"+c).value;
		  if(cityName==""||cityName=="全拼/简拼/汉字"){
				$("city"+c).value="";
				if(c==1){
					try{$("bFlight").style.height = "auto"}catch(e){}
					$("iInfo").innerHTML="请选择出发城市";
				}else{
					try{$("bFlight").style.height = "auto"}catch(e){}
					$("iInfo").innerHTML="请选择到达城市";
					$("cname_city"+c).focus();	      
					return false;
				}
		  }else{
			if(showCityIframe.getSanByCityName(cityName)==""){
			   try{$("bFlight").style.height = "auto"}catch(e){}
			   $("iInfo").innerHTML="第"+c+"航段出发城市错误";
			   $("cname_city"+c).focus();	      
				return false;
			}else{
				$("city"+c).value=showCityIframe.getSanByCityName(cityName);
			}
		  }	
		}	
   	}
	
	var str ="<b>温馨提示：</b><ol style='margin-top:0;margin-bottom:0;'><li>本网站只提供三天后至一年内的国际航班预订，请确认您所选择的时间符合要求。</li><li>若您用于支付的银行卡非中国大陆地区发行，不具有银联标识，请您登录<a href='http://www.flychinasouthern.com/'>南航海外网站</a>购票；</li><li>在填写旅客详细信息时，中国籍内地旅客，乘坐国际航班请输入有效护照号码，前往港澳等地区请输入港澳通行证号码；外国旅客、华侨、港澳同胞、台湾同胞，请输入相应的有效护照、回乡证、居留证、旅行证号码；</li><li>请您在支付页面跳转的过程中，不要关闭浏览器；</li><li>在为您办理退款过程中，自受理之日起，一般会在15天左右将款项退还至您的银行卡中；</li><li>若您是留学生或澳洲新移民且想享受额外行李优惠，请前往当地的办事处、营业部或售票处办理。一旦网上购票后，不能再增加免费行李额。</li><li>如有任何疑问，请您致电南航客户服务热线：4006695539或0086-20-22395539 ，或发送邮件至flychinasouthern@csair.com。</li></ol><p align='center'><input type='button' value='确定' onclick='return fltForm()' id='guoji_OK' />&nbsp;&nbsp;&nbsp;<input type='button' value='取消' onclick='removeObj()' id='guoji_cancel' /></p>";
  var msgw,msgh,bordercolor;
  msgw=580;//提示窗口的宽度
  msgh=350;//提示窗口的高度
  bordercolor="#007CBA";//提示窗口的边框颜色
  titlecolor="#99CCFF";//提示窗口的标题颜色

  var sWidth,sHeight;
  sWidth=document.body.offsetWidth;//浏览器工作区域内页面宽度
  sHeight=screen.height;//屏幕高度（垂直分辨率）
  
  
  bod = document.getElementsByTagName('body')[0];//清除垂直滚动条
  bod.style.height = '100%';
  bod.style.overflow = 'hidden';
				  
  htm = document.getElementsByTagName('html')[0];//清除垂直滚动条
  htm.style.height = '100%';
  htm.style.overflow = 'hidden';

  
  cWidth = ((msgw+10)/2)+"px";
  cHeight = ((msgh+10)/2)+"px";

  //背景层（大小与窗口有效区域相同，即当弹出对话框时，背景显示为放射状透明灰色）
  var bgObj=document.createElement("iframe");
  bgObj.setAttribute('id','bgIframe');
  bgObj.style.position="absolute";
  bgObj.style.top="0";
  bgObj.style.background="#666";
  bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0,finishOpacity=0";
  bgObj.style.opacity="0.0";
  bgObj.style.left="0";
  bgObj.style.width=sWidth + "px";
  bgObj.style.height=sHeight + "px";
  bgObj.style.textAlign = "center";
  bgObj.style.zIndex = "9999";
  document.body.appendChild(bgObj);//在body内添加该div对象
  
  var bgObj2=document.createElement("div");
  bgObj2.setAttribute('id','bgDiv');
  bgObj2.style.position="absolute";
  bgObj2.style.top="0";
  bgObj2.style.background="#666";
  bgObj2.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
  bgObj2.style.opacity="0.6";
  bgObj2.style.left="0";
  bgObj2.style.width=sWidth + "px";
  bgObj2.style.height=sHeight + "px";
  bgObj2.style.textAlign = "center";
  bgObj2.style.zIndex = "10000";
  document.body.appendChild(bgObj2);//在body内添加该div对象

  var msgObj=document.createElement("div")//创建一个div对象（提示框层）
  msgObj.setAttribute("id","msgDiv");
  msgObj.setAttribute("align","left");
  msgObj.style.background="white";
  msgObj.style.border="5px solid " + bordercolor;
  msgObj.style.padding="0 10px"
  msgObj.style.position = "absolute";
  msgObj.style.left = "50%";
  msgObj.style.top = "50%";
  msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
  msgObj.style.marginLeft = "-" + cWidth;
  msgObj.style.marginTop = "-" + cHeight
  msgObj.style.width = msgw + "px";
  msgObj.style.height = msgh + "px";
  msgObj.style.textAlign = "left";
  msgObj.style.lineHeight ="25px";
  msgObj.style.zIndex = "10001";

  document.body.appendChild(msgObj);//在body内添加提示框div对象msgObj

  var txt=document.createElement("div");//创建一个div对象（提示框提示信息）
  txt.style.margin="1em 0"
  txt.setAttribute("id","msgTxt");
  txt.innerHTML=str;//来源于函数调用时的参数值
  
  document.getElementById("msgDiv").appendChild(txt);//在提示框div中添加提示信息对象txt
}