/* Drubbiebuu common JavaScripts */
/* Ver1.01                         */

//Browser Version Check function
//IE NN6 NN4
var fIE = false;
var fIE5 = false;
var fNN4 = false;
var fNN6 = false;
var bCode = 0;
function getBVer(){
  if(document.all){fIE = true; bCode = 1;}
    if(document.getElementById){
    if(fIE){
      fIE5 = true;
    }
    else{
      fNN6 = true; bCode = 2;
    }
  }
  if(document.layers){fNN4 = true; bCode = 3;}
}
//Auto Browser Version Check
//IE4 NN6
getBVer();



//Browser Language Check
//IE NN6 NN4
FoceEnglish = false;
function getBLang(){
  if(fIE){
    return navigator.browserLanguage;
  }else{
    if(fNN4 || fNN6)
    {
      return navigator.language;
    }else{
      return "";
    }
  }
}
lang = getBLang();
langJa = ((lang.indexOf("ja") != -1) || (lang == "undefined") || (lang == "")) && (FoceEnglish != true);


//Get Style Object
//IE NN4 NN6
function getStyleObject(id_){
  var styleObj = null;
  if(bCode != 0){
    if(fIE){
      styleObj = document.all(id_).style;
    }else{
      if(fNN6){
        styleObj = document.getElementById(id_).style;
      }else{
        if(fNN4){
          styleObj = document.layers[id_];
        }
      }
    }
  }
  return styleObj;
}


//Get ViewSize and Scroll Pos
//IE NN6 NN4
var winW = 0;
var winH = 0;
var scrlX = 0;
var scrlY = 0;
function getWindowSize(){
  if(fIE){
    with(document.body){
      scrlX = scrollLeft;
      scrlY = scrollTop;
      winW = clientWidth;
      winH = clientHeight;
    }
  }else{
    if(fNN4 || fNN6){
      with(window){
        scrlX = pageXOffset;
        scrlY = pageYOffset;
        winW = innerWidth;
        winH = innerHeight;
      }
    }
  }
}

//Window Size Chenge
//IE NN6
function resizeWin(widthPx,heightPx,oj){
  if(fIE || fNN6){
    var nw=navigator.userAgent.indexOf("Win");
    if(nw!=-1){widthPx+=5;heightPx+=24}
  }
  if(!oj){oj=self}
  oj.resizeTo(widthPx, heightPx);
}


//Image Object Chenge
//IE NN6 NN4
function SsS(id_, name_){
  var obj = document;
  if(fNN4){
    if(!document.images[id_]){
      var s='';
      for(var i = 0; i < document.layers.length; i++){
        if(document.layers[i].document.images[id_]){
          break;
        }
      }
      obj = document.layers[i].document;
    }
  }
  if (document.images)
  {
    obj.images[id_].src = eval(name_+".src");
  }
}

//Replace InnerHTML
//IE NN6  NN4(absolute target only)
function writeInnerHTML(id_, s_){
  if(fNN6){
    with(document.getElementById(id_)){
      while(hasChildNodes()) removeChild(lastChild);
    }
    var range = document.createRange();
    range.selectNodeContents(document.getElementById(id_));
    range.collapse(true);
    var cf = range.createContextualFragment(s_);
    document.getElementById(id_).appendChild(cf);
  }
  if(fNN4){
    with(document.layers[id_].document){
      open('text/html','replace');
      write(s_);
      close();
    }
  }
  if(fIE){
    document.all(id_).innerHTML = s_;
  }
}

//Get Style Object Width
//IE NN4  NN6
function getStylWidth(id_){
  if(fIE) return fIE5?document.all(id_).offsetWidth:document.all(id_).style.pixelWidth;
  if(fNN6){
    var a = document.getElementById(id_).style.width;
    if(a != ''){return parseInt(a)}
    else{return 0;}
  }
  if(fNN4) return document.layers[id_].clip.width;
  return 0;
}

//Get Style Object Height
//IE NN4  NN6
function getStylHeight(id_){
  if(fIE) return fIE5?document.all(id_).offsetHeight:document.all(id_).style.pixelHeight;
  if(fNN6){
    var a = document.getElementById(id_).style.height;
    if(a != ''){return parseInt(a)}
    else{return 0;}
  }
  if(fNN4) return document.layers[id_].clip.height;
  return 0;
}

//Get Style Object Left
//IE NN6 NN4
function getStylLeft(id_){
  if(fIE) return fIE5?document.all(id_).offsetLeft:document.all(id_).style.pixelLeft;
  if(fNN6) return parseInt(document.getElementById(id_).style.left);
  if(fNN4) return document.layers[id_].clip.left;
  return 0;
}

//Get Style Object Top
//IE NN6 NN4
function getStylTop(id_){
  if(fIE) return fIE5?document.all(id_).offsetTop:document.all(id_).style.pixelTop;
  if(fNN6) return parseInt(document.getElementById(id_).style.top);
  if(fNN4) return document.layers[id_].top;
  return 0;
}

//Style Object Centering
//IE NN4  NN6
function centeringStyl(id_, adjustX_, adjuctY_, minLinitX_, minLinitY_){
  getWindowSize();
  var x_ = (winW -adjustX_) /2 -getStylWidth(id_) /2 +adjustX_;
  var y_ = (winH -adjuctY_) /2 -getStylHeight(id_) /2 +adjuctY_;
  if(x_ < minLinitX_){x_ = minLinitX_}
  if(y_ < minLinitY_){y_ = minLinitY_}
  chrPSet(id_, x_, y_, 'visible');
}

//Set StyleBackgroundImage Position from Style Position
//IE
function SetBGPositionFromStylPos(fromid_, id_, adjustX_, adjustY_){
  if(bCode != 0){
    var styleObj = null;
    if(fIE){
      styleObj = document.all(id_).style.backgroundPosition = (-getStylLeft(fromid_) +adjustX_) +' ' +(-getStylTop(fromid_) +adjustY_);
    }else{
      if(fNN6){
        //document.getElementById(id_).style.backgroundPosition = '0 0';
      }
    }
  }
}

//Get Frame Object
function checkFrameExist(freamName_){
  var frmObj = null;
  for(i = 0; i < top.frames.length; i++){
    if(top.frames[i].name == freamName_){
      frmObj = top.frames[i];
      break;
    }
  }
  return frmObj;
}

//Set Body BackGroundImage
//IE NN6
function SetBodyBGImage(imageURL_){
  if(fIE || fNN6){
    document.body.style.backgroundImage = 'url(' +imageURL_ +')';
  }
}

//Set Style BackGroundImage
//IE NN6 NN4
function SetStyleBGImage(id_, imageURL_){
  var styleObj = getStyleObject(id_);
  if(fIE || fNN6){
    styleObj.backgroundImage = 'url(' +imageURL_ +')';
  }else{
    if(fNN4) styleObj.background.src = imageURL_;
  }
}


//Cliper Size and Position Set
//IE NN4
function setCliper(id_, clipLeft_, clipTop_, clipRight_, clipBottom_, x_, y_){
  var styleObj = getStyleObject(id_);
  if(styleObj){
    with(styleObj){
      if(fIE){
        left = x_; top = y_;
        clip='rect(' +clipTop_ +',' +clipRight_ +',' +clipBottom_ +',' +clipLeft_ +')';
      }else{
        if(fNN6){
          left = x_; top = y_;
          clip='rect('+clipTop_+','+(getStylWidth(id_) -clipRight_)+','+(getStylHeight(id_) -clipBottom_)+','+clipLeft_+')';
        }else{
          if(fNN4){
            left = x_; top = y_;
            with(clip){
              top=clipTop_;right=clipRight_;bottom=clipBottom_;left=clipLeft_;
            }
          }
        }
      }
    }
  }
}


//Visible function
//IE NN6 NN4
function chrVSet(id_, chrVisibile){
  var styleObj = getStyleObject(id_);
  if(styleObj){
    styleObj.visibility = chrVisibile;
  }
}

//Position and Visible function
//IE NN6 NN4
function chrPSet(id_, x_, y_, chrVisibile){
  var styleObj = getStyleObject(id_);
  if(styleObj){
    styleObj.left = x_; styleObj.top = y_; styleObj.visibility = chrVisibile;
  }
}

//Object auto inherite
//IE NN
//ex
//new person2(x, y, c);
//autoInherit(person2, person1);
function autoInherit(subClass, superClass){
  for(var prop in superClass.prototype){
    subClass.prototype[prop] = superClass.prototype[prop];
  }
}
function click() {
if (event.button==2) {
alert('All rights by Drubbiebuu Webdesign')
}
}
document.onmousedown=click

