//SWF Function
var thumbnailviewer2SWF={
	enableTitleSWF: true, //Should "title" attribute of link be used as description?
	enableTransitionSWF: true, //Enable fading transition in IE?
	hideimgmouseoutSWF: false, //Hide enlarged image when mouse moves out of anchor link? (if enlarged image is hyperlinked, always set to false!)
	/////////////No need to edit beyond here/////////////////////////
	
	iefilterstringSWF: 'progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=1.0 Duration=0.7)', //IE specific multimedia filter string
	iefiltercapableSWF: document.compatMode && window.createPopup? true : false, //Detect browser support for IE filters
	preloadedimagesSWF:[], //array to preload enlarged images (ones set to display "onmouseover"
	targetlinksSWF:[], //array to hold participating links (those with rel="enlargeimage:initType"
	alreadyrunflagSWF: false, //flag to indicate whether initSWF() function has been run already come window.onload

loadimageSWF:function(linkobjSWF){
	var imagepathSWF=linkobjSWF.getAttribute("href") //Get URL to enlarged image
	var showcontainerSWF=document.getElementById(linkobjSWF.getAttribute("rev").split("::")[0])
	// ^Reference container on page to show enlarged image in
	var destSWF=linkobjSWF.getAttribute("rev").split("::")[1] //Get URL enlarged image should be linked to, if any
	var descriptionSWF=(thumbnailviewer2SWF.enableTitleSWF && linkobjSWF.getAttribute("title"))? linkobjSWF.getAttribute("title") : ""
	//^Get title attr
	var	imageSWF='<object width="400" height="224" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+imagepathSWF+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="'+imagepathSWF+'" quality="high" bgcolor="#ffffff" width="400" height="224" name="video" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" /></object>' //Construct HTML for SWF File
	if (typeof destSWF!="undefined") //Hyperlink the enlarged image?
		imageSWF='<a href="'+dest+'">'+imageSWF+'</a>'
		if (descriptionSWF!="") //Use title attr of the link as description?
			imageSWF+descriptionSWF
			if (this.iefiltercapableSWF){ //Is this an IE browser that supports filters?
				showcontainerSWF.style.filter=this.iefilterstringSWF
				showcontainerSWF.filters[0].Apply()
			}
	showcontainerSWF.innerSWF=imageSWF
	this.featureImageSWF=showcontainerSWF.getElementsByTagName("img")[0] //Reference enlarged image itself
	this.featureImageSWF.onload=function(){ //When enlarged image has completely loaded
		if (thumbnailviewer2SWF.iefiltercapableSWF) //Is this an IE browser that supports filters?
		showcontainerSWF.filters[0].Play()
	}
	this.featureImageSWF.onerror=function(){ //If an error has occurred while loading the image to show
		if (thumbnailviewer2SWF.iefiltercapableSWF) //Is this an IE browser that supports filters?
		showcontainerSWF.filters[0].Stop()
	}
},

hideimageSWF:function(linkobjSWF){
	var showcontainerSWF=document.getElementById(linkobjSWF.getAttribute("rev").split("::")[0]) //Reference container on page to show enlarged image in
	showcontainerSWF.innerSWF=""
},

cleanupSWF:function(){ //Clean up routine on page unload
	if (this.featureImageSWF){this.featureImageSWF.onload=null; this.featureImageSWF.onerror=null; this.featureImage=null}
	this.showcontainerSWF=null
	for (var i=0; i<this.targetlinksSWF.length; i++){
		this.targetlinksSWF[i].onclick=null
		this.targetlinksSWF[i].onmouseover=null
		this.targetlinksSWF[i].onmouseout=null
	}
},

addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
},

//INIT SWF
initSWF:function(){ //Initialize thumbnail viewer script
	this.iefiltercapableSWF=(this.iefiltercapableSWF && this.enableTransitionSWF) //True or false: IE filters supported and is enabled by user
	var pagelinksSWF=document.getElementsByTagName("a")
	for (var i=0; i<pagelinks.length; i++){ //BEGIN FOR LOOP
		//IF FOR SWF File
		if (pagelinksSWF[i].getAttribute("rel") && /enlargeimage:/i.test(pagelinksSWF[i].getAttribute("rel"))){ //Begin if statement: Test for rel="enlargeimage"
			var initType=pagelinksSWF[i].getAttribute("rel").split("::")[1] //Get display type of enlarged image ("click" or "mouseover")
			if (initType=="mouseover"){ //If type is "mouseover", preload the enlarged image for quicker display
				this.preloadedimagesSWF[this.preloadedimagesSWF.length]=new Image()
				this.preloadedimagesSWF[this.preloadedimagesSWF.length-1].src=pagelinks[i].href
				pagelinks[i]["onclick"]=function(){ //Cancel default click action
					return false
				}
			}
			pagelinksSWF[i]["on"+initType]=function(){ //Load enlarged image based on the specified display type (event)
			thumbnailviewer2SWF.loadimageSWF(this) //Load image
			return false
		}
	if (this.hideimgmouseoutSWF)
		pagelinksSWF[i]["onmouseout"]=function(){
			thumbnailviewer2SWF.hideimageSWF(this)
		}
	this.targetlinksSWF[this.targetlinksSWF.length]=pagelinksSWF[i] //store reference to target link
		} //end if statement for SWF
		
	} //END FOR LOOP
}//END SFW init()
}
// END SWF Function
//SWF Misc
if (document.addEventListener) //Take advantage of "DOMContentLoaded" event in select Mozilla/ Opera browsers for faster init
	thumbnailviewer2SWF.addEvent(document, function(){thumbnailviewer2SWF.alreadyrunflagSWF=1; thumbnailviewer2SWF.initSWF()}, "DOMContentLoaded") //Initialize script on page load
else if (document.all && document.getElementsByTagName("a").length>0){ //Take advantage of "defer" attr inside SCRIPT tag in IE for instant init
	thumbnailviewer2SWF.alreadyrunflagSWF=1
	thumbnailviewer2SWF.initSWF()
	/*thumbnailviewer2SWF.initSWF()*/
}
thumbnailviewer2SWF.addEvent(window, function(){if (!thumbnailviewer2SWF.alreadyrunflagSWF) thumbnailviewer2SWF.initSWF()}, "load") //Default init method: window.onload
thumbnailviewer2SWF.addEvent(window, function(){thumbnailviewer2SWF.cleanupSWF()}, "unload")
//END SWF