// JavaScript Document
<!--//
function popWindow(u,n,o,x,y){
	var s = o+',width='+x+',height='+y;
	window.open(u,n,s);
}

function update(url, index, isSuper) 
			{
				currentIndex = index;
				currentIsSuper = isSuper;
				document['homepic'].src=url;
				
				
return;
}



function getkey(e){
  if (window.event)
    return window.event.keyCode;
  else if (e)
    return e.which;
  else
    return null;
}

function goodchars(e, goods){
  var key, keychar;
  key = getkey(e);
  if (key == null) return true;
  keychar = String.fromCharCode(key);
  keychar = keychar.toLowerCase();
  goods = goods.toLowerCase();
  if (goods.indexOf(keychar) != -1)  return true;
  if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )  return true;
  return false;
}

var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
  var keyCode = (isNN) ? e.which : e.keyCode;
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
  if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus();
  }
  function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
      if(arr[index] == ele)
        found = true;
      else
        index++;
      return found;
  }  
  function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
      if (input.form[i] == input)index = i;
      else i++;
     return index;
  }
  return true;
}

function bookmark(url, description){
  var ver = navigator.appName; 
  var num = parseInt(navigator.appVersion); 
  if(ver == "Microsoft Internet Explorer" && num >= 4){
    window.external.AddFavorite(url, description);
  } else {
    alert("Don't forget to bookmark our site!");
  }
}

function textCounter(field, maxlimit) {
  if(field.value.length > maxlimit) {
    field.value = field.value.substring(0, maxlimit);
  }
}

function textCounterUpdate(fieldName, maxlimit) {
  field = document.getElementById(fieldName+'_txt');
  txt_field = document.getElementById(fieldName+'_char_count');
  txt_field.innerText = field.value.length;
  txt_field.innerHTML = field.value.length;
  textCounter(field, maxlimit);
}

function descWordCount(fieldName, maxlimit, init) {
  if(!init) {
    textCounterUpdate(fieldName, maxlimit);
  } else {
    document.write("<strong id=\""+fieldName+"_char_count\">0</strong>");
  }
}

function copyAddress(form){  
  if(form.same.checked == true){
    form.billFirstName.value = form.fname.value;
    form.billLastName.value = form.lname.value;
    form.billAdr.value = form.adr.value;
    form.billCity.value = form.city.value;
    form.billState.value = form.state.value;
    form.billZip.value = form.zip.value;
  } else {
    form.billFirstName.value = '';
    form.billLastName.value = '';
    form.billAdr.value = '';
    form.billCity.value = '';
    form.billState.value = 'null';
    form.billZip.value = '';
  }
}

function disableButton(theButton){
 theButton.disabled = true;
 theButton.form.submit();
}

function swapImage(target, fname){
  document[target].src = "images/" + fname;
}

function CheckAll(form){
  for(i=0; i < form.city.length; i++){
    if(form.checkall.checked){
      form.city[i].checked=true;
    } else {
      form.city[i].checked=false;
    }
  }
}

function setting(){
  slide = document.getElementById('pic');
  slide.src = imgAr1[0];
  slide.setAttribute("width",width);
  slide.setAttribute("height",height);
}

function slideshow(){
  if(picture < imgAr1.length-1){
    picture=picture+1;
    slide.src = imgAr1[picture];
    document.getElementById("picNum").innerHTML = picture+1;
  }
}

function prev(){
  if(picture > 0 ){
    picture=picture-1;
    slide.src = imgAr1[picture];
    document.getElementById("picNum").innerHTML = picture+1;
  }
}

function start(){
  slide.src = imgAr1[1];
  picture = 1;
}

function end(){
  slide.src = imgAr1[imgAr1.length-1];
  picture = imgAr1.length-1
}

function flipRowOn(e,color){
 e.style.backgroundColor=color;
}

function flipRowOff(e,color){
 e.style.backgroundColor=color;
}

//-->
