/* Common javascript for www.slingeasy.co.uk */
/* (c) merville.biz 2004 */

  var image_dir = "images/";
  var image_prefix = image_dir + "/Fabric_";
  var image_suffix = ".jpg";
  var image_index = 1;

function preload(image_total){

  var images = new Array(image_total);

  /* Loop to preload images */

  for ( ""; image_index < (image_total+1); image_index++){

    images[image_index] = new Image();
    images[image_index].src = image_prefix + image_index + image_suffix;

  }

}

function isValidEmail(addressS)

{

    emailRegexp = RegExp('/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/', 'i');

    if (emailRegexp.test(addressS))

    {

        return true;

    }

    alert("Please enter a valid email");
    return false;

}


function button_enable(button){

  eval("document.forms[0]." + button + "[0].disabled = false;");
  eval("document.forms[0]." + button + "[1].disabled = false;");

}

function button_disable(button){

  eval("document.forms[0]." + button + "[0].disabled = true;");
  eval("document.forms[0]." + button + "[1].disabled = true;");

}


function dhtml(target,content){

    // Replace the current DIV (target) with content

    var span_el = document.getElementById(target);
    var new_txt = document.createTextNode(content);
    span_el.replaceChild(new_txt, span_el.childNodes[0]);

}

function swatch_hover(index){

    // Changes image and text when user highlights a thumbnail

    document.Preload_image.src = image_dir+index;

}

function demo_hover(index){

    // Runs the demo

    document.Preload_image.src = images[index].src;
    header = title[index];
	text = content[index];
    dhtml("dhtml_header",header);
	dhtml("dhtml_text",text);

}

function add_item(){

   alert(document.product.item.value);

}
