/* $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) {
	var iScreenWidth = window.screen.width;
	var iLeft = (iScreenWidth-340)/2;
	window.open(url,name,'width= 340,height= 270,resizable,left='+iLeft+',top=10');
}

function popWindow(url,name,width,height,options) {
	var iScreenWidth = window.screen.width;
	var iLeft = (iScreenWidth-width)/2;	
	window.open(url,name,'width=' + width+',height='+height+',left='+iLeft+',top=10,'+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;
}


function fnToggleEmailUnSub(){
	window.scrollTo(0,0);
	var oDOM = {
		'overlay' : $('email-unsub-opacity'),
		'content' : $('email-unsub')	
	};	
	oDOM.overlay.setStyles({'display':'block','opacity':0});
	oDOM.content.setStyles({'display':'block','opacity':0});
	
	new Fx.Style(oDOM.overlay, 'opacity', {duration:500}).start(0.7);
	new Fx.Style(oDOM.content, 'opacity', {duration:500}).start(1);

}



