function show(object) {
  if (document.getElementById) {
    document.getElementById(object).style.visibility = 'visible';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].visibility = 'visible';
  }
  else if (document.all) {
    document.all[object].style.visibility = 'visible';
  }
}

function hide(object) {
  if (document.getElementById) {
    document.getElementById(object).style.visibility = 'hidden';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].visibility = 'hidden';
  }
  else if (document.all) {
    document.all[object].style.visibility = 'hidden';
  }
}


 function handleClick(whichClick) {
    if (whichClick == "hide it") {
        hide('messagelyr');
        checkit();
    }
  }
function message()
{
var a
show('messagelyr');
handleClick(a);

}


//here
function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

//here











function checkit()
{
	    var textstring = '';
        var logostring ='1';
		var spkrstring ='0';
        var descleadtime='2-5 days';
		var raidopt=0;
		var user_input = '';
 
// Get value of the 'cpu' radio buttons.

	user_input = '';
	
	for (i=0;i<document.forms[0].cpu.length;i++)
	{
		if (document.forms[0].cpu[i].selected)
		{
			user_input = document.forms[0].cpu[i].value;
		}
	}

    textstring += user_input;

// Get value of the 'lcd' radio buttons.   
          
    user_input="E";

	textstring += user_input;
     
// Get value of the 'mem' radio buttons.

    for (i=0;i<document.forms[0].mem.length;i++)
	{
		if (document.forms[0].mem[i].selected)
		{
			user_input = document.forms[0].mem[i].value;
		}
	}
  
	textstring += user_input;

// Get value of the 'hdd' radio buttons.

    for (i=0;i<document.forms[0].hdd.length;i++)
	{
		if (document.forms[0].hdd[i].selected)
		{
			hdd_user_input = document.forms[0].hdd[i].value;
		}
	}

	if ((hdd_user_input == "K")||(hdd_user_input == "L")||(hdd_user_input == "M"))
	{
		raidopt=0;
	}
	else
	{
		raidopt=1;
	}   
	textstring += hdd_user_input;
// Get value of the 'os' radio buttons.

        for (i=0;i<document.forms[0].os.length;i++)
	{
		if (document.forms[0].os[i].selected)
		{
			user_input = document.forms[0].os[i].value;
		}
	}

    textstring += user_input;

// Get value of the 'touch' radio buttons.

    for (i=0;i<document.forms[0].touch.length;i++)
	{
		if (document.forms[0].touch[i].selected)
		{
			user_input = document.forms[0].touch[i].value;
		}
	}
	textstring += user_input;

// Use Standard I/O port, No Spkr
//	user_input="0";

        for (i=0;i<document.forms[0].spkr.length;i++)
    	{
	    	if (document.forms[0].spkr[i].selected)
	    	{
	    		user_input = document.forms[0].spkr[i].value;
	    	}
	   }
	textstring += user_input;

// Get value of the 'opt' radio buttons. (Add on 1)

        for (i=0;i<document.forms[0].opt.length;i++)
	{
		if (document.forms[0].opt[i].selected)
		{
			user_input = document.forms[0].opt[i].value;
		}
	}
 
	textstring += user_input;

// NO PCI add on
    user_input="0";
	textstring += user_input;

// NO Add on 2
    user_input="0";

	textstring += user_input;

// Logo
    user_input="1";
	textstring += user_input;

// Base included
//    user_input="1";

	
	 for (i=0;i<document.forms[0].base.length;i++)
	{
		if (document.forms[0].base[i].selected)
		{
			base_user_input = document.forms[0].base[i].value;
		}
	}
	
	
	if ((raidopt==0) && (base_user_input!="1"))
	{
		alert("Please contact us for custom part#. 888-468-9757 or sales@pioneerpos.com");
		document.partno_form.leadtime.value = "";
		document.partno_form.output.value = "";
		return false;
    }  
	textstring += base_user_input;

	document.forms[0].output.value =textstring;
	document.forms[0].leadtime.value = " "+descleadtime;
	}

function valid(form){

        var logostring ='1';
		var spkrstring='0'
        var descleadtime='2-5 days';
    	var user_input = '';

		var newwhich=0;
		newwhich=document.partno_form.output.value;
		var count=partno_form.output.value.length;
		
	if (count>12){
  		 alert("Incorrect PartNo");
    	
 	 	document.partno_form.leadtime.value = "";
	 	document.partno_form.output.value = "";
		document.partno_form.output.focus();
     	return false; 
		}
// ARRAY COUNTS TO THE RIGHT
// [0]  [1]  [2]
// [3]  [4]
		
///CPU
   Upwhich= newwhich.toUpperCase();
   cpu_user_input = Upwhich.substring(0,1);

	if ( cpu_user_input=="S"){
       document.partno_form.cpu[0].selected = true;
    }
	
	if ( cpu_user_input=="T"){
       document.partno_form.cpu[1].selected = true;
    }

	if ( cpu_user_input=="V"){
       document.partno_form.cpu[2].selected = true;
    }


//LCD 
  Upwhich= newwhich.toUpperCase(); 
  user_input = Upwhich.substring(1,2);

   if (user_input=="E"){
 //  document.partno_form.lcd[0].checked = true;
     }
   
//MEM
  Upwhich= newwhich.toUpperCase();   
  user_input = Upwhich.substring(2,3);

    if (user_input=="1"){
       document.partno_form.mem[0].selected = true;
    }

    if (user_input=="B"){
       document.partno_form.mem[1].selected = true;
    }

//HDD
   Upwhich= newwhich.toUpperCase();   
   user_input = Upwhich.substring(3,4);
	
   if (user_input=="A"){
       document.partno_form.hdd[0].selected = true;
    }
	
   if (user_input=="C"){
       document.partno_form.hdd[1].selected = true;
    }
	
   if (user_input=="K"){
       document.partno_form.hdd[2].selected = true;
    }

   if (user_input=="M"){
       document.partno_form.hdd[3].selected = true;
    }
	
//OS
  Upwhich= newwhich.toUpperCase();          
  user_input = Upwhich.substring(4,5);

   if (user_input=="0"){
       document.partno_form.os[0].selected = true;
    }
	
   if (user_input=="X"){
       document.partno_form.os[1].selected = true;
    }
		
   if (user_input=="W"){
       document.partno_form.os[2].selected = true;
    }
	
   if (user_input=="2"){
       document.partno_form.os[3].selected = true;
    }


//Touch
	Upwhich= newwhich.toUpperCase();         
	user_input = Upwhich.substring(5,6);

   if (user_input=="R"){
       document.partno_form.touch[0].selected = true;
    }
	
   if (user_input=="S"){
       document.partno_form.touch[1].selected = true;
    }

   if (user_input=="U"){
       document.partno_form.touch[2].selected = true;
    }

   if (user_input=="0"){
       document.partno_form.touch[3].selected = true;
    }
	
//   if (user_input=="T"){
//       document.partno_form.touch[1].checked = true;
//    }

// I/O
  Upwhich= newwhich.toUpperCase(); 
  user_input = Upwhich.substring(6,7);

   if (user_input=="0"){
     document.partno_form.spkr[0].selected = true;
     }

   if (user_input=="1"){
     document.partno_form.spkr[1].selected = true;
     }

	
//OPT (Add on 1)
  Upwhich= newwhich.toUpperCase();         
  user_input = Upwhich.substring(7,8);

   if (user_input=="0"){
      document.partno_form.opt[0].selected = true;
    }
	
   if (user_input=="5"){
      document.partno_form.opt[1].selected = true;
    }

	
// PCI ADD ON
  Upwhich= newwhich.toUpperCase(); 
  user_input = Upwhich.substring(8,9);

   if (user_input=="0"){
 //  document.partno_form.lcd[0].checked = true;
     }

// ADD ON 2
  Upwhich= newwhich.toUpperCase(); 
  user_input = Upwhich.substring(9,10);

   if (user_input=="0"){
 //  document.partno_form.lcd[0].checked = true;
     }

// LOGO
  Upwhich= newwhich.toUpperCase(); 
  user_input = Upwhich.substring(10,11);

   if (user_input=="1"){
 //  document.partno_form.lcd[0].checked = true;
     }

// BASE
  Upwhich= newwhich.toUpperCase(); 
  user_input = Upwhich.substring(11,12);

 //  if (user_input=="1"){
 //  document.partno_form.lcd[0].checked = true;
 //    }
   if (user_input=="1"){
      document.partno_form.base[0].selected = true;
    }
	
   if (user_input=="4"){
      document.partno_form.base[1].selected = true;
    }
	

//check if correct part no or not

   cpuui = Upwhich.substring(0,1);
   lcdui = Upwhich.substring(1,2);
   memui = Upwhich.substring(2,3);
   hddui = Upwhich.substring(3,4);
   osui = Upwhich.substring(4,5);
   touchui = Upwhich.substring(5,6);
   ioui = Upwhich.substring(6,7);
   optui = Upwhich.substring(7,8);
   pciui = Upwhich.substring(8,9);
   addonui = Upwhich.substring(9,10);
   logoui = Upwhich.substring(10,11);
   baseui = Upwhich.substring(11,12);
if (Upwhich==""){
checkit();
return true;
}
else if ( ((cpuui =="S")||(cpuui =="T")||(cpuui =="V")) &&
			(lcdui =="E")&&
			((memui =="1")||(memui =="B"))&&
			((hddui =="A")||(hddui =="C")||(hddui =="K")||(hddui =="M"))&&
			((osui =="2")||(osui =="X")||(osui =="W")||(osui =="0"))&&
			((touchui =="R")||(touchui =="S")||(touchui =="0")||(touchui =="U"))&&
			((ioui =="0")||(ioui=="1"))&&
			((optui =="0")||(optui =="5"))&&
			(pciui =="0")&&
			(addonui == "0")&&
			(logoui =="1")&&
			((baseui =="1")||(baseui=="4")) )
{
}
 else {
 	alert("Incorrect PartNo");
   	 document.partno_form.leadtime.value = "";
	 	 document.partno_form.output.value = "";
     return false;
    }  
return true;
}//end of function



// -->


