//this version is used when max(med_links,proc_links) > 11 and < 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 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 findPos(name) {
	obj = document.getElementById(name)
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
//	alert("returning: left:"+curleft+" top:"+curtop +" obj:"+name);
	return [curleft,curtop];
}




  function setupDivs(){

		b = document.getElementById("branding_area");
		b = b.offsetHeight;
		// branding = .offsetHeight;
	   //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("tax_left");
		 blc.style.left = pos[0]+"px";
		 
	   blc.style.top =  (pos[1] + maxH + 15) +"px";


	   //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');
	   nci_offsetHeight = (nci == null)? 0 : nci.offsetHeight + 20;
	   if(nci != null){
		 	   		nci_top = findPos("newsCareersInvestors")[1];
		 	   		
		 	   		nci_h = nci_offsetHeight;
		 	   		left_top = pos[1];
		 	   		left_h = document.getElementById('tax_left').offsetHeight;
		 	   		if(left_top < nci_top){
		 	   			//the way it should be
		 	   			top_diff =  nci_top - left_top;
		 	   			new_h = left_h - top_diff;
		 	   			nci.style.position="absolute";
		 	   			pad = ((new_h - 18)/2);
		 	   			pad = (pad >= 0)?pad:0; //ie doesnt like negative args
		 	   			nci.style.paddingBottom =(pad+1)+"px";
		 	   			pos_rt = findPos('tax_right');
		 	   			nci.style.top = (pos_rt[1] + document.getElementById('tax_right').offsetHeight) +"px"
		 	   			
	
		 	   			nci.style.left = pos_rt[0] + "px";
		 	   			nci.style.paddingTop = pad + "px";
		 	   			
	  // 					nci.style.marginLeft = "19px"; 
	   					
	   					brc.style.position="absolute";
							brc.style.left = pos_rt[0]+"px";
	   					brc.style.top =  (new_h + 12 + nci_top) +"px";
		 	   		}
		 	   		
	   } else {
	  	  brc.style.width="211px";
	   		brc.style.position="absolute";
	   		pos_rt = findPos('tax_right');
		 		brc.style.left = pos_rt[0]+"px";
	   		brc.style.top =  (pos_rt[1] + t_h + 15 + 0) +"px";
	   }
	//   brc.style.marginLeft = "19px";
	   //now resize content height
	   cont = document.getElementById('content');
	   pos_cont = findPos("content");
	   cont_h = cont.offsetHeight;
	   maxH = Math.max(document.getElementById('tax_left').offsetHeight,document.getElementById('tax_mid').offsetHeight);

	 	   top_footer = findPos('footer')[1];
	
		
	   	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;
	//		alert("WWWW: tr_w:"+tr_w+" brc_w:"+brc_w);
			if(tr_w != brc_w){
				brc.style.width=(tr_w-20)+"px";
			}
 }

