/* $Id: general.js,v1.0 2005/10/13 14:26:14 leey Exp $ */


function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
function popWindow(url,name) {
	window.open(url,name,'width= 340,height= 270,resizable');
 }

function popWindow(url,name,width,height,options) {
	window.open(url,name,'width=' + width+',height='+height+', '+options);
}

/* Function to center a popup window, also resizes to make best use of available resolution */
function centerPopup(url,name,width,height){
	//var  
	var screenWidth = window.screen.width;
	
	if(screenWidth <= 1024)
	{	
		width = 1000;
	}
	else if(screenWidth <= 1152)
	{
		width = (screenwidth-50);
	}
	else
	{
		width = (screenWidth-100);
	}
	var left = (screenWidth-width)/2;
	var settings ='height='+height+',';
	settings +='width='+width+',';
	settings +='top=10,';
	settings +='left='+left+',';
	settings +='resizable=yes';
	window.open(url,name,settings);
}
 
 
function gotonew(url) {
	var opener = window.opener;
	opener.focus();
	opener.open(url, 'new_window');
}

// Changes location of the parent window and closes window that link was in
function goto(url) {
	if (window.opener && !window.opener.closed) {
		var opener = window.opener;
		opener.parent.location.href = url;
		opener.focus();	
	} else {
		var main = window.open(url, 'products', 'location=1, resizable=yes, scrollbars=yes');
		main.focus();
		
	}
	
}

 
 

function showEMF(objOne,objTwo) 
// Show the Email a friend window.
{
	var One=document.getElementById(objOne);
	var Two=document.getElementById(objTwo);
	if (One.style.display == "none") // ON 
	{
		One.style.display = "";
		if(Two)
		Two.style.display = "";
	}
	else if (One.style.display == "") // OFF 
	{
		One.style.display = "none";
		if(Two)
		Two.style.display = "none";
	}
	window.scrollTo(0,0); //resets to top of the page
}

function detectMacFirefox2() {
  var ua = navigator.userAgent.toLowerCase();
  if (/firefox[\/\s](\d+\.\d+)/.test(ua)) {
    var firefox_version = new Number(RegExp.$1);
    if (firefox_version < 3 && ua.indexOf('mac') != -1) {
      return true;
    }
  }
  return false;
}


