/**
 * shop.item.details.list.js - insert headline here
 *
 * COPYRIGHT: All  title   and  proprietary  rights,  including  trade
 * secrets,   in   the   Software   and   any   copies thereof and the
 * accompanying  written   materials,   are  owned  by   schukai  GmbH
 * and  are  protected  by  German  copyright  laws,  other applicable
 * copyright   laws  and  international  treaty  provisions.
 *
 * @package    alvine
 * @author     schukai GmbH <info@schukai.de>
 * @copyright  Copyright (C) 2002, 2003, 2004, 2005, 2006 schukai GmbH
 * @license    http://www.alvine.de/license/
 * @version    20061114
 * @link       http://www.alvine.de/
 */

function content_frontend_plugin_shop_item_details_list_init(boxID){
	
}

function content_frontend_plugin_shop_item_details_list_registerImage(targetID, srcID, imageIndex, bigImageUrl, registerType, optional, eventName, boxID, displayMode, eventBoxID){
	
	if(typeof targetID    == 'undefined') return false;
	if(typeof srcID       == 'undefined') return false;
	if(typeof imageIndex  == 'undefined') return false;
	if(typeof bigImageUrl == 'undefined') return false;
	
	if(!boxID) return false;
	
	var srcImage = element_isObject(srcID);
	if(!srcImage) return false;
	
	var targetImage = element_isObject(targetID);
	if(!targetImage) return false;
	
	srcImage['alvine_boxID']       = boxID;
	srcImage['alvine_imageIndex']  = imageIndex;
	srcImage['alvine_displayMode'] = (typeof displayMode == 'undefined')?'small':displayMode;
	
  targetImage['alvine_boxID']      = boxID;
	
	eventName = (typeof eventName == 'undefined')?'click':eventName;
			
	content_js_imagePreloader_registerImage(bigImageUrl, targetID);
	
	if(eventBoxID != null){
		var proxyObj = element_isObject(eventBoxID);
		proxyObj.alvine_bigImageObject = srcImage;
	} else {
		eventBoxID = srcID;
	}

  var eventParentObj = element_isObject(eventBoxID);
  if(eventParentObj){
    if(typeof eventParentObj.alvine_popupInit != 'object') eventParentObj.alvine_popupInit = {};
    if(typeof eventParentObj.alvine_popupInit[boxID] == 'undefined') eventParentObj.alvine_popupInit[boxID] = 0;

    if(typeof eventParentObj.alvine_bigItems != 'object') eventParentObj.alvine_bigItems = {};
    eventParentObj.alvine_bigItems[imageIndex] = targetImage;
  }

	switch(registerType){
		default:
		case 'bigImage':
			
			srcImage['alvine_bigImageUrl'] = bigImageUrl;
			srcImage['alvine_targetID']    = targetID;
			
			event_add(eventBoxID, eventName, content_frontend_plugin_shop_item_details_list_changeImage);
			break;
		
		case 'popup':
      if(typeof optional == 'undefined') break;
			if(!eventParentObj || eventParentObj.alvine_popupInit[boxID] > 0) break;

			srcImage['alvine_popupID']      = optional;
			srcImage['alvine_currentIndex'] = imageIndex;
			
			event_add(eventBoxID, eventName, content_frontend_plugin_shop_item_details_list_raisePopUp);
			eventParentObj.alvine_popupInit[boxID]++;
			break;
	}

}


function content_frontend_plugin_shop_item_details_list_changeImage(ev){
	
	var boxID      = this.alvine_boxID;
	var imageIndex = this.alvine_imageIndex;

	var bigImageObj = element_isObject(this.alvine_targetID);

	if(!bigImageObj) return false;
	
	bigImageObj.src = this.alvine_bigImageUrl;

	bigImageObj.alvine_currentIndex = imageIndex;
	
	return object_preventDefaultEventBehaviour(ev);
}

function content_frontend_plugin_shop_item_details_list_raisePopUp(ev){
	var obj = new Object();
	if(typeof this.alvine_bigImageObject != 'undefined'){
		obj = this.alvine_bigImageObject;
	} else {
		obj = this;
	}


  var currentIndex = obj.alvine_currentIndex;


  var copyObjectLayer = element_cloneNode(obj.alvine_bigItems[currentIndex], true);
	
  content_layout_popup_js_show(obj.alvine_popupID, copyObjectLayer, true);

	return object_preventDefaultEventBehaviour(ev);
}



;