var xm = 0;
var ym = 0;
var flag=0;

document.onmousemove = function(e){
	if (window.event) e=window.event;
	xm = e.clientX;
	ym = e.clientY;
}

var panel = {
	speed : .001,
	t : 0,
	O : [],
	over : false,

	run : function() {
		panel.t += panel.speed;
		for (var i = 0, o; o = panel.O[i]; i++)
			o.anim(i + panel.t);
	},

	init : function(){
		for (var i = 0, o; o = document.images[i]; i++){

			if (o.className.indexOf('panel') >= 0) {
				if(o.parentNode.href != undefined) {
					var div = document.createElement("a");
					div.href = o.parentNode.href;
				} else {
					var div = document.createElement("div");
				}
				div.className = 'panel';
				var img = document.createElement("img");
				img.src = o.src;
				img.className = 'imgPanel';
				o.parentNode.replaceChild(div,o);
				div.appendChild(img);
				div.ims = img.style;
				div.iw = img.width;
				div.ih = img.height;
				div.cx =0;
				div.cy = -div.ih/2 ;
	
				div.anim = function(t) {
					nw = this.offsetWidth;
					nh = this.offsetHeight;
					if (panel.over == this){
						for (var nx = 0, ny = -800, o = this; o != null; o = o.offsetParent) nx += o.offsetLeft, ny += o.offsetTop;
						var x = Math.max(-this.iw + nw, Math.min(0, (-(xm - nx) * (this.iw - nw)) / nw));
						var y = Math.max(-this.ih + nh, Math.min(0, (-(ym - ny) * (this.ih - nh)) / nh));
						if (Math.abs(xm-nx-nw * .5) > nw || Math.abs(ym-ny-nh * .5) > nw ) panel.over = false;						
						
					} else {
					
						var mx = (this.iw - nw) * .5;
						var my = (this.ih - nh) * .5;

						if(nw <= 1024)
						{
							var x= -200;
							var y = -850;
						}else if(nw <= 1152)
						{
							var x= 0;
							var y = -600;
						}else if(nw <= 1280)
						{
							var x= -200;

							if(ny<=1024)
								var y = -600;
							else 
								var y = -825;


							
						}else if(nw <= 1400)
						{
							var x= 0;
							var y = -710;
						}else if(nw <= 1440)
						{
							
							var x= -200;		
							var y = -725;
						}else if(nw <= 1680)
						{
							var x= -200;
							var y = -600;


						}					
						else if(nw <= 1900)
						{
						
							var x= -0;
							var y = -490;
						}
						else if(nw >= 1200 && nw <= 1300)
						{
							var x= -175;
								var y = -50;
						}
						else
						{
							var x= -200;
							var y = -340;
						}					
				
					}


					this.cx += (x - this.cx) * .1;
					this.cy += (y - this.cy) * .1;
					this.ims.left = Math.round(this.cx) + 'px';
					this.ims.top  = Math.round(this.cy) + 'px';
					var eone;
						
					eone=document.getElementById("spot1");
					eone.style.left = Math.round(this.cx + 980)+ 'px';
								
					e1=document.getElementById("spot2");
					e1.style.left = Math.round(this.cx + 1050)+ 'px';

					e2=document.getElementById("spot3");
					e2.style.left = Math.round(this.cx + 780)+ 'px';


					e3=document.getElementById("spot4");
					e3.style.left = Math.round(this.cx + 390)+ 'px';
								
					e4=document.getElementById("spot5");
					e4.style.left = Math.round(this.cx + 1350)+ 'px';

					e5=document.getElementById("spot6");
					e5.style.left = Math.round(this.cx + 680)+ 'px';

					e6=document.getElementById("spot7");
					e6.style.left = Math.round(this.cx + 580)+ 'px';

					e7=document.getElementById("spot8");
					e7.style.left = Math.round(this.cx + 900)+ 'px';


					
						if(flag==0)
						{
						eone.style.visibility="visible";
						e1.style.visibility="visible";
						e2.style.visibility="visible";
						e3.style.visibility="visible";
						e4.style.visibility="visible";
						e5.style.visibility="visible";
						e6.style.visibility="visible";
						e7.style.visibility="visible";					
						}
					
					var scr_y = screen.height;
					var browser_name = navigator.appName;
					if(flag==0)
					{						
						flag=1;
						//var t_id = setInterval(remove_loading,1000);
					}


					

				}

				div.onmouseover = function()
				{
					panel.over = this;
				}
				this.O.push(div);
			}
		}

		setInterval(panel.run, 32);
	}
}


onload = function ()
{
	panel.init();
	
}// JavaScript Document
 
 
 
 
 
 
 
 



 
 
 
 