//this version is used when max(med_links,proc_links) < 11 or > 14

  function show_country(event){
		x=event.clientX-10;
		y=event.clientY
		document.getElementById('countryDiv').style.marginLeft = Math.max(0, (x))+'px';
		document.getElementById('countryDiv').style.marginTop = Math.max(0, (y))+'px';
		document.getElementById('countryDiv').style.display = '';
  }
	

  function findPos(obj) {
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
		return [curleft,curtop];
  }

    function search(){
  	  if(!document.getElementById("SearchFormTop").q.value == ''){
  	   document.getElementById("SearchFormTop").currentPage.value="1";
  	 	 document.getElementById("SearchFormTop").submit()
  	 	}
    }
    
    function searchDevices(){
      if(!document.getElementById("SearchFormMain").productFinder_search.value == ''){
       document.getElementById("SearchFormMain").currentPage.value="1";
    	 document.getElementById("SearchFormMain").submit()
    	}
   }

 function setupDivs(){

		 
		 
	   //make the 2 middle divs the same height:
	   var maxH = Math.max(document.getElementById('tax_left').offsetHeight,document.getElementById('tax_mid').offsetHeight);
		 document.getElementById('tax_left').style.height=maxH+'px';
	   document.getElementById('tax_mid').style.height=maxH+'px';
	   //move the bottom left div under the 2 middle divs:
	   var blc = document.getElementById('bottom_left_content');
	   blc.style.position="absolute";
	   pos = findPos(document.getElementById('tax_left'));
		 blc.style.left = pos[0]+"px";
	   blc.style.top =  (pos[1] + maxH + 15) +"px";
	  // blc.style.marginLeft = "19px"; 
	   
	   //move the bottom right div under the right tax
	   var brc = document.getElementById('bottom_right_content');
	   var t_h = document.getElementById('tax_right').offsetHeight;
	   var nci = document.getElementById('newsCareersInvestors');
	   pos_rt = findPos(document.getElementById('tax_right'));
	   if(nci != null){
		 	 //  nci.style.marginLeft="19px";
		     nci.style.position="absolute";
		     
		     nci.style.top = (pos_rt[1] + document.getElementById('tax_right').offsetHeight) +"px"
		 	   nci.style.left = pos_rt[0] + "px";
		 	//   nci.style.marginLeft = "19px"; 
		 	   
	   } else {
	    	brc.style.width="211px";
	   }
	   nci = (nci == null)? 0 : nci.offsetHeight + 20;
	   
	   brc.style.position="absolute";
	   pos_rt = findPos(document.getElementById('tax_right'));
		 brc.style.left = pos_rt[0]+"px";
	   brc.style.top =  (pos_rt[1] + t_h + 15 + nci) +"px";
	 //  brc.style.marginLeft = "19px";
	   
	   //now resize content height
	    cont = document.getElementById('content');
	 	   top_footer = findPos('footer')[1];
	
		b = document.getElementById("branding_area");
		b = b.offsetHeight;
	   	blc_bottom = blc.offsetHeight + brc.offsetTop;
	   	brc_bottom = brc.offsetHeight + brc.offsetTop;
	   	rt_bottom = document.getElementById("left_pane").offsetHeight + document.getElementById("left_pane").offsetTop;
	//   	alert("blc:"+blc_bottom+" brc:"+brc_bottom+" rt:"+rt_bottom+" top:"+findPos("left_pane")[1]+" h:"+document.getElementById("left_pane").offsetHeight);
	    new_h = Math.max(Math.max(brc_bottom,brc_bottom),rt_bottom);
	 cont.style.height=(new_h - b) +"px";
	    
	    	 //readjust this dude 	
				  	brc = document.getElementById('bottom_right_content');
						tr_w = document.getElementById('tax_right').offsetWidth;
						brc_w = brc.offsetWidth;
						if(tr_w != brc_w){
							brc.style.width=(tr_w-20)+"px";
			}
 }