//alert('eds_eye.js');
function fnZoomBar(){}

fnZoomBar.prototype.Init=function(){
	this.zoomBar = $('EzoomBar');    
	this.zoomBarSign = $('MapSilder');
	//fnCreateEyeRoller();
	$('Change2D3D').onclick=this.C23D.bindAsEventListener(this);	
	$('EzoomMax').onclick=this.ZoomMax.bindAsEventListener(this);
	$('EzoomMin').onclick=this.ZoomMin.bindAsEventListener(this);
	$('Ezoom0').onclick=this.zoomBar_click.bindAsEventListener(this);
	$('Ezoom1').onclick=this.zoomBar_click.bindAsEventListener(this);
	$('Ezoom2').onclick=this.zoomBar_click.bindAsEventListener(this);
	$('Ezoom3').onclick=this.zoomBar_click.bindAsEventListener(this);
	$('EyeMapEx').onclick=this.EyeMapEx.bindAsEventListener(this);
	$('EyeHid').onclick=this.EyeHid.bindAsEventListener(this);
	this.zoomBar.onmousedown = this.zoomBar_mousedown.bindAsEventListener(this);
	this.zoomBar.onmousemove = this.zoomBar_mousemove.bindAsEventListener(this);
	this.zoomBar.onmouseup = this.zoomBar_mouseup.bindAsEventListener(this);
	this.ZoomBarSignPos(vM.Zoom());
}

fnZoomBar.prototype.C23D=function(){
	$('Change2D3D').className = vM.Switch23D() ? "Change2D" : "Change3D";
}

fnZoomBar.prototype.ZoomMax=function(){
	var z=vM.Zoom();
	if(z-1>=0){
		vM.FlatZoom(0);
		this.ZoomBarSignPos(0);
	}
}

fnZoomBar.prototype.ZoomMin=function(){
	var z=vM.Zoom();
	if(z+1<=3){
		vM.FlatZoom(3);
		this.ZoomBarSignPos(3);
	}
}

fnZoomBar.prototype.zoomBar_click=function(e){
	var src = e.srcElement ? e.srcElement : e.target;
	var z=src.id.replace('Ezoom','');
	if (z < 0 || z > 3) return ;
	vM.FlatZoom(z);
	this.ZoomBarSignPos(z);
}

fnZoomBar.prototype.zoomBar_mousedown=function(evt){
	var src = evt.srcElement ? evt.srcElement : evt.target;
	this.ocx = evt.clientX;
	this.ocy = evt.clientY;
	if (src.id == 'MapSilder'){
		this.zoomFlag = true;
		this.bmy = this.ocy - this.zoomBarSign.offsetTop;
		this.bmTop = this.zoomBarSign.offsetTop;
	}
}
fnZoomBar.prototype.zoomBar_mousemove=function(evt){
	var ex = evt.clientX;
	var ey = evt.clientY;
	if (this.zoomFlag){
		this.zoomBarSign.style.top = (ey - this.bmy) + 'px';
		if (this.zoomBarSign.offsetTop < 50)this.zoomBarSign.style.top = '50px';
		if (this.zoomBarSign.offsetTop > 113)this.zoomBarSign.style.top = '113px';
		var zz = Math.pow(2,  - (this.zoomBarSign.offsetTop - this.bmTop) /18).toFixed(3);
	}
}
fnZoomBar.prototype.zoomBar_mouseup=function(evt){
	var src = evt.srcElement ? evt.srcElement : evt.target;
	if (this.zoomFlag){
		this.zoomFlag = false;
		var z = Math.round((this.zoomBarSign.offsetTop - 50) / 21);
		vM.FlatZoom(z);
		this.ZoomBarSignPos(z);
		return false;
	}
}

fnZoomBar.prototype.ZoomBarSignPos=function(z){    
  this.zoomBarSign.style.top = (50+21 * z) + 'px';
}

fnZoomBar.prototype.EyeMapEx=function(){
    if($('EyeMapEx').className=='EyeExpand'){
		$('Eye').style.left = ($('Eye').offsetLeft - 308) + 'px';
		$('eyeEdushiMap').style.width = '498px'; $('eyeEdushiMap').style.height = '380px';
		$("eyeLeftBorder").className = 'eyeLeftBorder_Long';
		$("EyeHid").style.top = "195px";
        vMe.MapWidth(498); vMe.MapHeight(380); vMe.Show();
        $('eyeDirection').style.left = '466px';
        $('EyeMapEx').className = "EyeUnExpand";
    }else{
		$('eyeEdushiMap').style.width = '190px'; $('eyeEdushiMap').style.height = '145px';
		$('Eye').style.left = ($('Eye').offsetLeft + 308) + 'px';
		$("EyeHid").style.top = "77px";
		$("eyeLeftBorder").className = 'eyeLeftBorder_Lower';
        vMe.MapWidth(190); vMe.MapHeight(145); vMe.Show();
        $('eyeDirection').style.left = '158px';
        $('EyeMapEx').className = "EyeExpand";
    }   
}

fnZoomBar.prototype.EyeHid = function() {
	if($('EyeHid').className=='EyeHid'){
		if($('EyeMapEx').className=='EyeUnExpand') this.EyeMapEx();
		$('eyeEdushiMap').style.width = "0px";
		$('Eye').style.left = ($('Eye').offsetLeft + 190) + 'px';
		vMe.MapWidth(0); vMe.Show();
		$('EyeMapEx').style.display = 'none';
		$('eyeDirection').style.display = 'none';
		$('EyeHid').className='EyeShow'
	}else {
		$('Eye').style.left = ($('Eye').offsetLeft - 190) + 'px';
		$('eyeEdushiMap').style.width = "190px";
		vMe.MapWidth(190); vMe.Show();
		$('EyeMapEx').style.display = '';
		$('eyeDirection').style.display = '';
		$('EyeHid').className='EyeHid'
	}
}
