
/* TEST */

function rollovers()
{
	var option = 1;  // if 0, image will vanish on mouseout, vice versa, if 1, image will stay and wait for a click on the close button
var transparency_delay = 500; // set the time the transparency effect is shown in ms
var make_draggable = 1;

$$('a').each(function(el){

		if(el.getAttribute('rel')=='imgExpand'){
			/* IF OUR A TAGS HAVE THE REL OF artViper THEN DO THIS */
			el.onclick = function() {

					 return false

			}
			

			el.addEvent('mouseover',function(){

		rel = el.getAttribute('rel');
		href = el.getAttribute('href');
		var horPos = el.getTop();
		var leftPos = el.getLeft();

		var test = $('imagetext');

		if(test == false ){
			if(rel == "imgExpand"){
				if (window.innerWidth){
					width = window.innerWidth
				}
				else if (document.documentElement && document.documentElement.clientWidth){
					width = document.documentElement.clientWidth
				}
				else if (document.body){
					width = document.body.clientWidth
				}

				if (window.innerHeight){
					height = window.innerHeight
				}
				else if (document.documentElement && document.documentElement.clientHeight){
					height = document.documentElement.clientHeight
				}
				else if (document.body){
					height = document.body.clientHeight
				}

			image = new Image();
			if(href.indexOf(".rar") != -1){
			image.src = href;
			}else{
				image.src = "rar.jpg";
			}
			imgWidth = image.width;
			imgHeight = image.height;
			
			/* DEFINE SNAPSHOT SIZE */
			/* ++++++++++++++++++++++++++++++++++ */
			imgWidth = 388 // define thumbnail size width
			imgHeight = 293 // define thumbnail size height
			/* ++++++++++++++++++++++++++++++++++ */
			var boxh = imgHeight;
			var boxw = imgWidth;

			// ++++++++++++++++ DEFINE IMAGE POSITION +++++++++++++++++++

			width = leftPos + 50;
			height = horPos +20;
			
			// ++++++++++++++++ RETRIEVE AND CREATE ELEMENTS +++++++++++++
			
			var c = document.body;
			var b =document.body;
			var sx = new Element('div');
			var x = new Element('div');
			//var txt = new Element('div');
			//comment = new Element('div');
			//reloader = new Element('img');
			//img = new Element('img');
			

			// ++++++++++++++++ SET STYLES ++++++++++++++++++++
			x.setStyle('visibility','hidden');
			//txt.setStyle('visibility','hidden');
			//comment.setStyle('visibility','hidden');
			/*
			reloader.setStyle('position','absolute');
			reloader.setStyle('float','right');
			reloader.setStyle('top','-50px');
			reloader.setStyle('left','200px');
			reloader.src="refresh.png";
				*/
			sx.setStyle('position','absolute');
			sx.setStyle('width',boxw);
			sx.setStyle('height',boxh+50);
			sx.setAttribute('id','dragger');
			//sx.setStyle('background','url(/alergy_plus/_css/_gfx/bg.png) top no-repeat');
			
			sx.setStyle('left',width);
			sx.setStyle('top',height);
			
			if (document.documentElement && document.documentElement.clientWidth){
			sx.setStyle('left',0);
			sx.setStyle('top',0);
			}
			
			x.setStyle('position','absolute');
			x.setStyle('width',boxw);
			x.setStyle('height',boxh);
			x.setStyle('color','#FFF');
			x.setStyle('font-size','10px');
			x.setStyle('padding','10px');
			x.setStyle('left',  width + 80);
			x.setStyle('top', height - 200 );
			x.setStyle('z-index','1000');
			x.setAttribute('id','imageover');
			//x.setStyle('background',' transparent url(/allergy_plus/_css/_gfx/bg.png) no-repeat  center center');

			
			
			
			//  +++++++++++++++++ MAKE DRAGGABLE ++++++++++++++++++++
			if(make_draggable == 1){
				sx.makeDraggable();
			}
				
			// +++++++++++++++++ CREATE THUMBNAIL +++++++++++++++++++
			
			if(href.indexOf(".rar") == -1){
					
				var image2 = new Element('img');
				image2.setAttribute('id','thumbnail');
				//image2.src = "http://www.artviper.net/screenshots/screener.php?url=" + href + "&sdx=1024&sdy=768&w=" + imgWidth + "&h=" + imgHeight;
				image2.src = this.href;
				image2.injectInside(x);
			
		//	x.innerHTML = "<img alt='artViper website thumbnail' src='http://www.artviper.net/screenshots/screener.php?url=" + href + 	
		//	"&sdx=1024&sdy=768&w=" + imgWidth + "&h=" + imgHeight + "   />";

			  } else {
			x.innerHTML = '<img alt="rar file" src="rar.jpg" width=' + imgWidth + ' height=' + imgHeight + ' />';
			}
			
			// ++++++++++++++++ SET STYLES +++++++++++++++++++++
/*
			txt.setStyle('position','absolute');
			txt.setStyle('background','#000');
			txt.setStyle('padding','0 10px 0 10px');
			txt.setStyle('width',imgWidth);
			txt.setStyle('height',50);
			txt.setStyle('left',  width + 20);
			txt.setStyle('top', height+ imgHeight + 50 );
			txt.setAttribute('id','imagetext');	
			
			*/
			/*
			comment.setStyle('position','absolute');
			comment.setStyle('float','left');
			comment.setStyle('width',imgWidth-35);
			comment.setStyle('height',50);
			comment.setStyle('color','#FFF');
			comment.setStyle('font-size','10px');
			comment.setStyle('font-family','Arial');
			*/
			var alt = el.getAttribute('title');	

			// +++++++++++++++ CREATE FADING EFFECTS ++++++++++++

			mynewEff =x.effect('opacity',{duration: transparency_delay, transition: Fx.Transitions.linear, wait: false }).start(0,1);
			//mynewEff =txt.effect('opacity',{duration: transparency_delay, transition: Fx.Transitions.linear, wait: false }).start(0,1);
			//mynewEff =comment.effect('opacity',{duration: transparency_delay, transition: Fx.Transitions.linear, wait: false }).start(0,1);
			
			// +++++++++++++++ SET TITLE TAG AS DESCRIPTION +++++++++++
			/*
			if(alt != ""){
				comment.innerHTML = alt + "<br/><a href='http://www.artviper.net' title='artViper thumbnails' style='color:#CCFF00;text-decoration:none'>artViper thumbnails</a>";
			}
			*/
			
			/*mynewEff =img.effect('opacity',{duration: transparency_delay, transition: Fx.Transitions.linear, wait: false }).start(0,1);
			img.src = "close.jpg";
			img.setStyle('float','right');
			img.setStyle('background','#000');
			img.setStyle('visible','hidden');
			img.setStyle('z-index','2000');
			img.setAttribute('alt','close');
			*/
		/*
		el.addEvent('mouseout',function(){
			var remo = $('dragger');
			c.removeChild(remo);
			el.removeEvent('mouseout');
		})
		*/
		/*reloader.addEvent('click',function(){

			x.removeChild($('thumbnail'));
			image2 = new Element('img');
			image2.setAttribute('id','thumbnail');
			//image2.src = "http://www.artviper.net/screenshots/screener.php?url=" + href + "&sdx=1024&sdy=768&w=" + imgWidth + "&h=" + imgHeight + "&forceUpdate=1";
			image2.src = this.href;
			image2.injectInside(x);
		})
		*/

			sx.injectInside(b);
			x.injectInside(sx);
			//reloader.injectInside(x);
			//txt.injectAfter(x);
			//img.injectInside(txt);
			//comment.injectInside(txt);
			
		}
		  }
		

		
		
		el.addEvent('mouseout',function(){
			var c = document.body;							
			var remo = $('dragger');
			if(remo)
			{
			c.removeChild(remo);
			el.removeEvent('mouseover');
			}
			/*var text = $('imagetext');
			c.removeChild(text);
			*/

			//el.removeEvent('mouseover');
			//document.body.removeChild(document.getElementById('dragger'));
			
			
		})
		
		
		return false;

})


		}

		return false;
		})
/* END OF IF REL TAGS = imgExpand */

}
