// JScript für die Pulldown-Menues
// onmouseover="show(this,'submenu') onmouseout="hide('submenu')

// init
var timer=3000;		// Anzeigedauer des Submenüs
var m_timer=null;
var m_start;
var m_flag=false;
var m_prev=null;
document.onclick = new Function("show(null)")

// Position für Pulldown
function getPos(el,sProp) {
  var iPos = 0
  while (el!=null) {
    iPos+=el["offset" + sProp]
    el = el.offsetParent
  }
  return iPos
}

// Pulldown anzeigen
if (document.layers)
{
  doc = "document.";
  style= ".";
  visible="show";
  hidden ="hide"
}
if (document.getElementById)
{
  doc = "document.getElementById('";
  style= "').style.";
  visible="visible";
  hidden="hidden"
}
if (document.all)
{
  doc = "document.all.";
  style= ".style.";
  visible="visible";
  hidden="hidden"
}
function usr_clearTimeout() {
  if (m_timer) clearTimeout(m_timer);
  m_timer = null;
  m_flag = false;
}
function usr_startTimeout(menu) {
  m_start = new Date();
  m_flag = true;
  m_timer = setTimeout("DoHide('"+menu+"');",timer);
}
function show(el,menu){
  usr_clearTimeout();
  if (menu) {
    varleft=(getPos(el,"Left"))
    vartop=getPos(el,"Top") + el.offsetHeight + 4
    eval(doc+menu+style+"visibility= visible;");
    eval(doc+menu+style+"left=varleft;");  
    eval(doc+menu+style+"top=vartop;");
  }
  if ((menu!=m_prev) && (m_prev))  eval(doc+m_prev+style+"visibility=hidden;");
  m_prev=menu
}
function hide(menu){
  usr_startTimeout(menu);
}
function DoHide(menu){
  if (!m_flag) return;
  var elapsed = new Date() - m_start;
  if (elapsed < timer) {
    m_timer = setTimeout("DoHide('"+menu+"');",(timer+100)-elapsed);
    return;
  }
  m_flag = false;
  eval(doc+menu+style+"visibility=hidden;");
}

// Rollover für Submenues => Menuepunkt hervorheben
function highlight(el)	{
  el.style.background='#F2F2F2';
  el.style.border='none';
  el.style.borderWidth='0px';
  el.style.borderColor='';
}

// Rollover für Submenues => Menuepunkt normal
function delight(el)	{
  el.style.background='#D9D9D9';
  el.style.border='none';
  el.style.borderWidth='0px';
  el.style.borderColor='';
}

// Clear text für Eingabefelder
function clearText(thefield)	{
	if (thefield.defaultValue==thefield.value)
	thefield.value = "";
} 

// Funktion zum Öffnen des Fensters Bildergallerie
function prodimg(lid,pid) {
  LeftPosition = (screen.width) ? (screen.width-560)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-600)/2 : 0;
  window.open('pop/pop_img.asp?lid='+lid+'&pid='+pid,'prodimg','top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,status=no,width=560,height=600');
  }

// Funktion zum Öffnen des Fensters Technische Details
function prodtech(lid,pid) {
  LeftPosition = (screen.width) ? (screen.width-560)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-600)/2 : 0;
  window.open('pop/pop_tech.asp?lid='+lid+'&pid='+pid,'prodtech','top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,status=no,width=560,height=600');
  }

// Öffnen des Fensters "printversion"
function openprint(tmpl,urlparam) {
  window.open('pop_print.asp?'+urlparam+'&tmpl='+tmpl,'printversion','resizable=yes,scrollbars=yes,toolbar=yes,status=yes,width=800,height=600');
  }

// Öffnen des Fensters "sendmail"
function opensendmail(tmpl,urlparam) {
  window.open('pop_sendmail.asp?'+urlparam+'&tmpl='+tmpl,'sendmail','resizable=yes,scrollbars=yes,toolbar=yes,status=yes,width=800,height=600');
  }


// Schliessen eines Fensters
function closepop() {
  window.close();
  }
  

<!-- This script verifies if the required fields on the Contact Form have been filled up. -->

<!-- Begin
function verify() {
var themessage = "You are required to complete the following fields:\n";
/*if (document.form.first.value=="") {
themessage = themessage + " - First Name";
}
if (document.form.last.value=="") {
themessage = themessage + " -  Last Name";
}
if (document.form.email.value=="") {
themessage = themessage + " -  E-mail";
}
*/

// Glyn Contact Form Fields 
// Form name: contact

if (document.contact.Customer_Name.value=="") {
themessage = themessage + " \nName";
}

if (document.contact.Email.value=="") {
themessage = themessage + " \nEmail Address";
}

if (document.contact.Phone.value=="") {
themessage = themessage + " \nPhone (Work)";
}


if (document.contact.Company.value=="") {
themessage = themessage + " \nCompany Name";
}

if (document.contact.Company_Street.value=="") {
themessage = themessage + " \nCompany Address: Street";
}

if (document.contact.Company_City.value=="") {
themessage = themessage + " \nCompany Address: City";
}

if (document.contact.Company_State.value=="") {
themessage = themessage + " \nCompany Address: State";
}

if (document.contact.Company_Postcode.value=="") {
themessage = themessage + " \nCompany Address: Post Code";
}

if (document.contact.Company_Country.value=="") {
themessage = themessage + " \nCompany Address: Country";
}


//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields:\n") {
document.contact.submit();
return true;
}
else {
alert(themessage);
return false;
   }
}
//  End -->


/*
function DisplayImage(url) {
  var w = window.open("",'NewWin','toolbar=no,status=no,width=700,height=600');
  var d = w.document;
  // Output an HTML document into the new window
  d.write('<HTML>');
  d.write('<HEAD>');
  d.write('<TITLE>Product Image</TITLE>');
  d.write('</HEAD>');
  d.write('<BODY>');
  d.write('<DIV align=center>');
  d.write('<FONT FACE="Arial">');
  d.write('<B>µOLED-128-G1</B><br><FONT SIZE=-2>1.5" Intelligent OLED Display Module</FONT></FONT><br><br>');
//  d.write(url);  // this has the correct URL string
  d.write('<IMG src="' + url + '"><br><br>');
  d.write('<INPUT TYPE="button" VALUE="Close Window" onClick="self.close()">');
  d.write('</DIV>');
  d.write('</BODY>');
  d.write('</HTML>');
  d.close(); 
}
*/

function DisplayImage(url,label1,label2) {
  var w = window.open("",'NewWin','toolbar=no,status=no,width=700,height=600');
  var d = w.document;
  // Output an HTML document into the new window
  d.write('<HTML>');
  d.write('<HEAD>');
  d.write('<TITLE>Product Image</TITLE>');
  d.write('</HEAD>');
  d.write('<BODY>');
  d.write('<DIV align=center>');
  d.write('<FONT FACE="Arial">');
  d.write('<B>' + label1 + '</B><br><FONT SIZE=-2>' + label2 +'</FONT></FONT><br><br>');
//  d.write(url);  // this has the correct URL string
  d.write('<IMG src="' + url + '"><br><br>');
  d.write('<INPUT TYPE="button" VALUE="Close Window" onClick="self.close()">');
  d.write('</DIV>');
  d.write('</BODY>');
  d.write('</HTML>');
  d.close(); 
}



