<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var browser, verStr = navigator.appVersion, app = navigator.appName, version = parseFloat(verStr);

var content = new Array('preloader', 'bodycontent');
var cc_processing = new Array('submitdiv', 'processingdiv');

function test_browser () {
  if ((app.indexOf('Netscape') != -1) && version >= 5) {
    browser = "netscape";
  }
  else if ((app.indexOf('Microsoft') != -1) && version >= 4) {
    browser = "ie";
  }
}

function show_sub(show_which_sub, var_array, mode) {

  for (i = 0; i < eval(var_array + ".length"); i++) {
    if (eval(var_array + "[i]") != show_which_sub) {
      hide_sub(eval(var_array + "[i]"));
    }    
  }

  if (show_which_sub != "") {  
    if (browser == "netscape") {
      if (document.getElementById(show_which_sub).style.display == 'block') {
        if (mode == 1) {
          document.getElementById(show_which_sub).style.display = 'none';
        }
      }
      else {
        document.getElementById(show_which_sub).style.display = 'block';
      }
    }
    else if (browser == "ie") {
      show_menu = eval(show_which_sub);
      if(show_menu.style.display == 'block'){
        if (mode == 1) {
          show_menu.style.display = 'none'; 
        }
      } 
      else {
        show_menu.style.display = 'block';    
      }
    }    
  }
  
}

function hide_sub(which_sub) {
  if (browser == "netscape") {
    document.getElementById(which_sub).style.display = 'none'; 
  }
  else if (browser == "ie") {
    sub_menu = eval(which_sub); 
    sub_menu.style.display = 'none';    
  }
}

function auto_hide() {
  show_sub("");
}

function update_image(show_which_sub, var_array) {

  var dsp_op;
  
  for (i = 0; i < eval(var_array + ".length"); i++) {
    if (eval(var_array + "[i]") != show_which_sub) {
      collapse(eval(var_array + "[i]"));
    }    
  }
  
  if (browser == "netscape") {
    dsp_op = document.getElementById(show_which_sub).style.display;     
  }
  else if (browser == "ie") {
    show_menu = eval(show_which_sub);
    dsp_op = show_menu.style.display; 
  }   
  if (dsp_op == 'block') {
    eval("document.img" + show_which_sub + ".src='images/collapse.gif'");
  }
  else {
    eval("document.img" + show_which_sub + ".src='images/expand.gif'"); 
  }
}

function collapse(hide_which_sub) {
  eval("document.img" + hide_which_sub + ".src='images/expand.gif'");
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

test_browser();

active_menu = "";
click_ctr 	= 0;
function display_submenu (current_menu) {
    if (active_menu != "") { 
  	  document.getElementById(active_menu).style.display = "none";
  	}
  	document.getElementById(current_menu).style.display = "block";
  	active_menu = current_menu;
		click_ctr = 0;
	
}

function display_pic(eid, prod_code, pic, enlarge, width, height) {
  var prod_pic = new SWFObject("flash/pf.swf", "pro" + eid, "130", "133", "5", "#FFFFFF");
	prod_pic.addVariable("product_id", eid);
	prod_pic.addVariable("product_code", prod_code);
	prod_pic.addVariable("pic", pic);
	prod_pic.addVariable("enlarge", enlarge);
	prod_pic.addVariable("pic_width", width);
	prod_pic.addVariable("pic_height", height);
	prod_pic.addParam("wmode", "transparent");
	prod_pic.write("pro" + eid);
}
function display_pic_1(eid, prod_code, pic, enlarge, width, height, pic_div, pic_large) {
  var prod_pic = new SWFObject("flash/pf4.swf", "pro1" + eid, "130", "133", "5", "#FFFFFF");
	prod_pic.addVariable("product_id", eid);
	prod_pic.addVariable("product_code", prod_code);
	prod_pic.addVariable("pic", pic);
	prod_pic.addVariable("enlarge", enlarge);
	prod_pic.addVariable("pic_width", width);
	prod_pic.addVariable("pic_height", height);
	prod_pic.addVariable("pic_div", pic_div);
	prod_pic.addVariable("pic_large", pic_large);
	prod_pic.addParam("wmode", "transparent");
	prod_pic.write("pro" + eid);
}
function display_pic_small(eid, prod_code, pic, enlarge, width, height, pic_div, pic_large) {
  var prod_pic = new SWFObject("flash/pf2.swf", "pro" + eid, "60", "63", "5", "#FFFFFF");
	prod_pic.addVariable("product_id", eid);
	prod_pic.addVariable("product_code", prod_code);
	prod_pic.addVariable("pic", pic);
	prod_pic.addVariable("enlarge", enlarge);
	prod_pic.addVariable("pic_width", width);
	prod_pic.addVariable("pic_height", height);
	prod_pic.addVariable("pic_div", pic_div);
	prod_pic.addVariable("pic_large", pic_large);
	prod_pic.addParam("wmode", "transparent");
	prod_pic.write("pro_small" + eid);
}
active_pic = "";
function show_image(filename, width, height, pic_div) {

  if (active_pic != "") { 
	  document.getElementById(active_pic).style.display = 'none';
	}
	
	var sox = new SWFObject("flash/pf3.swf", "lpic", "300", "300", "5", "#FFFFFF");	
	sox.addVariable("pic_width", width);	
	sox.addVariable("pic_height", height);	
  sox.addVariable("pic", filename);
	sox.addParam("wmode", "transparent");
	sox.write(pic_div);
	
	document.getElementById(pic_div).style.display = 'block';
	active_pic = pic_div;

}

function hide_pic () {
  if (active_pic != "") {
	  document.getElementById(active_pic).style.display = 'none'; 
	}
}
function preview_image(product_code, product_id, pic_width, pic_height) {
  pic_width = parseInt(pic_width) + 80;
	pic_height = parseInt(pic_height) + 80;
  url = "img=products/large/pro-" + product_code + ".jpg&product_id=" + product_id;
  window.open("view_picture.php?" + url ,"browser","'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + pic_width + ",height=" + pic_height + "'");
}

function display_cat(type, cat_id, code, pic) {
  var cat_pic = new SWFObject("flash/cf.swf", "cat" + cat_id, "130", "133", "5", "#FFFFFF");
	cat_pic.addVariable(type, cat_id);
	level = 2;
	if (type == "category_id") { 
	  level = 1;
	}
	cat_pic.addVariable("level", level);
	cat_pic.addVariable("pic", pic);
	cat_pic.addVariable("code", code);
	cat_pic.addVariable("pic", pic);
	cat_pic.write("cat" + cat_id);
}

function check_delivery () {
	document.getElementById('dname').readOnly			  = false;
 document.getElementById('daddress_1').readOnly = false; 
 document.getElementById('daddress_2').readOnly = false;
 document.getElementById('dcity').readOnly			= false;
 document.getElementById('dstate').readOnly		 	= false;
 document.getElementById('dzip').readOnly			  = false;

 if (document.getElementById('same').checked) { 
 	 document.getElementById('dname').value 		 = document.getElementById('first_name').value + " " + document.getElementById('last_name').value;
   document.getElementById('daddress_1').value = document.getElementById('address_1').value; 
	 document.getElementById('daddress_2').value = document.getElementById('address_2').value; 
	 document.getElementById('dcity').value 		 = document.getElementById('city').value; 
	 document.getElementById('dstate').value 		 = document.getElementById('state').value; 
	 document.getElementById('dzip').value 			 = document.getElementById('zip').value;
	 
	 document.getElementById('daddress_1').readOnly = true; 
   document.getElementById('daddress_2').readOnly = true;
   document.getElementById('dcity').readOnly			= true;
   document.getElementById('dstate').readOnly		 	= true;
   document.getElementById('dzip').readOnly			  = true;	
	 document.getElementById('dname').readOnly			  = true;
 }
 
}

var http_request  = false;

function init_post_request() {

  this.fn_request = false;

  if (window.XMLHttpRequest) { // Mozilla, Safari,...
    this.fn_request = new XMLHttpRequest();
    if (this.fn_request.overrideMimeType) {
      this.fn_request.overrideMimeType('text/html');
    }
  } 
	else if (window.ActiveXObject) { // IE
    try {
      this.fn_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
       try {
         this.fn_request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (e) {}
    }
  }
  if (!this.fn_request) {
    alert('Cannot create XMLHTTP instance');
    return false;
  }

}

function post_request(obj, url, parameters) {

  obj.open('POST', url, true);
  obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  obj.setRequestHeader("Content-length", parameters.length);
  obj.setRequestHeader("Connection", "close");
  obj.send(parameters);

}

function make_post_request(url, parameters) {

  tmp_http_req = new init_post_request();
	http_request = tmp_http_req.fn_request;
  
  http_request.onreadystatechange = update_content;
	resetClock();
	
	post_request(http_request, url, parameters);
	
}

function display_promo_box() {

  url = "php_templates/store_cat_box.tmp.php";
	parameters = "";

  tmp_http_req = new init_post_request();
	http_request = tmp_http_req.fn_request;

  http_request.onreadystatechange = update_promo_box;
	
	post_request(http_request, url, parameters);
	
	setTimeout("display_promo_box()", 20000);
		
}

function update_promo_box() {

  if (http_request.readyState == 4 || http_request.readyState == "complete") {
    data = http_request.responseText;
		document.getElementById('promobox').innerHTML = data;	
	}

}

var active_swf = "";

function flash_bg(swf) {

  active_swf = swf;

  if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
    swidth = window.innerWidth;
    winH 	 = window.innerHeight;
   }
   if (navigator.appName.indexOf("Microsoft")!=-1) {
    swidth = document.body.offsetWidth;
    winH 	 = document.body.offsetHeight;
   }
  }				
	
	x_pos = swidth - ((swidth / 2) - 600);
	if (x_pos < 0 || x_pos > (swidth / 2)) { 
	  x_pos = 0;
	}
	fwidth  = swidth - 10;
	fheight = ((fwidth / 1200) * 800) - 10;
	
	//alert(fwidth + " " + fheight);
	
	document.getElementById('fbg').style.left = x_pos + "px";  

  var fbg = new SWFObject("flash/" + swf, "fbg", String(fwidth), String(fheight), "5", "#FFFFFF");
  fbg.addParam("wmode", "transparent");
  fbg.write("fbg");

}

//-->