
MSIE = "Microsoft Internet Explorer";

document.writeln("<style>");
if ((navigator.appName == MSIE) || (navigator.userAgent.indexOf("Opera") > 0)) {
  document.writeln(".wide {width: 200px;}");
  document.writeln(".halfwide {width: 100px;}");
  document.writeln(".oneandhalfwide {width: 300px;}");
  document.writeln(".qty {width: 20px;}");
  if (navigator.appName == MSIE) {
    document.writeln(".wide, .halfwide, .oneandhalfwide, .qty {border: 1px solid Black;}");
  }
} 
if (navigator.appName == "Netscape") {
 document.writeln("ul {margin-left: -25px; margin-top: -5px;}");
}
document.writeln("</style>");


function swapImage(name, src) {
  document.images[name].src = "images/" + src;
}


function showCardImage(cardid) {
  window.open('http://www.cardsonline.ru/showimage.php?cardid='+cardid, '', config='height=230,width=300,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no');
}

function showNominalImage(nomid) {
  window.open('http://www.cardsonline.ru/showimage.php?nomid='+nomid, '', config='height=230,width=300,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no');
}



function CheckEmail(em) {

  l  = em.length;
  i1 = em.indexOf("@");
  i2 = em.lastIndexOf(".");

  return ((i1 > 0) && ((i2-i1) > 1) && ((l-i2) > 1));
}
function isDigit(c) {
  return (c <= '9') && (c >= '0');
}
function getBrowserName() {
  if (navigator.userAgent.indexOf('Opera') >= 0) return 'Opera';
  if (navigator.userAgent.indexOf('Firefox') >= 0) return 'Firefox';
  if (navigator.appName == 'Microsoft Internet Explorer') return 'MSIE';
  return 'Unknown';
}
function getBrowserVersion(name) {
  var ind;
  var str=navigator.userAgent;
  var version='';
  switch(name) {
    case 'Opera': //Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.51
      ind = str.indexOf('Opera');
      if(ind == -1) return null;
      ind += 6;
      while((isDigit(str.charAt(ind)) || (str.charAt(ind)=='.')) && (ind < str.length)) {
        version += str.charAt(ind);
        ind++;
      }
      return version;
      break;
    case 'Firefox':  //Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
      ind = str.indexOf('Firefox');
      if(ind == -1) return null;
      ind += 8;
      while((isDigit(str.charAt(ind)) || (str.charAt(ind)=='.')) && (ind < str.length)) {
        version += str.charAt(ind);
        ind++;
      }
      return version;
      break;
    case 'MSIE': //Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
      ind = str.indexOf('MSIE');
      if(ind == -1) return null;
      ind += 5;
      while((isDigit(str.charAt(ind)) || (str.charAt(ind)=='.')) && (ind < str.length)) {
        version += str.charAt(ind);
        ind++
      }
      return version;
      break;
    default:
      return null;
  }
}
function isOldBrowser(name, version) {
  return (name=='Unknown') ||
         ((version.charAt(0) < '0') || (version.charAt(0) > '9')) ||
         ((name=='Opera') && (version < '7.0')) ||
         ((name=='Firefox') && (version < '1.4')) ||
         ((name=='MSIE') && (version < '6.0'));
}
function show_basket(ref_no, nid) {
  if(isOldBrowser(browserName, browserVersion))
    document.write('<a href="addtocart.php?nid='+nid+'"><img src="images/basket.gif" class="action" width=15 height=16 border=0 alt="add to shopping cart"></a>');
  else {
    document.write('<img id="img_nom'+nid+'" src="images/basket.gif" class="action" width=15 height=16 alt="add to shopping cart" onClick="add_to_cart(\''+ref_no+'\', '+nid+')">')
    document.writeln('<div id="show_nom_state'+nid+'" style="display:none">')
    document.writeln('<table width=150px class="popup">')
    document.writeln('<tr><td id="nom_state'+nid+'"></td></tr>')
    document.writeln('</table>')
    document.writeln('</div>')
  }
}

var browserName=getBrowserName();
var browserVersion=getBrowserVersion(browserName);


