// JavaScript Document

// requires easypopup

/*
 * Initializing collection detail
 *
 */

var detail, i, j, a, divs, trs, tds, tmp, zoom_image, zoom_icon;


// get the detail / color list
detail = getObj('detail');

/*** main routine ***/

if (detail) {
	
	if (divs = document.getElementsByTagName('DIV')) {
		for(i=0; i < divs.length; i++) {
			switch(divs.item(i).className) {
				case 'zoom_image':
				case 'zoom_icon':
					// create zoom function
					if (!divs.item(i).popup) divs.item(i).popup = divs.item(i).getAttribute('popup');
					if (divs.item(i).popup) {
						divs.item(i).style.cursor = 'pointer';
						divs.item(i).onclick = function() {
							if (!this.popup) this.popup = this.getAttribute('popup');
							if (!this.name) this.name = this.getAttribute('name');
							easyPopup.popup(this.popup, this.name, 'product_image_popup');
						}
					}
					else {
						alert('no popup given');
						divs.item(i).style.cursor = 'default';
					}
					break;
				case 'color':
					// create basket functionality
					/*frm = divs.item(i).getElementsByTagName('FORM').item(0);
					if (frm) {
						if (frm.elements) {
							//frm.elements.additem.onfocus = function() { this.blur() }
						}
						frm.onsubmit = function() {
							alert('Putting '+this.elements.amount.value+' pieces into basket');
							return false;
						}
					}*/
					break;
			}
		}
	}
}


/*** sub functions ***/


