$(function() {
$('#product-content hr').remove();
$('#ctl00_MainContent_RecProducts').css({ 'width': '560px' });
$('#home_panel').css({ 'width': '565px' });
//$('#ctl00_MainContent_RecProducts').css({'width':'898px'});
$('#ctl00_MainContent_Baynote2').css({ 'width': '150px' });
$("#ctl00_MainContent_PaymentManager_PaymentManagerCreditCardViewLabel").hide();
$('#cat-drop,#dog-drop,.drop-down').nmcDropDown({ show_delay: 250 });
$('.search').toggleVal();
$(".search-results-product-options").each(function(i) {
$(".search-results-sizes:nth-child(odd)").addClass("alt");
});
});
// autoship modal
// 0 disabled; 1 enabled;
var popupStatus = 0;
//loading popup
function loadPopup(){
//loads popup only if it is disabled
if(popupStatus==0){
$("#autoshipBkgd").css({
"opacity": "0.15"
});
$("#autoshipBkgd").fadeIn("fast");
$("#autoshipInfo").fadeIn("fast");
popupStatus = 1;
}
}
//disabling popup
function disablePopup(){
//disables popup only if it is enabled
if(popupStatus==1){
$("#autoshipBkgd").fadeOut("fast");
$("#autoshipInfo").fadeOut("fast");
popupStatus = 0;
}
}
//centering popup
function centerPopup(){
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = $("#autoshipInfo").height();
var popupWidth = $("#autoshipInfo").width();
//centering
//$("#autoshipInfo").css({
// "position": "absolute",
// "top": windowHeight/2-popupHeight/2,
// "left": windowWidth/2-popupWidth/2
//});
//only need force for IE6
$("#autoshipBkgd").css({
"height": windowHeight
});
}
//CONTROLLING EVENTS
$(document).ready(function(){
//LOADING POPUP
//button click
$("#button1").click(function(){
//centering with css
centerPopup();
//load popup
loadPopup();
});
//CLOSING POPUP
//Click close
$("#autoshipInfoClose").click(function(){
disablePopup();
});
$("#continue").click(function(){
disablePopup();
});
//Click out event!
$("#autoshipBkgd").click(function(){
disablePopup();
});
//Press Escape event!
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
disablePopup();
}
});
});

