// Ignore errors
function IgnoreError() {return true;}
window.onerror=IgnoreError;

// Framebuster
if (top.location!=location) {top.location.href=location.href;} 

// Function to open new windows
function rs(n,u,w,h) {
  var remote = null;
  remote = window.open(u, n, 'width=' + w + ',height=' + h +',toolbar=no,titlebar=no,menubar=no,resizable=no,scrollbars=yes');
  if (remote != null) {
    if (remote.opener == null)
      remote.opener = self;
    window.name = 'catpop';
    remote.location.href = u;
  }
  window.focus();
}

function priceheader(h1,h2,h3,h4,h5,h6,h7,h8,h9,h10) {
  document.write('<TR HEIGHT=24>');
  document.write('<TD CLASS=priceheader>'+h1+'</TD>');
  document.write('<TD CLASS=priceheader>'+h2+'</TD>');
  document.write('<TD CLASS=priceheader>'+h3+'</TD>');
  document.write('<TD CLASS=priceheader>'+h4+'</TD>');
  document.write('<TD CLASS=priceheader>'+h5+'</TD>');
  document.write('<TD CLASS=priceheader>'+h6+'</TD>');
  document.write('<TD CLASS=priceheader>'+h7+'</TD>');
  document.write('<TD CLASS=priceheader>'+h8+'</TD>');
  document.write('<TD CLASS=priceheader>'+h9+'</TD>');
  document.write('<TD CLASS=priceheader>'+h10+'</TD>');
  document.write('</TR>');
}
function pricesizes(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10) {
  document.write('<TR HEIGHT=24>');
  document.write('<TD CLASS=pricesizes><B>'+(d1)+'</B></TD>');
  document.write('<TD CLASS=pricesizes>$'+f(d2)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+f(d3)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+f(d4)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+f(d5)+'</TD>');
  document.write('<TD CLASS=pricesizeshighlight>$'+f(d6)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+f(d7)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+f(d8)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+f(d9)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+f(d10)+'</TD>');
  document.write('</TR>');
}
function pricesizesdangler(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10) {
  document.write('<TR HEIGHT=24>');
  document.write('<TD CLASS=pricesizes><B>'+(d1)+'</B></TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d2)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d3)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d4)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d5)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d6)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d7)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d8)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d9)+'</TD>');
  document.write('<TD CLASS=pricesizes>$'+fd(d10)+'</TD>');
  document.write('</TR>');
}
function f(n1) {
  d = bd;
  var r1 = '' + (n1 * d);
  while (r1.length < 4)
    r1 = r1 + '0';
  return r1.substr(0,4);
}
function fd(n1) {
  d = bd + 0.10;
  var r1 = '' + (n1 * d);
  while (r1.length < 4)
    r1 = r1 + '0';
  return r1.substr(0,4);
}

// Function to display prices for smaller pins
function pricesupdated() {
  document.write("02/01/2010");
}

// Function to display prices for smaller pins - photo pins
function showlittlepinsphoto() {
  priceheader('',            100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizesdangler('0.50"', 1.57,1.32,1.02,0.91,0.78,0.73,0.57,0.52,0.42);
  pricesizesdangler('0.75"', 1.70,1.45,1.14,1.02,0.88,0.81,0.67,0.60,0.50);
  pricesizesdangler('1.00"', 1.84,1.72,1.57,1.44,1.29,1.12,1.01,0.89,0.85);
}

// Function to display prices for smaller pins other than photo
function showlittlepinsother() {
  priceheader('',            100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizesdangler('0.50"', 1.57,1.32,1.02,0.91,0.78,0.73,0.57,0.52,0.42);
  pricesizesdangler('0.75"', 1.70,1.45,1.14,1.02,0.88,0.81,0.67,0.60,0.50);
  pricesizesdangler('1.00"', 1.84,1.72,1.57,1.44,1.29,1.12,1.01,0.89,0.85);
}

// Function to display prices for dog tags
function dogtags() {
  priceheader('',     100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('2.00" tags', 3.21,2.74,2.17,1.90,1.57,1.44,1.33,1.28,1.23);
}

// Function to display prices for keychains - photo screen
function keychainsphoto() {
  priceheader('',     100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('1.25"', 2.96,2.37,1.74,1.49,1.24,1.05,0.96,0.91,0.86);
  pricesizes('1.50"', 3.03,2.47,1.84,1.59,1.35,1.15,1.06,1.01,0.96);
  pricesizes('1.75"', 3.09,2.57,1.94,1.72,1.45,1.31,1.20,1.15,1.10);
  pricesizes('2.00"', 3.21,2.74,2.17,1.90,1.57,1.44,1.33,1.28,1.23);
  pricesizes('2.25"', 3.35,2.90,2.36,2.07,1.71,1.58,1.48,1.42,1.37);
}

// Function to display prices for keychains - photo screen
function keychainssoftenamel() {
  priceheader('',     100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('1.25"', 3.01,2.30,1.75,1.51,1.29,1.14,1.06,0.97,0.87);
  pricesizes('1.50"', 3.08,2.45,1.92,1.65,1.38,1.22,1.16,1.03,0.93);
  pricesizes('1.75"', 3.13,2.61,2.12,1.92,1.66,1.49,1.42,1.36,1.23);
  pricesizes('2.00"', 3.38,2.96,2.37,2.24,1.90,1.73,1.66,1.59,1.47);
  pricesizes('2.25"', 3.81,3.30,2.91,2.54,2.27,2.10,1.99,1.91,1.84);
}

// Function to display prices for bigger pins - photo pins
function showbiggerpinsphoto() {
  priceheader('',     100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('0.50"', 2.75,2.13,1.50,1.25,1.00,0.81,0.72,0.67,0.62);
  pricesizes('0.75"', 2.82,2.20,1.57,1.32,1.07,0.88,0.79,0.74,0.69);
  pricesizes('1.00"', 2.89,2.27,1.64,1.39,1.14,0.95,0.86,0.81,0.76);
  document.write('<TR HEIGHT=4>');
  document.write('<TD COLSPAN=10 CLASS=pricesizes><B>Normal Sized Pins</B></TD>');
  document.write('</TR>');
  pricesizes('1.25"', 2.96,2.37,1.74,1.49,1.24,1.05,0.96,0.91,0.86);
  pricesizes('1.50"', 3.03,2.47,1.84,1.59,1.35,1.15,1.06,1.01,0.96);
  pricesizes('1.75"', 3.09,2.57,1.94,1.72,1.45,1.31,1.20,1.15,1.10);
  pricesizes('2.00"', 3.21,2.74,2.17,1.90,1.57,1.44,1.33,1.28,1.23);
  document.write('<TR HEIGHT=4>');
  document.write('<TD COLSPAN=10 CLASS=pricesizes><B>Large Sized Pins</B></TD>');
  document.write('</TR>');
  pricesizes('2.25"', 3.43,2.98,2.42,2.15,1.79,1.66,1.56,1.50,1.45);
  pricesizes('2.50"', 3.89,3.40,2.79,2.46,2.09,1.91,1.76,1.70,1.65);
  pricesizes('2.75"', 4.48,3.79,3.08,2.77,2.38,2.06,1.96,1.90,1.85);
  pricesizes('3.00"', 5.32,4.53,3.69,3.21,2.63,2.41,2.28,2.23,2.18);
//  pricesizes('3.25"', 6.09,5.19,4.36,3.87,3.27,3.06,2.93,2.88,2.83);
//  pricesizes('3.50"', 6.99,5.99,5.16,4.67,4.07,3.86,3.73,3.68,3.63);
//  pricesizes('3.75"', 8.32,7.32,6.49,6.00,5.40,5.19,5.06,5.01,4.96);
//  pricesizes('4.00"', 9.92,8.92,8.19,7.60,7.00,6.79,6.66,6.61,6.56);
}
// Function to display prices for bigger pins other than photo
function showbiggerpinsother() {
  priceheader('',     100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('0.50"', 2.70,2.12,1.52,1.28,1.15,1.02,0.97,0.86,0.77);
  pricesizes('0.75"', 2.73,2.15,1.61,1.33,1.18,1.05,1.01,0.89,0.80);
  pricesizes('1.00"', 2.84,2.22,1.68,1.40,1.22,1.09,1.03,0.93,0.83);
  document.write('<TR HEIGHT=4>');
  document.write('<TD COLSPAN=10 CLASS=pricesizes><B>Normal Sized Pins</B></TD>');
  document.write('</TR>');
  pricesizes('1.25"', 3.01,2.30,1.75,1.51,1.29,1.14,1.06,0.97,0.87);
  pricesizes('1.50"', 3.08,2.45,1.92,1.65,1.38,1.22,1.16,1.03,0.93);
  pricesizes('1.75"', 3.13,2.61,2.12,1.92,1.66,1.49,1.42,1.36,1.23);
  pricesizes('2.00"', 3.28,2.76,2.27,2.14,1.80,1.63,1.56,1.49,1.37);
  document.write('<TR HEIGHT=4>');
  document.write('<TD COLSPAN=10 CLASS=pricesizes><B>Large Sized Pins</B></TD>');
  document.write('</TR>');
  pricesizes('2.25"', 3.81,3.30,2.91,2.54,2.27,2.10,1.99,1.91,1.84);
  pricesizes('2.50"', 4.44,3.89,3.40,2.98,2.70,2.53,2.28,2.23,2.17);
  pricesizes('2.75"', 5.48,4.70,4.14,3.68,3.25,2.97,2.69,2.61,2.52);
  pricesizes('3.00"', 6.47,5.68,4.74,4.20,3.73,3.49,3.34,3.27,3.19);
}

var email = "sales"
var emailHost = "metropins.com"

function showdeliverydates(howmanyforward) {
  AddDays = howmanyforward;  //  How many days ahead of the current date
  TDate = new Date();
  TDay = new Array('Sun', 'Mon', 'Tues', 'Wed', 'Thu', 'Fri', 'Sat');
  TMonth = new Array('January', 'February', 'March', 'April', 'May','June', 'July', 'August', 'September', 'October', 'November', 'December');
  MonthDays = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');

  CurYear = TDate.getYear();
  if (CurYear < 2000)       // Y2K Fix, Isaac Powell
    CurYear = CurYear + 1900; // http://onyx.idbsu.edu/~ipowell
  CurMonth = TDate.getMonth();
  CurDayOw = TDate.getDay();
  CurDay = TDate.getDate();
  month = TMonth[CurMonth];
  if (month == 'February')  {
    if (((CurYear % 4)==0) && ((CurYear % 100)!=0) || ((CurYear % 400)==0)) {
      MonthDays[1] = 29;
    } else {
      MonthDays[1] = 28;
    }
  }
  days = MonthDays[CurMonth];
  CurDay += AddDays;
  if (CurDay > days) {
    if (CurMonth == 11) {
      CurMonth = 0;
      month = TMonth[CurMonth];
      CurYear = CurYear + 1
    } else {
      month = TMonth[CurMonth+1];
    }
    CurDay = CurDay - days;
  }
  CurDayOw += AddDays;

  adjustDay(CurDayOw);
  TheDate  = CurDayOw + ', ';
  TheDate += month + ' ';
  d = CurDay.toString();
  if (d.length<=1) {
	TheDate += "0" + CurDay + ', ';
  } else {
	TheDate += CurDay + ', ';
  }
  if (CurYear<100) CurYear="19" + CurYear;
  TheDate += CurYear;
  document.write(TheDate);
}

function isLeapYear (Year) {
  if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) {
    return true;
  } else {
    return false;
  }
}

function adjustDay (cday) {
  if (cday > 6) {
    cday -= 6;
    CurDayOw = TDay[cday-1];
    adjustDay(cday-1);
  } else {
    CurDayOw = TDay[cday];
    return true;
  }
}
