﻿var _g666 = false;
if ( $.browser.msie )
{
    if( $.browser.version.split(".")[0] == 6)
    {
        //Show ie6 access denied
        _g666 = true;
    }        
}


var _gSubNavMenuOpen = false;
var _gSubNavMenuOver = false;
    
var _gWindowWidth = 0;
var _gWindowHeight = 0;
function getWindowSize(){var w=0;var h=0;if(!window.innerWidth){if(!(document.documentElement.clientWidth==0)){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight}else{w=document.body.clientWidth;h=document.body.clientHeight}}else{w=window.innerWidth;h=window.innerHeight}window.Width=w;window.Height=h;_gWindowWidth=w;_gWindowHeight=h}

//function setCookie(c_name,value,expiredays)
//{
//    var exdate=new Date();
//    exdate.setDate(exdate.getDate()+expiredays);
//    document.cookie=c_name+ "=" +escape(value)+
//    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
//}
//function getCookie(c_name)
//{
//    if (document.cookie.length>0)
//    {
//        c_start=document.cookie.indexOf(c_name + "=");
//        if (c_start!=-1)
//        {
//            c_start=c_start + c_name.length+1;
//            c_end=document.cookie.indexOf(";",c_start);
//            if (c_end==-1) c_end=document.cookie.length;
//            return unescape(document.cookie.substring(c_start,c_end));
//        }
//    }
//    return "";
//}


$(function()
{
    if (_g666 == true)
    {
        $("#IEContainer").removeClass("hidden"); 
    }
    else
    {
        $("#mainContainer").fadeIn("slow");
    }
    getWindowSize();
    
    $("#careers_main").css({minHeight:_gWindowHeight-420}); //ONLY APPLICABLE FOR CAREERS PAGE

//    var cookie = getCookie('HANDASIA_LOADED'); 
//    if (cookie!=null && cookie!="") $("#mainContainer").fadeIn("slow");
    
    //Remove outline from links
	$("a").click(function(){ $(this).blur(); });
    
    $("ul.navmenu span, #ourprojects span").css("opacity","0");
	$("ul.navmenu span, #ourprojects span").hover
	(
	    function () { $(this).stop().animate({ opacity: 1 }, 'fast'); },
	    function () { $(this).stop().animate({ opacity: 0 }, 'fast'); }
	);
	
	//$("#services_subnavmenu").css("opacity","0");
	$("ul.navmenu a.services").hover
	(
	    function () 
	    { 
	        setTimeout(function()
	        {
	            _gSubNavMenuOpen = true;
	            $("#services_subnavmenu").removeClass("hidden");
	            //$("#services_subnavmenu").stop().animate({ opacity: 1 }, 'fast'); 
	            
	        }, 0);
	    },
	    function () 
	    { 
	        _gSubNavMenuOpen = false;
	        setTimeout(function()
	        {
	            if ( _gSubNavMenuOver == false && _gSubNavMenuOpen == false )
	            {
	                //$("#services_subnavmenu").stop().animate({ opacity: 0 }, 'fast');
	                $("#services_subnavmenu").addClass("hidden");
	            }
	        }, 0);
	        
	    }
	);
	$("#services_subnavmenu").hover
	(
	    function () { _gSubNavMenuOver = true; },
	    function () 
	    { 
	        _gSubNavMenuOver = false;
	        _gSubNavMenuOpen = false;
	        //$("#services_subnavmenu").stop().animate({ opacity: 0 }, 'fast');
	        $("#services_subnavmenu").addClass("hidden"); 
	    }
	);
	
	$("#services_subnavmenu, ul.navmenu a.services").mouseout(function(){ _gSubNavMenuOpen = false; });
	$("ul.navmenu a.home, a.about, a.projects, a.careers, a.contact").mouseover(function()
	{ 
	    _gSubNavMenuOver = false;_gSubNavMenuOpen = false;
	    //$("#services_subnavmenu").stop().animate({ opacity: 0 }, 'fast');
	    $("#services_subnavmenu").addClass("hidden");
	});
		
    
    $("#empulsia").css("opacity","0.5");
    $("#empulsia").hover(
      function () {
         $("#empulsia").animate({opacity: 1}, 700);
      }, 
      function () {
        $("#empulsia").animate({opacity: 0.5}, 700);
      }
    );
        
});
