/****

    Is extra css necessary?

    ex. __getScreenSize().x<=960 or __getScreenSize().y<=700
       x: width of window. / y: height of window.

****/
var isIE = (navigator.appName.toLowerCase().indexOf('internet explorer')+1?1:0);
var isOpera = (navigator.userAgent.toLowerCase().indexOf('opera')+1?1:0);
if (isOpera) isIE = false;
var isSafari = (navigator.appVersion.toLowerCase().indexOf('safari')+1?1:0);

function __getScreenSize() {
    var obj = new Object();
    if (!isSafari && !isOpera) {
        obj.x = document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth;
        obj.y = document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight;
    } else {
        obj.x = window.innerWidth;
        obj.y = window.innerHeight;
    }
    obj.mx = parseInt((obj.x)/2);
    obj.my = parseInt((obj.y)/2);
    return obj;
}

function setAdjust(strPath) {
    if( __getScreenSize().x<=960 || __getScreenSize().y<=700 ){
        document.write('<link href="'+ strPath +'css/bs_ex.css" rel="stylesheet" type="text/css" media="all" \/>');
    }
}


/****

    change footer height.

    ex. __getScreenSize().y>723 -> changeSize
       y: height of window.

****/
window.onload=function(){
    __setFooterAdjust();
}
window.onresize=function(){
    __setFooterAdjust();
}
function __setFooterAdjust() {
    var dy;
    if(__getScreenSize().y>700){
	dy = __getScreenSize().y - 700;
        __changeSize(dy,'footer');
    }
}
function __changeSize(dy,divID) {
  if(document.getElementById){
    document.getElementById(divID).style.height = dy+'px';
  }else if(document.all) {
    document.all[divID].style.pixelHeight =  dy+'px';
  }
}


/****

    menu

****/
function changeMapImage(imgPath) {
  document.getElementById('map').src = imgPath;
}
function menuImage(idName, imgPath) {
  document.getElementById(idName).src = imgPath;
}

/****

    for iPhone / iPad  Style

****/
function setExStyle(strAtt) {
    if(strAtt==null || strAtt==''){
        strAtt='../';
    }
    if( navigator.userAgent.indexOf('iPhone')!= -1 || navigator.userAgent.indexOf('iPad')!= -1 || navigator.userAgent.indexOf('iPod')!= -1 ){
        document.write('<link href="'+ strAtt +'css/ex_ios.css" rel="stylesheet" type="text/css" media="all" \/>');
    }
}
function getExStyle(strAtt) {
    if(strAtt==null || strAtt==''){
        strAtt='../';
    }
    if( navigator.userAgent.indexOf('iPhone')!= -1 || navigator.userAgent.indexOf('iPad')!= -1 || navigator.userAgent.indexOf('iPod')!= -1 ){
        document.write('<link href="'+ strAtt +'css/ex_ios.css" rel="stylesheet" type="text/css" media="all" \/>');
    }
}

