function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function showHideSearchForm(oSender)
{
    oTarget= document.getElementById("searchArea");
  
    if(oTarget.style.display != "none")
    {
        oSender.innerHTML = "[+] Show Search Form";
        oTarget.style.display = "none";
    }
    else
    {
        oSender.innerHTML = "[-] Hide Search Form";
        oTarget.style.display = "";
    }
 
}
function showHideSearchForm2(oSender)
{
    oTarget= document.getElementById("searchArea");
    
    if(oTarget.style.display != "none")
    {
        oSender.innerHTML = "[+]";
        oTarget.style.display = "none";
    }
    else
    {
        oSender.innerHTML = "[-]";
        oTarget.style.display = "";
    }
   
}
function showDetails(detailDivId)
{

    oOpacityDiv = document.getElementById('mainAreaInactiveOpacityLayer');
    oTargetDiv = document.getElementById(detailDivId);
     //alert(document.documentElement.clientHeight);
   oOpacityDiv.style.width= document.documentElement.clientWidth;
   // oOpacityDiv.style.height= document.documentElement.scrollBottom;
    //alert(document.body.scrollTop);
    //alert(document.documentElement.scrollHeight);
    //alert(window.pageYOffset);
    var hl =2100; 
    var top =(window.pageYOffset)?(window.pageYOffset):(document.documentElement)?document.documentElement.scrollTop:document.body.scrollTop;
    if(document.documentElement.scrollHeight > 100)
    {
    hl = document.documentElement.scrollHeight;
    }
    else
    {    
     hl = document.documentElement.clientHeight;
    }
    oOpacityDiv.style.height= hl;
    
    try { 
        oOpacityDiv.style.top = top + "px;";
    } 
    catch (ignore) 
    {
        oOpacityDiv.style.top = top;
    }
    
    
    try { 
        //oTargetDiv.style.left=Math.round((document.documentElement.clientWidth/2)-350) + 'px;';
        oTargetDiv.style.left=Math.round((document.documentElement.clientWidth/2)-330) + 'px;';
    } 
    catch (ignore) 
    {
        //oTargetDiv.style.left=Math.round((document.documentElement.clientWidth/2)-350);
        oTargetDiv.style.left=Math.round((document.documentElement.clientWidth/2)-330);
    }
    
    try { 
        oTargetDiv.style.top=top + 50 + "px;";
    } 
    catch (ignore) 
    {
        oTargetDiv.style.top=top + 50;
    }
    
    oOpacityDiv.style.display='';
    oTargetDiv.style.display='';
}
function hideDetails(detailDivId)
{
    oOpacityDiv = document.getElementById('mainAreaInactiveOpacityLayer');
    oTargetDiv = document.getElementById(detailDivId);
    oOpacityDiv.style.display='none';
    
    oTargetDiv.style.display='none';
}

function showDetail(detailId)
{
    var oTarget = document.getElementById("divResultDetail" + detailId);
    
    if(oTarget.style.display=='none')
    {
        oTarget.style.display='block';
    }
    else
    {
        oTarget.style.display='none';
    }
   // alert("t" + oTarget.style.height); 
    //SetFirefox(oTarget.style.height);
}

function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollHeight : 0,
		document.body ? document.body.scrollHeight : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}



	
	function SetFirefox(ht){ 
    /* sort out a height problem in firefox */
     var hl =2100;  
     //alert("ht" + ht);
     if(document.documentElement.scrollHeight > 100)
     {
     hl = document.documentElement.scrollHeight;
    //alert("scroll" +hl);
    }
    else
     {    
     hl = document.documentElement.clientHeight;
    // alert("clientHeight" +hl);
     } 
     
    // alert(f_scrollTop()); 
    
    
    
    document.getElementsByTagName('body')[0].style.width='98%'; 
    document.getElementsByTagName('body')[0].style.height= hl; //+ ht; 

} 

	function setYearSearch(searchMode)
	 {   
		   if(searchMode.value == 'year')
			 {
				  document.getElementById('divSearchYear').style.display = '';
				  document.getElementById('divSearchDateRange').style.display = 'none'; 
				   document.getElementById('divSearchDateRange2').style.display = 'none';
				  //document.getElementById('YearSelectorMain').value = '';
			  }
			 else
			  {
				  document.getElementById('divSearchYear').style.display = 'none';
				  document.getElementById('divSearchDateRange').style.display = ''; 
				  document.getElementById('divSearchDateRange2').style.display = '';
				 // document.getElementById('txtStartDate').value = '(dd/mm/yyyy)';
				 // document.getElementById('txtEndDate').value = '(dd/mm/yyyy)';
		    }
	 }
	 
	 function CheckRoundbox()
	 {
	 
	  alert("test");
	    if(document.getElementById('roundYear').checked)
	    {
	          document.getElementById('divSearchYear').style.display = '';
			  document.getElementById('divSearchDateRange').style.display = 'none'; 
			  document.getElementById('divSearchDateRange2').style.display = 'none';
	   
	    }
	   else
	   {
	          document.getElementById('divSearchYear').style.display = 'none';
			  document.getElementById('divSearchDateRange').style.display = ''; 
			  document.getElementById('divSearchDateRange2').style.display = '';
	   }
	 
	 }
	  function autoWidth(conName)
        {
            var maxlength = 0;
            var mySelect = document.getElementById(conName);
            for (var i=0; i<mySelect.options.length;i++)
            {
                if (mySelect[i].text.length > maxlength)
                {
                    maxlength = mySelect[i].text.length;
                }
            }
            mySelect.style.width = maxlength * 7;
        }
 
 function OpenDDL(con)
 {
 
  var sel = document.getElementById(con)
  {
    
    sel.click(); 
  
  }
 }
 
  
 function ExpandDDL(con)
 {
 
  var sel = document.getElementById(con)
  {
    
    sel.style.width="300%"; 
  
  }
 }
 function getStyle(el, style) {
   if(!document.getElementById) return;
   
     var value = el.style[toCamelCase(style)];
   
    if(!value)
        if(document.defaultView)
            value = document.defaultView.
                 getComputedStyle(el, "").getPropertyValue(style);
       
        else if(el.currentStyle)
            value = el.currentStyle[toCamelCase(style)];
     
     return value;
}

function setStyle(objId, style, value) {
    document.getElementById(objId).style[style] = value;
}

function toCamelCase( sInput ) {
    var oStringList = sInput.split('-');
    if(oStringList.length == 1)    
        return oStringList[0];
    var ret = sInput.indexOf("-") == 0 ? 
       oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0];
    for(var i = 1, len = oStringList.length; i < len; i++){
        var s = oStringList[i];
        ret += s.charAt(0).toUpperCase() + s.substring(1)
    }
    return ret;
}

function increaseWidth(addToWidth, whichDiv){
    var theDiv = document.getElementById(whichDiv);
    var currWidth = parseInt(getStyle(theDiv, "width"));
    var newWidth = currWidth + parseInt(addToWidth);
    setStyle(whichDiv, "width", newWidth + "px");
}
var timeout         = 300;
var closetimer		= 0;
var ddmenuitem      = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
//document.onclick = mclose; 
// -->