SET_DHTML("pol_1");

polaroid_counter = 3;

function newPolaroid(x, y){
    if (polaroid_counter <= (maxpolaroids+1)) {
	polaroid_counter++;
	var newdiv = document.createElement('div');
	newdiv.id='pol_div_'+polaroid_counter;
	newdiv.setAttribute('name', newdiv.id);
	// Element.setStyle(newdiv, {width: '135px', height: '160px', position: 'absolute'});
        newdiv.style.position='absolute';
        newdiv.style.width='135px';
        newdiv.style.height='160px';
	newdiv.setAttribute('class','polaroid_photo');
	document.getElementById('phome').appendChild(newdiv);

	var newimage = document.createElement('img');
	newimage.setAttribute('id','pol_'+polaroid_counter);
	newimage.setAttribute('name','pol_'+polaroid_counter);
	newimage.setAttribute('src',mypolaroids[polaroid_counter-4]);
	newimage.setAttribute('alt',myproduct[polaroid_counter-4]);
	newimage.setAttribute('title',myproduct[polaroid_counter-4]);
	newimage.setAttribute('width','135');
	newimage.setAttribute('height','160');
	newdiv.appendChild(newimage);
	
	ADD_DHTML(newdiv.id);
	dd.elements[newdiv.id].moveTo(x,y);

	// pngfix.js
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	
	if ((version >= 5.5) && (document.body.filters)) 
	{
	   for(var i=0; i<document.images.length; i++)
	   {
		  var img = document.images[i]
		  var imgName = img.src.toUpperCase()
		  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		  {
			 var imgID = (img.id) ? "id='" + img.id + "' " : ""
			 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			 var imgStyle = "display:inline-block;" + img.style.cssText 
			 if (img.align == "left") imgStyle = "float:left;" + imgStyle
			 if (img.align == "right") imgStyle = "float:right;" + imgStyle
			 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
			 var strNewHTML = "<span " + imgID + imgClass + imgTitle
			 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>";
			 img.outerHTML = strNewHTML;
			 i = i-1;
		  }
	   }
	}
	
	//new Insertion.Bottom(document.getElementById('polaroid_container'), '<div id="pol_div_'+polaroid_counter+'"><img src="/ama/images/polaroid3.png" alt="Team 100" name="pol_'+polaroid_counter+'" width="135" height="160" class="polaroid_photo" id="pol_'+polaroid_counter+'" style="top:'+y+'px;left:'+x+'px;z-index:3" title="Team 100" /></div>');
	// new Draggable('pol_'+polaroid_counter);
	//ADD_DHTML('pol_div_'+polaroid_counter);
	}
}
