

function image_list(names,titles,prices,codes) {
  this.current = 0;
  this.images = new Array();
  //this.titles = new Array();
  //this.prices = new Array();
  //this.codes = new Array();
  this.cycle = cycle_list;
  this.get_current_img = current_img;
  //this.get_current_title = current_title;
  //this.get_current_price = current_price;
  this.get_current_index = current_index;
  //this.get_current_code = current_code;
  for (var i = 0; i < names.length; i++) {
     this.images[i] = new Image();
     this.images[i].src = names[i];
     //this.titles[i] = titles[i];
     //this.prices[i] = prices[i];
     //this.codes[i] = codes[i];
  }
} 

function current_index() {
    return this.current;
}

function cycle_list(dir) {
   var k = this.current;
   var m = this.images.length - 1;
   if (m>0) {
       if (dir > 0) { k++; } else {k--;}
       if (k > m) { k = 0; }
       if (k < 0) { k = m; }
       this.current = k;
   }
}

function current_img() {
    return this.images[this.current];
}

function current_title() {
     return this.titles[this.current];
}

function current_price() {
     return this.prices[this.current];
}

function current_code() {
     return this.codes[this.current];
}

function swap_img(name,img) {
	if (document.images) {
		document[name].src = img.src;
	}
}

function swap_img_src(name,new_src) {
    if (document.images) {
        document[name].src = new_src;
    }
}

function show_title(name,txt) {
    //alert ("name =" + name + " title =" + txt);
    document.getElementById(name).innerHTML = txt;
}

function img_cycle(direction,img_name,title_name,price_name,code_name,list) {
    list.cycle(direction);
    var img = list.get_current_img();
    swap_img(img_name,img);
    //var txt = list.get_current_title();
    //show_title(title_name,txt);
    //var txt = list.get_current_price();
    //show_title(price_name,txt); 
    //var txt = list.get_current_code();
    //show_title(code_name,txt);
}



function popup(mylink, windowname, width, height, scrollbars, status, resizable) {
   if (! window.focus) return true;
   var href;
   if (typeof(mylink) == 'string')
      href=mylink;
   else
      href=mylink.href;
   s = 'resizable,width=' + width + ',height=' + height + ',status=' +  status + ',scrollbars=' +  scrollbars;
   windowref = window.open(href, windowname, s);
   windowref.focus();
   // window.open("http://www.w3schools.com","","toolbar=no,location=no,directories=no, status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=400,height=400")
   //return false;
}

function img_zoom(list,listzoom) {
    var k = list.get_current_index();
    //alert ('index =' + k);
    var big_src =  listzoom.images[k].src;
    //alert (big_src);
    popup(big_src,'mt fashion', 820,560,1,0,1);
}



   var imgb_normal = new Image();
   imgb_normal.src = "img/imgb_normal.gif";
   var imgb_plus = new Image();
   imgb_plus.src = "img/imgb_plus.gif";
   var imgb_minus = new Image();
   imgb_minus.src = "img/imgb_minus.gif";





 

