
function addLoadEvent(funcName) {
    var oldonload = window.onload;
    if(typeof window.onload != 'function') {
        window.onload = funcName;
    } else {
        window.onload = function() {
            oldonload();
            funcName();
        }
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   imgOver
//
//**************************************************************************************************************
//
//  Example)
//      <img src="/_image/common/ÀÌ¹ÌÁö.jpg" alt="" title="" onmouseover="imgOver(this)" onmouseout="imgOver(this,'out')">
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function imgOver(element,opt) {
    var src = element.getAttribute('src');
    var ftype = src.substring(src.lastIndexOf('.'), src.length);
    
    if (opt == 'out') element.src = element.src.replace("_o"+ftype, ftype);
    else element.src = element.src.replace(ftype, "_o"+ftype);
}


function imgOverGroup(element) {
    var over_group = document.getElementById(element);

    if(!document.getElementsByTagName) return false;
    if(!document.getElementById) return false;
    if(!over_group) return true;

    var imgs = over_group.getElementsByTagName("IMG");
    for(var i=0; i < imgs.length; i++) {
        if (!imgs[i].className){
            imgs[i].onmouseover = function() {
                imgOver(this);
            }
            imgs[i].onmouseout = function() {
                imgOver(this,'out');
            }
        }
    }
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   goFlash
//
//**************************************************************************************************************
//
//  Usage) ÇÃ·¡½Ã ¸µÅ© ÀÚ¹Ù½ºÅ©¸³Æ® ¿¬µ¿
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var flashLink=new Array();
flashLink['logoBtn']="/";
flashLink['mainMenu_00_00']="/content/content.php?cont=company_greeting";
flashLink['mainMenu_00_01']="/content/content.php?cont=company_greeting";
flashLink['mainMenu_00_02']="/content/content.php?cont=company_outline";
flashLink['mainMenu_00_03']="/content/content.php?cont=company_vision";
flashLink['mainMenu_00_04']="/content/content.php?cont=company_history";
flashLink['mainMenu_00_05']="/content/content.php?cont=company_orfanization";
flashLink['mainMenu_00_06']="/content/content.php?cont=company_ci";
flashLink['mainMenu_00_07']="/content/content.php?cont=company_cf";
flashLink['mainMenu_00_08']="/content/content.php?cont=company_map";
flashLink['mainMenu_01_00']="/content/content.php?cont=service_support";
flashLink['mainMenu_01_01']="/content/content.php?cont=service_support";
flashLink['mainMenu_01_02']="/content/content.php?cont=service_architectural_design";
flashLink['mainMenu_01_03']="/content/content.php?cont=service_urban_development";
flashLink['mainMenu_01_04']="/content/content.php?cont=service_construction_supervision";
flashLink['mainMenu_02_00']="/board/?db=project&cate=";
flashLink['mainMenu_02_01']="/board/?db=project&cate=";
flashLink['mainMenu_02_02']="/board/?db=project&temp1=¼­¿ï";
flashLink['mainMenu_02_03']="/board/?db=project&temp2=2010";
flashLink['mainMenu_03_00']="/board/?db=pr_notice";
flashLink['mainMenu_03_01']="/board/?db=pr_notice";
flashLink['mainMenu_03_02']="/board/?db=pr_room";
flashLink['mainMenu_03_03']="/board/?db=pr_award";
flashLink['mainMenu_04_00']="/content/content.php?cont=partner";
flashLink['mainMenu_04_01']="/content/content.php?cont=partner";
flashLink['mainMenu_05_00']="/board/?db=recruit";
flashLink['mainMenu_05_01']="/board/?db=recruit";
flashLink['mainMenu_06_00']="/board/?db=archive";
flashLink['mainMenu_06_01']="/board/?db=archive";
flashLink['btn_allProject']="/board/?db=project&cate=1";
flashLink['btn_log']="/";

function goFlash(n){
	//alert(n);
	if (!flashLink[n]) return;
	else location.href=flashLink[n];
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   setPng24
//
//**************************************************************************************************************
//
//  Usage) IE 7 ÀÌÇÏ¿¡¼­ png24 ÀÇ ¾ËÆÄÃ¤³Î Áö¿ø
//
//  Example)
//      <img src="ÀÌ¹ÌÁö" alt="" title="" class="png24">
//      -  css ÆÄÀÏ¶Ç´Â ¹®¼­³»¿¡ .png24{tmp:expression(setPng24(this));} °¡ ÁöÁ¤µÇÀÖ¾î¾ß »ç¿ë°¡´É
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function setPng24(obj) { 
      var browser = navigator.appName;
      var version = parseFloat(navigator.appVersion.replace (/^.*MSIE ([.0-9]+).*$/,"$1"));

      if(browser.indexOf("Internet Explorer") && version < 7.0 ) { // IE6 ÀÌÇÏ¿¡¼­¸¸ µ¿ÀÛ 2008-03-14 by zardsama
            obj.width=obj.height=1; 
            obj.className=obj.className.replace(/\bpng24\b/i,''); 
            obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
            obj.src='';  
            return ''; 
      }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//  ¢Æ   bookmarksite
//
//**************************************************************************************************************
//
//  Usage) Áñ°ÜÃ£±â
//         -  À§»ç¸ô °ü¸®ÀÚÀÇ ¼îÇÎ¸ô°ü¸® - ´ëÇ¥µµ¸ÞÀÎ ¼³Á¤ - ´ëÇ¥µµ¸ÞÀÎ, 
//            À§»ç¸ô °ü¸®ÀÚÀÇ ¼îÇÎ¸ô°ü¸® - Å¸ÀÌÆ²¸ÞÅ¸°Ë»ö - À¥ºê¶ó¿ìÀú Å¸ÀÌÆ²ÀÌ ³»¿ëÀ¸·Î µé¾î°¨
//
//  Example)
//      <img src="ÀÌ¹ÌÁö°æ·Î" alt="Áñ°ÜÃ£±â" onclick="addBookmark()">
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function addBookmark(url, title) {
    if (!url) var url = root_url;
    if (!title) document.title;

    if (window.sidebar) // firefox
        window.sidebar.addPanel(title, url, ""); 
    /*    
        else if(window.opera && window.print) { // opera 
            var elem = document.createElement('a');
            elem.setAttribute('href',url);
            elem.setAttribute('title',title);
            elem.setAttribute('rel','sidebar');
            elem.click();
        }
    */
    else if(document.all) // IE
        window.external.AddFavorite(url, title);

    else {// for other browsers which does not support
        alert('Your browser does not support this bookmark action');
        return false;
    }
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//	¢Æ R2Slider 1.0
//
//	- 2008-03-20 by zardsama
//
// ************************************************************************************************************
//
// Usage)
//		var º¯¼ö¸í = new R2Slider("·¹ÀÌ¾î ID","º¯¼ö¸í", ¼Óµµ, »ó´Ü¸¶Áø);
//		º¯¼ö¸í.slide();
//
//		- ¼Óµµ, »ó´Ü¸¶ÁøÀº »ý·« °¡´É / ÃßÈÄ º¯°æ °¡´É
//		- 'º¯¼ö¸í.limitTop' È¤Àº 'º¯¼ö¸í.limitBottom' À¸·Î »ó/ÇÏ´Ü ÇÑ°è ÁöÁ¡ ¼³Á¤°¡´É
//
//
//	Example )
//		<div id="scroll" style="position:absolute; width: 100px; height: 400px;"></div>
//		<script type="text/javascript">
//			var test = new R2Slider ("scroll","test",null,null,null);
//			test.limitTop = 100;
//			test.slide();
//		</script>
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

R2Slider = function(id, slider, divPitch, marginTop, dElement) {
	if (isNaN(parseInt(marginTop))) marginTop = 0;	// »ó´Ü ¸¶Áø µðÆúÆ®
	if (isNaN(parseInt(divPitch))) divPitch = 15;	// ÀÌµ¿ °£°Ý µðÆúÆ®
	if (!dElement) dElement = document.documentElement; // DTD strict ÀÏ¶§ ( Transitional ÀÏ¶§´Â document.body )

	this.timer;	// Å¸ÀÌ¸Ó º¯¼ö
	this.slider = slider;	// °´Ã¼ º¯¼ö¸í
	this.obj = document.getElementById (id);	// ¿ÀºêÁ§Æ®
	this.marginTop = parseInt(marginTop);	// »ó´Ü ¸¶Áø
	this.divPitch = parseInt(divPitch);	// ÀÌµ¿ °£°Ý
	this.dElement = dElement; // DTD ¿¡ µû¸¥ µµÅ¥¸ÕÆ® ¿¤¸®¸ÕÆ®
	this.limitTop;	 // »ó´Ü ÇÑ°èÁ¡
	this.limitBottom;	 // ÇÏ´Ü ÇÑ°èÁ¡
}


R2Slider.prototype.moveIt = function(){
	var pitch = (parseInt(this.dElement.scrollTop)+ parseInt(this.marginTop)) - parseInt(this.obj.style.top);

	if (pitch == 0) return;
	else nextPos = parseInt(this.obj.style.top) + pitch / this.divPitch
	nextPos = (pitch > 0) ? Math.ceil(nextPos) : Math.floor(nextPos);

	var limitBottom = this.dElement.scrollHeight - parseInt(this.limitBottom)- parseInt(this.obj.offsetHeight);
	if ( this.limitTop && nextPos  < this.limitTop ) nextPos = this.limitTop;
	if ( this.limitBottom && nextPos  > limitBottom ) nextPos = limitBottom;
	if (nextPos < this.marginTop) nextPos = this.marginTop;
	if (isNaN(nextPos)) nextPos = 0;

	this.obj.style.top = nextPos+"px";
}


R2Slider.prototype.slide = function() {
	this.timer = setInterval(""+this.slider+".moveIt()", 10);
}


function imgresize(obj, limit) {//ÀÌ¹ÌÁö ¸®»çÀÌÂ¡
    var box = document.getElementById(obj);
    var img = box.getElementsByTagName('img');

    for (var i=0;i<img.length;i++) {
        var iSrc = img[i].src;
        
        if (img[i].offsetWidth > limit) {
            img[i].style.width = limit+"px";
            img[i].style.cursor='pointer';
            img[i].onclick = function(){
                window.open(this.src);
            }
        }
    }
}

function pageToLayer(url, obj_name) {
	if(!document.getElementById) return false;
	if(!document.getElementById(obj_name)) return false;
	var layer = document.getElementById (obj_name);
	//if (layer.innerHTML) getHttpRequest('/content/content.php?cont=blank&mode=1');
	var getDetail = getHttpRequest(url);

	layer.innerHTML = getDetail;
	//layer.style.top = (document.body.scrollTop + 20)+"px";
	layer.style.display = "block";
}

function imgView(url) {
    openWin = window.open('/content/content.php?cont=img&mode=1&file='+url, 'imgView', 'left=0, top=0, width=575, height=400, scrollbars=no');
    openWin.focus();
	return openWin;
}

addLoadEvent(function() {imgOverGroup('navigation');});

