﻿// JavaScript Document
var LOADING = false;
var docEl = (
                 typeof document.compatMode != "undefined" && 
                 document.compatMode        != "BackCompat"
                )? "documentElement" : "body";
var navi = "";
var Bpic = new Array();
function get_colB(col){
	document.getElementById('Im_width').style.borderColor = col;
	document.getElementById('Im_height').style.borderColor = col;
	}
	
function get_colT(col){
	document.getElementById('Im').style.color = col;
	}
	
var c = 0; 
var drnew = true;
var dr2top = 0;	
var no =false;
var noC =false;
var on = false;
var Py    =  0;
var Px    =  0;
var rel_pos = "";
var tx_pos = 0;
var arrow="";

function get_scroll(th){
	var scB = document.getElementById('scrolline');
	var scB_h = scB.offsetHeight;
	var tx = document.getElementById('sw_text');
	var tx_h = tx.offsetHeight;
	var dr = document.getElementById('droper');
	var dr_y = dr.offsetTop;
	var ar_t = document.getElementById('arrow_t');
	var ar_tH = dr.offsetTop;	
	var ar_b = document.getElementById('arrow_b');
	var ar_bH = dr.offsetTop;	
	var bgcol = document.body.bgColor;
	ar_b.onmousedown = function(e){
		push_SC(this,'+');
	}
	ar_t.onmousedown = function(e){
		push_SC(this,'-');
	}
	if(document.layers){
		document.captureEvents(Event.MOUSEMOVE);
		document.captureEvents(Event.MOUSEDOWN);
	}
	dr.onmousedown = function(e){
		var pos    =  e? e.pageY : window.event.y;
		no =true;
		noC =true;
		if(drnew==true){dr2top = pos-c;drnew=false;
		
	}	

	scB.onmousemove = function(e){
		dr.focus();
		onmouseup = function(){noC = false;no=false;}
		scB.onmouseup = function(){noC = false;no=false;}
		th.onmouseup = function(){noC = false;no=false;}
		dr.onmouseup = function(){noC = false;no=false;c = rel_pos}	
		
		var yy    =  e? e.pageY : window.event.y;	
		rel_pos = (yy-(dr2top));
		if(rel_pos>scB_h-dr.offsetHeight||rel_pos<0){
			no = false;
		}else{
			if(noC==true){
				no = true;
				}else{
				no = false;
			}
		}
		if(no==true){
			dr.style.backgroundColor = '#600';
			dr.style.top = rel_pos+"px";
			c= rel_pos;
			slide(rel_pos,((tx_h-200)/scB_h),tx_h,tx);tx_pos = 	rel_pos;
		}else{
			dr.style.backgroundColor = bgcol;
		}
	}
	}
}  

function push_SC(aa,ar){
	arrow=ar;
	var int = setInterval(go_s,20);
	aa.onmouseout = function(){
		clearInterval(int);
	}
	aa.onmouseup = function(){
			clearInterval(int);
	}
	onmouseup = function(){
		clearInterval(int);
	}	
}

function go_s(){
	var hei = document.getElementById('scrolline').offsetHeight;
	var drop = document.getElementById('droper');
	var txcon = document.getElementById('sw_text');
	var con_hei = txcon.offsetHeight;
	var jumps = 3;
	if(c<hei-drop.offsetHeight&&c>0){
		if(arrow=='+')c = c+jumps;
		if(arrow=='-')c = c-jumps;
		drop.style.top = c+"px";	
	}else{
		if(c<=0)c = (c+jumps);
		if(c>=hei-drop.offsetHeight)c = (c-jumps);
		drop.style.top = c+"px";
	}	
	slide(c,((con_hei-200)/hei),con_hei,txcon);	
}

function slide(po,j,h,ob){
	ob.style.top = -(po*(j))+"px";	
	}


function blendcenter(nw,cen,inw,inv){
	
	if(inv=='true')document.images['loader'].src = Droot+'bin/layout/C_M/load/load.png';
	navi = navigator.userAgent;
	init_MOUSE();
	
	if(nw==0&&inv!='true'){
		cen=document.body;
		
		go_blend(cen);
		
		for(var i=0;i<document.images.length;i++){
			document.images[i].style.MozOpacity = 1;
			document.images[i].style.opacity = 1;
			document.images[i].style.filter = "alpha(opacity: 100)";
		}
	}else{
		pics=document.images;
	
		for(var i=0;i<pics.length;i++){
			var cd = pics[i].src;
			if(cd.search(inw)>0&&cd.search('IMG_TEXT')==-1||cd.search('screens')>0){
				go_blend(pics[i]);
				
			}
		}
	}
if(typeof(window.init_BIG) == "function")init_BIG();
}

function go_blend(ob,hu){
	var k = 0;
	var vg = 0;
	if(hu==true)vg==1;
	var b = (vg*100);
	ob.style.MozOpacity = vg;
	ob.style.opacity = vg;
	ob.style.filter = "alpha(opacity: "+b+")";
	if(int1)clearInterval(int1);
	var int1 = setInterval(blende,10);
	
	function blende(){
		if(ob.complete==true||ob.src==undefined){
			if(hu==true){
				k--;
				b=100+k*2;
				ob.style.filter = "alpha(opacity: "+b+")";						
				ob.style.MozOpacity = b/100;
				ob.style.opacity = b/100;
			}else{
				b = k++;
				ob.style.filter = "alpha(opacity: "+(b*2)+")";						
				ob.style.MozOpacity = b/40;
				ob.style.opacity = b/40;
			}
			if(hu==true&&b<=0){
				ob.style.display = 'none';
				clearInterval(int1);
			}else if(k==100){
				clearInterval(int1);
			}
		}
	}
	return;
	
}

var writ = true;
var IH = '';
function get_info(thp,inf,picT){
		var in2 = setInterval(wait,100);
		var height_P = 200;
		var q  = 0;
		var ppp = '';
		if(picT)ppp = '<div style=\"margin-bottom:15px;height:'+height_P+'px;\"><img style=\"background:#fff;filter:Alpha(opacity=100);moz-opacity:1;opacity:1\" src=\"'+picT+'&amp;height='+height_P+'\" alt=\"\" /></div>';
		var ind = document.createElement('div');
		function wait(){
			q++;
			if(q==10){
				clearInterval(in2);
				q=0;
				go_inf();
			}
		}
		function go_inf(){
			if(writ==true){
				
				document.body.appendChild(ind);
				ind.setAttribute('id','cm_info');
				ind.setAttribute('style','position:absolute;left:'+(Px+20)+'px;top:'+(Py-20)+'px;filter:Alpha(opacity=0);moz-opacity:0;opacity:0');
				ind.setAttribute('id','cm_info');
				ind.innerHTML = ppp+inf.replace(" ","&nbsp;");
				
				writ=false;
				var int3 = setInterval(blenIN,10);
				var a = 0;	
				var hab = -(window.innerHeight-(ind.offsetHeight+ind.offsetTop));
				if(hab>0)ind.style.top = ind.offsetTop-hab+'px';
			}
			function blenIN(){
				a++;
				var f = a/30;
				ind.style.MozOpacity = f;
				ind.style.opacity = f;
				ind.style.filter = "alpha(opacity: "+(f*100)+")";						
				ind.style.MozOpacity = f;
				ind.style.opacity = f;
				if(f>=1)clearInterval(int3);
			}
			
		}
		thp.onmouseout = function(){
				if(writ==false)document.body.removeChild(ind);
				writ=true;
				clearInterval(in2);
		}
}

function init_MOUSE(){
	if(document.layers)document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = function(e){
		Py    =  e? e.pageY : window.event.y;
		Px    =  e? e.pageX : window.event.x;
		}
}

function mousewheel( event ) {
  var delta = 0;
  if ( !event )
    event = window.event;
  if ( event.wheelDelta ) { 
    delta = event.wheelDelta / 120;
    if ( window.opera ) 
      delta = -delta;
  } else if ( event.detail ) { 
    delta = -event.detail / 3;
  }
  if ( delta ) get_wheel(delta);
  if ( event.preventDefault )
    event.preventDefault();
  event.returnValue = false;
}

function get_wheel( delta ){
	if (window.addEventListener)window.addEventListener('DOMMouseScroll', mousewheel, false);
	window.onmousewheel = document.onmousewheel = mousewheel;
	if(delta==1)arrow = '-';
	if(delta==-1)arrow = '+';
	if(delta==-1||delta==1)go_s(delta);
	document.getElementById('sw_text').onmouseout = function(){
			window.removeEventListener('DOMMouseScroll', mousewheel, false);
		}
	}

