function popup(url)
{
   window.open(url, "name","height=550,width=750,left=30,top=30,location=no,resizable=yes,scrollbars=yes,toolbar=no,status=no");
}
function showProductsmenu(){
document.getElementById("productMenu").display="block";
}
function hideProductsmenu(){
document.getElementById("productMenu").display="none";
}

/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/
var offsetfrommouse=[15,15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.
var currentimageheight = 270;	// maximum image size.

document.write('<div id="trailimageid" style="position:absolute; z-index:25;">');
document.write('</div>');

function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("trailimageid")
else if (document.all)
return document.all.trailimagid
}

function showtrail(imagename, title, description){
    document.onmousemove=followmouse;
    newHTML = '<div style="z-index:25; padding: 10px; background-color: #FFF; border: 1px solid #888;">';
    newHTML = newHTML + '<h2>' + title + '</h2>';
    newHTML = newHTML + '<div align="center" style="padding: 8px 2px 2px 2px;">';
    newHTML = newHTML + '<img src="' + imagename + '" border="1"></div>';
    newHTML = newHTML + description + '<br/>';
    newHTML = newHTML + '</div>';
    gettrailobjnostyle().innerHTML = newHTML;
    gettrailobj().display="inline";
}
function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("trailimageid")
else if (document.all)
return document.all.trailimagid
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail(){
    gettrailobj().innerHTML = " ";
    gettrailobj().display="none"
    document.onmousemove=""
    gettrailobj().left="-500px"
}

function followmouse(e){
    var xcoord=offsetfrommouse[0]
    var ycoord=offsetfrommouse[1]
    var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
    var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)
    //if (document.all){
    //	gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br>B = ' + truebody().clientHeight;
    //} else {
    //	gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br>D = ' + window.innerHeight;
    //}

    if (typeof e != "undefined"){
        if (docwidth - e.pageX < 380){
            xcoord = e.pageX - xcoord - 400; // Move to the left side of the cursor
        } else {
            xcoord += e.pageX;
        }
        if (docheight - e.pageY < (currentimageheight + 110)){
            ycoord += e.pageY - Math.max(0,(110 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
        } else {
            ycoord += e.pageY;
        }

    } else if (typeof window.event != "undefined"){
        if (docwidth - event.clientX < 380){
            xcoord = event.clientX + truebody().scrollLeft - xcoord - 400; // Move to the left side of the cursor
        } else {
            xcoord += truebody().scrollLeft+event.clientX
        }
        if (docheight - event.clientY < (currentimageheight + 110)){
            ycoord += event.clientY + truebody().scrollTop - Math.max(0,(110 + currentimageheight + event.clientY - docheight));
        } else {
            ycoord += truebody().scrollTop + event.clientY;
        }
    }

    var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
    var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
        if(ycoord < 0) { ycoord = ycoord*-1; }
    gettrailobj().left=xcoord+"px"
    gettrailobj().top=ycoord+"px"

}


/************************************************************************************************************
(C) www.dhtmlgoodies.com, November 2005
************************************************************************************************************/

var timeBeforeAutoHide = 700;	// Microseconds to wait before auto hiding menu(1000 = 1 second)
var slideSpeed_out = 30;	// Steps to move sub menu at a time ( higher = faster)
var slideSpeed_in = 20;


var slideTimeout_out = 1;	// Microseconds between slide steps ( lower = faster)
var slideTimeout_in = 1;	// Microseconds between slide steps ( lower = faster)

var showSubOnMouseOver = true;	// false = show sub menu on click, true = show sub menu on mouse over
var fixedSubMenuWidth = false;	// Width of sub menu items - A number(width in pixels) or false when width should be dynamic

var xOffsetSubMenu = 0; 	// Offset x-position of sub menu items - use negative value if you want the sub menu to overlap main menu

var slideDirection = 'right';	// Slide to left or right ?

/* Don't change anything below here */

var activeSubMenuId = false;
var activeMainMenuItem = false;
var currentZIndex = 1000;
var autoHideTimer = 0;
var submenuObjArray = new Array();
var okToSlideInSub = new Array();
var subPositioned = new Array();


function stopAutoHide()
{
    autoHideTimer = -1;
}

function autoHide()
{

    if(autoHideTimer>timeBeforeAutoHide)
    {

        if(activeMainMenuItem){
            activeMainMenuItem.className='';
            activeMainMenuItem = false;
        }

        if(activeSubMenuId){
            var obj = document.getElementById('subMenuDiv' + activeSubMenuId);
            showSub();
        }
    }else{
        if(autoHideTimer>=0){
            autoHideTimer+=50;
            setTimeout('autoHide()',50);
        }
    }
}

function initAutoHide()
{
    autoHideTimer = 0;
    if(autoHideTimer>=0) {
        autoHide();
    }
}

function getTopPos(inputObj)
{
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
  return returnValue;
}

function getLeftPos(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
  return returnValue;
}

function showSub()
{
	
    var subObj = false;
    if(this && this.tagName){
        var numericId = this.parentNode.id.replace(/[^0-9]/g,'');
        okToSlideInSub[numericId] = false;
        var subObj = document.getElementById('subMenuDiv' + numericId);
        if(activeMainMenuItem)activeMainMenuItem.className='';
        if(subObj){
            if(!subPositioned[numericId]){
                if(slideDirection=='right'){
                    subObj.style.left = getLeftPos(submenuObjArray[numericId]['parentDiv']) + submenuObjArray[numericId]['parentDiv'].offsetWidth + xOffsetSubMenu + 'px';
                }else{
                    subObj.style.left = getLeftPos(submenuObjArray[numericId]['parentDiv']) + xOffsetSubMenu +  'px';

                }
                submenuObjArray[numericId]['left'] = subObj.style.left.replace(/[^0-9]/g,'');
           
                subObj.style.top = getTopPos(submenuObjArray[numericId]['parentDiv']) +  'px';
                subPositioned[numericId] = true;
            }
            subObj.style.visibility = 'visible';
            subObj.style.zIndex = currentZIndex;
           	subObj.firstChild.style.visibility = 'visible';
            currentZIndex++;
            this.className='activeMainMenuItem';
            activeMainMenuItem = this;
        }
    }else{
        var numericId = activeSubMenuId;
    }
    if(activeSubMenuId && (numericId!=activeSubMenuId || !subObj))slideMenu(activeSubMenuId,(slideSpeed_in*-1));
    if(numericId!=activeSubMenuId && this && subObj){
        subObj.style.width = '0px';
        slideMenu(numericId,slideSpeed_out);
        activeSubMenuId = numericId;
    }else{
        if(numericId!=activeSubMenuId)activeSubMenuId = false;
    }
    if(showSubOnMouseOver)stopAutoHide();
}

function slideMenu(menuIndex,speed){
	
    var obj = submenuObjArray[menuIndex]['divObj'];
     
    var obj2 = submenuObjArray[menuIndex]['ulObj'];
    var width = obj.offsetWidth + speed;
    if(speed<0){
        if(width<0)width = 0;
        obj.style.width = width + 'px';
        if(slideDirection=='left'){
            obj.style.left = submenuObjArray[menuIndex]['left'] - width + 'px';
            obj2.style.left = '0px';
        }else{
            obj2.style.left = width - submenuObjArray[menuIndex]['width'] + 'px'
        }
        if(width>0 && okToSlideInSub[menuIndex])setTimeout('slideMenu(' + menuIndex + ',' + speed + ')',slideTimeout_in); else{
            obj.style.visibility = 'hidden';
            obj2.style.visibility = 'hidden';
            obj.style.width = '0px';
            if(activeSubMenuId==menuIndex)activeSubMenuId=false;
        }

    }else{
        if(width>submenuObjArray[menuIndex]['width'])width = submenuObjArray[menuIndex]['width'];
        if(slideDirection=='left'){
            obj.style.left = submenuObjArray[menuIndex]['left'] - width + 'px';
            obj2.style.left = '0px';
        }else{
            obj2.style.left = width - submenuObjArray[menuIndex]['width'] + 'px'
        }
		 
        obj.style.width = width + 'px';
       
        if(width<submenuObjArray[menuIndex]['width']){
            setTimeout('slideMenu(' + menuIndex + ',' + speed + ')',slideTimeout_out);
        }else{
            okToSlideInSub[menuIndex] = true;
        }
    }
}
function resetPosition()
{
    subPositioned.length = 0;
}

function initLeftMenu()
{
    var isMSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false;
    var browserVersion = parseInt(navigator.userAgent.replace(/.*?MSIE ([0-9]+?)[^0-9].*/g,'$1'));
    if(!browserVersion)browserVersion=1;

    var menuObj = document.getElementById('dhtmlgoodies_menu');
    if (!menuObj) return;

    var mainMenuItemArray = new Array();
	
    var mainMenuItem = menuObj.getElementsByTagName('LI')[0];
    while(mainMenuItem){
        if(mainMenuItem.tagName && mainMenuItem.tagName.toLowerCase()=='li'){
            mainMenuItemArray[mainMenuItemArray.length] = mainMenuItem;

            var aTag = mainMenuItem.getElementsByTagName('A')[0];
            if(showSubOnMouseOver)
                aTag.onmouseover = showSub;
            else
                aTag.onclick = showSub;
        }
        mainMenuItem = mainMenuItem.nextSibling;
    }

    var lis = menuObj.getElementsByTagName('A');
    for(var no=0;no<lis.length;no++){
        if(!showSubOnMouseOver)lis[no].onmouseover = stopAutoHide;
        lis[no].onmouseout = initAutoHide;
        lis[no].onmousemove = stopAutoHide;
    }

    for(var no=0;no<mainMenuItemArray.length;no++){
        var sub = mainMenuItemArray[no].getElementsByTagName('UL')[0];
        if(sub){
            mainMenuItemArray[no].id = 'mainMenuItem' + (no+1);
            var div = document.createElement('DIV');
            div.className='dhtmlgoodies_subMenu';
           
            
            
     
            
           
            //td.appendChild(sub);
           //div.appendChild(table);
             
             //
            
         
            //sub.appendChild(subUL);            
           
            
            div.appendChild(sub);
            
            document.body.appendChild(div);
            if(slideDirection=='right'){
                div.style.left = getLeftPos(mainMenuItemArray[no]) + mainMenuItemArray[no].offsetWidth + xOffsetSubMenu + 'px';
            }else{
                div.style.left = getLeftPos(mainMenuItemArray[no]) + xOffsetSubMenu + 'px';
            }
            div.style.top = getTopPos(mainMenuItemArray[no]) + 'px';
            div.id = 'subMenuDiv' + (no+1);
            sub.id = 'submenuUl' + (no+1);
            sub.style.position = 'relative';

            if(navigator.userAgent.indexOf('Opera')>=0){
                submenuObjArray[no+1] = new Array();
                submenuObjArray[no+1]['parentDiv'] = mainMenuItemArray[no];
                submenuObjArray[no+1]['divObj'] = div;
                submenuObjArray[no+1]['ulObj'] = sub;
                submenuObjArray[no+1]['width'] = sub.offsetWidth;
                submenuObjArray[no+1]['left'] = div.style.left.replace(/[^0-9]/g,'');
            }
            sub.style.left = 1 - sub.offsetWidth + 'px';

			

            if(browserVersion<7 && isMSIE)div.style.width = '1px';

            if(navigator.userAgent.indexOf('Opera')<0){
                submenuObjArray[no+1] = new Array();
                submenuObjArray[no+1]['parentDiv'] = mainMenuItemArray[no];
                submenuObjArray[no+1]['divObj'] = div;
                submenuObjArray[no+1]['ulObj'] = sub;
                submenuObjArray[no+1]['width'] = sub.offsetWidth;



                submenuObjArray[no+1]['left'] = div.style.left.replace(/[^0-9]/g,'');
                if(fixedSubMenuWidth)submenuObjArray[no+1]['width'] = fixedSubMenuWidth;
            }
            

            if(!document.all)div.style.width = '1px';

        }
    }
    menuObj.style.visibility = 'visible';

    window.onresize = resetPosition;
    
}


/*******************************************************************
TOP MENU STARTS HERE
*******************************************************************/

var dhtmlgoodies_topmenuObj;	// Reference to the menu div
var currentTopZIndex = 2000;
var liIndex = 0;
var visibleMenus = new Array();
var activeTopMenuItem = false;
var timeBeforeTopAutoHide = 200; // Microseconds from mouse leaves menu to auto hide.
var dhtmlgoodies_topmenu_arrow = 'images/arrow.gif';

var MSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false;
var navigatorVersion = navigator.appVersion.replace(/.*?MSIE ([0-9]\.[0-9]).*/g,'$1')/1;
var menuBlockArray = new Array();
var menuParentOffsetLeft = false;



function getTopTopPos(inputObj)
{

  var returnValue = inputObj.offsetTop;
  if(inputObj.tagName=='LI' && inputObj.parentNode.className=='menuBlock1'){
    var aTag = inputObj.getElementsByTagName('A')[0];
    if(aTag)returnValue += aTag.parentNode.offsetHeight;

  }
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;

  return returnValue;
}

function getTopLeftPos(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
  return returnValue;
}

function showHideTopSub()
{
    var attr = this.parentNode.getAttribute('currentDepth');
    if(navigator.userAgent.indexOf('Opera')>=0){
        attr = this.parentNode.currentDepth;
    }
    this.className = 'currentDepth' + attr + 'over';
    if(activeTopMenuItem && activeTopMenuItem!=this){
        activeTopMenuItem.className=activeTopMenuItem.className.replace(/over/,'');
    }
    activeTopMenuItem = this;
    var numericIdThis = this.id.replace(/[^0-9]/g,'');
    var exceptionArray = new Array();
    // Showing sub item of this LI
    var sub = document.getElementById('subOf' + numericIdThis);
    if(sub){
        visibleMenus.push(sub);
        sub.style.display='';
        sub.parentNode.className = sub.parentNode.className + 'over';
        exceptionArray[sub.id] = true;
    }
    // Showing parent items of this one
    var parent = this.parentNode;
    while(parent && parent.id && parent.tagName=='UL'){
        visibleMenus.push(parent);
        exceptionArray[parent.id] = true;
        parent.style.display='';

        var li = document.getElementById('dhtmlgoodies_listItem' + parent.id.replace(/[^0-9]/g,''));
        if(li.className.indexOf('over')<0)li.className = li.className + 'over';
        parent = li.parentNode;

    }
    hideTopMenuItems(exceptionArray);
}

function hideTopMenuItems(exceptionArray)
{
    /*
    Hiding visible menu items
    */
    var newVisibleMenuArray = new Array();
    for(var no=0;no<visibleMenus.length;no++){
        if(visibleMenus[no].className!='menuBlock1' && visibleMenus[no].id){
            if(!exceptionArray[visibleMenus[no].id]){
                var el = visibleMenus[no].getElementsByTagName('A')[0];
                visibleMenus[no].style.display = 'none';
                var li = document.getElementById('dhtmlgoodies_listItem' + visibleMenus[no].id.replace(/[^0-9]/g,''));
                if(li.className.indexOf('over')>0)li.className = li.className.replace(/over/,'');
            }else{
                newVisibleMenuArray.push(visibleMenus[no]);
            }
        }
    }
    visibleMenus = newVisibleMenuArray;
}
var menuActive = true;
var hideTimer = 0;

function mouseOverMenu()
{
    menuActive = true;
}

function mouseOutTopMenu()
{
    menuActive = false;
    timerAutoTopHide();
}

function timerAutoTopHide()
{
    if(menuActive){
        hideTimer = 0;
        return;
    }

    if(hideTimer<timeBeforeTopAutoHide){
        hideTimer+=100;
        setTimeout('timerAutoTopHide()',99);
    }else{
        hideTimer = 0;
        autohideTopMenuItems();
    }
}

function autohideTopMenuItems()
{
    if(!menuActive){
        hideTopMenuItems(new Array());
        if(activeTopMenuItem)activeTopMenuItem.className=activeTopMenuItem.className.replace(/over/,'');
    }
}


function initSubTopMenus(inputObj,initOffsetLeft,currentDepth)
{
    var subUl = inputObj.getElementsByTagName('UL');
    if(subUl.length>0){
        var ul = subUl[0];
		
        ul.id = 'subOf' + inputObj.id.replace(/[^0-9]/g,'');
        ul.setAttribute('currentDepth' ,currentDepth);
        ul.currentDepth = currentDepth;
        ul.className='menuBlock' + currentDepth;
        ul.onmouseover = mouseOverMenu;
        ul.onmouseout = mouseOutTopMenu;
        currentTopZIndex+=1;
        ul.style.zIndex = currentTopZIndex;
        menuBlockArray.push(ul);
        var topPos = getTopTopPos(inputObj);
        var leftPos = getTopLeftPos(inputObj)/1 + initOffsetLeft/1;
        ul = dhtmlgoodies_topmenuObj.appendChild(ul);
        ul.style.position = 'absolute';
        ul.style.left = leftPos + 'px';
        ul.style.top = 67 + 'px';
        var li = ul.getElementsByTagName('LI')[0];

        while(li){
            if(li.tagName=='LI'){
                li.className='currentDepth' + currentDepth;
                li.id = 'dhtmlgoodies_listItem' + liIndex;
                liIndex++;
                var uls = li.getElementsByTagName('UL');
                li.onmouseover = showHideTopSub;

                if(uls.length>0){
                    var offsetToFunction = li.getElementsByTagName('A')[0].offsetWidth+2;
                    if(navigatorVersion<6 && MSIE)offsetToFunction+=15;	// MSIE 5.x fix
                    initSubTopMenus(li,offsetToFunction,(currentDepth+1));
                }
                if(MSIE){
                    var a = li.getElementsByTagName('A')[0];
                    a.style.width=li.offsetWidth+'px';
                    a.style.display='block';
                }
            }
            li = li.nextSibling;
        }
        ul.style.display = 'none';
        if(!document.all){
            //dhtmlgoodies_topmenuObj.appendChild(ul);
        }
    }
}


function resizeTopMenu()
{
    var offsetParent = getTopLeftPos(dhtmlgoodies_topmenuObj);

    for(var no=0;no<menuBlockArray.length;no++){
        var leftPos = menuBlockArray[no].style.left.replace('px','')/1;
        menuBlockArray[no].style.left = leftPos + offsetParent - menuParentOffsetLeft + 'px';
    }
    menuParentOffsetLeft = offsetParent;
}

/*
Initializing menu
*/
function initDhtmlGoodiesMenu()
{
    dhtmlgoodies_topmenuObj = document.getElementById('dhtmlgoodies_topmenu');


    var aTags = dhtmlgoodies_topmenuObj.getElementsByTagName('A');
    for(var no=0;no<aTags.length;no++){

        var subUl = aTags[no].parentNode.getElementsByTagName('UL');
        if(subUl.length>0 && aTags[no].parentNode.parentNode.parentNode.id != 'dhtmlgoodies_topmenu'){
            var img = document.createElement('IMG');
            img.src = dhtmlgoodies_topmenu_arrow;
            aTags[no].appendChild(img);

        }

    }

    var mainMenu = dhtmlgoodies_topmenuObj.getElementsByTagName('UL')[0];
    mainMenu.className='menuBlock1';
    mainMenu.style.zIndex = currentTopZIndex;
    mainMenu.setAttribute('currentDepth' ,1);
    mainMenu.currentDepth = '1';
    mainMenu.onmouseover = mouseOverMenu;
    mainMenu.onmouseout = mouseOutTopMenu;

    var mainMenuItemsArray = new Array();
    var mainMenuItem = mainMenu.getElementsByTagName('LI')[0];
    mainMenu.style.height = mainMenuItem.offsetHeight + 2 + 'px';
    while(mainMenuItem){

        mainMenuItem.className='currentDepth1';
        mainMenuItem.id = 'dhtmlgoodies_listItem' + liIndex;
        mainMenuItem.onmouseover = showHideTopSub;
        liIndex++;
        if(mainMenuItem.tagName=='LI'){
            mainMenuItem.style.cssText = 'float:left;';
            mainMenuItem.style.styleFloat = 'left';
            mainMenuItemsArray[mainMenuItemsArray.length] = mainMenuItem;
            initSubTopMenus(mainMenuItem,0,2);
        }

        mainMenuItem = mainMenuItem.nextSibling;
    }
    for(var no=0;no<mainMenuItemsArray.length;no++){
        initSubTopMenus(mainMenuItemsArray[no],0,2);
    }
    menuParentOffsetLeft = getTopLeftPos(dhtmlgoodies_topmenuObj);
    window.onresize = resizeTopMenu;
    dhtmlgoodies_topmenuObj.style.visibility = 'visible';
}
window.onload = initLeftMenu;
//window.onload = initDhtmlGoodiesMenu;
