//FROM PRODUCTS PAGES - WHERE VIDEOS ARE INCLUDED
function popPresentation(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=640,height=515,left = 320,top = 142.5');");
}

// QTIP
$.fn.qtip.styles.phpsugar = { // Last part is the name of the style
   width: 300,
   background: '#A2C7E0',
   color: '#333',
   textAlign: 'left',
   border: {
      width: 1,
      radius: 5,
      color: '#0077C7'
   },
   position: {
      corner: {
         target: 'topRight',
         tooltip: 'topLeft'
	  }
   },
  tip: { // Now an object instead of a string
  	color: '#0077C7',
	corner: 'topLeft' // We declare our corner within the object using the corner sub-option
  },
   name: 'blue' // Inherit the rest of the attributes from the preset dark style

}
// By suppling no content attribute, the library uses each elements title attribute by default

$(document).ready(function() {
   // By suppling no content attribute, the library uses each elements title attribute by default
   $('[id="help_tip"]').qtip({
      content: {
         text: false // Use each elements title attribute
      },
      style: 'phpsugar' // Give it some style
   });

});

// FOR THE DROP DOWN MENU
var timeout	= 200;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
// close layer when click-out
document.onclick = mclose; 
// END DROP DOWN MENU
// VALIDATE CONTACT FORM
function validate_required(field,alerttxt)
	{
	with (field)
	{
	if (value==null||value=="")
	  {alert(alerttxt);return false}
	else {return true}
	}
}
function validate_email(field,alerttxt)
	{
	with (field)
	{
	apos=value.indexOf("@")
	dotpos=value.lastIndexOf(".")
	if (apos<1||dotpos-apos<2) 
	  {alert(alerttxt);return false}
	else {return true}
	}
} 
function validate_form(thisform)
	{
	with (thisform)
	{
	if (validate_email(email,"Please enter your email address")==false)
	  {email.focus();return false}
	if (validate_required(msg,"Please write the message you wish to send.")==false)
	  {msg.focus();return false}
	if (validate_required(math,"Please enter the result to confirm you are a human.")==false)
	  {math.focus();return false}
	}
}