	function selectDeselectAllCartItemsNow(frm, obj)
	{			
		for (var i = 0; i < frm.elements.length; i++) {
			var e = frm.elements[i];
			var magazines = new RegExp("selRenewalNow");
			if(magazines.test(e.name))
				{	
					e.checked = obj.checked;
				}
			var magazines = new RegExp("selProductNow");
			if(magazines.test(e.name))
				{	
					e.checked = obj.checked;
				}
			var magazines = new RegExp("selPackageNow");
			if(magazines.test(e.name))
				{	
					e.checked = obj.checked;
				}
		}
	}

	function selectDeselectAllCartItemsLater(frm, obj)
	{			
		for (var i = 0; i < frm.elements.length; i++) {
			var e = frm.elements[i];
			var magazines = new RegExp("selRenewalLater");
			if(magazines.test(e.name))
				{	
					e.checked = obj.checked;
				}
			var magazines = new RegExp("selProductLater");
			if(magazines.test(e.name))
				{	
					e.checked = obj.checked;
				}
			var magazines = new RegExp("selPackageLater");
			if(magazines.test(e.name))
				{	
					e.checked = obj.checked;
				}
		}
	}
	
  function Check(e)
  {
  	e.checked = true;
  }
  
  function Clear(e)
  {
  	e.checked = false;
  }

  function CheckAll(e, field)
  {
  	var ml = e;
  	var len = ml.elements.length;
  	for (var i = 0; i < len; i++) {
  		
  	    var e = ml.elements[i];
  	    if (e.name == field) {
  		Check(e);
		//setCtgIdsValue(e);
  	    }
  	}
  }

  function ClearAll(e, field)
  {
  	var ml = e;
  	var len = ml.elements.length;
  	for (var i = 0; i < len; i++) {
  	    var e = ml.elements[i];
  	    if (e.name == field) {
  		Clear(e);
		//setCtgIdsValue(e);
  	    }
  	}
  }
	
  function ChangeState(e, str)
  {
  	if(arguments[1]==null)
  		{
  			field="id[]";
  		}
  	else
  		{
  			field=str+"[]";
  		}
  		
  	if ( e.checked == false)
  		ClearAll(e.form, field);
  	else CheckAll(e.form, field);
  }	
	
 	function copy_customer_data(obj)
	{
		var frm = obj.form;
		if (obj.checked == true)
			{
				frm.ship_to_locationname.value = frm.bill_to_nickname.value;
				frm.ship_to_first_name.value = frm.bill_to_first_name.value;
				frm.ship_to_last_name.value = frm.bill_to_last_name.value;
				frm.ship_to_street1.value = frm.bill_to_street1.value;
				frm.ship_to_street2.value = frm.bill_to_street2.value;		
				frm.ship_to_city.value = frm.bill_to_city.value;		
				frm.ship_to_province.value = frm.bill_to_province.value;
				frm.ship_to_zip.value = frm.bill_to_zip.value;				
				frm.ship_to_phone_nr.value = frm.bill_to_phone_nr.value;
				frm.ship_to_fax_nr.value = frm.bill_to_fax_nr.value;			
				
				frm.ship_to_country.value = frm.bill_to_country.value;
				setCountryStates(frm.bill_to_country.value, 'ship_to_state', frm.bill_to_state.value, 'ship_to_province');

			}
		else
			{
				frm.ship_to_locationname.value = '';
				frm.ship_to_first_name.value = '';
				frm.ship_to_last_name.value = '';
				frm.ship_to_street1.value = '';
				frm.ship_to_street2.value = '';	
				frm.ship_to_province.value = '';				
				frm.ship_to_city.value = '';		
				frm.ship_to_zip.value = '';				
				frm.ship_to_phone_nr.value = '';				
				frm.ship_to_fax_nr.value = '';								
			}
	} 

var o = { x: 15 };

function f(message1, message2)
{
    alert(message1 + (this.x * this.x) + message2);
}

function submitForm(formName, action, func, submitName, submitValue)
{	
 	forma = document.getElementById(formName);	
	var res = true

	if (func)
	{
      res = func.apply();
	}

	if (res != false)
	{
		forma.action = action;
		if (submitName)
		{
		  submitNameId			= document.getElementById(submitName);	
		  if (!submitValue)
		  {
			submitValue = 1;
		  }
		  submitNameId.value	= submitValue;
		}
		forma.submit();
	}
}


<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://willmaster.com/
// Version: July 28, 2007

var cX = 0; var cY = 0; var rX = 0; var rY = 0;


function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e)
{ 
	cX = event.clientX; cY = event.clientY;
}

if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }

function AssignPosition(d) 
{
	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
		}
	else if(document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
		}
	else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
		}
	if(document.all) {
		cX += rX; 
		cY += rY;
		}
	d.style.left = (cX+10) + "px";
	d.style.top = (cY+10) + "px";
	}
	function HideContent(d, h, w) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

function ShowContent(d, h, w) 
{
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);

	if (!h) h = 50;
	if (!w) w = 400;	

	AssignPosition(dd);

	dd.style.width = w;
	dd.style.width = h;

	if (dd.style.width)		dd.style.width = w;
	if (dd.style.height)	dd.style.height = h;

	dd.style.display = "block";
}

function ReverseContentDisplay(d) 
{
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if(dd.style.display == "none") { dd.style.display = "block"; }
	else { dd.style.display = "none"; }
}
//-->

/* 2009 10 03 */

function makeWindow(URL) {
  popX=550
  popY=650
  posX=((screen.availWidth/2)-(popX/2))
  posY=((screen.availHeight/2)-(popX/2))
  window.open(host+URL,"Pagename","height="+popX+",width="+popY+",toolbar=0,menubar=0,directories=0,scrollbars=0,left="+posX+",top="+posY);
}

function XmlHttp() {
  var W = window, T = this, C = T.constructor, I = function(){return T!=W}(), r, i;
  if (!I) return;

  if (W.XMLHttpRequest) {
    r = new XMLHttpRequest();

    if (r.readyState == null) {
      r.readyState = 1;
      r.addEventListener("load", function () { r.readyState = 4; if (typeof r.onreadystatechange == "function") r.onreadystatechange(); }, false);
    }
    return r;
  }
  if (W.ActiveXObject) {
    for (i=0;i<=4;i++) {
      try { return new ActiveXObject(["MSXML2", "Microsoft", "MSXML", "MSXML3"][i] + ".XmlHttp"); }
      catch (e) {};
    }
    throw new Error("Could not find an installed XML parser");
  }
  alert("Your browser does not support XmlHttp objects");
}

function MakeSelect(data, input_name, data_indexes, selected)
{      
  var d = document.getElementById(input_name);
  var selectedId = 0;
  d.length = 0;
  
  for( var i = 0; i < data.length; i++)
  {
    if (data_indexes[i] == selected) selectedId = i;
    d.options[i] = new Option(data[i], data_indexes[i], false, false);
  }
  d.options[selectedId].selected = true;
}

function getCountries(cust_group_id, prd_id, selectedCountryId, pageId, rAlias) {
  var h = new XmlHttp()            

  urlPlus = "";
  if (rAlias) urlPlus = "&rAlias="+rAlias;
                
  cntr = document.URL; 
  pathArray = window.location.pathname.split( '/' );   
  intRegion = "";      
  if (pathArray[1]) intRegion = pathArray[1];       
                                                
  h.open('GET', host+'catalog/dropdown_countries/?httprequest=yes&cust_group_id='+cust_group_id+'&prd_id='+prd_id+'&intRegion='+intRegion+urlPlus, false);
  
  //alert(host+'catalog/dropdown_countries/?httprequest=yes&cust_group_id='+cust_group_id+'&prd_id='+prd_id+'&intRegion='+intRegion+urlPlus);
  
  h.send(null);
  
  data = [];
  data_ids = [];
  selectedRegion = [];
  eval(h.responseText);

  try { eval(h.responseText) }
  catch (e) {}
  
  
  if (selectedRegion[0]) selectedCountryId = selectedRegion[0];  
  
  MakeSelect(data, "country_id", data_ids, selectedCountryId);

  var region_id = document.getElementById("country_id");

  getSubscriptionsTerms(prd_id, region_id.options[region_id.options.selectedIndex].value, pageId)
}

function getSubscriptionsTerms(prd_id, country_id, pageId) {
       
  var h = new XmlHttp()
  var cust_gr_id = document.getElementById("customer_group_id");
  cust_group_id = cust_gr_id.options[cust_gr_id.options.selectedIndex].value

  var backIssue = document.getElementById("backIssue");

  h.open('GET', host+'catalog/dropdown_subsr_terms/?httprequest=yes&cust_group_id='+cust_group_id+'&prd_id='+prd_id+'&country_id='+country_id+'&backIssue='+backIssue.value, false);
  
  //alert(host+'catalog/dropdown_subsr_terms/?httprequest=yes&cust_group_id='+cust_group_id+'&prd_id='+prd_id+'&country_id='+country_id+'&backIssue='+backIssue.value);
  
  h.send(null);

  subscr_terms = [];
  data_ids = [];
  eval(h.responseText);

  try { eval(h.responseText) }
  catch (e) {}

  if (data_ids.length == 0)
  {
    //window.location = host+"catalog/viewItem/?prdid="+prd_id+"&backIssue=1";
    window.location = document.URL+"&backIssue=1";
    return;
  }
                
  MakeSelect(subscr_terms, "subscription_term", data_ids);
  var subscr_gr_id = document.getElementById("subscription_term");

  //getProductAllInfo(prd_id, subscr_gr_id.options[subscr_gr_id.options.selectedIndex].value)
  
  var single_mgzn_form = document.getElementById("single_magazine_form");    
  if (single_mgzn_form)    
  {
    getProductAllInfoSingle(prd_id, pageId);
  }
  
  var prd_info_table = document.getElementById("product_info");  
  if (prd_info_table) 
  {
    getProductAllInfo(prd_id, pageId);        
  }
}

function showMore(objName)
{
  var obj1 = document.getElementById(objName);
  var obj2 = document.getElementById(objName+'More');

  if (obj2) 
  {
    obj2.style.display = 'none'; 
    if (window.attachEvent) obj1.style.display = "block"; 
    else obj1.style.display = "table-row";  
  }
}


function changeProductLocation(selLocation, productId)
{
  cntr = document.getElementById('country_id');
  if (cntr)
  {    
    var hh = new XmlHttp()    

    hh.open('GET', mhost+'/international/catalog/dropdown_countries/?httprequest=yes&country_id='+selLocation+'&url='+document.URL, false);    
    hh.send(null);
    
    url = [];                                                                                  
    eval(hh.responseText);
    
    try { eval(hh.responseText) }
    catch (e) {}    

    window.location = url[0];  
    return;   
  }
  /*
  if (selLocation == 100)
  {
    shippingLocation = "usa";
  }
  else if(selLocation == 132)
  {
    shippingLocation = "canada";
  }
  else
  {
    shippingLocation = "international";
  }
  */

  //window.location = mhost;
}

/*
function changeProductLocation(selLocation, productId)
{
  if (selLocation == 100)
  {
    shippingLocation = "usa";
  }
  else if(selLocation == 132)
  {
    shippingLocation = "canada";
  }
  else
  {
    shippingLocation = "international";
  }

  window.location = mhost+shippingLocation+'/catalog/viewItem/?prdid='+productId+'&countryId='+selLocation;
}
*/

function showNavigation()
{
  var menuNo  = document.getElementById("menuNo");
  var menuYes = document.getElementById("menuYes");

  menuNo.style.display = "none"; 

  if (window.attachEvent) menuYes.style.display = "block"; 
  else menuYes.style.display = "table-row";  
}
