// JavaScript Document
var mytimer;

function hideAllMenu()
{
 
$("#menu_weare").css("display","none");
$("#menu_whyus").css("display","none");
$("#menu_products").css("display","none");
$("#menu_services").css("display","none");
$("#menu_support").css("display","none");
$("#menu_career").css("display","none");
$("#menu_infra").css("display","none");

}

/*function showHide_show(menuBtnId, menuId)
{
hideAllMenu();
$(menuId).fadeIn("fast");
alignToBtn(menuBtnId,menuId);
$(menuId).fadeTo("fast",0.95);
}
function showHide_hide(menuId)
{
$(menuId).hide("fast");
}*/

function showHide_show(menuBtnId, menuId)
{
hideAllMenu();
$(menuId).slideDown("fast");
alignToBtn(menuBtnId,menuId);
$(menuId).fadeTo("fast",0.95);
}
function showHide_hide(menuId)
{
$(menuId).slideUp("fast");
}


function alignToBtn(buttonName1,menuName1)
{
var oset = $(buttonName1).offset();
var t=oset.top +24;
var l=oset.left -1;
$(menuName1).css("left",l);
$(menuName1).css("top",t);
}

// align to button for logins

function alignToBtn2(buttonName1,menuName1)
{
var oset = $(buttonName1).offset();
var t=oset.top +30;
var l=oset.left +12;
$(menuName1).css("left",l);
$(menuName1).css("top",t);
}

$(document).ready(function()
{

//events
//menu 1--------------------------------------------------
$("#weare").mouseover(function()
{
clearTimeout(mytimer);
showHide_show("#weare","#menu_weare");
});

$("#weare").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_weare')",500);
});

$("#menu_weare").mouseover(function()
{
clearTimeout(mytimer);
});

$("#menu_weare").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_weare')",500);
});
//menu 2--------------------------------------
$("#whyus").mouseover(function()
{
clearTimeout(mytimer);
showHide_show("#whyus","#menu_whyus");
});

$("#whyus").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_whyus')",500);
});

$("#menu_whyus").mouseover(function()
{
clearTimeout(mytimer);
});

$("#menu_whyus").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_whyus')",500);
});

//menu 3--------------------------------------
$("#products").mouseover(function()
{
clearTimeout(mytimer);
showHide_show("#products","#menu_products");
});

$("#products").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_products')",500);
});

$("#menu_products").mouseover(function()
{
clearTimeout(mytimer);
});

$("#menu_products").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_products')",500);
});

//menu 4--------------------------------------
$("#services").mouseover(function()
{
clearTimeout(mytimer);
showHide_show("#services","#menu_services");
});

$("#services").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_services')",500);
});

$("#menu_services").mouseover(function()
{
clearTimeout(mytimer);
});

$("#menu_services").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_services')",500);
});

//menu 5--------------------------------------
$("#support").mouseover(function()
{
clearTimeout(mytimer);
showHide_show("#support","#menu_support");
});

$("#support").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_support')",500);
});

$("#menu_support").mouseover(function()
{
clearTimeout(mytimer);
});

$("#menu_support").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_support')",500);
});

//menu 6--------------------------------------
$("#career").mouseover(function()
{
clearTimeout(mytimer);
showHide_show("#career","#menu_career");
});

$("#career").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_career')",500);
});

$("#menu_career").mouseover(function()
{
clearTimeout(mytimer);
});

$("#menu_career").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_career')",500);
});

//menu 7--------------------------------------
$("#infra").mouseover(function()
{
clearTimeout(mytimer);
showHide_show("#infra","#menu_infra");
});

$("#infra").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_infra')",500);
});

$("#menu_infra").mouseover(function()
{
clearTimeout(mytimer);
});

$("#menu_infra").mouseout(function()
{
mytimer=setTimeout("showHide_hide('#menu_infra')",500);
});
//menu ends here ------------------------

// cycle code

 
//tooltip
$("#servicebox a").mouseover(function()
{
$("#apDiv1").css("display","block");

$("#apDiv1").fadeTo("fast",0.9);
$("#apDiv1").html($(this).attr('discr'));
 });
 
 $("#servicebox a").mouseout(function()
{
$("#apDiv1").css("display","none");
 });
 
$("#servicebox a").mousemove(function(e)
{
 $("#apDiv1").css("top",(e.pageY +10) + "px");
 $("#apDiv1").css("left",(e.pageX + 10) + "px");
});

$("#empLogin").click(function()
		{	
		 alignToBtn2("#empLogin","#apDiv2");
			$("#apDiv2").toggle("fast");
			$("#apDiv2").fadeTo("fast", 0.92);
			
			return false;
		});

$("#vendorLogin").click(function()
		{	
		 alignToBtn2("#vendorLogin","#apDiv1");
			$("#apDiv1").toggle("fast");
			$("#apDiv1").fadeTo("fast", 0.92);
			
			return false;
		});
		

});
