var g_currPopupId, g_popupTimer;

function placeCoverSelectFrame(obj) {
  if (document.all) {
    if (!obj) return false;  
    var coverageframe = document.getElementById("coverageframe" + obj.id);
    if (coverageframe == null) {    
      coverageframe  = document.createElement("iframe");  
      with (coverageframe) {
        style.position = "absolute";    
        style.zIndex = 0;
        frameBorder = 0;
        src = "javascript:false;";    
        id = "coverageframe" + obj.id;
        style.width = parseInt(obj.offsetWidth);
        style.height = parseInt(obj.offsetHeight);    
        style.display = "";    
      }
      document.forms[0].appendChild(coverageframe);	
    }
    coverageframe.style.top = parseInt(obj.offsetTop);
    coverageframe.style.left = parseInt(obj.offsetLeft);    
  }
    
}
function hideCoverSelectFrame(obj) {
  if (document.all)
    if (document.getElementById("coverageframe" + obj.id))
      document.getElementById("coverageframe" + obj.id).removeNode(true);
}
function showPopUp() {
  var obj = document.getElementById(g_currPopupId)
	if (!obj) return false;					
  obj.style.display="block"; // display the pop-up
  placeCoverSelectFrame(obj);
}

function InfoShow(id, e) {
  if (g_currPopupId != id) {
    g_currPopupId = id;  
    //Clear previous timer  
    window.clearTimeout(g_popupTimer);  
    g_popupTimer = window.setTimeout("showPopUp();", 500);
  }
  //Init popup location
  var obj = document.getElementById(g_currPopupId)
  if (!obj) return false;

	//Move the element as a child under the form element, to make sure its 
	//position is correct. Note: obj must be positioned absolute	
  document.forms[0].appendChild(obj);	
  
  obj.style.zIndex = 100;
  if (e) {		
		if(e!=null) {
			var x = 0;
			var y = 0;			
			
			x = e.clientX + document.body.scrollLeft + 16; // get the mouse left position
			y = e.clientY + document.body.scrollTop + 16; // get the mouse top position 

			var nRightMargin = (window.innerWidth ? window.innerWidth + window.pageXOffset : document.body.clientWidth + document.body.scrollLeft);
			if ((x + 260) > nRightMargin)  // tooltip runs off right 
				obj.style.left = x - 260; 
			else
				obj.style.left = x;
			
			obj.style.top = y; // set the pop-up's top				
			if (obj.style.display == "block") {
	      placeCoverSelectFrame(obj);
	    }
		} 			
		
	}
	
}

// this function hides the pop-up when user moves the mouse out of the link
function InfoHide(id) {  
  //Clear timer
  window.clearTimeout(g_popupTimer);
	var o = document.getElementById(id)
	if(o!=null)
		o.style.display="none"; // hide the pop-up
	hideCoverSelectFrame(o);
}


// toggle the div
function ToggleInfo(id)
{

	var o = document.getElementById(id); 
 	if(o!=null)
 	{
        if ( o.style.display  != "")
        {   
			o.style.display = ""; 
        } 
        else o.style.display  = "none";
     }
   
     
  o = document.getElementById("klapin_" + id); 
 	if(o!=null)
 	{
        if ( o.style.display  != "inline")
        {   
			o.style.display = "inline"; 
        } 
        else o.style.display  = "none";
     }
     
  o = document.getElementById("klapintekst_" + id); 
 	if(o!=null)
 	{
        if ( o.style.display  != "inline")
        {   
			o.style.display = "inline"; 
        } 
        else o.style.display  = "none";
     }
     
   o = document.getElementById("klapuit_" + id); 
 	if(o!=null)
 	{
        if ( o.style.display  != "inline")
        {   
			o.style.display = "inline"; 
        } 
        else o.style.display  = "none";
     }

}  

function ShowDateSelection(o, idSelection)
{
	//var o = document.getElementById(id); 
	if(o!=null)
 	{
 		
 		if ( o.selectedIndex == 3 )
 		{
 			document.getElementById(idSelection).style.display= "block";
 		}
 		else
 		{
			document.getElementById(idSelection).style.display="none";	
 		}
 	}
 
}   

