 
$(document).ready(function() {
	var isMouseInsideMenu = false; 
    var leaveTime; 
    var MenuItemActivated; 
	var MenuItemId;
	var LastSelected;	
	
	$('div[id$="View_UP"] div').css("height", ""); /* to quit the scroll in the events page */
	$('evtBar').css("height", "25");
	
	$(".SubMenuItem").hide();
	//$(".SubMenuItemSelected").show();				
	
	//$("#PortalCentralImage").addClass($(".MenuItemSelected").attr('id'));		//Not in use
 
	$("a.evtLinks:contains('Desktop')").text("Export to Calendar");  /* Changes the label Export to Desktop in the calendar details */
	$("a.evtLinks:contains('Register')").hide();  /* Hide the Register Events link to use the customs */	
	$("a.StoreMiniCartViewCart:contains('Cart')").text("Checkout / View Cart");  /* Changes the label in the Mini Cart from View my Cart to Checkout/View My Cart */
	/* changes the message to the user before place the order */
	$(".cvStoreOnlinePaymentProvider:contains('Place Order')").text('Click Next to Place Your Order. You do NOT need a PayPal account to complete payment. PayPal offers a "Guest" option that will allow you to pay with a credit card without a PayPal account');	
	
	$("#topnav").hover(function(){  /* This is for the JQuery menu for the VIPER CART */
		$(".sub").show();
	},function(){
		$(".sub").hide(); 
	});
	   
	/*  required shipping fields form  */	
	$(".StoreAddressLabel span").each(function() {
		if ($(this).text() == "First Name")
			$(this).text("*" + $(this).text());
		if ($(this).text() == "Last Name")
			$(this).text("*" + $(this).text());		
		if ($(this).text() == "Address 1")
			$(this).text("*" + $(this).text());
		if ($(this).text() == "City")
			$(this).text("*" + $(this).text());
		if ($(this).text() == "Postal Code")
			$(this).text("*" + $(this).text());
		if ($(this).text() == "Daytime Phone")
			$(this).text("*" + $(this).text());
		if ($(this).text() == "Email Address")
			$(this).text("*" + $(this).text());
	});
	   
		/* footer Links */
	$(".fadelink").click(function(){		
		if ($(this).text() == "About Us")
			$(this).attr("href", location.protocol + "//" + location.host + "/AboutUs/HistoryMissionValues.aspx");
		if ($(this).text() == "Best Practices Institute")			
			$(this).attr("href", location.protocol + "//" + location.host + "/BestPracticesInstitute/WhoWeAre.aspx");
		if ($(this).text() == "Evaluation Resource Institute")			
			$(this).attr("href", location.protocol + "//" + location.host + "/EvaluationResourceInstitute/MIssionPurposeObjectives.aspx");
		if ($(this).text() == "Advocacy")			
			$(this).attr("href", location.protocol + "//" + location.host + "/Advocacy/Howwework.aspx");
		if ($(this).text() == "Get Involved")			
			$(this).attr("href", location.protocol + "//" + location.host + "/GetInvolved/Membership.aspx");		
		if ($(this).text() == "Resources")			
			$(this).attr("href", location.protocol + "//" + location.host + "/Resources/Elibrary.aspx");
		if ($(this).text() == "Shop ICVP")			
			$(this).attr("href", location.protocol + "//" + location.host + "/ShopICVP/OrderOnline.aspx");	
	});	
	
	/*$("#LikePluginPagelet").hide();   THis is to hide the FB connection in the product detail */
	$(".StoreDetailReturnButton").hide();   /*  This is to hide the return to Category link in product detail */
	
	$(".leftLogo_image").click(function() {
		location.href = location.protocol + "//" + location.host + "/Home.aspx";   /*"http://icvp.gammapartners.com/Home.aspx";*/
	});
	
	$(".leftLogo_image").hover(function(){
		$(".leftLogo_image").css("cursor","pointer");
	});

	/*$("ul.cvStoreCheckoutSteps li:eq(2)").hide();
	$("ul.cvStoreCheckoutSteps li:eq(1)").hide();   change this when is there any shipping or not */ 
		
	
	$(".ListEventDate").show();		
		
	$('input[id$="btnProceedCheckout"]').hover(function(){
		$(this).attr("src","/Portals/0/CVStore/Templates/images/proceedToCheckouth.jpg");
	},function(){
		$(this).attr("src","/Portals/0/CVStore/Templates/images/proceedToCheckout.png");
	});
	 
	$("#PortalCentralImage").addClass(function() {
		if ($(".MenuItemSelected").attr('id') == null)
			return "MenuItem95";
		else
			return $(".MenuItemSelected").attr('id');
	});
	
	$("input#btnDonateNow").addClass("ICVPbuttonDonate1"); 
	$("input#btnTakeAction").addClass("ICVPbuttonAction1"); 
	
	$("input#btnDonateNow").click(function() {
		location.href = location.protocol + "//" + location.host + "/GetInvolved/Donate.aspx?pageId=donations"; /*"http://icvp.gammapartners.com/GetInvolved/Donate.aspx?pageId=donations";*/
	});
	
	$("input#btnTakeAction").click(function() {	
		location.href = location.protocol + "//" + location.host + "/LegislationAdminCenter.aspx";
		/*window.open("http://capwiz.com/icvp/state/main/?state=IL");	*/
	});
	
	$("input#btnDonateNow").hover( 							
		function () {		
			$("input#btnDonateNow").removeClass("ICVPbuttonDonate1");
			$("input#btnDonateNow").addClass("ICVPbuttonDonate2");
		}, 
		function () { 
			$("input#btnDonateNow").removeClass("ICVPbuttonDonate2");
			$("input#btnDonateNow").addClass("ICVPbuttonDonate1");		
		} 			
	);

	$("input#btnTakeAction").hover( 							
		function () {		
			$("input#btnTakeAction").removeClass("ICVPbuttonAction1");
			$("input#btnTakeAction").addClass("ICVPbuttonAction2");
		}, 
		function () { 
			$("input#btnTakeAction").removeClass("ICVPbuttonAction2");
			$("input#btnTakeAction").addClass("ICVPbuttonAction1");		
		} 			
	);	
	
	MenuItemActivated = $(".MenuItemSelected").attr('id');
	
	$(".MainMenuTable").hover(function () {	}, 
		function () { 			
			$('.MenuItemSelected[id!="MenuItemActivated"]').addClass('MenuItem');	
			$('.MenuItemSelected[id!="MenuItemActivated"]').children().next().removeClass('SubMenuItemSelected');
			$('.MenuItemSelected[id!="MenuItemActivated"]').children().next().addClass('SubMenuItem');					
			$('.MenuItemSelected[id!="MenuItemActivated"]').removeClass('MenuItemSelected');																							
			$(".SubMenuItem").hide();				
			$("#" + MenuItemActivated).addClass('MenuItemSelected');
			$("#" + MenuItemActivated).removeClass('MenuItem');
			$("#" + MenuItemActivated).children().next().removeClass('SubMenuItem');
			$("#" + MenuItemActivated).children().next().addClass('SubMenuItemSelected');
			$(".SubMenuItemSelected").show();
		} 			
	);	
	
	$(".MenuItem").hover( 							
		function () {		
			MenuItemId = $(this).attr('id');									
			//if (MenuItemActivated != MenuItemId)
			//	{				
					//alert($(".MenuItemSelected").attr('id'));
					//$("#" + MenuItemActivated).addClass('MenuItem');
					//$("#" + MenuItemActivated).removeClass('MenuItemSelected');							
					//$("#" + MenuItemActivated).children().next().removeClass('SubMenuItemSelected');
					//$("#" + MenuItemActivated).children().next().addClass('SubMenuItem');
					
					/* Second Option */
					$('.MenuItemSelected[id!="MenuItemActivated"]').addClass('MenuItem');	
					$('.MenuItemSelected[id!="MenuItemActivated"]').children().next().removeClass('SubMenuItemSelected');
					$('.MenuItemSelected[id!="MenuItemActivated"]').children().next().addClass('SubMenuItem');
					/*$('.MenuItemSelected[id!="MenuItemActivated"]').children().next().children().removeClass('SubMenuItemSelected');
					$('.MenuItemSelected[id!="MenuItemActivated"]').children().next().children().addClass('SubMenuItem');			
					$('.MenuItemSelected[id!="MenuItemActivated"]').children().next().children().children().removeClass('SubMenuItemSelected');
					$('.MenuItemSelected[id!="MenuItemActivated"]').children().next().children().children().addClass('SubMenuItem');*/
					$('.MenuItemSelected[id!="MenuItemActivated"]').removeClass('MenuItemSelected');					
																			
					$(".SubMenuItem").hide();
					
					$("#" + MenuItemActivated).addClass('MenuItemSelected');
					$("#" + MenuItemActivated).removeClass('MenuItem');
					$("#" + MenuItemActivated).children().next().removeClass('SubMenuItem');
					$("#" + MenuItemActivated).children().next().addClass('SubMenuItemSelected');
					
					$(this).removeClass('MenuItem');
					$(this).addClass('MenuItemSelected');
					$(this).children().next().removeClass('SubMenuItem');
					$(this).children().next().addClass('SubMenuItemSelected');
					$(this).children().next().children().removeClass('SubMenuItem');
					$(this).children().next().children().addClass('SubMenuItemSelected');			
					$(this).children().next().children().children().removeClass('SubMenuItem');
					$(this).children().next().children().children().addClass('SubMenuItemSelected');	
					$(".SubMenuItemSelected").show();			
			//	}					
			}, 
		function () { 			
		} 			
	);		
});	

		
		


