// JavaScript Document
function imgClip(img,w,h) 
{ 
  var ratio=img.width/img.height; 
  if(ratio<(w/h)) 
  { 
    img.width=w; 
    img.height=Math.round(w/ratio); 
    img.style.marginTop=(h-img.height)/2+"px"; 
  }else{ 
    img.height=h; 
    img.width=Math.round(w*ratio); 
    img.style.marginLeft=(w-img.width)/2+"px";    
  }    
} 



function createAjax() {		
	var _xmlhttp;
	try {	
		_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	
	}
	catch (e) {
		try {
			
			
			if (window.XMLHttpRequest)
             {// code for IE7+, Firefox, Chrome, Opera, Safari
             _xmlhttp=new XMLHttpRequest();
              }
             else
            {// code for IE6, IE5
            _xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
            }

			
			//_xmlhttp=new XMLHttpRequest();	
		}
		catch (e) {
			_xmlhttp=false;	
		}
	}
	return _xmlhttp;
}



function getweblists(idname,d_nmae) {	


	var xmlhttp=createAjax();	
	if (xmlhttp) {	
		var imglist=document.getElementById('Team_top');	
		xmlhttp.open('get','Team_top.php?searchkey='+escape(d_nmae),true);	
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	
				imglist.innerHTML=unescape(xmlhttp.responseText);
			}
			else {
				imglist.innerHTML='';	
			}
		}
		xmlhttp.send(null);	
	}
}









function getweblist(idname,d_nmae) {	

	 if(d_nmae=='A')
	    {document.getElementById(idname).innerHTML='<div class="mli"><a href="#" class="ma_ok">北區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'B\');">中區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'C\');">南區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'D\');">東區業者</a></div>';
		
		document.getElementById('maueA').style.display='';
		document.getElementById('maueB').style.display='none';
		document.getElementById('maueC').style.display='none';
		document.getElementById('maueD').style.display='none';
		}
		
	 if(d_nmae=='B')
	    {document.getElementById(idname).innerHTML='<div class="mli"><a href="#"  onclick="getweblist(\'maue\',\'A\');" >北區業者</a></div><div class="mli"><a href="#" class="ma_ok">中區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'C\');">南區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'D\');">東區業者</a></div>';
		
		document.getElementById('maueA').style.display='none';
		document.getElementById('maueB').style.display='';
		document.getElementById('maueC').style.display='none';
		document.getElementById('maueD').style.display='none';
		}
 
	 if(d_nmae=='C')
	    {document.getElementById(idname).innerHTML='<div class="mli"><a href="#"  onclick="getweblist(\'maue\',\'A\');" >北區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'B\');">中區業者</a></div><div class="mli"><a href="#" class="ma_ok">南區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'D\');">東區業者</a></div>';
		
		document.getElementById('maueA').style.display='none';
		document.getElementById('maueB').style.display='none';
		document.getElementById('maueC').style.display='';
		document.getElementById('maueD').style.display='none';
		}
				 
	 if(d_nmae=='D')
	    {document.getElementById(idname).innerHTML='<div class="mli"><a href="#"  onclick="getweblist(\'maue\',\'A\');" >北區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'B\');">中區業者</a></div><div class="mli"><a href="#" onclick="getweblist(\'maue\',\'C\');">南區業者</a></div><div class="mli"><a href="#" class="ma_ok">東區業者</a></div>';
		
		document.getElementById('maueA').style.display='none';
		document.getElementById('maueB').style.display='none';
		document.getElementById('maueC').style.display='none';
		document.getElementById('maueD').style.display='';
		}
				
	 	
}

