var launchWin;
function launchWindow(url, width, height, scrolling)
	{
	if(launchWin)
	  launchWin.close();
	screenX = (screen.width /2) - (width /2); // used to center.
	screenY = (screen.height /2) - (height /2); // used to center.
	launchWin = window.open(url,"pop","toolbar=no,directories=no,menubar=no,scrollbars=" + scrolling + ",resizable=yes,width=" + width + ",height=" + height + ",top=" + screenY + ",left=" + screenX + ",screenX=" + screenX + ",screenY=" + screenY);
	launchWin.focus();
	}
	
function fSubscribe()
  {
  var oEmail = escape(document.forms["subscribe_form"].form_email.value);
  var oType = getCheckedValue(document.forms["subscribe_form"].form_type);
  launchWindow("process_subscription.php?email=" + oEmail + "&type=" + oType,300,182);
  }	
  
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
                    
// preload images
o_menu_2_1_2_off = new Image();
o_menu_2_1_2_off.src = 'images/menu_2_1_2_off.gif';
o_menu_2_1_2_on = new Image();
o_menu_2_1_2_on.src = 'images/menu_2_1_2_on.gif';
o_menu_2_1_2_hover = new Image();
o_menu_2_1_2_hover.src = 'images/menu_2_1_2_hover.gif';

o_menu_2_3_2_off = new Image();
o_menu_2_3_2_off.src = 'images/menu_2_3_2_off.gif';
o_menu_2_3_2_on = new Image();
o_menu_2_3_2_on.src = 'images/menu_2_3_2_on.gif';
o_menu_2_3_2_hover = new Image();
o_menu_2_3_2_hover.src = 'images/menu_2_3_2_hover.gif';

o_menu_2_5_2_off = new Image();
o_menu_2_5_2_off.src = 'images/menu_2_5_2_off.gif';
o_menu_2_5_2_on = new Image();
o_menu_2_5_2_on.src = 'images/menu_2_5_2_on.gif';
o_menu_2_5_2_hover = new Image();
o_menu_2_5_2_hover.src = 'images/menu_2_5_2_hover.gif';

o_menu_2_7_2_off = new Image();
o_menu_2_7_2_off.src = 'images/menu_2_7_2_off.gif';
o_menu_2_7_2_on = new Image();
o_menu_2_7_2_on.src = 'images/menu_2_7_2_on.gif';
o_menu_2_7_2_hover = new Image();
o_menu_2_7_2_hover.src = 'images/menu_2_7_2_hover.gif';

o_menu_2_9_2_off = new Image();
o_menu_2_9_2_off.src = 'images/menu_2_9_2_off.gif';
o_menu_2_9_2_on = new Image();
o_menu_2_9_2_on.src = 'images/menu_2_9_2_on.gif';
o_menu_2_9_2_hover = new Image();
o_menu_2_9_2_hover.src = 'images/menu_2_9_2_hover.gif';

o_menu_2_11_2_off = new Image();
o_menu_2_11_2_off.src = 'images/menu_2_11_2_off.gif';
o_menu_2_11_2_on = new Image();
o_menu_2_11_2_on.src = 'images/menu_2_11_2_on.gif';
o_menu_2_11_2_hover = new Image();
o_menu_2_11_2_hover.src = 'images/menu_2_11_2_hover.gif';

o_menu_2_13_2_off = new Image();
o_menu_2_13_2_off.src = 'images/menu_2_13_2_off.gif';
o_menu_2_13_2_on = new Image();
o_menu_2_13_2_on.src = 'images/menu_2_13_2_on.gif';
o_menu_2_13_2_hover = new Image();
o_menu_2_13_2_hover.src = 'images/menu_2_13_2_hover.gif';

o_menu_2_15_1_off = new Image();
o_menu_2_15_1_off.src = 'images/menu_2_15_1_off.gif';
o_menu_2_15_1_on = new Image();
o_menu_2_15_1_on.src = 'images/menu_2_15_1_on.gif';
o_menu_2_15_1_hover = new Image();
o_menu_2_15_1_hover.src = 'images/menu_2_15_1_hover.gif';


function fChangeImage(pName,pImage)
  {
  if(document.images)
    {
    document.images[pName].src = pImage;
    }
  fSetMenu();  
  }
  
function fSetMenu()
  {  
  var oThisActiveMenu = '<?php echo $oPageMenuArray[$oThisPage]; ?>';
  document.images[oThisActiveMenu].src = eval('o_' + oThisActiveMenu + '_on.src');
  }

var launchWin;
function launchWindow(url, width, height, scrolling)
	{
	if(launchWin)
	  launchWin.close();
	screenX = (screen.width /2) - (width /2); // used to center.
	screenY = (screen.height /2) - (height /2); // used to center.
	launchWin = window.open(url,"pop","toolbar=no,directories=no,menubar=no,scrollbars=" + scrolling + ",resizable=yes,width=" + width + ",height=" + height + ",top=" + screenY + ",left=" + screenX + ",screenX=" + screenX + ",screenY=" + screenY);
	launchWin.focus();
	}
	
function fSubscribe()
  {
  var oEmail = escape(document.forms["subscribe_form"].form_email.value);
  var oType = getCheckedValue(document.forms["subscribe_form"].form_type);
  launchWindow("http://www.lw3.com/process_subscription.php?email=" + oEmail + "&type=" + oType,300,182);
  }	
  
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}


SetCookie("screen_width", "", 1);
SetCookie("screen_height", "", 1);
SetCookie("screen_width", screen.width, 1);
SetCookie("screen_height", screen.height, 1);
