<!--
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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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];}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function verifyCompatibleBrowser(){
    this.ver=navigator.appVersion
    this.dom=document.getElementById?1:0
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
    this.ie4=(document.all && !this.dom)?1:0;
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;

    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
    return this
}
bw=new verifyCompatibleBrowser()

var speed=40

var loop, timer

function ConstructObject(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
    this.up=MoveAreaUp;this.down=MoveAreaDown;
    //this.up2=MoveAreaUp2;this.down2=MoveAreaDown2;
    this.MoveArea=MoveArea; this.x; this.y;
    this.MoveArea2=MoveArea2; this.x2; this.y2;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

function MoveArea(x,y){
    this.x=x;this.y=y
    this.css.left=this.x
    this.css.top=this.y
}
function MoveArea2(x,y){
    this.x=x;this.y=y
    this.css.left=this.x
    this.css.top=this.y
}

function MoveAreaDown(move){
	if(this.y>-this.scrollHeight+objContainer.clipHeight){
    this.MoveArea(0,this.y-move)
    if(loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}
function MoveAreaDown2(move){
	if(this.y>-this.scrollHeight+objContainer2.clipHeight){
    this.MoveArea2(0,this.y-move)
    if(loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}
function MoveAreaUp(move){
	if(this.y<0){
    this.MoveArea(0,this.y-move)
    if(loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}

function PerformScroll(speed){
	if(initialised){
		loop=true;
		if(speed>0) objScroller.down(speed)
		else objScroller.up(speed)
	}
}
function PerformScroll2(speed){
	if(initialised){
		loop=true;
		if(speed>0) objScroller2.down(speed)
		else objScroller2.up(speed)
	}
}

function CeaseScroll(){
    loop=false
    if(timer) clearTimeout(timer)
}
var initialised;
function InitialiseScrollableArea(){
    objContainer=new ConstructObject('layer1')
    objScroller=new ConstructObject('layer2','layer1')
    objContainer2=new ConstructObject('layer3')
    objScroller2=new ConstructObject('layer4','layer3')
	objScroller.MoveArea(0,0)
	objScroller2.MoveArea2(0,0)
    objContainer.css.visibility='visible'
    objContainer2.css.visibility='visible'
    initialised=true;
}

function toggleLayer(layername)
{
  var obj;
  obj = MM_findObj(layername);
  if (obj != null)
  {

      if (obj.style.visibility == 'visible')
	    obj.style.visibility = 'hidden';
      else
	    obj.style.visibility = 'visible';
  }
}

function hideLayers()
{
  var i,p,v,obj,args=hideLayers.arguments;
  for (i=0; i<args.length; i++)
  {
    obj = MM_findObj(args[i]);
    if (obj != null)
       obj.style.visibility = 'hidden';
  }
 }

//Format numbers to 2 precision 
function dp2(a){
    a = a.toString();

    if (a.indexOf("e-")!= -1){

    } else if (a.indexOf("e+")!= -1){

    } else {
      if(a.indexOf(".") >= 0){
        chk_3 =  (a.substring(a.indexOf(".") + 3, a.indexOf(".") + 4))*1;
        if (chk_3 > 4){
          a = a*1 + 0.01;
        }
        a = a + "";
        a = a.substring(0, a.indexOf(".") + 3);
      } else {
	    if (a != "Infinity"){
          a = a + ".00";
		}
      }
      if(a.length - a.indexOf(".") == 2){
         a = a + "0";
      }
    }
  if (a == ".00"){a="0.00";}
  return a;
}

//=================Cookies Handling=======================
var path = "/";
var domain ;
var locapath = document.location.href

org_path_start = locapath.indexOf("://") + 3;
org_path_end = locapath.length;
domain = locapath.substring(org_path_start, org_path_end);
if (domain.toString().search('/')!= -1){
   org_path_start = 0;
   org_path_end = domain.indexOf("/");
   domain = domain.substring(org_path_start, org_path_end);
}

function GetCookie (name) {  
   var arg = name + "=";  
   var alen = arg.length;  
   var clen = document.cookie.length;  
   var i = 0;  
   while (i < clen) {    
   var j = i + alen;    
   if (document.cookie.substring(i, j) == arg)      
   return getCookieVal (j);    
   i = document.cookie.indexOf(" ", i) + 1;    
   if (i == 0) break;   
   }  
   return null;
}

function getCookieVal(offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
       endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
}

function SetCookie (name, value) {  
   var argv = SetCookie.arguments;  
   var argc = SetCookie.arguments.length;  
   var expires = (argc > 2) ? argv[2] : null;  
   //var path = (argc > 3) ? argv[3] : null;  
   //var domain = (argc > 4) ? argv[4] : null;  
   
   var secure = (argc > 5) ? argv[5] : false;  
   document.cookie = name + "=" + escape (value) + 
   ( (expires == null) ? "" : ("; expires=" + expires.toGMTString()) ) + 
   //((expires == null) ? "" : ("; expires=")) + 
   ((path == null) ? "" : ("; path=" + path)) +  
   ((domain == null) ? "" : ("; domain=" + domain)) +    
   ((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {  
   var exp = new Date();  
   exp.setTime (exp.getTime() - 100);  
   var cval = GetCookie (name);  
   //document.cookie = name + "=" + cval + "; expires=" + "Wed, 31-Dec-1999 00:00:00 GMT;";
   SetCookie (name, cval, exp);
}
//====================================================


//========LPE Order Handling==============================

var lpe_id_name = "lpe_id";

function onload_lpe_select()
{
   var lpe_id_str = GetCookie (lpe_id_name);
   
   if (lpe_id_str != null && lpe_id_str != "")
   {
        var this_item_start = lpe_id_str.indexOf( "|" );
        var next_item_start = lpe_id_str.indexOf( "|", this_item_start + 1);
        if ( next_item_start == -1 ) next_item_start = lpe_id_str.length;
        
        //alert( lpe_id_str.substr(this_item_start, next_item_start) );
        while ( this_item_start >= 0 )
        {
            var item_start = this_item_start + 1;
            var item_end = next_item_start;
            
            var item = lpe_id_str.substring( item_start, item_end ); //elimate all |
            
            var data = item.split("^");
            
            if ( eval ( "document.form.lpe" + data[0] ) )
               eval ( "document.form.lpe" + data[0] ).checked = true;
            
            this_item_start = lpe_id_str.indexOf( "|", next_item_start);
            next_item_start = lpe_id_str.indexOf( "|", this_item_start + 1);
            if ( next_item_start == -1 ) next_item_start = lpe_id_str.length;

            //alert( lpe_id_str.substring(this_item_start, next_item_start) );
        }
   }   
}

function add_lpe_item ( no )
{
   var argv = add_lpe_item.arguments;
   var argc = add_lpe_item.arguments.length;
   var qty = (argc > 1) ? argv[1] : "1";
   var type = (argc > 2) ? argv[2] : "mtd";

   var lpe_id_str = GetCookie (lpe_id_name);
   if (lpe_id_str == null || lpe_id_str == "")
      lpe_id_str = "|" + no + "^" + qty + "^" + type;
   else
      lpe_id_str = lpe_id_str + "|" + no + "^" + qty + "^" + type;

   //alert(lpe_id_str);
   SetCookie( lpe_id_name, lpe_id_str);
}

function update_lpe_item ( no )
{
   var lpe_id_str = GetCookie (lpe_id_name);

   var argv = update_lpe_item.arguments;
   var argc = update_lpe_item.arguments.length;
   var qty = (argc > 1) ? argv[1] : "";
   var type = (argc > 2) ? argv[2] : "";

   if (lpe_id_str != null && lpe_id_str != "")
   {
        var start = lpe_id_str.indexOf( "|" + no + "^");
        var end = lpe_id_str.indexOf( "|", start + 1);
        if ( end == -1 ) end = lpe_id_str.length;
        
        if (start >= 0 && end > 0)
        {
           lpe_id_str = lpe_id_str.substr(0, start) + "|" + no + "^" + qty + "^" + type + lpe_id_str.substr(end , lpe_id_str.length)
           //if ( lpe_id_str == "|" ) lpe_id_str = ""; //eliminate the last |
        }
   }
   //alert(lpe_id_str);
   SetCookie( lpe_id_name, lpe_id_str);
}

function del_lpe_item ( no )
{
   var lpe_id_str = GetCookie (lpe_id_name);
   if (lpe_id_str != null && lpe_id_str != "")
   {
        var start = lpe_id_str.indexOf( "|" + no + "^");
        var end = lpe_id_str.indexOf( "|", start + 1);
        if ( end == -1 ) end = lpe_id_str.length;
        
        if (start >= 0 && end > 0)
        {
           lpe_id_str = lpe_id_str.substr(0, start) + lpe_id_str.substr(end , lpe_id_str.length)
           //if ( lpe_id_str == "|" ) lpe_id_str = ""; //eliminate the last |
        }
   }
   //alert(lpe_id_str);
   SetCookie( lpe_id_name, lpe_id_str);
}

//====================================================

//========OP Order Handling==============================

var op_id_name = "op_id";

function onload_op_select()
{
   var op_id_str = GetCookie (op_id_name);
   
   if (op_id_str != null && op_id_str != "")
   {
        var this_item_start = op_id_str.indexOf( "|" );
        var next_item_start = op_id_str.indexOf( "|", this_item_start + 1);
        if ( next_item_start == -1 ) next_item_start = op_id_str.length;
        
        //alert( op_id_str.substr(this_item_start, next_item_start) );
        while ( this_item_start >= 0 )
        {
            var item_start = this_item_start + 1;
            var item_end = next_item_start;
            
            var item = op_id_str.substring( item_start, item_end ); //elimate all |
            
            var data = item.split("^");
            
            if ( eval ( "document.form.op" + data[0] ) )
               eval ( "document.form.op" + data[0] ).checked = true;
            
            this_item_start = op_id_str.indexOf( "|", next_item_start);
            next_item_start = op_id_str.indexOf( "|", this_item_start + 1);
            if ( next_item_start == -1 ) next_item_start = op_id_str.length;

            //alert( op_id_str.substring(this_item_start, next_item_start) );
        }
   }   
}

function add_op_item ( no )
{
   var argv = add_op_item.arguments;
   var argc = add_op_item.arguments.length;

   var op_id_str = GetCookie (op_id_name);
   if (op_id_str == null || op_id_str == "")
      op_id_str = "|" + no + "^";
   else
      op_id_str = op_id_str + "|" + no + "^";

   //alert(op_id_str);
   SetCookie( op_id_name, op_id_str);
}

function del_op_item ( no )
{
   var op_id_str = GetCookie (op_id_name);
   if (op_id_str != null && op_id_str != "")
   {
        var start = op_id_str.indexOf( "|" + no + "^");
        var end = op_id_str.indexOf( "|", start + 1);
        if ( end == -1 ) end = op_id_str.length;
        
        if (start >= 0 && end > 0)
        {
           op_id_str = op_id_str.substr(0, start) + op_id_str.substr(end , op_id_str.length)
           //if ( op_id_str == "|" ) op_id_str = ""; //eliminate the last |
        }
   }
   //alert(op_id_str);
   SetCookie( op_id_name, op_id_str);
}

//====================================================

//==============Order Form Generation=================
var subtotal = 0;

function gen_lpe_form()
{           
           var lpe_id_str = GetCookie (lpe_id_name);
           var item_start, item_end, item, cart_data, lpe_str, pid, qty, type, amt;
           
           if (lpe_id_str != null && lpe_id_str != "")
           {
                var this_item_start = lpe_id_str.indexOf( "|" );
                var next_item_start = lpe_id_str.indexOf( "|", this_item_start + 1);
                if ( next_item_start == -1 ) next_item_start = lpe_id_str.length;
                
                while ( this_item_start >= 0 )
                {
                    item_start = this_item_start + 1;
                    item_end = next_item_start;
                    item = lpe_id_str.substring( item_start, item_end ); //elimate all |

                    //alert(item);
                    
                    cart_data = item.split("^");
                    pid = cart_data[0];
                    qty = cart_data[1];
                    type = cart_data[2];
                    
                    if (!LPE[pid])
                         break;
                    lpe_str = LPE[pid];
                    lpe_data = lpe_str.split("|");
                    
                    product_name = lpe_data[0];
                    unmtd_price = lpe_data[1];
                    mtd_price = lpe_data[2];
                    amt = ((type == "mtd")? mtd_price:unmtd_price) * qty
                    
                    document.write( '<tr bgcolor="#CCCCCC">' );
                    document.write( '    <td align="left" class="formdata">' + product_name + '</td>');
                    document.write( '    <td> <p class="formdata"> ');
                    document.write( '        <label> ');
                    document.write( '        <input type="radio" name="lpe_type_' + pid + '" value="mtd" onClick="//document.getElementById(\'price_' + pid + '\').innerHTML = \'' + mtd_price + '\';"' + ((type == "mtd")? "checked" : "") + '>');
                    document.write( '        mtd.</label>');
                    document.write( '        <br>');
                    document.write( '        <label> ');
                    document.write( '        <input type="radio" name="lpe_type_' + pid + '" value="unmtd" onClick="//document.getElementById(\'price_' + pid + '\').innerHTML = \'' + unmtd_price + '\';"' + ((type == "unmtd")? "checked" : "") + '>');
                    document.write( '        unmtd.</label>');
                    document.write( '        <br>');
                    document.write( '      </p></td>');
                    document.write( '    <td align="center"><input name="lpe_qty_' + pid + '" type="text" value="' + qty + '" size="3" maxlength="2"> ');
                    document.write( '    </td>');
                    document.write( '    <td align="right" class="formdata"><div id="price_' + pid + '">' + dp2(amt) + '</div></td>');
                    document.write( '    <td align="center"><input name="lpe_remove_' + pid + '" type="checkbox" value="removeitem"> ');
                    document.write( '    </td>');
                    document.write( '</tr>');
                       
                    subtotal = subtotal + parseInt((amt));
                                        
                    this_item_start = lpe_id_str.indexOf( "|", next_item_start);
                    next_item_start = lpe_id_str.indexOf( "|", this_item_start + 1);
                    if ( next_item_start == -1 ) next_item_start = lpe_id_str.length;
                    
                    //alert( lpe_id_str.substr(this_item_start, next_item_start) );
                }
           }   
}

function gen_op_form()
{           
           var op_id_str = GetCookie (op_id_name);
           var item_start, item_end, item, cart_data, op_str, pid;
           
           if (op_id_str != null && op_id_str != "")
           {
                var this_item_start = op_id_str.indexOf( "|" );
                var next_item_start = op_id_str.indexOf( "|", this_item_start + 1);
                if ( next_item_start == -1 ) next_item_start = op_id_str.length;
                
                while ( this_item_start >= 0 )
                {
                    item_start = this_item_start + 1;
                    item_end = next_item_start;
                    item = op_id_str.substring( item_start, item_end ); //elimate all |

                    //alert(item);
                    
                    cart_data = item.split("^");
                    pid = cart_data[0];

                    if (!OP[pid])
                         break;

                    op_str = OP[pid];
                    op_data = op_str.split("|");
                    
                    product_name = op_data[0];
                    mtd_price = op_data[1];
                    
                    document.write( '<tr bgcolor="#CCCCCC">');
                    document.write( '   <td height="45" colspan="3" align="left" class="formdata">' + product_name + '</td>');
                    document.write( '   <td height="45" align="right" class="formdata">' + dp2(mtd_price) + '</td>');
                    document.write( '   <td align="center"><input name="op_remove_' + pid + '" type="checkbox" value="removeitem">');
                    document.write( '</tr>');
                    
                    subtotal = subtotal + parseInt(mtd_price);
                    
                    this_item_start = op_id_str.indexOf( "|", next_item_start);
                    next_item_start = op_id_str.indexOf( "|", this_item_start + 1);
                    if ( next_item_start == -1 ) next_item_start = op_id_str.length;
                    
                    //alert( op_id_str.substr(this_item_start, next_item_start) );
                }
           }   
}

function sub_total()
{
          document.write( dp2(subtotal) );
}

//====================================================


//==============Order Form Updating===================
function update_lpe_form()
{
   var pid, qty, type, remove;
   var lpe_id_str = GetCookie (lpe_id_name);
   
   if (lpe_id_str != null && lpe_id_str != "")
   {
        var this_item_start = lpe_id_str.indexOf( "|" );
        var next_item_start = lpe_id_str.indexOf( "|", this_item_start + 1);
        if ( next_item_start == -1 ) next_item_start = lpe_id_str.length;
        
        //alert( lpe_id_str.substr(this_item_start, next_item_start) );
        while ( this_item_start >= 0 )
        {
            var item_start = this_item_start + 1;
            var item_end = next_item_start;
            
            var item = lpe_id_str.substring( item_start, item_end ); //elimate all |
            
            var cart_data = item.split("^");

            pid = cart_data[0];
            
            qty = get_value( "lpe_qty_" + pid );
            type = get_value( "lpe_type_" + pid );
            remove = get_value( "lpe_remove_" + pid );
            
            if (remove == "" || remove == null)
               update_lpe_item(pid, qty, type);
            else if (remove == "removeitem")
               del_lpe_item(pid);
            
            this_item_start = lpe_id_str.indexOf( "|", next_item_start);
            next_item_start = lpe_id_str.indexOf( "|", this_item_start + 1);
            if ( next_item_start == -1 ) next_item_start = lpe_id_str.length;
        }
   }   
}

function update_op_form()
{
   var pid, qty, type, remove;
   var op_id_str = GetCookie (op_id_name);
   
   if (op_id_str != null && op_id_str != "")
   {
        var this_item_start = op_id_str.indexOf( "|" );
        var next_item_start = op_id_str.indexOf( "|", this_item_start + 1);
        if ( next_item_start == -1 ) next_item_start = op_id_str.length;
        
        //alert( op_id_str.substr(this_item_start, next_item_start) );
        while ( this_item_start >= 0 )
        {
            var item_start = this_item_start + 1;
            var item_end = next_item_start;
            
            var item = op_id_str.substring( item_start, item_end ); //elimate all |
            
            var cart_data = item.split("^");

            pid = cart_data[0];
            remove = get_value( "op_remove_" + pid );
            
            if (remove == "removeitem")
               del_op_item(pid);
            
            this_item_start = op_id_str.indexOf( "|", next_item_start);
            next_item_start = op_id_str.indexOf( "|", this_item_start + 1);
            if ( next_item_start == -1 ) next_item_start = op_id_str.length;
        }
   }   
}

function fill_up_form()
{
   document.form.salutation.value = unescape(get_value("salutation"));
   document.form.name.value = unescape(get_value("name"));
   document.form.email.value = unescape(get_value("email"));
   document.form.tel.value = unescape(get_value("tel"));
   document.form.fax.value = unescape(get_value("fax"));
   document.form.cadd1.value = unescape(get_value("cadd1"));
   document.form.cadd2.value = unescape(get_value("cadd2"));
   document.form.cadd3.value = unescape(get_value("cadd3"));
   document.form.cadd4.value = unescape(get_value("cadd4"));
   document.form.czip.value = unescape(get_value("czip"));
   document.form.ccountry.value = unescape(get_value("ccountry"));
   document.form.sadd1.value = unescape(get_value("sadd1"));
   document.form.sadd2.value = unescape(get_value("sadd2"));
   document.form.sadd3.value = unescape(get_value("sadd3"));
   document.form.sadd4.value = unescape(get_value("sadd4"));
   document.form.szip.value = unescape(get_value("szip"));
   document.form.scountry.value = unescape(get_value("scountry"));
}

function fill_up_print_form()
{
   document.getElementById("salutation").innerHTML = unescape(get_value("salutation"));
   document.getElementById("name").innerHTML = unescape(get_value("name"));
   document.getElementById("email").innerHTML = unescape(get_value("email"));
   document.getElementById("tel").innerHTML = unescape(get_value("tel"));
   document.getElementById("fax").innerHTML = unescape(get_value("fax"));
   document.getElementById("cadd1").innerHTML = unescape(get_value("cadd1"));
   document.getElementById("cadd2").innerHTML = unescape(get_value("cadd2"));
   document.getElementById("cadd3").innerHTML = unescape(get_value("cadd3"));
   document.getElementById("cadd4").innerHTML = unescape(get_value("cadd4"));
   document.getElementById("czip").innerHTML = unescape(get_value("czip"));
   document.getElementById("ccountry").innerHTML = unescape(get_value("ccountry"));
   document.getElementById("sadd1").innerHTML = unescape(get_value("sadd1"));
   document.getElementById("sadd2").innerHTML = unescape(get_value("sadd2"));
   document.getElementById("sadd3").innerHTML = unescape(get_value("sadd3"));
   document.getElementById("sadd4").innerHTML = unescape(get_value("sadd4"));
   document.getElementById("szip").innerHTML = unescape(get_value("szip"));
   document.getElementById("scountry").innerHTML = unescape(get_value("scountry"));
}
//====================================================


//==============Order Form Checking===================
function form_checking1()
{
    for (var i=0; i<document.form.elements.length; i++)
    {
        var target = document.form.elements[i];
        if ( target.name.indexOf("qty_") > 0 ){
                if (isNaN(target.value) || target.value <= 0 || target.value.indexOf('.') >= 0)
		{
			alert('Invalid input of quantity');
			target.focus();
			return false;
		}        
        }
    }
    return true;
}

function form_checking2()
{
        if ( document.form.salutation.options[document.form.salutation.selectedIndex].value == "")
        {
	    alert('Missing input the salutation');
	    document.form.salutation.focus();
	    return false;
	}
        if ( document.form.name.value == "")
        {
	    alert('Please enter your full name');
	    document.form.name.focus();
	    return false;
	}
        if ( document.form.email.value == "")
        {
	    alert('Please enter your e-mail address');
	    document.form.email.focus();
	    return false;
	}
        if ( document.form.tel.value == "")
        {
	    alert('Please enter your contact telephone');
	    document.form.tel.focus();
	    return false;
	}
        if ( document.form.cadd1.value == "")
        {
	    alert('Please enter your house/apt/block address');
	    document.form.cadd1.focus();
	    return false;
	}
        if ( document.form.cadd2.value == "")
        {
	    alert('Please enter your street');
	    document.form.cadd2.focus();
	    return false;
	}
        if ( document.form.cadd3.value == "")
        {
	    alert('Please enter your town/city');
	    document.form.cadd3.focus();
	    return false;
	}
        if ( document.form.cadd4.value == "")
        {
	    alert('Please enter your state/county/district');
	    document.form.cadd4.focus();
	    return false;
	}
        if ( document.form.czip.value == "")
        {
	    alert('Please enter your zip/postal code');
	    document.form.czip.focus();
	    return false;
	}
        if ( document.form.ccountry.value == "")
        {
	    alert('Please enter your country');
	    document.form.ccountry.focus();
	    return false;
	}
	

	return true;
}

//====================================================

//==============Location Data Parsing ====================
var Key = new Array();
var val = new Array();

function parse_data(){
    var location = window.location;
    location = location.toString();
    var arr_a = location.split("?");
    if (arr_a[1])
    {
        var tmp_a = arr_a[1];
        tmp_a = tmp_a.toString();
        tmp_a = tmp_a.split("&");
        for (var i=0; i<tmp_a.length; i++)
        {
                pair = tmp_a[i].split("=");
                Key[i] = pair[0];
                val[i] = pair[1];
        }
        return true;
    }else
    {
        return false;
    }
}

function get_value( find_key )
{
    if ( Key.length > 0 && val.length > 0 && Key.length == val.length)
    {
        for (var i=0; i<Key.length; i++)
        {
                if (Key[i] == find_key)
                    return val[i];
        }
    }
    return null;
}

//===================================================

//==============Print Form Generation=================
var subtotal_print = 0;

function gen_lpe_print_form()
{           
           var lpe_id_str = GetCookie (lpe_id_name);
           var item_start, item_end, item, cart_data, lpe_str, pid, qty, type, amt;
           
           if (lpe_id_str != null && lpe_id_str != "")
           {
                var this_item_start = lpe_id_str.indexOf( "|" );
                var next_item_start = lpe_id_str.indexOf( "|", this_item_start + 1);
                if ( next_item_start == -1 ) next_item_start = lpe_id_str.length;
                
                while ( this_item_start >= 0 )
                {
                    item_start = this_item_start + 1;
                    item_end = next_item_start;
                    item = lpe_id_str.substring( item_start, item_end ); //elimate all |

                    //alert(item);
                    
                    cart_data = item.split("^");
                    pid = cart_data[0];
                    qty = cart_data[1];
                    type = cart_data[2];
                    
                    if (!LPE[pid])
                         break;

                    lpe_str = LPE[pid];
                    lpe_data = lpe_str.split("|");
                    
                    product_name = lpe_data[0];
                    unmtd_price = lpe_data[1];
                    mtd_price = lpe_data[2];
                    amt = ((type == "mtd")? mtd_price:unmtd_price) * qty
                    
                    document.write(" <tr style='height:23.0pt'>");
                    document.write("  <td width=274 colspan=3 style='width:274.0pt;border:solid windowtext .5pt;");
                    document.write("  border-top:none;mso-border-top-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;");
                    document.write("  height:23.0pt'>");
                    document.write("  <p class=MsoNormal style='margin-right:-5.4pt'><span style='font-size:9.0pt;");
                    document.write("  font-family:Arial'>" + product_name + "<o:p></o:p></span></p>");
                    document.write("  </td>");
                    document.write("  <td width=68 colspan=3 style='width:68.0pt;border-top:none;border-left:none;");
                    document.write("  border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt;");
                    document.write("  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;");
                    document.write("  padding:0in 5.4pt 0in 5.4pt;height:23.0pt'>");
                    document.write("  <p class=MsoNormal style='margin-right:-5.4pt'><span style='font-size:9.0pt;");
                    document.write("  font-family:Arial'>" + ((type == 'mtd')? 'mounted':'unmounted') + "<o:p></o:p></span></p>");
                    document.write("  </td>");
                    document.write("  <td width=68 style='width:68.0pt;border-top:none;border-left:none;border-bottom:");
                    document.write("  solid windowtext .5pt;border-right:solid windowtext .5pt;mso-border-top-alt:");
                    document.write("  solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;");
                    document.write("  height:23.0pt'>");
                    document.write("  <p class=MsoNormal align=center style='margin-right:-5.4pt;text-align:center'><span");
                    document.write("  style='font-size:9.0pt;font-family:Arial'>" + qty + "<o:p></o:p></span></p>");
                    document.write("  </td>");
                    document.write("  <td width=68 colspan=2 style='width:68.0pt;border-top:none;border-left:none;");
                    document.write("  border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt;");
                    document.write("  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;");
                    document.write("  padding:0in 5.4pt 0in 5.4pt;height:23.0pt'>");
                    document.write("  <p class=MsoNormal style='margin-right:-5.4pt'><span style='font-size:9.0pt;");
                    document.write("  'font-family:Arial'> " + dp2(amt) + "<o:p></o:p></span></p>");
                    document.write("  </td>");
                    document.write(" </tr>");                       
                    subtotal_print = subtotal_print + parseInt((amt));
                                        
                    this_item_start = lpe_id_str.indexOf( "|", next_item_start);
                    next_item_start = lpe_id_str.indexOf( "|", this_item_start + 1);
                    if ( next_item_start == -1 ) next_item_start = lpe_id_str.length;
                    
                    //alert( lpe_id_str.substr(this_item_start, next_item_start) );
                }
           }   
}

function gen_op_print_form()
{           
           var op_id_str = GetCookie (op_id_name);
           var item_start, item_end, item, cart_data, op_str, pid;
           
           if (op_id_str != null && op_id_str != "")
           {
                var this_item_start = op_id_str.indexOf( "|" );
                var next_item_start = op_id_str.indexOf( "|", this_item_start + 1);
                if ( next_item_start == -1 ) next_item_start = op_id_str.length;
                
                while ( this_item_start >= 0 )
                {
                    item_start = this_item_start + 1;
                    item_end = next_item_start;
                    item = op_id_str.substring( item_start, item_end ); //elimate all |

                    //alert(item);
                    
                    cart_data = item.split("^");
                    pid = cart_data[0];

                    if (!OP[pid])
                         break;

                    op_str = OP[pid];
                    op_data = op_str.split("|");
                    
                    product_name = op_data[0];
                    mtd_price = op_data[1];
                    
                    document.write(" <tr style='height:22.0pt'>");
                    document.write("  <td width=410 colspan=7 style='width:410.0pt;border:solid windowtext .5pt;");
                    document.write("  border-top:none;mso-border-top-alt:solid windowtext .5pt;padding:0in 5.4pt 0in 5.4pt;");
                    document.write("  height:22.0pt'>");
                    document.write("  <p class=MsoNormal style='margin-right:-5.4pt'><span style='font-size:9.0pt;");
                    document.write("  font-family:Arial'>" + product_name + "<o:p></o:p></span></p>");
                    document.write("  </td>");
                    document.write("  <td width=68 colspan=2 style='width:68.0pt;border-top:none;border-left:none;");
                    document.write("  border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt;");
                    document.write("  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;");
                    document.write("  padding:0in 5.4pt 0in 5.4pt;height:22.0pt'>");
                    document.write("  <p class=MsoNormal style='margin-right:-5.4pt'><span style='font-size:10.0pt;");
                    document.write("  font-family:Arial'>  " + dp2(mtd_price) + "<o:p></o:p></span></p>");
                    document.write("  </td>");
                    document.write(" </tr>");
                    
                    subtotal_print = subtotal_print + parseInt(mtd_price);
                    
                    this_item_start = op_id_str.indexOf( "|", next_item_start);
                    next_item_start = op_id_str.indexOf( "|", this_item_start + 1);
                    if ( next_item_start == -1 ) next_item_start = op_id_str.length;
                    
                    //alert( op_id_str.substr(this_item_start, next_item_start) );
                }
           }   
}

function sub_total_print()
{
          document.write( dp2(subtotal_print) );
}

//====================================================

/*========Product Information ========================
  LPE Product information defined as follow
  "Product Name|Unmounted price|Mounted price"
*/

LPE = new Array();

//LPE Page1
LPE[0] = "THE WHITE BENCH|30.00|35.00";
LPE[1] = "THE GREENHOUSE|30.00|35.00";
LPE[2] = "THE PATIO|30.00|35.00";
LPE[3] = "THE TOOLSHED|30.00|35.00";
LPE[4] = "ORIENTAL POPPIES II|30.00|35.00";
LPE[5] = "MEADOW FLOWERS|20.00|25.00";
LPE[6] = "THE HARVEST|20.00|25.00";
LPE[7] = "COW PARSLEY|30.00|35.00";

//LPE Page2
LPE[8] = "SUMMER GARDEN|20.00|25.00";
LPE[9] = "FRENCH WINDOW II|30.00|35.00";
LPE[10] = "PINK AND RED POPPIES|30.00|35.00";
LPE[11] = "AFTERNOON SUNLIGHT|30.00|35.00";
LPE[12] = "SPRING LANDSCAPE|30.00|35.00";
LPE[13] = "AUGUST LANDSCAPE|20.00|25.00";
LPE[14] = "THE WHITE GATE|30.00|35.00";
LPE[15] = "PATIO CHAIR|30.00|35.00";

//LPE Page3
LPE[16] = "THE CHAIR I|30.00|35.00";
LPE[17] = "THE CHAIR II|30.00|35.00";
LPE[18] = "POPPIES IN VASE|30.00|35.00";
LPE[19] = "THE RAMBLING ROSE|30.00|35.00";
LPE[20] = "MAPLES|60.00|65.00";
LPE[21] = "RIVERSIDE TREES|60.00|65.00";

//LPE Page4
LPE[22] = "AUTUMN REFLECTIONS|65.00";
LPE[23] = "THE THREE TENORS|55.00";
LPE[24] = "SPELSBURY|55.00";
LPE[25] = "PORTMEADOW|55.00";
LPE[26] = "ENSTONE IN AUTUMN|5O.00";


//  OP Product information defined as follow
//  "Product Name|Mounted price"
OP = new Array();
//OP Page1
OP[0] = "THE HARBOUR|300";
OP[1] = "OTMOOR|650";
OP[2] = "CAVTAT|280";
OP[3] = "COAST WITH BOAT|290";
OP[4] = "SOUTH NEWINGTON|270";
OP[5] = "CHURCH ENSTONE|400";
OP[6] = "LANDSCAPE WITH OLIVE TREE|380";
OP[7] = "THE BERKSHIRE DOWNS|380";

//OP Page2
OP[8] = "ECHOES OF GREECE I|450";
OP[9] = "ECHOES OF GREECE II|450";
OP[10] = "COAST WITH GULL|320";
OP[11] = "YOUNG MAPLE|290";
OP[12] = "DAISIES|475";
OP[13] = "TERRACOTTA PARK|460";
OP[14] = "BLENHEIM PARK II|380";
OP[15] = "BROOKSIDE COW PARSLEY|650";

//OP Page3
OP[16] = "THE OLD SWAMP|550";
OP[17] = "BARFORD ST JOHN|300";
OP[18] = "BOAT WITH GULLS|290";
OP[19] = "FRITILLARY MEADOW|240";
OP[20] = "BIRCH VARIATIONS|380";
OP[21] = "HUGTIME|290";
OP[22] = "GULLS ON THE SHORE|475";
OP[23] = "INDIAN SUMMER|280";

//OP Page4
OP[24] = "PANGBOURNE|380";
OP[25] = "DUCKS|270";
OP[26] = "LEAFY LANE|270";
OP[27] = "LONGBOROUGH|280";
OP[28] = "SOUTH NEWINGTON|270";
OP[29] = "PORT MEADOW|340";
OP[30] = "ISLIP|350";
OP[31] = "OTMOOR|350";


//====================================================

//-->
