

function removeSSL(){
  var url = window.location.toString();
  var page = url.substr(url.lastIndexOf('/'));
  if(url.substr(0,5).toLowerCase() == "https")
    window.location = "http://www.nelliesbouncehouse.com"+ page;
}

function sendMessage(){
  window.location = "mail.asp";
}


function scheduleOrder(bounceHouseIDX){
  window.location = "order.asp?BounceHouse1="+bounceHouseIDX;
}



function noSave(){
  if(confirm("Do you want to cancel?"))
     window.location='default.htm';
}


var labelwindow = null;
  
function showImg(g,h,w){
  if(labelwindow != null){
    labelwindow.close();
    labelwindow=null;
  }
  labelwindow = window.open ('graphics/'+g, 'labelwindow', config='height='+(h+40)+', width='+(w+40)+', left=20, top=20, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=yes');
  labelwindow.focus();
}


function showAlternatives(){
  if(labelwindow != null){
    labelwindow.close();
    labelwindow=null;
  }
  labelwindow = window.open ('alternatives.asp', 'labelwindow', config='height=400, width=600, left=20, top=20, toolbar=yes, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=yes');
  labelwindow.focus();
}


function confWaitList(str){
  var str2 = 'This is how Nellie\'s Waiting List works\n';
  str2 += '------------------------------------------\n\n';
  str2 += 'This rental is already scheduled for somebody else.\n';
  str2 += 'If that person cancels, you will get the delivery. We\n';
  str2 += 'will confirm with them the day before delivery and\n';
  str2 += 'if they cancel, we will call you to confirm. If we\n';
  str2 += 'do not have any cancellations, we will still call you.\n\n';
  str2 += 'Click [OK] if you understand or\n';
  str2 += 'Click [Cancel] to make changes to your order.\n';
  if(confirm(str)){
    if(confirm(str2)){
      document.form1.CheckInventory.value="NO";
      document.form1.submit();
    }
  }
  return true;
}



function checkDropOffDate(dt,elem){
  var eDate = new Date(dt);
  //NextDay = dt +1days
  var nextDay = (eDate.getMonth()+1)+"/"+(eDate.getDate()+1)+"/"+eDate.getYear();
  var nextDayVal = new Date(nextDay);
  if (elem.value != ""){
    eDate = new Date(elem.value);
    if (eDate < nextDayVal){
      alert("Sorry but we do not currently offer same-day delivery service.\nThe date will be automatically changed.");      
      elem.value = nextDay;
    }
  }
}


function launchDateTool(f){
  var elem = document.form1.elements(f);
  var why = isDate(elem, true);
  if(why!="")
    elem.value="";
  showCal(f);
}


document.onkeydown=keyhandler;
function keyhandler(){
  if (!document.form1)
    return true;
  //alert(window.event.keyCode);
  var els = document.form1.elements;
  var xBackspace=true;
  var m="";
  for(var i=0; i<els.length; i++){
    if(((els[i].type=="text")||(els[i].type=="password")||(els[i].type=="textarea"))&&(els[i]==document.activeElement))
      xBackspace=false;
  }
  if ((window.event.keyCode==8)&&(xBackspace)){
    return false;
  }else{
    return true;
  }
}
