// 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,h11,h12,h13,h14) {
  document.write('<TR HEIGHT=24>');
  if (h1) { document.write('<TD CLASS=priceheader>'+h1+'</TD>'); }
  if (h2) { document.write('<TD CLASS=priceheader>'+h2+'</TD>'); }
  if (h3) { document.write('<TD CLASS=priceheader>'+h3+'</TD>'); }
  if (h4) { document.write('<TD CLASS=priceheader>'+h4+'</TD>'); }
  if (h5) { document.write('<TD CLASS=priceheader>'+h5+'</TD>'); }
  if (h6) { document.write('<TD CLASS=priceheader>'+h6+'</TD>'); }
  if (h7) { document.write('<TD CLASS=priceheader>'+h7+'</TD>'); }
  if (h8) { document.write('<TD CLASS=priceheader>'+h8+'</TD>'); }
  if (h9) { document.write('<TD CLASS=priceheader>'+h9+'</TD>'); }
  if (h10) { document.write('<TD CLASS=priceheader>'+h10+'</TD>'); }
  if (h11) { document.write('<TD CLASS=priceheader>'+h11+'</TD>'); }
  if (h12) { document.write('<TD CLASS=priceheader>'+h12+'</TD>'); }
  if (h13) { document.write('<TD CLASS=priceheader>'+h13+'</TD>'); }
  if (h14) { document.write('<TD CLASS=priceheader>'+h14+'</TD>'); }
  document.write('</TR>');
}
function pricesizes(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14) {
  document.write('<TR HEIGHT=24>');
  if (d1) { document.write('<TD CLASS=pricesizes><B>'+(d1)+'</B></TD>'); }
  if (d2) { document.write('<TD CLASS=pricesizes>$'+f(d2)+'</TD>'); }
  if (d3) { document.write('<TD CLASS=pricesizes>$'+f(d3)+'</TD>'); }
  if (d4) { document.write('<TD CLASS=pricesizes>$'+f(d4)+'</TD>'); }
  if (d5) { document.write('<TD CLASS=pricesizes>$'+f(d5)+'</TD>'); }
  if (d6) { document.write('<TD CLASS=pricesizes>$'+f(d6)+'</TD>'); }
  if (d7) { document.write('<TD CLASS=pricesizes>$'+f(d7)+'</TD>'); }
  if (d8) { document.write('<TD CLASS=pricesizes>$'+f(d8)+'</TD>'); }
  if (d9) { document.write('<TD CLASS=pricesizes>$'+f(d9)+'</TD>'); }
  if (d10) { document.write('<TD CLASS=pricesizes>$'+f(d10)+'</TD>'); }
  if (d11) { document.write('<TD CLASS=pricesizes>$'+f(d11)+'</TD>'); }
  if (d12) { document.write('<TD CLASS=pricesizes>$'+f(d12)+'</TD>'); }
  if (d13) { document.write('<TD CLASS=pricesizes>$'+f(d13)+'</TD>'); }
  if (d14) { document.write('<TD CLASS=pricesizes>$'+f(d14)+'</TD>'); }
  document.write('</TR>');
}
function pricesizesdangler(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14) {
  document.write('<TR HEIGHT=24>');
    if (d1) { document.write('<TD CLASS=pricesizes><B>'+(d1)+'</B></TD>'); }
    if (d2) { document.write('<TD CLASS=pricesizes>$'+fd(d2)+'</TD>'); }
    if (d3) { document.write('<TD CLASS=pricesizes>$'+fd(d3)+'</TD>'); }
    if (d4) { document.write('<TD CLASS=pricesizes>$'+fd(d4)+'</TD>'); }
    if (d5) { document.write('<TD CLASS=pricesizes>$'+fd(d5)+'</TD>'); }
    if (d6) { document.write('<TD CLASS=pricesizes>$'+fd(d6)+'</TD>'); }
    if (d7) { document.write('<TD CLASS=pricesizes>$'+fd(d7)+'</TD>'); }
    if (d8) { document.write('<TD CLASS=pricesizes>$'+fd(d8)+'</TD>'); }
    if (d9) { document.write('<TD CLASS=pricesizes>$'+fd(d9)+'</TD>'); }
    if (d10) { document.write('<TD CLASS=pricesizes>$'+fd(d10)+'</TD>'); }
    if (d11) { document.write('<TD CLASS=pricesizes>$'+fd(d11)+'</TD>'); }
    if (d12) { document.write('<TD CLASS=pricesizes>$'+fd(d12)+'</TD>'); }
    if (d13) { document.write('<TD CLASS=pricesizes>$'+fd(d13)+'</TD>'); }
    if (d14) { document.write('<TD CLASS=pricesizes>$'+fd(d14)+'</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("01/22/2012");
}

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

// Function to display prices for silicone bands 
function silicone() {
  priceheader('Width',             50, 100, 200, 300, 400, 500, 750,1000,2500,5000);
  pricesizes('Standard (12mm)',  2.99,2.49,1.49,1.43,1.33,1.08,1.01,0.94,0.84,0.73);
  pricesizes('Medium (19mm)',    3.29,2.69,1.61,1.54,1.43,1.16,1.09,1.01,0.90,0.79);
  pricesizes('Fatties (25mm)',   3.60,2.85,1.72,1.64,1.53,1.24,1.16,1.08,0.96,0.84);
}

// Function to display prices for wine charms
function winecharms() {
  priceheader(' ',    25,  50,  75,  100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('0.75"', 7.00,4.57,3.42,2.87,2.16,1.61,1.37,1.15,1.00,0.92,0.83,0.73);
  pricesizes('1.00"', 7.07,4.64,3.49,2.94,2.23,1.68,1.44,1.22,1.07,0.99,0.90,0.80);
  pricesizes('1.25"', 7.14,4.71,3.56,3.01,2.30,1.75,1.51,1.29,1.14,1.06,0.97,0.87);
}

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

// Function to display prices for keychains - photo screen
function keychainssoftenamel() {
  at=0.40;
  priceheader(' ',    50,  100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('1.25"', 4.71+at,3.01+at,2.30+at,1.75+at,1.51+at,1.29+at,1.14+at,1.06+at,0.97+at,0.87+at);
  pricesizes('1.50"', 4.78+at,3.08+at,2.45+at,1.92+at,1.65+at,1.38+at,1.22+at,1.16+at,1.03+at,0.93+at);
  pricesizes('1.75"', 4.83+at,3.13+at,2.61+at,2.12+at,1.92+at,1.66+at,1.49+at,1.42+at,1.36+at,1.23+at);
  pricesizes('2.00"', 4.98+at,3.28+at,2.76+at,2.27+at,2.14+at,1.80+at,1.63+at,1.56+at,1.49+at,1.37+at);
  pricesizes('2.25"', 5.51+at,3.81+at,3.30+at,2.91+at,2.54+at,2.27+at,2.10+at,1.99+at,1.91+at,1.84+at);
}

// Function to display prices for bigger pins - photo pins
function showbiggerpinsphoto() {
  priceheader(' ',    50,  100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('0.50"', 4.45,2.75,2.13,1.50,1.25,1.00,0.81,0.72,0.67,0.62);
  pricesizes('0.75"', 4.52,2.82,2.20,1.57,1.32,1.07,0.88,0.79,0.74,0.69);
  pricesizes('1.00"', 4.59,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=14 CLASS=pricesizes><B>Normal Sized Pins</B></TD>');
  document.write('</TR>');
  pricesizes('1.25"', 4.66,2.96,2.37,1.74,1.49,1.24,1.05,0.96,0.91,0.86);
  pricesizes('1.50"', 4.73,3.03,2.47,1.84,1.59,1.35,1.15,1.06,1.01,0.96);
  pricesizes('1.75"', 4.79,3.09,2.57,1.94,1.72,1.45,1.31,1.20,1.15,1.10);
  pricesizes('2.00"', 4.91,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=14 CLASS=pricesizes><B>Large Sized Pins</B></TD>');
  document.write('</TR>');
  pricesizes('2.25"', 5.13,3.43,2.98,2.42,2.15,1.79,1.66,1.56,1.50,1.45);
  pricesizes('2.50"', 5.59,3.89,3.40,2.79,2.46,2.09,1.91,1.76,1.70,1.65);
  pricesizes('2.75"', 6.18,4.48,3.79,3.08,2.77,2.38,2.06,1.96,1.90,1.85);
  pricesizes('3.00"', 7.02,5.32,4.53,3.69,3.21,2.63,2.41,2.28,2.23,2.18);
//  pricesizes('3.25"', 7.79,6.09,5.19,4.36,3.87,3.27,3.06,2.93,2.88,2.83);
//  pricesizes('3.50"', 8.69,6.99,5.99,5.16,4.67,4.07,3.86,3.73,3.68,3.63);
//  pricesizes('3.75"',10.02,8.32,7.32,6.49,6.00,5.40,5.19,5.06,5.01,4.96);
//  pricesizes('4.00"',11.62,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 - photo pins - short list of sizes
function showbiggerpinsphotoshort() {
  priceheader(' ',    50,  100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('1.50"', 4.73,3.03,2.47,1.84,1.59,1.35,1.15,1.06,1.01,0.96);
  pricesizes('1.75"', 4.79,3.09,2.57,1.94,1.72,1.45,1.31,1.20,1.15,1.10);
  pricesizes('2.00"', 4.91,3.21,2.74,2.17,1.90,1.57,1.44,1.33,1.28,1.23);
  pricesizes('2.25"', 5.13,3.43,2.98,2.42,2.15,1.79,1.66,1.56,1.50,1.45);
}

// Function to display prices for bigger pins other than photo
function showbiggerpinsother() {
  priceheader(' ',    50,  100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('0.50"', 4.40,2.70,2.12,1.52,1.28,1.15,1.02,0.97,0.86,0.77);
  pricesizes('0.75"', 4.43,2.73,2.15,1.61,1.33,1.18,1.05,1.01,0.89,0.80);
  pricesizes('1.00"', 4.54,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=14 CLASS=pricesizes><B>Normal Sized Pins</B></TD>');
  document.write('</TR>');
  pricesizes('1.25"', 4.71,3.01,2.30,1.75,1.51,1.29,1.14,1.06,0.97,0.87);
  pricesizes('1.50"', 4.78,3.08,2.45,1.92,1.65,1.38,1.22,1.16,1.03,0.93);
  pricesizes('1.75"', 4.83,3.13,2.61,2.12,1.92,1.66,1.49,1.42,1.36,1.23);
  pricesizes('2.00"', 4.98,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=14 CLASS=pricesizes><B>Large Sized Pins</B></TD>');
  document.write('</TR>');
  pricesizes('2.25"', 5.51,3.81,3.30,2.91,2.54,2.27,2.10,1.99,1.91,1.84);
  pricesizes('2.50"', 6.15,4.44,3.89,3.40,2.98,2.70,2.53,2.28,2.23,2.17);
  pricesizes('2.75"', 7.18,5.48,4.70,4.14,3.68,3.25,2.97,2.69,2.61,2.52);
  pricesizes('3.00"', 8.17,6.47,5.68,4.74,4.20,3.73,3.49,3.34,3.27,3.19);
}

// Function to display prices for bigger pins other than photo - short list of sizes
function showbiggerpinsothershort() {
  priceheader(' ',    50,  100, 200, 300, 400, 500, 750, 1000,2500,5000);
  pricesizes('1.50"', 4.78,3.08,2.45,1.92,1.65,1.38,1.22,1.16,1.03,0.93);
  pricesizes('1.75"', 4.83,3.13,2.61,2.12,1.92,1.66,1.49,1.42,1.36,1.23);
  pricesizes('2.00"', 4.98,3.28,2.76,2.27,2.14,1.80,1.63,1.56,1.49,1.37);
  pricesizes('2.25"', 5.51,3.81,3.30,2.91,2.54,2.27,2.10,1.99,1.91,1.84);
}

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

function showdeliverydatesBUSYSEASON(howmanyforward) {
  document.write("&nbsp;<A HREF='order-pins.html'>Contact us (busy season)</A>");
}

function showdeliverydatesHOLIDAYSEASON(howmanyforward) {
  document.write("&nbsp;<A HREF='order-pins.html' STYLE='font:10pt/12pt Arial;'>Contact us (holiday season)</A>");
}

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;
  }
}

