﻿
$(document).ready(function () {

    
	/*------------------------------------------------------------------------------STYLE DROP DOWN MENU SCROLLBAR*/
	$('#SmallDropDown').jScrollPane();
	$('#SmallDropDown').jScrollPane({showArrows:true});
	$('#BigDropDown').jScrollPane();
	$('#BigDropDown').jScrollPane({showArrows:true});
	$('.leftDialog .jScrollPaneContainer').hide();
	$('.rightdialog .jScrollPaneContainer').hide();
	
	/*------------------------------------------------------------------------------ADD CLASS NAMES*/
    $("ul.rmHorizontal li.rmItem").eq(1).addClass("item2");
    $("ul.rmHorizontal li.rmItem").eq(2).addClass("item3");
    $("ul.rmHorizontal li.rmItem").eq(3).addClass("item4");
	$("ul.rmHorizontal li.rmItem").eq(4).addClass("item5");
	$("ul.rmHorizontal li.rmItem").eq(5).addClass("item6");
	$("ul.rmHorizontal li.rmItem").eq(6).addClass("item7");
    // CLASS NAMES TO ADVERTO IN ORDER TO OPEN MODAL WINDOW
    $(".adVisualLayoutVertical li a").addClass("modalWindow");
    $(".adLayoutSingleAd a").addClass("modalWindow");
	$(".adTextualLayoutVertical li a").addClass("modalWindow");
	$(".adLayoutRotatingAds a").addClass("modalWindow");

    /*-----------------------------------------------------------------------------BIG DROP DOWN MENU*/

	$(document).ready(function ()
	{
	    var t;

	    $(".dropMenuTop").click(function ()
	    {
	        $("#scrollPane").toggle();
	        $("#scrollPane").jScrollPane();
	    });

	    $(".dropMenuOuter").mouseleave(function ()
	    {
	        t = setTimeout(function ()
	        {
	            $("#scrollPane").slideUp();
	        }, 2000);

	    });

	    $(".dropMenuOuter").mouseenter(function ()
	    {
	        clearTimeout(t);
	    });


        ////Small dropdown
	    var q;

	    $(".dropMenuTopSmall").click(function ()
	    {
	        $("#scrollPaneSmall").toggle();
	        $("#scrollPaneSmall").jScrollPane();
	    });

	    $(".dropMenuOuter").mouseleave(function ()
	    {
	        q = setTimeout(function ()
	        {
	            $("#scrollPaneSmall").slideUp();
	        }, 2000);

	    });

	    $(".dropMenuOuter").mouseenter(function ()
	    {
	        clearTimeout(q);
	    });


	});

    /*------------------------------------------------------------------------------SMALL DROP DOWN MENU*/
    
	// OPEN THE SMALL DROP DOWN ON IMAGE CLICK
	
	var smallNavOpen = false;
	
    $("img.menu_head_content").click(function () {
       	//alert(smallNavOpen);
        $("ul.menu_body_content").slideToggle('fast');
		if (smallNavOpen)
		{
			closeDropDown();
			smallNavOpen = !smallNavOpen;
		} else
		{
			openDropDown();
			//SMALL NAV NOW OPEN
			smallNavOpen = true;
			
		}
    });
	
	// CLOSE THE SMALL DROP DOWN IF WE CLICK ON ONE OF THE LINKS
	
	$("ul.menu_body_content li a").click(function () {
        $("ul.menu_body_content").slideUp("medium");
		closeDropDown();
		smallNavOpen = false;
    });
	
	// ClOSE THE SMALL DROP DOWN WHEN WE MOUSE OUT
	
    $('.dropMenuWrapper_content').mouseleave(function() {
	  if (smallNavOpen)
		{
			closeDropDown();
			smallNavOpen = false;
		}
	});
	
	// OPEN AND CLOSE THE SMALL DROP DOWN IN THE LEFT COLUMN
	
	function openDropDown()
	{
		$('.leftDialog .jScrollPaneContainer').slideToggle('fast');
	}
	
	function closeDropDown()
	{
		$('.leftDialog .jScrollPaneContainer').slideToggle('fast');
		
	}
	
	

    /*------------------------------------------------------------------------------COLORBOX AJAX WINDOW*/
	$(".modalWindow").colorbox({ width: "535", height: "100%", iframe: true });

	// Load the Google Ads last.
	$('div.banner').each(function() {
	    var id = $(this).attr('id').replace(/_hidden/, '');
	    var pos = $("#" + id).offset();

	    if (pos) {
	        // Show the banner directly over the placeholder
	        $(this).css(
        {
            "left": pos.left + "px",
            "top": pos.top + "px"
        });
	        $("#" + id).height($(this).height() + 5);
	        $("#" + id).width($(this).width());
	    }
	});

	// Repositioning the ads divs
	$(window).resize(function() {
	    $('div.banner').each(function() {
	        var id = $(this).attr('id').replace(/_hidden/, '');
	        var pos = $("#" + id).offset();

	        if (pos) {
	            // Show the banner directly over the placeholder
	            $(this).css(
          {
              "left": pos.left + "px",
              "top": pos.top + "px"
          });
	        }
	    });
	});

});


/*------------------------------------------------------------------------------MEDIHELP PAGE SERVICES*/

boxes = new Array();
var currBox;
function hideAll(currItem) {

    $("div#P").hide();
    $("div#O").hide();
    $("div#B").hide();
    $("div#G").hide();
    $("div#C").hide();

    switch (currItem) {

        case 'P':
            $("div#P").show();
            break;
        case 'O':
            $("div#O").show();
            break;
        case 'B':
            $("div#B").show();
            break;
        case 'G':
            $("div#G").show();
            break;
        case 'C':
            $("div#C").show();
            break;
        default:
            $("div#P").show();

    }
}
$(document).ready(function () {
    $("div#P").show();
});


