var hoverTimeout = 200;

var mhmeTimer = 0;
var mdpnTimer = 0;
var mwebTimer = 0;
var mgfxTimer = 0;
var moptTimer = 0;
var msavTimer = 0;
var mlabTimer = 0;
var mcntTimer = 0;

var isOverHvrhme    = false;
var isOverMhme      = false;
var isOverHvrdpn    = false;
var isOverMdpn      = false;
var isOverHvrweb    = false;
var isOverMweb      = false;
var isOverHvrgfx    = false;
var isOverMgfx      = false;
var isOverHvropt    = false;
var isOverMopt      = false;
var isOverHvrsav    = false;
var isOverMsav      = false;
var isOverHvrlab    = false;
var isOverMlab      = false;
var isOverHvrcnt    = false;
var isOverMcnt      = false;


function hmeOut()
{
    if(!isOverHvrhme && !isOverMhme)
    {
        $("#hvrhme").slideUp("fast", function()
        {
            $("#lhme").removeClass("mhmeOvr");
            $("#lhme").addClass("mhmeOut");
            $("#hvrhmeright").css("background-position", "0px 0px");
        });
    }        
}

function dpnOut()
{
    if(!isOverHvrdpn && !isOverMdpn)
    {
        $("#hvrdpn").slideUp("fast", function()
        {
            $("#ldpn").removeClass("mdpnOvr");
            $("#ldpn").addClass("mdpnOut");
        });
    }        
}

function webOut()
{
    if(!isOverHvrweb && !isOverMweb)
    {
        $("#hvrweb").slideUp("fast", function()
        {
            $("#lweb").removeClass("mwebOvr");
            $("#lweb").addClass("mwebOut");
            $("#hvrwebright").css("background-position", "0px 0px");
        });
    }        
}

function gfxOut()
{
    if(!isOverHvrgfx && !isOverMgfx)
    {
        $("#hvrgfx").slideUp("fast", function()
        {
            $("#lgfx").removeClass("mgfxOvr");
            $("#lgfx").addClass("mgfxOut");
            $("#hvrgfxright").css("background-position", "0px 0px");
       });
    }        
}

function optOut()
{
    if(!isOverHvropt && !isOverMopt)
    {
        $("#hvropt").slideUp("fast", function()
        {
            $("#lopt").removeClass("moptOvr");
            $("#lopt").addClass("moptOut");
            $("#hvroptright").css("background-position", "0px 0px");
        });
    }        
}

function savOut()
{
    if(!isOverHvrsav && !isOverMsav)
    {
        $("#hvrsav").slideUp("fast", function()
        {
            $("#lsav").removeClass("msavOvr");
            $("#lsav").addClass("msavOut");
            $("#hvrsavright").css("background-position", "0px 0px");
        });
    }        
}

function labOut()
{
    if(!isOverHvrlab && !isOverMlab)
    {
        $("#hvrlab").slideUp("fast", function()
        {
            $("#llab").removeClass("mlabOvr");
            $("#llab").addClass("mlabOut");
            $("#hvrlabright").css("background-position", "0px 0px");
        });
    }        
}

function cntOut()
{
    if(!isOverHvrcnt && !isOverMcnt)
    {
        $("#hvrcnt").slideUp("fast", function()
        {
            $("#lcnt").removeClass("mcntOvr");
            $("#lcnt").addClass("mcntOut");
        });
    }        
}


$(document).ready(function()
{
    // <HME>
    $("#mhme").hover
    (
        function()
        { 
            isOverMhme = true;
            if(mhmeTimer)
            {
                clearTimeout(mhmeTimer);
            }

            $("#lhme").removeClass("mhmeOut");
            $("#lhme").addClass("mhmeOvr");
            
            $("#hvrweb").css("z-index", "1000");
            $("#hvrgfx").css("z-index", "1000");
            $("#hvropt").css("z-index", "1000");
            $("#hvrsav").css("z-index", "1000");
            $("#hvrlab").css("z-index", "1000");
            $("#hvrcnt").css("z-index", "1000");
            $("#hvrdpn").css("z-index", "1000");
            $("#hvrhme").css("z-index", "1010");

            $("#hvrhme").slideDown("fast");
        }, 
        function()
        { 
            isOverMhme = false;
            if(mhmeTimer)
            {
                clearTimeout(mhmeTimer);
            }
            mhmeTimer = setTimeout("hmeOut()", hoverTimeout);
        } 
    );
    
    $("#hvrhme").hover
    (
        function() 
        { 
            isOverHvrhme = true;
        }, 
        function()
        { 
            isOverHvrhme = false;
            if(mhmeTimer)
            {
                clearTimeout(mhmeTimer);
            }
            mhmeTimer = setTimeout("hmeOut()", hoverTimeout);
        } 
    );
    // </HME>

    // <DPN>
    $("#mdpn").hover
    (
        function()
        { 
            isOverMdpn = true;
            if(mdpnTimer)
            {
                clearTimeout(mdpnTimer);
            }

            $("#ldpn").removeClass("mdpnOut");
            $("#ldpn").addClass("mdpnOvr");
            
            $("#hvrhme").css("z-index", "1000");
            $("#hvrweb").css("z-index", "1000");
            $("#hvrgfx").css("z-index", "1000");
            $("#hvropt").css("z-index", "1000");
            $("#hvrsav").css("z-index", "1000");
            $("#hvrlab").css("z-index", "1000");
            $("#hvrcnt").css("z-index", "1000");
            $("#hvrdpn").css("z-index", "1010");

            $("#hvrdpn").slideDown("fast");
        }, 
        function()
        { 
            isOverMdpn = false;
            if(mdpnTimer)
            {
                clearTimeout(mdpnTimer);
            }
            mdpnTimer = setTimeout("dpnOut()", hoverTimeout);
        } 
    );
    
    $("#hvrdpn").hover
    (
        function() 
        { 
            isOverHvrdpn = true;
        }, 
        function()
        { 
            isOverHvrdpn = false;
            if(mdpnTimer)
            {
                clearTimeout(mdpnTimer);
            }
            mdpnTimer = setTimeout("dpnOut()", hoverTimeout);
        } 
    );
    // </DPN>

   // <WEB>
    $("#mweb").hover
    (
        function()
        { 
            isOverMweb = true;
            if(mwebTimer)
            {
                clearTimeout(mwebTimer);
            }

            $("#lweb").removeClass("mwebOut");
            $("#lweb").addClass("mwebOvr");
            
            $("#hvrhme").css("z-index", "1000");
            $("#hvrdpn").css("z-index", "1000");
            $("#hvrgfx").css("z-index", "1000");
            $("#hvropt").css("z-index", "1000");
            $("#hvrsav").css("z-index", "1000");
            $("#hvrlab").css("z-index", "1000");
            $("#hvrcnt").css("z-index", "1000");
            $("#hvrweb").css("z-index", "1010");

            $("#hvrweb").slideDown("fast");
        }, 
        function()
        { 
            isOverMweb = false;
            if(mwebTimer)
            {
                clearTimeout(mwebTimer);
            }
            mwebTimer = setTimeout("webOut()", hoverTimeout);
        } 
    );
    
    $("#hvrweb").hover
    (
        function() 
        { 
            isOverHvrweb = true;
        }, 
        function()
        { 
            isOverHvrweb = false;
            if(mwebTimer)
            {
                clearTimeout(mwebTimer);
            }
            mwebTimer = setTimeout("webOut()", hoverTimeout);
        } 
    );
    // </WEB>

    // <GFX>
    $("#mgfx").hover
    (
        function()
        { 
            isOverMgfx = true;
            if(mgfxTimer)
            {
                clearTimeout(mgfxTimer);
            }

            $("#lgfx").removeClass("mgfxOut");
            $("#lgfx").addClass("mgfxOvr");
            
            $("#hvrhme").css("z-index", "1000");
            $("#hvrdpn").css("z-index", "1000");
            $("#hvrweb").css("z-index", "1000");
            $("#hvropt").css("z-index", "1000");
            $("#hvrsav").css("z-index", "1000");
            $("#hvrlab").css("z-index", "1000");
            $("#hvrcnt").css("z-index", "1000");
            $("#hvrgfx").css("z-index", "1010");

            $("#hvrgfx").slideDown("fast");
        }, 
        function()
        { 
            isOverMgfx = false;
            if(mgfxTimer)
            {
                clearTimeout(mgfxTimer);
            }
            mgfxTimer = setTimeout("gfxOut()", hoverTimeout);
        } 
    );
    
    $("#hvrgfx").hover
    (
        function() 
        { 
            isOverHvrgfx = true;
        }, 
        function()
        { 
            isOverHvrgfx = false;
            if(mgfxTimer)
            {
                clearTimeout(mgfxTimer);
            }
            mgfxTimer = setTimeout("gfxOut()", hoverTimeout);
        } 
    );
    // </GFX>

    // <OPT>
    $("#mopt").hover
    (
        function()
        { 
            isOverMopt = true;
            if(moptTimer)
            {
                clearTimeout(moptTimer);
            }

            $("#lopt").removeClass("moptOut");
            $("#lopt").addClass("moptOvr");
            
            $("#hvrhme").css("z-index", "1000");
            $("#hvrdpn").css("z-index", "1000");
            $("#hvrweb").css("z-index", "1000");
            $("#hvrgfx").css("z-index", "1000");
            $("#hvrsav").css("z-index", "1000");
            $("#hvrlab").css("z-index", "1000");
            $("#hvrcnt").css("z-index", "1000");
            $("#hvropt").css("z-index", "1010");

            $("#hvropt").slideDown("fast");
        }, 
        function()
        { 
            isOverMopt = false;
            if(moptTimer)
            {
                clearTimeout(moptTimer);
            }
            moptTimer = setTimeout("optOut()", hoverTimeout);
        } 
    );
    
    $("#hvropt").hover
    (
        function() 
        { 
            isOverHvropt = true;
        }, 
        function()
        { 
            isOverHvropt = false;
            if(moptTimer)
            {
                clearTimeout(moptTimer);
            }
            moptTimer = setTimeout("optOut()", hoverTimeout);
        } 
    );
    // </OPT>
    
    // <SAV>
    $("#msav").hover
    (
        function()
        { 
            isOverMsav = true;
            if(msavTimer)
            {
                clearTimeout(msavTimer);
            }

            $("#lsav").removeClass("msavOut");
            $("#lsav").addClass("msavOvr");
            
            $("#hvrhme").css("z-index", "1000");
            $("#hvrdpn").css("z-index", "1000");
            $("#hvrweb").css("z-index", "1000");
            $("#hvrgfx").css("z-index", "1000");
            $("#hvropt").css("z-index", "1000");
            $("#hvrlab").css("z-index", "1000");
            $("#hvrcnt").css("z-index", "1000");
            $("#hvrsav").css("z-index", "1010");

            $("#hvrsav").slideDown("fast");
        }, 
        function()
        { 
            isOverMsav = false;
            if(msavTimer)
            {
                clearTimeout(msavTimer);
            }
            msavTimer = setTimeout("savOut()", hoverTimeout);
        } 
    );
    
    $("#hvrsav").hover
    (
        function() 
        { 
            isOverHvrsav = true;
        }, 
        function()
        { 
            isOverHvrsav = false;
            if(msavTimer)
            {
                clearTimeout(msavTimer);
            }
            msavTimer = setTimeout("savOut()", hoverTimeout);
        } 
    );
    // </SAV>

    // <LAB>
    $("#mlab").hover
    (
        function()
        { 
            isOverMlab = true;
            if(mlabTimer)
            {
                clearTimeout(mlabTimer);
            }

            $("#llab").removeClass("mlabOut");
            $("#llab").addClass("mlabOvr");
            
            $("#hvrhme").css("z-index", "1000");
            $("#hvrdpn").css("z-index", "1000");
            $("#hvrweb").css("z-index", "1000");
            $("#hvrgfx").css("z-index", "1000");
            $("#hvropt").css("z-index", "1000");
            $("#hvrsav").css("z-index", "1000");
            $("#hvrcnt").css("z-index", "1000");
            $("#hvrlab").css("z-index", "1010");

            $("#hvrlab").slideDown("fast");
        }, 
        function()
        { 
            isOverMlab = false;
            if(mlabTimer)
            {
                clearTimeout(mlabTimer);
            }
            mlabTimer = setTimeout("labOut()", hoverTimeout);
        } 
    );
    
    $("#hvrlab").hover
    (
        function() 
        { 
            isOverHvrlab = true;
        }, 
        function()
        { 
            isOverHvrlab = false;
            if(mlabTimer)
            {
                clearTimeout(mlabTimer);
            }
            mlabTimer = setTimeout("labOut()", hoverTimeout);
        } 
    );
    // </LAB>

    // <CNT>
    $("#mcnt").hover
    (
        function()
        { 
            isOverMcnt = true;
            if(mcntTimer)
            {
                clearTimeout(mcntTimer);
            }

            $("#lcnt").removeClass("mcntOut");
            $("#lcnt").addClass("mcntOvr");
            
            $("#hvrhme").css("z-index", "1000");
            $("#hvrdpn").css("z-index", "1000");
            $("#hvrweb").css("z-index", "1000");
            $("#hvrgfx").css("z-index", "1000");
            $("#hvropt").css("z-index", "1000");
            $("#hvrsav").css("z-index", "1000");
            $("#hvrlab").css("z-index", "1000");
            $("#hvrcnt").css("z-index", "1010");

            $("#hvrcnt").slideDown("fast");
        }, 
        function()
        { 
            isOverMcnt = false;
            if(mcntTimer)
            {
                clearTimeout(mcntTimer);
            }
            mcntTimer = setTimeout("cntOut()", hoverTimeout);
        } 
    );
    
    $("#hvrcnt").hover
    (
        function() 
        { 
            isOverHvrcnt = true;
        }, 
        function()
        { 
            isOverHvrcnt = false;
            if(mcntTimer)
            {
                clearTimeout(mcntTimer);
            }
            mcntTimer = setTimeout("cntOut()", hoverTimeout);
        } 
    );
    // </CNT>
  
    //Menu Home
	    
    $("#mhmeiai").hover
    (
        function()
        {
			$("#hvrhmeright").animate({ backgroundPosition : "-208px 0px" }, "fast"); 
        },
        function()
        {
        }
    );    
    
	$("#mhmeiat").hover
    (
        function()
        {
			$("#hvrhmeright").animate({ backgroundPosition : "-416px 0px" }, "fast");            
        },
        function()
        {
        }
    );    
    
	$("#mhmeimv").hover
    (
        function()
        {
			$("#hvrhmeright").animate({ backgroundPosition : "-624px 0px" }, "fast"); 
        },
        function()
        {
        }
    );    
    
	$("#mhmeiwb").hover
    (
        function()
        {
			$("#hvrhmeright").animate({ backgroundPosition : "-832px 0px" }, "fast"); 
        },
        function()
        {
        }
    );    
    
	$("#mhmeipp").hover
    (
        function()
        {
			$("#hvrhmeright").animate({ backgroundPosition : "-1040px 0px" }, "fast"); 
        },
        function()
        {
        }
    );    
    
	$("#mhmeimi").hover
    (
        function()
        {
			$("#hvrhmeright").animate({ backgroundPosition : "-1248px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    //Webdesign

    $("#mwebwdi").hover    
    (
        function()
        {
            $("#hvrwebright").animate({ backgroundPosition : "0px 0px" }, "fast"); 
        },
        function()
        {
        }
    );

    $("#mwebpfi").hover    
    (
        function()
        {
            $("#hvrwebright").animate({ backgroundPosition : "-151px 0px" }, "fast"); 
        },
        function()
        {
        }
    );

    $("#mwebnli").hover    
    (
        function()
        {
            $("#hvrwebright").animate({ backgroundPosition : "-302px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    //Grafica
    $("#mgfxldi").hover    
    (
        function()
        {
            $("#hvrgfxright").animate({ backgroundPosition : "-216px 0px" }, "fast"); 
        },
        function()
        {
        }
    );

    $("#mgfxmii").hover    
    (
        function()
        {
            $("#hvrgfxright").animate({ backgroundPosition : "-432px 0px" }, "fast"); 
        },
        function()
        {
        }
    );

    $("#mgfxpai").hover    
    (
        function()
        {
            $("#hvrgfxright").animate({ backgroundPosition : "-648px 0px" }, "fast"); 
        },
        function()
        {
        }
    );

    $("#mgfxcbi").hover    
    (
        function()
        {
            $("#hvrgfxright").animate({ backgroundPosition : "-864px 0px" }, "fast"); 
        },
        function()
        {
        }
    );

    $("#mgfxafi").hover    
    (
        function()
        {
            $("#hvrgfxright").animate({ backgroundPosition : "-1080px 0px" }, "fast"); 
        },
        function()
        {
        }
    );

    $("#mgfxcdi").hover    
    (
        function()
        {
            $("#hvrgfxright").animate({ backgroundPosition : "-1296px 0px" }, "fast"); 
        },
        function()
        {
        }
    );

    $("#mgfxpii").hover    
    (
        function()                                                
        {
            $("#hvrgfxright").animate({ backgroundPosition : "-1512px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    //Optimizare
    $("#moptogi").hover    
    (
        function()
        {
            $("#hvroptright").animate({ backgroundPosition : "-203px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    $("#moptpai").hover    
    (
        function()
        {
            $("#hvroptright").animate({ backgroundPosition : "-406px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    //Solutii Antivirus
    $("#msavndi").hover    
    (
        function()
        {
            $("#hvrsavright").animate({ backgroundPosition : "-94px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    $("#msavssi").hover    
    (
        function()
        {
            $("#hvrsavright").animate({ backgroundPosition : "-188px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    //Lab
    $("#mlabwni").hover    
    (
        function()
        {
            $("#hvrlabright").animate({ backgroundPosition : "-214px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    $("#mlabwpi").hover    
    (
        function()
        {
            $("#hvrlabright").animate({ backgroundPosition : "-428px 0px" }, "fast"); 
        },
        function()
        {
        }
    );
    
    
    
    $("p").hover( function() { $(this).css("color", "#000000"); }, function() { $(this).css("color", "#555555"); });
});
