/* 
 * This provides the functionality to easily embed a clipTeaser,
 * this Version does NOT include swfobject.
 * 
 * Uses: SWFObject v2.2 <http://code.google.com/p/swfobject/>
 * 
 * options = {
 * 	 width: int,
 * 	 height: int,
 *   link: string (the target destination the teaser points to on click),
 *   buttonSize: small|medium|big,
 *   buttonCircleColor: hex color,
 *   buttonArrowColor: hex color,
 *   buttonAlpha: number,
 *   wmode: 
 * }
 * 
 */

function clone(obj){
	if(obj == null || typeof(obj) != 'object')
		return obj;
	
	var temp = new obj.constructor();
	for(var key in obj)
		temp[key] = clone(obj[key]);
  return temp;
}

var clipsTeaser = function() {
	
	var counted = false,
		empty = function(){}();
	
	return {
		insert: function(elementId, catalogObjectId, options, version){
			
			if(version == '1'){
				var lOptions = clone(options);
				lOptions.coid = catalogObjectId;
				
				if(lOptions.wmode == '')
					lOptions.wmode = 'direct';
				
				var url = 'http://www.onlinereisekataloge.de/clipsteaser/olimarclips/';
				swfobject.embedSWF (
						'http://www.onlinereisekataloge.de/clipsteaser/olimarclips/clipsTeaser.swf', 
						elementId, 
						lOptions.width, 
						lOptions.height, 
						'10.0.0', 
						'http://www.onlinereisekataloge.de/clipsteaser/olimarclips/expressInstall.swf', 
						lOptions,
						{
							allowScriptAccess: 'always',
							wmode: lOptions.wmode
						},
						{
							allowScriptAccess: 'always',
							wmode: lOptions.wmode
						});
				if(!counted){
					counted = true;
					document.getElementById(elementId).innerHTML += '<img src="http://interface.travelcms.de/IFIDf4769d1f25e4b18bcee221ff6c754/show/clip/count.gif?rand='+(new Date().getTime())+'" width="1" height="1" border="0" alt="" title="" />';
				}
				
			} //Version 1
		} //Insert
	} //return
	
}();