function $(id){
	return document.getElementById(id);
}
var b=0,c=0;
function ls(i){
	$('ls_'+b).style.display='none';
	$('ls_'+i).style.display='block';
	b=i;
}
function chnav(i){
	$('nav_'+c).style.background='url(images/btn_0.png) 0 0';
	$('nav_'+i).style.background='url(images/btn_0.png) 0 -34px';
	c=i;
}
//alert('Success');
function change(b,id,i){
	
	if(i==0){
		if(b==0){
				$("nav_"+id).style.background="url(images/btn_0.png) no-repeat  2px -34px";
				$("list_"+id).style.display ="";
			}
			else{
				$("nav_"+id).style.background="url(images/btn_0.png) no-repeat  2px 0px";

			}
	}
	else{
		    if(b==0){
			    $("listm_"+id).style.background = "url(images/btn_1.png) no-repeat 0 -19px";
				$("nav_"+id).style.background="url(images/btn_0.png) no-repeat  2px -34px";
			}
			else{
				$("nav_"+id).style.background="url(images/btn_0.png) no-repeat  2px 0px";
				$("list_"+id).style.display ="none";
				$("listm_"+id).style.background = "url(images/btn_1.png) no-repeat 0 0px";
			}
	}
}

var i=0,a=0,j=0;
var i=0,a=0,j=0;
function bgch(v,id,image){
	if(id=='xt_'){
	$(id+i).style.background='url(images/ad_jd.png) no-repeat 0 0';
	$(id+v).style.background='url(images/ad_jd.png) no-repeat -87px 0';
	$('dt').style.background='url(images/faq.png)';
	$('dt').innerHTML = '<div style="margin:35% 22%;"><img src="images/loader.gif"> loading...</div>';
	$('hiddenshowimage').src = 'images/516/'+$('image').value+image+'.jpg';
	
	i=v;
	}
	
	if(id=='xxk_'){
	$(id+a).style.background='transparent url(images/xxk.png) no-repeat -87px -26px';
	//alert($(id+a).style.background);
	$(id+a).style.fontWeight='normal';
	$('xk_'+a).style.display='none';
	$(id+v).style.background='transparent url(images/xxk.png) no-repeat 0px -26px';

    $(id+v).style.fontWeight='bold';
	$('xk_'+v).style.display='block';
	a=v;
	}
	if(id=='xxk1_'){
	$(id+j).style.background='url(images/xxk.png) no-repeat -160px 0px';
	$(id+j).style.fontWeight='normal';
	$('xk1_'+j).style.display='none';
	$(id+v).style.background='url(images/xxk.png) no-repeat 0 0';
    $(id+v).style.fontWeight='bold';
	$('xk1_'+v).style.display='block';
	j=v;
	}
	
}
function onloadimage(src,title){
	
	title = decodeURIComponent(title);
	title = title.split('+');
	title = title.join("&nbsp;");
	$('dt').innerHTML = '<img src='+ src +' style="width:517px; height:382px;" title='+title+' align="left" id="showimage">';
}
function gender(e){
	if(e==0){
	$('g_0').style.background='#545454';
	$('g_0').style.color='#ffffff';	
	$('g_1').style.background='none';
	$('g_1').style.color='#000';	
	}
	else{
	$('g_0').style.background='none';
	$('g_0').style.color='#000';
	$('g_1').style.background='#545454';
	$('g_1').style.color='#ffffff';	
	}
}

/**
 * 无刷新定义
*/
function Get_AJAX(){var ajax=false;try{ajax=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{ajax=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){ajax=false;}}if(!ajax && typeof XMLHttpRequest != 'undefined'){ajax=new XMLHttpRequest();}return ajax;}function loadXMLDoc(data){var xmlDoc;if(window.ActiveXObject){xmlDoc=new ActiveXObject("Microsoft.XMLDOM");}else if (document.implementation && document.implementation.createDocument){xmlDoc=document.implementation.createDocument("","",null);}else{alert('Your browser cannot handle this script');}xmlDoc.async=false;xmlDoc.preserveWhiteSpace= true;xmlDoc.load(data)||xmlDoc.loadXML(data);return xmlDoc;}
var ajaxs = Get_AJAX();
function Ajax (url,response,pars,param){
	
	var method ='POST';	
	if (method == "GET"){
		ajaxs.open(method, url+"?"+pars, true);
		pars = "";		
	}
	else{
		
		ajaxs.open(method,url,true);
		ajaxs.setRequestHeader("Method", "POST "+url+" HTTP/1.1");
		ajaxs.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	}
	ajaxs.onreadystatechange = function(){NewAjax(response,param)};
	ajaxs.send(pars);
	
}
function NewAjax (response,param){
		if(ajaxs.readyState == 4){
		if(ajaxs.status == 200){
			var str = ajaxs.responseText;
		   // 开启测试
// 			alert(str);
			eval(str);
			response(msg,flag,param)
		}
	}
}

// ajax 结束

// 判断是否为空
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}

function changesate(id,param){
	var url = 'ajax.php?action=zones&country_id='+parseInt(id);
	Ajax(url,completes,'',param);
}
function completes(msg,flag,param){
	
	var param = param.split('|');
	var msg = msg.split(';');
	var Cmsg= msg.length;
	var select = '';
	for(i = 0 ;i < Cmsg;i++){	
		temp = msg[i].split('|')
		select += '<option value="'+temp[0]+'|'+temp[2]+'">'+temp[1]+'</option>'; 
		
	}
	
	if(Cmsg < 2)
		$(param[0]).innerHTML = '<input name ="'+param[1]+'" id="'+param[1]+'">&nbsp;&nbsp;<span class="STYLE1">*</span><div style="height:auto;width:200px;display:none;color:red" id="'+param[1]+'-show"></div>';
	else
		$(param[0]).innerHTML = '<select name="'+param[1]+'" id="'+param[1]+'" >'+select+'</select>&nbsp;&nbsp;<span class="STYLE1">*</span><div style="height:auto;width:200px;display:none;color:red" id="'+param[1]+'-show"></div>';
}


// div 模拟下拉菜单
var bottombgcolor='#316AC5';//鼠标移动到下拉菜单后的背景颜色
function showbgcolor(obj)
{
	obj.style.backgroundColor=bottombgcolor;
}
function hiddenbgcolor(obj)
{
	obj.style.backgroundColor='';
}
function showselectbottom()
{
	$('selectbottom').style.display='';
}
function selected(obj)
{
	$('select_txt_top').value=obj.value;
	$('selectbottom').style.display='none';
}
// 结束

function submit (){
	if($('select')){
//		alert(1);
//		$('select').submit();
	}
}