 <?php 
 if(LANGICOSWITCH=='y'){
 $sql = "SELECT * from ".TABLE_LANG." where pbh='".USERBH."' and sta_visible='y' order by pos desc,id";
 $langnum = getnum($sql);				 				 
if($langnum>1)
{
	$rowalllang = getall($sql);

	$sql33 = "SELECT lang,name,langpath from ".TABLE_LANG." where pbh='".USERBH."' and lang='" .LANG. "' and sta_visible='y' order by pos desc,id limit 1";
	//echo $sql33;
	$row = getrow($sql33);
	if($row=='no') {
		echo '<p>语言 '.LANG.' 不存在，或处于隐藏状态</p>';
		exit;	
	}
	 
    $langname = $row['name'];

    $langsrc = STAPATH.'img/langimg/'.LANG.'.gif';
?>
     <div class="langimg">
     	 <div class="clicknextshow  cp">
     	 <img src="<?php echo STAPATH;?>img/langimg/<?php echo LANG?>.gif" height="16" title="<?php echo $langname?>"  alt="<?php echo $langname?>" />
			<i class="langarrow"></i>
     	 </div>
	 		<div class="langimginc dn">
	 			  <?php 
							  $sql = "SELECT * from ".TABLE_LANG." where pbh='".USERBH."' and lang<>'" .LANG. "' and sta_visible='y' order by pos desc,id";
								$rowlist = getall($sql);
								if($rowlist=='no') echo '暂无内容';
								else{
									global $httpv;
									if(SITEIDBYDOMAIN=='y'){ 
									 foreach ($rowalllang as  $v) {	

										    if(MAINLANG<>$v['lang']){
										    	
												   $langsrc = STAPATH.'img/langimg/'.$v['lang'].'.gif';	   
											       echo '<a  href="'.$httpv.$v['domain'].'"><img src="'.$langsrc.'" title="'.$v['name'].'" alt="'.$v['name'].'" /></a>';
											   }
										   } 
										 }
									else{	
										foreach($rowlist as $v){ 								 
										  $lang=$v['lang']; 
										  $langpath=$v['langpath']; 
										  $langsrc = STAPATH.'img/langimg/'.$lang.'.gif';	

										  if($lang==MAINLANG)	$link = BASEURL;			    
										   else $link = BASEURL.$langpath.'/';
										  echo '<a title="'.$lang.'" href="'.$link.'"><img src="'.$langsrc.'" title="'.$v['name'].'" alt="'.$v['name'].'" /></a>';
										}
									}




							}


	 			  ?>

	 		</div>

     </div>
 <?php 
     }
 }
  ?>