//bandwidth cookie
var expires = new Date (); 
expires.setTime(expires.getTime() + 1 * 60 * 60 * 1000); 
document.cookie = "mysite=yes; path=/" + "; expires=" + expires.toGMTString();

//obj browser detection
function Is ()
{   
				var agt=navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1)));
    this.nav2 = (this.nav && (this.major == 2));
    this.nav3 = (this.nav && (this.major == 3));
				
    this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
			//	this.ie5     = (this.ie && (this.major == 4));//x ie5.01 e ie5.5 ie6 ie7 ?????
   // ... and so on ...
    this.vms   = (agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1);
}
var is = new Is(); 
//if (is.nav) {  ... navigator code here ... }
//else if (is.ie) {  ... explorer code here ... }

// window dimension  
var x,y;
if (self.innerHeight) // all except Explorer
{
	x = self.innerWidth;
	y = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
{
	x = document.documentElement.clientWidth;
	y = document.documentElement.clientHeight;
}
else if (document.body) // other Explorers
{
	x = document.body.clientWidth;
	y = document.body.clientHeight;
}


//win popup
function popWin( url, name, width, height, scroller ) {
	var outStr = 'height=' + height + ',width=' + width;
	if (scroller == true) {	outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes';} 
	else if (scroller == false) {	outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no';} 
	else {	outStr = outStr +',menubar=yes,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes';
	}newWindow=window.open(url, name, outStr);
}

//return current url without '#'
function getCurrentUrl() {
	 url_root = this.document.location.href;
	 url_path = url_root.substring(0, url_root.indexOf('#'));
		//return url_path;
		setCurrentPage_new(url_path);
	}
	
//change "current" link layout
function setCurrentPage_new(path_url)
{
	var currentPage =(path_url!="")? path_url:window.location.href;
	var navigationContainer = document.getElementById('top_menu_right');
	var navBarLinkCollection = navigationContainer.getElementsByTagName('a');
	var j;

	for (j=0;j < navBarLinkCollection.length;j++)
	{
		if (currentPage == navBarLinkCollection[j].href)
		 {
				var newClass=(navBarLinkCollection[j].parentNode.parentNode.className=='menu')?'current':'subcurrent';
				//alert(navBarLinkCollection[j].parentNode.parentNode.className);			
				navBarLinkCollection[j].className = newClass;
				if (newClass=='subcurrent')
					{
						navBarLinkCollection[j].parentNode.parentNode.parentNode.firstChild.className='current'; //alert(navBarLinkCollection[j].parentNode.parentNode.parentNode.firstChild.nodeName)
				 }
			}
	}
} 	

		
//ON OFF ul ul #submenu
if (!document.getElementById)
    document.getElementById = function() { return null; }

function initializeMenu(menuId, actuatorId) {
    var menu = document.getElementById(menuId);
    var actuator = document.getElementById(actuatorId);

    if (menu == null || actuator == null) return;

    actuator.onclick = function() {
       var display = menu.style.display;
	menu.style.display = (display == "block") ? "none" : "block";
	actuator.className = (actuator.className =='stretchtoggle1') ? "stretch_active1" : "stretchtoggle1"
       return false;
    }
}