<?php
/**
 *----------------------------------------------------------------------------*
 * 版权所有 2005-2010 GV32.COM，并保留所有权利。
 * 网站地址: http://www.gv32.com；
 * 作者: GV32.COM
 *----------------------------------------------------------------------------*
**/
class Ajaxarea
{
	function Ajaxarea()
	{
	}
	
	function infolist()
	{
		
	}
	
	function province()
	{
		$objval = $_REQUEST["objval"];
		$selval	= $_REQUEST["selval"];
		
		$sqlarea = " SELECT are_id,are_name  FROM  ".SQL_PREFIX."areadict   WHERE are_parentid = 1  GROUP BY are_id  ";
				
		$areaDetail = $GLOBALS['MySql'] -> selectInfo($sqlarea);
		
		$echoval  =  '<select name="idprovince" id="idprovince" onchange="getareadict( this.value,  \'userd_city\' , \'city\' );provinceval(this);" >';
		
		$echoval .= '<option value="" >请选择</option>';
		
		foreach($areaDetail as $akey => $aval)
		{
			if($selval==$aval["are_id"])
			{
				$echoval .= '<option value='.$aval["are_id"].' selected=\'selected\' >'.$aval["are_name"].'</option>';
				$selval = $aval["are_name"];
			}else{
				$echoval .= '<option value='.$aval["are_id"].' >'.$aval["are_name"].'</option>';
			}
		}
		
		$echoval .= '</select>';
		if($selval==1)
		{
			echo $selval."&nbsp;";
		}else{
			echo $echoval;
		}
	}
	
	function city()
	{
		$objval = $_REQUEST["objval"];
		$selval	= $_REQUEST["selval"];
		
		if( $objval!='' )
		{
			$sqlarea = " SELECT are_id,are_name  FROM  ".SQL_PREFIX."areadict   WHERE are_parentid =  ".$objval."  GROUP BY are_id  ";
				
			$areaDetail = $GLOBALS['MySql'] -> selectInfo($sqlarea);
		}
		$echoval  = '<select name="idcity" id="idcity" onchange="getareadict( this.value,  \'userd_district\' , \'district\');cityval(this);" >';
		
		$echoval .= '<option value="" >请选择</option>';
		if($areaDetail!=''){
			foreach($areaDetail as $akey => $aval)
			{
				if($selval==$aval["are_id"])
				{
					$echoval .= '<option value='.$aval["are_id"].' selected=\'selected\' >'.$aval["are_name"].'</option>';
					$selval = $aval["are_name"];
				}else{
					$echoval .= '<option value='.$aval["are_id"].' >'.$aval["are_name"].'</option>';
				}
			}
		}
		$echoval .= '</select>';
		if($selval==1)
		{
			echo $selval."&nbsp;";
		}else{
			echo $echoval;
		}
	}
	
	function district()
	{
		$objval = $_REQUEST["objval"];
		$selval = $_REQUEST["selval"];
		
		if( $selval!='' )
		{
			$sqlarea = " SELECT are_id,are_name  FROM  ".SQL_PREFIX."areadict   WHERE are_parentid = ".$objval."  GROUP BY are_id  ";
					
			$areaDetail = $GLOBALS['MySql'] -> selectInfo($sqlarea);
		}
		$echoval  = '<select name="iddistrict" id="iddistrict" onchange="districtval(this)" >';
		
		$echoval .= '<option value="" >请选择</option>';
		if($areaDetail!='')
		{
			foreach($areaDetail as $akey => $aval)
			{
				if($selval==$aval["are_id"])
				{
					$echoval .= '<option value='.$aval["are_id"].' selected=\'selected\' >'.$aval["are_name"].'</option>';
					$selval = $aval["are_name"];
				}else{
					$echoval .= '<option value='.$aval["are_id"].' >'.$aval["are_name"].'</option>';
				}
			}
		}
		$echoval .= '</select>';
		if($selval==1)
		{
			echo $selval."&nbsp;";
		}else{
			echo $echoval;
		}
	}
}

$Ajaxarea = new Ajaxarea();
?>

