var pseudowindowheight;
var pseudowindowwidth;
if (!price) var price=0
function applyonclickstoall(){
  var inputtags=document.getElementsByTagName("input");
  var labeltags=document.getElementsByTagName("label");
  for (i=0;i<labeltags.length;i++){
    inputid=labeltags[i].htmlFor;
    if (document.getElementById(inputid).type=="checkbox") {
      labeltags[i].onclick= checkupdate;
    }
    if (document.getElementById(inputid).type=="radio") {
      labeltags[i].onclick= radioupdate;
    }
  }
}

function openwindow(url) {
  pseudowindowclose="<p style=\"text-align:right\">cancel <a style=\"cursor:pointer;\" onclick=\"closewindow()\"><img src=\"images/btn_close.gif\" alt=\"\" /></a></p>";
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e) {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlhttpresponsetext=false;
    xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
      //thepseudowindow.innerHTML=xmlHttp.responseText;
        xmlhttpresponsetext= pseudowindowclose+xmlHttp.responseText;
        pseudowindowheight=400;
        pseudowindowwidth=600;
        finishhttprequest();
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }

function openideawindow(url) {
  var xmlHttp;
  try {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e) {
    // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e) {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlhttpresponsetext=false;
    xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
      //thepseudowindow.innerHTML=xmlHttp.responseText;
        xmlhttpresponsetext= xmlHttp.responseText;
        pseudowindowheight=475;
        pseudowindowwidth=651;
        finishhttprequest(1, 1, 1);
        }
      }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
  }

function finishhttprequest(noshadow, clickclose, clearbg) {
  //alert("noshadow= '"+noshadow+"', clickclose= '"+clickclose+"', clearbg= '"+clearbg+"'")
  if (!document.getElementById("pseudowindow")) {
    newdiv = document.createElement("div");
    newdiv.setAttribute("id","pseudowindow");
    if(clickclose==1) {
      newdiv.onclick=closewindow;
      }
    else {
      newdiv.removeAttribute("onclick");
      }
    //newdiv.appendChild(document.createTextNode("hello world"));
    document.getElementsByTagName("body")[0].appendChild(newdiv);
    }
  else {
    document.getElementById("pseudowindow").style.display="block";
    }
  if (clearbg) {
    document.getElementById("pseudowindow").style.backgroundColor="transparent";
    document.getElementById("pseudowindow").style.border="0";
    }
  else {
    document.getElementById("pseudowindow").style.backgroundColor="#ccc";
    document.getElementById("pseudowindow").style.border="1px solid #000";
    }
  if (!noshadow) {
    if (!document.getElementById("shadow")) {
      newdiv = document.createElement("div");
      newdiv.setAttribute("id","shadow");
      newdiv.onclick=closewindow;
      //newdiv.appendChild(document.createTextNode("hello world"));
      document.getElementsByTagName("body")[0].appendChild(newdiv);
      }
    else {
      document.getElementById("shadow").style.display="block";
      }
    }
  thepseudowindow=document.getElementById("pseudowindow");
  thepseudowindow.style.height=pseudowindowheight+"px";
  thepseudowindow.style.width=pseudowindowwidth+"px";
  if (isie6==1) {
    }
  else {
    window.onresize=positionpseudowindow;
    positionpseudowindow();
    }
  thepseudowindow.innerHTML=xmlhttpresponsetext;
  }

function closewindow() {
if (document.getElementById("pseudowindow")) document.getElementById("pseudowindow").style.display="none";
if (document.getElementById("shadow")) document.getElementById("shadow").style.display="none";
  }

function positionpseudowindow() {
  if (window.innerWidth) {
      //alert(pseudowindowwidth / 2);
      leftpixel= window.innerWidth / 2 - (pseudowindowwidth / 2);
      toppixel= window.innerHeight / 2 - (pseudowindowheight / 2);
      }
    else if (document.documentElement.clientHeight > 0) {
      leftpixel= document.documentElement.clientWidth / 2 - (pseudowindowwidth / 2);
      toppixel= document.documentElement.clientHeight / 2 - (pseudowindowheight / 2);
      }
    else {
      leftpixel= document.body.clientHeight / 2 - (pseudowindowwidth / 2);
      toppixel= document.body.clientHeight / 2 - (pseudowindowheight / 2);
    }
  document.getElementById("pseudowindow").style.left=leftpixel+"px";
  document.getElementById("pseudowindow").style.top=toppixel+"px";
  }

function getradiovalue(radio) {
radio = document.getElementsByName(radio);
for (var i=0; i < radio.length; i++)
   {
   if (radio[i].checked)
      {
      var rad_val = radio[i].value;
      }
   }
   return rad_val;
}
function getElementsByClass(searchClass,node,tag) {//thank you http://www.dustindiaz.com/
  var classElements = new Array();
  if ( node == null )
    node = document;
  if ( tag == null )
    tag = '*';
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}
function ajaxpullpage(url) {

}

function rewrite(whatid, towrite) {
  if (document.getElementById && document.createElement) {
    document.getElementById(whatid).innerHTML=towrite;
    }
}

window.onload= function setup(){
//applyonclickstoall();
//recalcall();
}
