
var emailerror1="Please input your email address";
var emailerror2="Bad Syntax of Email address";

function newalert(errorstring) {
   alert(errorstring);
};

function Validator(theForm)
{ if (theForm.email.value =="")
  { theForm.email.focus();
    newalert(emailerror1);
    return (false); }
	
  var checkOK = "@";
  var checkStr = theForm.email.value;
  var allValid = false;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
      {
 allValid = true;
 break;
      }
  }
 if (!allValid)
  {
    theForm.email.focus();
    newalert(emailerror2);
    return (false);
  }
  var checkOK = ".";
  var checkStr = theForm.email.value;
  var allValid = false;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
      {
 allValid = true;
 break;
      }
  }
 if (!allValid)
  {
    theForm.email.focus();
    newalert(emailerror2);
    return (false);
  }
  var checkOK = "@???????????????????????º???0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.";
  var checkStr = theForm.email.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
 break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    theForm.email.focus();
    newalert(emailerror2);
    return (false);
  }
  return (true);
};
function register_enews(reg_file){

window.open("http://www.ophiropt.com/laser/register.php?item="+reg_file+"&enews=enews",'an','toolbar=no,member=no,location=no,menubar=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=740,width=580');
}
function register(reg_file){

window.open("http://www.ophiropt.com/laser/register.php?item="+reg_file,'an','toolbar=no,member=no,location=no,menubar=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=740,width=580');
/*  if (window.focus) {nwin1.focus();}*/
}
function jp_register(reg_file){

window.open("http://www.ophiropt.com/laser/pdf/jp/jp_register.php?item="+reg_file,'an','toolbar=no,member=no,location=no,menubar=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=740,width=580');
/*  if (window.focus) {nwin1.focus();}*/
}
function de_register(reg_file){

window.open("http://www.ophiropt.com/laser/de/de_register.php?item="+reg_file,'an','toolbar=no,member=no,location=no,menubar=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=740,width=580');
/*  if (window.focus) {nwin1.focus();}*/
}
function register_ppc(reg_file){

window.open("http://www.ophiropt.com/laser/register-ppc.php?item="+reg_file,'an','toolbar=no,member=no,location=no,menubar=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
/*  if (window.focus) {nwin1.focus();}*/
}
function pdf_laser(pdf){

 window.open("http://www.ophiropt.com/laser/pdf/index.php?item="+pdf,"an","toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=650");
  
}
function jp_pdf_laser(pdf){

 window.open("http://www.ophiropt.com/laser/pdf/jp/index.php?item="+pdf,"an","toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=650");
  
}
  // Detect Browser
     var IE = (document.all) ? 1 : 0;
     var DOM = 0;
     if (parseInt(navigator.appVersion) >=5) {DOM=1};

	function showDiv(who) {
		var viewer;
		if (DOM) {
            viewer = document.getElementById(who)
		} else if (IE) {
			viewer = document.all[who];
		}

		if (viewer.style.display != "block") {
			viewer.style.display = "block";
		} else {
			viewer.style.display = "none";
		}
	}
function register_co2(type){
	
		window.open("http://www.ophiropt.com/co2_optics/register.php?item="+type,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	
}
function jp_register_co2(type){
	
		window.open("http://www.ophiropt.com/co2_optics/jp_register.php?item="+type,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	
}
function de_register_co2(type){
	
		window.open("http://www.ophiropt.com/co2_optics/de_register.php?item="+type,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	
}
function register_optics(type,code){
	if(!code)
	{
		window.open("http://www.ophiropt.com/optics/register.php?type="+type,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	}
	else
	{
window.open("http://www.ophiropt.com/optics/register.php?type="+type+"&code="+code,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	}
}
function jp_register_optics(type,code){
	if(!code)
	{
		window.open("http://www.ophiropt.com/optics/jp_register.php?type="+type,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	}
	else
	{
window.open("http://www.ophiropt.com/optics/jp_register.php?type="+type+"&code="+code,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	}
}

function de_register_optics(type,code){
	if(!code)
	{
		window.open("http://www.ophiropt.com/optics/de_register.php?type="+type,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	}
	else
	{
window.open("http://www.ophiropt.com/optics/de_register.php?type="+type+"&code="+code,'an','toolbar=no,member=no,location=no,directories=no,scrollbars=yes,status=no,copyhistory=no,resizable=yes,height=500,width=450');
	}
}
var gAutoPrint = true; // Flag for whether or not to automatically call the print function
function printSpecial(type,sentence)
{
 if (document.getElementById != null)
 {
  var html = '<HTML>\n<HEAD>\n';

 

  if (document.getElementsByTagName != null)
  {
   var headTags = document.getElementsByTagName("head");
   if (headTags.length > 0)
    html += headTags[0].innerHTML;
  }

 
if(type=="IR")
{
  html += '\n</HE' + 'AD>\n<BODY style="margin:20px;"><link rel="stylesheet" href="http://www.ophiropt.com/css/ophir.css" type="text/css"><link rel="stylesheet" href="http://www.ophiropt.com/css/main.css" type="text/css"><table cellpadding="0" cellspacing="0" width="700" border="0"><tr><td><img src="http://www.ophiropt.com/user_files/logos/optical_logo.gif" alt="" width="103" height="78" border="0"></td><!--<td align="left" style="padding-top:18px;padding-left:18px"><img src="http://www.ophiropt.com/user_files/logos/infrared_header_big.gif" alt="" width="178" height="28" border="0"></td>--></tr></table><h3> <font color="#74a33e">Infrared Catalog Lenses</h1>\n';
}
if(type=='laser')
{
  html += '\n</HE' + 'AD>\n<BODY style="margin:20px;"><link rel="stylesheet" href="http://www.ophiropt.com/css/ophir.css" type="text/css"><link rel="stylesheet" href="http://www.ophiropt.com/css/main.css" type="text/css"><table cellpadding="0" cellspacing="0" width="700" border="0"><tr><td><img src="http://www.ophiropt.com/user_files/logos/2logos.jpg" alt="" width="206" height="78" border="0"></td><td align="right" style="padding-top:18px;"><img src="http://www.ophiropt.com/user_files/logos/laser_big_header.gif" alt="" width="392" height="22" border="0"></td></tr><tr><td colspan="2"><br>\n';
}
if(type=="CO2")
{
  html += '\n</HE' + 'AD>\n<BODY style="margin:20px;"><link rel="stylesheet" href="http://www.ophiropt.com/css/ophir.css" type="text/css"><link rel="stylesheet" href="http://www.ophiropt.com/css/main.css" type="text/css"><table cellpadding="0" cellspacing="0" width="700" border="0"><tr><td><img src="http://www.ophiropt.com/user_files/logos/optical_logo.gif" alt="" width="103" height="78" border="0"></td><td align="left" style="padding-top:18px;padding-left:18px"><img src="http://www.ophiropt.com/user_files/logos/CO2_header_big.gif" alt=""  border="0"></td></tr></table><h4> <font color="#eb7826">';
  html += eval("sentence");
  html += '</font></h4>';
}

 

  var printReadyElem = document.getElementById("printReady");

 

  if (printReadyElem != null)
  {
    html += printReadyElem.innerHTML;
  }
  else
  {
   alert("Could not find the printReady section in the HTML");
   return;
  }

html = html.replace(/printer.gif/g,"pixel.gif");
html = html.replace(/Print Version/g," ");
html = html.replace(/DISPLAY: none;/g,"display:show;");

html += '\n</BO' + 'DY>\n</td></tr></table></HT' + 'ML>';

 

  var printWin = window.open("","printSpecial");
  printWin.document.open();
  printWin.document.write(html);
  printWin.document.close();
  if (gAutoPrint)
   printWin.print();
 }
 else
 {
  alert("Sorry, the print ready feature is only available in modern browsers.");
 }
}