// JavaScript Document
$(document).ready(function()
{						
	Nav_show('');
}
);

//getOs
function J_getOs()
{
   if(navigator.userAgent.indexOf("MSIE")>0)return 1;
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0)return 2;
   if(isSafari=navigator.userAgent.indexOf("Safari")>0)return 3;   
   if(isCamino=navigator.userAgent.indexOf("Camino")>0)return 4;
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0)return 5;
   return 0;
}

function getPosition()
{
  var top    = document.documentElement.scrollTop;
  var left   = document.documentElement.scrollLeft;
  var height = document.documentElement.clientHeight;
  var width  = document.documentElement.clientWidth;
  return {top:top,left:left,height:height,width:width};
}

function getScrollTop()
{
    var scrollTop=0;
    if(document.documentElement&&document.documentElement.scrollTop)
    {
        scrollTop=document.documentElement.scrollTop;
    }
    else if(document.body)
    {
        scrollTop=document.body.scrollTop;
    }
    return scrollTop;
}

function Nav_myAddBookmark(title,url) 
{ 
    if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
    { 
        window.sidebar.addPanel(title,url,""); 
    } 
    else
    { 
        window.external.AddFavorite(url,title); 
    } 
} 

function Nav_printdiv(printpage)
{
	var headstr = "<html><head><title></title></head><body>";
	var footstr = "</body></html>";
	var newstr = document.all.item(printpage).innerHTML;
	var oldstr = document.body.innerHTML;
	document.body.innerHTML = headstr+newstr+footstr;
	window.print(); 
	document.body.innerHTML = oldstr;
	return false;
}

function Nav_close(objname,Maxheight)
{
	var obj=document.getElementById(objname);
	var closeH=function()
	{
		var objH=parseInt(obj.style.height);
		if(objH>1)
		{
			obj.style.height=(objH-Math.ceil(objH)/2)+'px';
			obj.style.top=parseInt(obj.style.top)+1+"px";
		}
		else
		{
			clearInterval(closeM1);
			obj.style.display='none';
			var navigation_con=$("#navigation").html();			
			$("#navigation").html('<div class="right2" id="navigation_right2" ></div>');
			obj.style.display='block';
			var Position = getPosition();	
			obj.style.top=Position.height-33+getScrollTop()+"px";
			$("#navigation_right2").click(function(){Nav_show(navigation_con);});
		}
	}	
	closeM1=setInterval(closeH,1);
}


function Nav_show(html)
{
	if(html!='')
	{
		$('#navigation').html(html);
	}
	$('#navigation').css("width",document.body.clientWidth+"px");
	var Position = getPosition();
	$('#navigation').css("top",Position.height-33+getScrollTop()+"px");
	window.onscroll=function ()
	{
		$('#navigation').css("top",Position.height-33+getScrollTop()+"px");
	};
	$('#navigation_mid').css("width",document.body.clientWidth-54+"px");
	$('#navigation_con').css("width",980+"px");//content, it is fixed 
	$('#navigation_search').css("width",205+"px");//div for search input
	$('#navigation_search_key').css("width",203+"px");//search input 
	$('#navigation_close').click(function(){$('#navigation_tip').css("display","none");});
		
	$("#navigation_right").click(function(){Nav_close("navigation",33);});
	

}

