﻿var currentSubMenu;

function hideSubMenu()
{
//    obj.style.visibility = 'hidden';
    var subMenu = document.getElementById(currentSubMenu);
//    if (currentSubMenu != null && obj != subMenu)
    if (currentSubMenu != null)
    {
        subMenu.style.visibility = 'hidden';
    }
}

function showSubMenu(obj)
{
    if(obj.id == "menu_aboutus")
    {
        var subMenu = document.getElementById('submenu_aboutus');
        if (subMenu.style.visibility == 'hidden')
        {
            var leftPos = document.getElementById('main_menu_inner').offsetLeft;
            var topPos = document.getElementById('main_menu_inner').offsetTop;
            subMenu.style.visibility = 'visible';
            subMenu.style.filter = 'alpha(opacity=100)';
            subMenu.style.left = (parseInt(obj.offsetLeft) - 10) + 'px';
            subMenu.style.top = (parseInt(obj.offsetTop) + 25) + 'px';
            currentSubMenu = 'submenu_aboutus';
        }
    }
}

function displaylargepicture(pic, status, src)
{
    obj = document.getElementById("divImage");
    img = document.getElementById("imgLargePicture");
    preImages = new Image();
    preImages.src = src;
    
    if (status == "true")
    {
        currentPos = findPos(pic)
        img.src = src;
        obj.style.top = document.documentElement.scrollTop + (document.documentElement.clientHeight - img.height) / 2;
        obj.style.left = currentPos[0] + 200;
        obj.style.visibility = "visible";
    }
    else
    {
        obj.style.visibility = "hidden";
        img.src = "../../images/products/blank.jpg";
    }
}

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_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 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 findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

<!--[if lt IE 7]><script type="text/javascript">
function correctPosition(oElement,oPos,oWhich) {
  while( oElement.offsetParent ) {
    oPos -= oElement['offset'+oWhich];
    oElement = oElement.offsetParent;
  }
  oPos += document.documentElement['scroll'+oWhich] ? document.documentElement['scroll'+oWhich] : document.body['scroll'+oWhich];
  return oPos;
}
</script><![endif]-->