var the_images = new Array();
function preloadimages()
{
  for (i = 0; i < preloadimages.arguments.length; i++)
  {
    the_images[i] = new Image();
    the_images[i].src = preloadimages.arguments[i];
  }
}

function check_email()
{
  email = document.ccoptin.ea.value;
  if (email == "" || email.indexOf("@") == -1 || email.indexOf(".") == -1)
  {
    alert("You must provide a valid email address.");
    return false;
  }
  else
  {
    return true;
  }
}



function imgOn(imgName)
{
  if (document.images) {
    document[imgName].src = eval(imgName + "on.src");
  }
}

function imgOff(imgName)
{
  if (document.images) {
    document[imgName].src = eval(imgName + "off.src");
  }
}

function popup(url, width, height, window_name)
{
  if (!window_name) window_name = "new_win";
  var left = (screen.width - width) / 2;
  var top = (screen.height - height) / 2;
  var new_win = window.open(url, window_name, "width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=yes,resizable=yes");
  return new_win;
}

var op_objects = new Array();

function opacity(id, opacStart, opacEnd, millisec, quality) {
    var mult = 10;
    if (quality) mult = 5;
    //speed for each frame
    var speed = Math.round(millisec / (100 / mult) );
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i = i - mult) {
            op_objects[id] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i = i + mult)
            {
            op_objects[id] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function restore_image(id)
{
    clearTimeout(op_objects[id]);
    changeOpac(100, id);
}

