var pMenuObjetcHistory = "";
var strCurrentSelectedMenu = "";
var strCurrentClassName = "";
$(document).ready(function(){
     $('div.ukhdmi-main-menu-cable, div.ukhdmi-main-menu-adapter, div.ukhdmi-main-menu-extender').hover(function(){		
            pMenuObjetcHistory = $(this).find('div').attr('id');
            $('#'+pMenuObjetcHistory).show();
            //alert($('#'+pMenuObjetcHistory).parent().find('div').attr('id'));
    },function(){
        $('#'+pMenuObjetcHistory).hide();
    }); 
    
    /***** Main Menu Option ******/
	$('div.ukhdmi-main-menu, div.ukhdmi-main-menu-cable, div.ukhdmi-main-menu-adapter, div.ukhdmi-main-menu-extender, div.ukhdmi-main-menu-switches, div.ukhdmi-main-menu-splitter, div.ukhdmi-main-menu-matrix, div.ukhdmi-main-menu-wallplates, div.ukhdmi-main-menu-oppo').hover(function(){
		strCurrentSelectedMenu = $(this).attr('class'); 
        $(this).removeClass(strCurrentSelectedMenu).addClass(strCurrentSelectedMenu+'-over');
    },function(){
        $(this).removeClass(strCurrentSelectedMenu+'-over').addClass(strCurrentSelectedMenu);
    }).click(function(){
        window.location.href = $(this).find('a').attr('href');
    }).css({ cursor: 'pointer'});
    
	/***** Sub Main Menu Option ******/
    $('div.ukhdmi-sub-menu-item').hover(function(){
        $(this).removeClass('ukhdmi-sub-menu-item').addClass('ukhdmi-hover-sub-menu-item');
    },function(){
        $(this).removeClass('ukhdmi-hover-sub-menu-item').addClass('ukhdmi-sub-menu-item');
    });
	
	/***** Footer *******/
	$('div.ukhdmi-user-authirization').hover(function(){
		$(this).find('#ukhdmi-user-authirization-image').attr('src','images/new_images/loing_registrer_over.png');
	},function(){
		$(this).find('#ukhdmi-user-authirization-image').attr('src','images/new_images/loing_registrer.png');
	}).css({ cursor: 'pointer'});
	
	/***** Country Selection Option ******/
	$('div#ukhdmi-country-container').hover(function(){	 		 
		$(this).find('#ukhdmi-country-box').slideDown('slow').show();
	},function(){
		$(this).find('#ukhdmi-country-box').slideUp('slow');
	}).css({ cursor: 'pointer'});
    
	/***** Shopping Menu ******/
    $('div.ukhdmi-menu-shopping-box').hover(function(){
        $(this).removeClass('ukhdmi-menu-shopping-box').addClass('ukhdmi-over-menu-shopping-box');
		$(this).find('#ukhdmi-menu-shopping-basket img').attr('src','images/new_images/cart_over.png');
	//$('#ukhdmimenushoppingitems').removeClass('ukhdmi-menu-shopping-items').addClass('ukhdmi-menu-shopping-items-over');
    },function(){
        $(this).removeClass('ukhdmi-over-menu-shopping-box').addClass('ukhdmi-menu-shopping-box');
		//$('#ukhdmimenushoppingitems').removeClass('ukhdmi-menu-shopping-items-over').addClass('ukhdmi-menu-shopping-items');
		$(this).find('#ukhdmi-menu-shopping-basket img').attr('src','images/new_images/cart_over.png');
    }).click(function(){
        window.location.href = $(this).find('a').attr('href');
    }).css({ cursor: 'pointer'});
	
	/***** Right Advertisement and Footer Image ******/
	$('#master_card, #google_check_out, #paypal, #visa, #twitter, #rss, #expo_09, #news_video_background, #clearance_corner, #100_garuntted_30_days_money_back, #fedex, #parcelforce, #royal_mail, #oppo, #octiva, #cablesson').hover(function(){
			pMenuObjetcHistory = $(this).attr('id');
			$(this).attr('src','images/new_images/'+pMenuObjetcHistory+"_over.png");
		},function(){
			$(this).attr('src','images/new_images/'+pMenuObjetcHistory+".png");
		}).css({ cursor: 'pointer'});
	
	/*****	Clearance *****/
	$('#div-clearance').hover(function(){
		$(this).css({'background-color': '#FFCC00'});
	},function(){
		$(this).css({'background-color': '#F0F0F0'});
	}).css({ cursor: 'pointer'});
	
	/*****	Whats new , HDMI Cablem HDMI Splitter , Switch and Matrix carsuel *****/	
	$('#ukhdmi-hdmi-cable, #ukhdmi-hdmi-switch, #ukhdmi-hdmi-splitter, #ukhdmi-hdmi-matrix').hover(function(){
		strCurrentClassName = $(this).attr('class');				 
		$(this).removeClass(strCurrentClassName).addClass(strCurrentClassName+'-over');
		$(this).find('.ukhdmi-hdmi-cable-helighited').toggleClass('ukhdmi-hdmi-cable-helighited-over');
	},function(){
		$(this).removeClass(strCurrentClassName+'-over').addClass(strCurrentClassName);
		$(this).find('.ukhdmi-hdmi-cable-helighited').toggleClass('ukhdmi-hdmi-cable-helighited-over');
	}).click(function(){
		window.location.href = $(this).find('a').attr('href');
	}).css({ cursor: 'pointer'});
	
	/*****	carousel Box *****/
	$('td div.ukhdmi-carousel-product-container').hover(function(){
		$(this).toggleClass('ukhdmi-carousel-product-container-over');
		$(this).find('#ukhdmi-carousel-product-name-name a').css({'text-decoration': 'underline','color':'#006699'});
		$(this).find('#product-more-information').attr('src','images/new_images/product_more_information_over.png');
		$(this).find('.ukhdmi-product-image-box').toggleClass('ukhdmi-product-image-box-over');
		$(this).find('#ukhdmi-carousel-product-infromation').css({'color': '#727272'});
		$(this).find('#ukhdmi-carousel-product-name').css({'background-color': '#E8EFF7'});		
	},function(){
		$(this).toggleClass('ukhdmi-carousel-product-container-over');
		$(this).find('#ukhdmi-carousel-product-name-name a').css({'text-decoration': 'none','color':'#149ADB'});
		$(this).find('#product-more-information').attr('src','images/new_images/product_more_information.png');
		$(this).find('.ukhdmi-product-image-box').toggleClass('ukhdmi-product-image-box-over');
		$(this).find('#ukhdmi-carousel-product-infromation').css({'color': '#999'});
		$(this).find('#ukhdmi-carousel-product-name').css({'background-color': '#E4EAF1'});		
	}).click(function(){
		window.location.href = $(this).find('a').attr('href');
	}).css({ cursor: 'pointer'});
	
	/*****	Product Box *****/
	$('td div.ukhdmi-product-container-box').hover(function(){		
		$(this).toggleClass('ukhdmi-product-container-box-over');
		$(this).find('#ukhdmi-product-name a').css({'text-decoration': 'underline','color':'#149ADB'});
		$(this).find('#product-more-information').attr('src','images/new_images/product_more_information_over.png');
		$(this).find('.ukhdmi-product-image-box').toggleClass('ukhdmi-product-image-box-over');
		$(this).find('#ukhdmi-product-infromation').css({'color': '#727272'});
		$(this).find('#ukhdmi-product-name').css({'background-color': '#E8EFF7'});		
	},function(){
		$(this).toggleClass('ukhdmi-product-container-box-over');
		$(this).find('#ukhdmi-product-name a').css({'text-decoration': 'none','color':'#006699'});
		$(this).find('#product-more-information').attr('src','images/new_images/product_more_information.png');
		$(this).find('.ukhdmi-product-image-box').toggleClass('ukhdmi-product-image-box-over');
		$(this).find('#ukhdmi-product-infromation').css({'color': '#999'});
		$(this).find('#ukhdmi-product-name').css({'background-color': '#E4EAF1'});		
	}).click(function(){
		window.location.href = $(this).find('a').attr('href');
	}).css({ cursor: 'pointer'});
	
	/*****	Quick View Cable Category *****/
	$('div.ukhdmi-hdmi-cable-connector').hover(function(){
		$(this).toggleClass('ukhdmi-hdmi-cable-connector-over');
	},function(){		
		$(this).toggleClass('ukhdmi-hdmi-cable-connector-over');
	}).click(function(){		 
	  var elementClicked = $(this).find('a').attr('class');	   	   
	  var destination = $('#'+elementClicked).offset().top;	   
	  $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, 3000 );
	  if($('.'+elementClicked).is(':hidden'))
		{
			$('.'+elementClicked).parent().find('div#ukhdmi-product-category-name a span.ukhdmi-product-category-name').html('-');
			$('.'+elementClicked).slideDown(3000);
		}
	  return false;
	}).css({ cursor: 'pointer'});

	/*****	Cable Category Product Box *****/
	$('div.ukhdmi-product-hdmi-cable-box').hover(function(){
		$(this).toggleClass('ukhdmi-product-hdmi-cable-box-over');
		$(this).find('#ukhdmi-product-hdmi-cable-name a').css({'text-decoration':'underline','color':'#149ADB'});
		$(this).find('#ukhdmi-product-hdmi-cable-information').css({'color': '#737373'});
		$(this).find('.ukhdmi-product-hdmi-cable-information').css({'color': '#72AA0C'});
		$(this).find('#product-more-information').attr('src','images/new_images/product_more_information_over.png');
		$(this).find('#ukhdmi-product-hdmi-cable-review a').css({'color':'#0092D8'});
		$(this).find('#ukhdmi-product-hdmi-cable-free-shipping').css({'color':'#72AA0C'});
		$(this).find('#ukhdmi-product-hdmi-cable-stock').css({'color':'#72AA0C'});
		$(this).find('.ukhdmi-product-hdmi-cable-image-box').toggleClass('ukhdmi-product-hdmi-cable-image-box-over');
	},function(){
		$(this).toggleClass('ukhdmi-product-hdmi-cable-box-over');
		$(this).find('#ukhdmi-product-hdmi-cable-name a').css({'text-decoration':'none','color':'#006699'});
		$(this).find('#ukhdmi-product-hdmi-cable-information').css({'color': '#999'});
		$(this).find('.ukhdmi-product-hdmi-cable-information').css({'color': '#999'});
		$(this).find('#product-more-information').attr('src','images/new_images/product_more_information.png');
		$(this).find('#ukhdmi-product-hdmi-cable-review a').css({'color':'#666'});
		$(this).find('#ukhdmi-product-hdmi-cable-free-shipping').css({'color':'#666'});
		$(this).find('#ukhdmi-product-hdmi-cable-stock').css({'color':'#666'});
		$(this).find('.ukhdmi-product-hdmi-cable-image-box').toggleClass('ukhdmi-product-hdmi-cable-image-box-over');
	}).click(function(){
		window.location.href = $(this).find('a').attr('href');
	}).css({ cursor: 'pointer'});
	
	/********On Click of Top Go To TOP ************/
	$('a[href=#top], div#ukhdmi-product-category-move-top').click(function(){
		$('html, body').animate({scrollTop:0},3000);
		return false;
	}).css({ cursor: 'pointer'});
	
	/*********** Cable Product Conatiner Animation ************/
	$('div a span.ukhdmi-product-category-name').click(function(){		 		 
		if($(this).parent().parent().parent().parent().find('.'+$(this).parent().attr('class')).is(":hidden")){
			$(this).html('-');
			$(this).parent().parent().parent().parent().find('div.'+$(this).parent().attr('class')).slideDown(1000);		 
		}else{
			$(this).html('+');
			$(this).parent().parent().parent().parent().find('div.'+$(this).parent().attr('class')).slideUp(1000);
		}
	});
	
});

function setMenuAction(pMenuCode, pNormalClass, phoverClass, pSubMenuCode , pActionCode)
    {
        if(pActionCode == 0)
            {
                document.getElementById(pMenuCode).className = pNormalClass;
                if(pSubMenuCode !="")
                    {
                        document.getElementById(pSubMenuCode).style.display = 'none';
                    }
            }
        else
            {
                document.getElementById(pMenuCode).className = phoverClass;
                if(pSubMenuCode !="")
                    {
                        document.getElementById(pSubMenuCode).style.display = 'block';
                    }
            }
    }
function setSubMenuAction(pMenuCode, pActionCode)
    {
        var strObjectName;
        strObjectName = "submenustatus"+pMenuCode;
        switch(parseInt(pActionCode))
            {
                case 1:
                    document.getElementById(strObjectName).className = 'submenu-status-over';
                    break;
                case 2:
                    document.getElementById(strObjectName).className = 'submenu-status';
                    break;
                case 3:
                    document.getElementById(strObjectName).className = 'submenu-text-over';
                    break;
                case 4:
                    document.getElementById(strObjectName).className = 'submenu-text';
                    break;
            }
    }
function swapImage(pImageCode, pImageName)
    {
        document.getElementById(pImageCode).src = "images/"+pImageName;
    }
function showMenu(pImageCode, pActionCode)
    {
        if(pMenuObjetcHistory !="")
            document.getElementById(pMenuObjetcHistory).style.display = 'none';
        if(pImageCode !="")
            document.getElementById(pImageCode).style.display = pActionCode;
        
        pMenuObjetcHistory  = pImageCode;
    }
function hideSearch(pObject)
    {
        document.getElementById(pObject).style.display = 'none';
    }
function showSearch(pObject)
    {
        document.getElementById(pObject).style.display = 'block';
    }			 

