function findResolution() {
  var image_width=screen.width;
  var resolution = 3;
  if (image_width >= 580  &&  image_width <= 640)
    resolution=1;
  if (image_width >= 700  &&  image_width <= 800)
    resolution=2;
  if (image_width >= 924  &&  image_width <= 1024)
    resolution=3;
  if (image_width >= 1100 && image_width <= 1152)
    resolution=4;
  if (image_width >= 1300 && image_width <= 1600)
    resolution=5;
  return resolution;
}


function validate_promo(element) {
  //var pattern = /[rR][fF][dD][lL][aA]070./;
  var pattern = /[a-zA-Z][a-zA-Z]..../;
  var code = element.value
  if (code == "" ) {
    alert("Please type in the promotion code!");
    element.focus();
    return false;
  } else if (!pattern.test(code)) { 
    alert("The promotion Code format is inccorect, please try again.");
    element.focus();
    return false;
  }
  return true;
}           


function checkNotZero(number, text,URL) {
  if(number == 0 || number == "0")
    alert(text);
  else 
    window.location.replace(URL);
}  

function checkBrowser() {
  var browserName = navigator.appName;
  var browserVersion = parseInt(navigator.appVersion);
  var browser;

  if (browserName == "Netscape" && browserVersion ==5)
    browser = "nn6";
  else if (browserName == "Netscape")    
    browser = "nn4";
  else if (browserName == "Microsoft Internet Explorer"  && 
           browserVersion == 4 &&
           navigator.appVersion.indexOf("MSIE 6.0") != -1)
    browser = "ie6";
  else if (browserName == "Microsoft Internet Explorer"  && 
           browserVersion == 4 &&
           navigator.appVersion.indexOf("MSIE 5.5") != -1)
    browser = "ie5";
  else if (browserName == "Microsoft Internet Explorer"  && 
           browserVersion == 4)
    browser = "ie4";
  
  return browser;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function findString (str) {
 if (parseInt(navigator.appVersion)<4) return;
 var strFound;
 if (navigator.appName=="Netscape") {

  // NAVIGATOR-SPECIFIC CODE

  strFound=self.find(str);
  if (!strFound) {
   strFound=self.find(str,0,1)
   while (self.find(str,0,1)) continue
  }
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {

  // EXPLORER-SPECIFIC CODE

  if (TRange!=null) {
   TRange.collapse(false)
   strFound=TRange.findText(str)
   if (strFound) TRange.select()
  }
  if (TRange==null || strFound==0) {
   TRange=self.document.body.createTextRange()
   strFound=TRange.findText(str)
   if (strFound) TRange.select()
  }
 }
 if (!strFound) alert ("String '"+str+"' not found!")
}