// FONT SIZE CHANGE ######################################

var Default = 1;
var tags    = new Array('alpha');
var sizing  = new Array('80%','100%','125%');
function FontChange(target,tarF) {
  if (!document.getElementById) return
  var dore = document,tarS = null,fontSize = Default,value,su,cTags;fontSize = tarF;
  Default = fontSize;
  if (!(tarS = dore.getElementById(target))) tarS = dore.getElementsByTagName(target)[0];
  tarS.style.fontSize = sizing[fontSize];
  for (value = 0 ; value < tags.length ; value++) {
    cTags = tarS.getElementsByTagName(tags[value]);
    for (su = 0 ; su < cTags.length ; su++) cTags[su].style.fontSize = sizing[fontSize];
  }
}


// ROLLOVER IMAGES ######################################

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// OPEN WINDOW ######################################

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.subwin = window.open(theURL,winName,features);
  subwin.focus();
}


// SCROLL BOX ######################################

var moveBox = function(){this.initialize.apply(this,arguments);}

moveBox.prototype={
	obj:null,idName:null,speed:500,Interval:500,Duration:30,offsetTop:0,marginTop:0,marginBottom:0,timer:0,bkup_position:null,
    initialize:function(){
        this.obj = document.getElementById(arguments[0]);
        this.bkup_position = this.obj.style.position;
        this.obj.style.position= "absolute";
		this.offsetTop = this.obj.offsetTop;
        this.idName= arguments[0];
        if(window.addEventListener){
            window.addEventListener('scroll',this.bind(this.scrollEvent,arguments),false);
        }else if(window.attachEvent){
            window.attachEvent('onscroll',this.bind(this.scrollEvent,arguments),false);
        }
    },
    bind:function(method,arg){
        var _this=this;var _arg=(arg)?arg:[];return function(){
        method.apply(_this,_arg);
        }
    },
    scrollEvent:function(){
        var _this=this;
        var obj = _this.obj;
        var scrollTop  = document.body.scrollTop || document.documentElement.scrollTop;
        var objY;
        var y=obj.offsetTop;
        var round = Math.round;
        var speed= this.speed/1000;
        var duration=this.Duration/100;
        var h;
        //var h = scrollTop + _this.offsetTop;
        if (scrollTop  + this.marginTop>= _this.offsetTop){
        //     h = scrollTop;
             h = scrollTop + this.marginTop;
        }else{
             h = this.offsetTop;
        }
        clearInterval(_this.timer);
        _this.timer= setInterval(function(){
            y += (h - y) * speed * duration;
            if(round(y) != h){
                obj.style.top= y  + "px";
            }else{
                clearInterval(_this.timer);
                //obj.style.position = _this.bkup_position;
            }
        },1);
    }
}

