$(document).ready(function () {


    //$('.modal-footer .btn').click(function () {

    //    $('body').each(function () {
    //        if ($('.modal.in').length > 1) {
    //            $('body').addClass('overHide');
    //        }
    //        else {
    //            $('body').removeClass('overHide');
    //        }
    //    });
    //});



    $('.modal-footer .btn').click(function () {
        
        setInterval(function() {
            //alert('hi');
            if ($('.modal-backdrop.fade.in').length > 0) {
              //  alert('hello');
                $('body').removeClass('overHide').addClass('overHide');
            }
            else
               // alert('hello2');
                $('body').removeClass('overHide');
        }, 50);
    });

    $('.termsLink').click(function () {
        $('#Terms_and_conditions_dialog').modal('show');
        $('#PrivacyPolicy').css({ 'z-index': '1000' });
        $('#Terms_and_conditions_dialog').css({ 'z-index': '1100' });

       

        //$('#PrivacyPolicy').modal('hide');
        //$('#cookieDiv').modal('hide');
        //$('#Terms_and_conditions_dialog').modal('show');
      //  return false;
        //$('#terms').click();
    });
    $('.privacyLink').click(function () {
        $('#PrivacyPolicy').modal('show');
        // $('#PrivacyPolicy').css({ 'z-index': '1100' });
        $('#Terms_and_conditions_dialog').css({ 'z-index': '1000' });
        $('#PrivacyPolicy').css({ 'z-index': '1100', 'display': 'block' });
        
        //$('#Terms_and_conditions_dialog').modal('hide');
        //$('#PrivacyPolicy').modal('show');
        //$('#cookieDiv').modal('hide');
        //$('#FAQ').modal('hide');
     //   return false;
    });
    $('.cookiePolicy').click(function () {
        
        $('#PrivacyPolicy').css({ 'z-index': '1000' });
        $('#cookiePolicy').css({ 'z-index': '1100', 'display': 'block' });
          //$('#Terms_and_conditions_dialog').modal('hide');
          //$('#PrivacyPolicy').modal('hide');
          //$('#cookieDiv').modal('show');
         // return false;
      });
$('.customRow .btn-group .btn').append('<span class="radioView"></span>');

$('.modal').attr('data-backdrop', 'static');

$('.searchResult .deviceModal').click(function(){
	
		$('.searchResult .deviceModal').removeClass('active');
		$(this).addClass('active');
});

//$('.deviceColor li').click(function(){
//	$('.deviceColor li').removeClass('active');
//	$(this).addClass('active');
//	$('.specMsg').hide();
//});
$('.capacity a').click(function () {
   
	$('.capacity a').removeClass('active');
	$(this).addClass('active');
})

$('.customerInfo .border5').click(function(){
	$('.customerInfo .border5').removeClass('active');
	$(this).addClass('active');
});

//disableBlock();

setInterval(function () {
    footerBar();
}, 1);
accordianLinking();

});

$(window).resize(function(){
	footerBar();
});

$(window).load(function(){
    accordianLinking();
    var _url = window.location.href;
    if (_url.indexOf('.aspx') == -1) {
        var _href = _url.split('#');
        if (_href.length == 2) {
            $('#' + _href[1]).modal('show');
        }
    }
});





function
    accordianLinking() {
    //$('.panel-collapse.collapse.in').removeClass('in');
    //$('.panel-collapse.collapse.in').prev('.panel-heading').find('a').click();
    //location.hash && $(location.hash + '.collapse').collapse('show');

    var id = '#' + $('.collapse.in').attr('id');

    if (id != location.hash) {
        location.hash && $(location.hash + '.collapse').prev('.panel-heading').find('a').click();
    }

    $('.special i').click(function () {
        $(this).click();
        var id = '#' + $('.collapse.in').attr('id');
        //var href = $('.special i').parent('a').attr('href');
        if (id != location.hash) {
            location.hash && $(location.hash + '.collapse').prev('.panel-heading').find('a').click();
        }
    });

}

 function footerBar(){
    var containerWidth = $('.container').width();
    if($('body').height() < $(window).height())
    {
        $('.footerBar').css({'position':'absolute', 'bottom':'0', 'width':containerWidth});
        if(($('body').height() + $('.footerBar').height()) > $(window).height()){
            $('.footerBar').css({'position':'relative'}); 
        }
    }else
    {
        $('.footerBar').css({'position':'relative'}); 
    }
}


function pcProdList(){
    $('.prodList').slideToggle('fast');
	if($('.pcProduct').hasClass('hiddenCnt')){
		$('.pcProduct').removeClass('hiddenCnt');
	}else{
		$('.pcProduct').addClass('hiddenCnt');
	}
}
function businessLink() {
    $('.business').slideToggle('fast');
    if ($('.businessdiv').hasClass('hiddenCnt')) {
        $('.businessdiv').removeClass('hiddenCnt');
    } else {
        $('.businessdiv').addClass('hiddenCnt');
    }
}

function disableBlock(){
   
			$("input:checked").each(function() {
					$(this).parent().click();	
			});
	}