var bliss={
pager: true, 
sky: true,
tel: '<div class="closewindow"><u>CLOSE WINDOW</u> X</div>',
blisspreview: '<img src="/images/loading.gif" /> Loading&nbsp;Preview...', 
art: 16,
opacitystring: 'filter:progid:DXImageTransform.Microsoft.alpha(opacity=10); -moz-opacity: 0.1; opacity: 0.1',
targetlinks:[], 

erotic:function(){
document.write('<div id="one" onClick="bliss.closeit()"><div id="websitedesign"></div>'+this.tel+'</div>')
document.write('<div id="stylepreview">'+this.blisspreview+'</div>')
this.one=document.getElementById("one")
this.websitedesign=document.getElementById("websitedesign") 
this.stylepreview=document.getElementById("stylepreview") 
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body 
},

centerDiv:function(divobj){ 
var ie=document.all && !window.opera
var dom=document.getElementById
var scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
var scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
var docwidth=(ie)? this.standardbody.clientWidth : window.innerWidth-this.art
var docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)? this.standardbody.offsetHeight : this.standardbody.scrollHeight 
var objwidth=divobj.offsetWidth 
var objheight=divobj.offsetHeight 
var topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+10+"px" 
divobj.style.left=docwidth/2-objwidth/2+"px" 
divobj.style.top=Math.floor(parseInt(topposition))+"px"
divobj.style.visibility="visible"
},

showone:function(){ 
this.centerDiv(this.one)
if (this.sky){ 
this.currentopacity=0.1 
this.opacitytimer=setInterval("bliss.opacityanimation()", 20)
}
},


loadimage:function(link){ 
if (this.one.style.visibility=="visible") 
this.closeit() 
var imageHTML='<img src="'+link.getAttribute("href")+'" style="'+this.opacitystring+'" />' 
if (this.pager && link.getAttribute("title")) 
imageHTML+='<br />'+link.getAttribute("title")
this.centerDiv(this.stylepreview) 
this.websitedesign.innerHTML=imageHTML 
this.featureImage=this.websitedesign.getElementsByTagName("img")[0] 
this.featureImage.onload=function(){ 
bliss.stylepreview.style.visibility="hidden" 
bliss.showone() 
}
if (document.all && !window.createPopup) 
this.featureImage.src=link.getAttribute("href")
this.featureImage.onerror=function(){ 
bliss.stylepreview.style.visibility="hidden" 
}
},

setimgopacity:function(value){ 
var targetobject=this.featureImage
if (targetobject.filters && targetobject.filters[0]){ 
if (typeof targetobject.filters[0].opacity=="number") 
targetobject.filters[0].opacity=value*100
else 
targetobject.style.filter="alpha(opacity="+value*100+")"
}
else if (typeof targetobject.style.MozOpacity!="undefined") 
targetobject.style.MozOpacity=value
else if (typeof targetobject.style.opacity!="undefined") 
targetobject.style.opacity=value
else 
this.stopanimation()
},

opacityanimation:function(){ 
this.setimgopacity(this.currentopacity)
this.currentopacity+=0.1
if (this.currentopacity>1)
this.stopanimation()
},

stopanimation:function(){
if (typeof this.opacitytimer!="undefined")
clearInterval(this.opacitytimer)
},


closeit:function(){ 
this.stopanimation()
this.one.style.visibility="hidden"
this.websitedesign.innerHTML=""
this.one.style.left="-2000px"
this.one.style.top="-2000px"
},

cleanup:function(){ 
this.stylepreview=null
if (this.featureImage) this.featureImage.onload=null
this.featureImage=null
this.websitedesign=null
for (var i=0; i<this.targetlinks.length; i++)
this.targetlinks[i].onclick=null
this.one=null
},

dotask:function(target, functionref, tasktype){ 
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
},

init:function(){ 
if (!this.sky)
this.opacitystring=""
var pagelinks=document.getElementsByTagName("a")
for (var i=0; i<pagelinks.length; i++){ 
if (pagelinks[i].getAttribute("rel") && pagelinks[i].getAttribute("rel")=="styles"){ 
pagelinks[i].onclick=function(){
bliss.stopanimation() 
bliss.loadimage(this) 
return false
}
this.targetlinks[this.targetlinks.length]=pagelinks[i] 
} 
} 
this.dotask(window, function(){if (bliss.one.style.visibility=="visible") bliss.centerDiv(bliss.one)}, "resize")
} 
}
bliss.erotic() 
bliss.dotask(window, function(){bliss.init()}, "load") 
bliss.dotask(window, function(){bliss.cleanup()}, "unload")
