
function options_price($n,$currency_code) {
    $options=new Array();
    for($i=1;$i<=$n;$i++) {
       $opt_str="option-"+$i;
		   $this_opt=document.getElementById($opt_str);
		   if(!$this_opt) { continue; }
		   $options[$i-1]=$this_opt.value;
		}
		if($options.length) {
		   $opts=$options.sort();
       url=ROOTURL+'options_price.php?option='+$opts.join(",")+'&code='+$currency_code;
       loadXMLDoc(url,'change_price');
    }
}

//change the price on page
function change_price() {
   if (req.readyState!=4 || req.status!=200) { return; }
   response  = req.responseXML.documentElement;
   price = response.getElementsByTagName('price')[0].firstChild.data;
   stock = response.getElementsByTagName('stock')[0].firstChild.data;
   document.getElementById('totalprice').firstChild.nodeValue=price;
   document.getElementById("quantity").value=1;
}

//preload product enlargement
function preload_enlargement($id) {
   $img=new Image();
   $img.src='content/products/l/'+$id+'.jpg';
}

function part_info($txt) {
   $partinfo=document.getElementById('partinfo');
   $partinfo.firstChild.nodeValue=$txt;
   $partinfo.style.display='block';
}
function hide_info() {
   document.getElementById('partinfo').style.display='none';
}

function show_option($id,$opt){
document.getElementById($id).src='content/options/'+$opt+'.jpg';
}
