/*
$(document).ready(function() {
    var bodyHeight = $('body').height() - 64;
    var contentHeight = $('#contents').height() + 60;

    if (contentHeight <= bodyHeight) {
        $('#lnb object').each(function() {

            this.height = bodyHeight;
        });
        $('#lnb embed').each(function() {
            this.height = bodyHeight;
        });
    } else {
        $('#lnb object').each(function() {
            this.height = contentHeight;
        });
        $('#lnb embed').each(function() {
            this.height = contentHeight;
        });
    }
});
*/
function lngBG()
{
var bodyHeight = $('body').height() - 64;
    var contentHeight = $('#contents').height() + 60;

    if (contentHeight <= bodyHeight) {
        $('#lnb object').each(function() {

            this.height = bodyHeight;
        });
        $('#lnb embed').each(function() {
            this.height = bodyHeight;
        });
    } else {
        $('#lnb object').each(function() {
            this.height = contentHeight;
        });
        $('#lnb embed').each(function() {
            this.height = contentHeight;
        });
    }
}

// 백그라운 위치 정렬
window.onload = function() {
	var browser = {
		a : navigator.userAgent.toLowerCase()
	}

	browser = {
		ie8 : browser.a.indexOf('msie 8') != -1,
		firefox : browser.a.indexOf('firefox') != -1
	}

	if(browser.ie8) {
		if(document.getElementById('mainWrap')) {
			document.getElementById("container").style.marginLeft = -1 + "px";
			document.getElementById("footer").style.marginLeft = -1 + "px";
		}
	} else if(browser.firefox) {
		document.getElementById("container").style.marginLeft = -1 + "px";
		document.getElementById("footer").style.marginLeft = -1 + "px";
	}
}

// 백그라운드 이미지 로딩
try {document.exeCommand('BackgroundImageCashe', false, true);} catch (e) {}

// png 파일 투명 처리
function setPng24(obj) {
    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 '';
}

// 이미지 오버
function imageOver(imgs) {
	imgs.src = imgs.src.replace("off.gif", "on.gif");
}
function imageOut(imgs) {
	imgs.src = imgs.src.replace("on.gif", "off.gif");
}

// 플래시
function flashString(mID, mUrl, mWidth, mHeight, mParams, mBGcolor, mWmode) {
	var buff = [];
	buff.push("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='" + mWidth + "' height='" + mHeight + "' id='" + mID + "' align='middle'>");
	buff.push("<param name='allowScriptAccess' value='sameDomain' />");
	buff.push("<param name='allowFullScreen' value='true' />");
	buff.push("<param name='movie' value='" + mUrl + "' />");
	buff.push("<param name='FlashVars' value='" + mParams + "' />");
	buff.push("<param name='quality' value='high' />");
	buff.push("<param name='wmode' value='" + mWmode + "' />");
	buff.push("<param name='bgcolor' value='" + mBGcolor + "' />");
	buff.push("<embed src='" + mUrl + "' FlashVars='" + mParams + "' quality='high' wmode='" + mWmode + "' bgcolor='" + mBGcolor + "' width='" + mWidth + "' height='" + mHeight + "' name='" + mID + "' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	buff.push("</object>");

	return buff.join("");
}

function flashObject(mID, mUrl, mWidth, mHeight, mParam, mBGcolor, mWmode) {
	document.write(flashString(mID, mUrl, mWidth, mHeight, mParam, mBGcolor, mWmode));
}

//메인 전체뉴스
$(document).ready(function() {
	if (!$('.allArticle')) return false;

	$('.allArticleBtn').find('img').click(function() {
		var bt = this;
		$('.allArticle').slideToggle('slow', function() {
			if(bt.className == '') {
				bt.src = bt.src.replace("off.gif", "on.gif");
				$(bt).addClass('on');
			} else {
				bt.src = bt.src.replace("on.gif", "off.gif");
				$(bt).removeClass('on');
			}
		});
	});
});


//계열사 소개 플래시
function make_flash(url, id, width, height, wmode, flashvars, allowfullscreen)
{
	var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
	var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
	var isFF = (navigator.userAgent.indexOf("Firefox") != -1) ? true : false;

	var str="";
	for(prop in flashvars )
	{
		var arg = flashvars[prop];
		str=str+"&"+prop+"="+arg;
	}

   if(isIE && isWin && !isOpera)
   {
		var obj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="' + width +'" height="' + height +'" id="' + id +'" align="middle">';
		obj += '<param name="allowScriptAccess" value="sameDomain">';
		obj += '<param name="quality" value="high">';
		obj += '<param name="src" value="' + url + '">';
		obj += '<param name="wmode" value="' + wmode + '">';
		obj += '<param name="flashvars" value="' + str + '">';
		obj += '<param name="allowFullScreen" value="' + allowfullscreen + '">';
		obj += '</object>';
   } else
   {
		obj = '<embed src="' + url + '" quality="high"  width="' + width +'" height="' + height +'" name="' + id +'" flashvars="'+str+'" align="middle" allowScriptAccess="sameDomain" allowFullScreen="' + allowfullscreen + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="' + wmode + '">';
   }
   document.write(obj);
}
function menuOver(){
	//document.getElementById('affiliatesinfo').style.height = '230px';
}

function menuOut(){
	//document.getElementById('affiliatesinfo').style.height = '195px';
}
