// JavaScript Document
function replaceAll(str, searchStr, replaceStr) {
	while (str.indexOf(searchStr) != -1) {
		str = str.replace(searchStr, replaceStr);
	}
	return str;
}

function toggleDivDisplay(obj) {
	if (obj.style.display == 'none') {
		showDiv(obj);
	}
	else {
		hideDiv(obj);
	}
}

function hideDiv(obj) {
	obj.style.display = 'none';
}

function showDiv(obj) {
	obj.style.display = 'block';
}

var motionValue = 0;
var motionStepValue = 0;
var motionObj = null;
var presetStepValue = 0;
function showMotionDiv(obj, motionType, startValue, endValue, stepValue) {
	var functionString = '';
	motionStepValue = (endValue - startValue) / stepValue;
	motionObj = obj;
	presetStepValue = stepValue;

	motionValue = 1;

	if (motionType == 'VUD') {
		motionObj.style.pixelHeight = startValue;
		motionObj.style.display = 'block';
		functionString = 'executeVerticalUDMotionDiv';
	}
	else if (motionType == 'VDU') {
		motionObj.style.pixelHeight = endValue;
		motionObj.style.display = 'block';
		functionString = 'executeVerticalDUMotionDiv';
	}
	else if (motionType == 'HLR') {
		motionObj.style.pixelHeight = startValue;
		motionObj.style.display = 'block';
		functionString = 'executeHorizonLRMotionDiv';
	}
	else if (motionType == 'HRL') {
		motionObj.style.pixelHeight = endValue;
		motionObj.style.display = 'block';
		functionString = 'executeHorizonRLMotionDiv';
	}

	eval(functionString + '()');

}

function executeVerticalUDMotionDiv() {
	//alert('test1:' + motionObj.style.pixelHeight + ' / ' + motionValue + ' / ' + motionStepValue);
	motionObj.style.pixelHeight += motionStepValue;
	++motionValue;

	if (motionValue < presetStepValue) {
		setTimeout('executeVerticalUDMotionDiv()', 10);
	}
	else if (motionValue + 1 >= presetStepValue) {
		motionObj.style.pixelHeight = motionObj.scrollHeight;
	}
	else {
		motionObj.style.display = 'block';
	}
}

function executeVerticalDUMotionDiv() {
	//alert('test2:' + motionValue + ' / ' + motionStepValue);
	motionObj.style.pixelHeight -= motionStepValue;
	++motionValue;

	if (motionValue <= presetStepValue) {
		setTimeout('executeVerticalDUMotionDiv()', 10);
	}
	else {
		motionObj.style.display = 'none';
	}
}

function executeHorizonLRMotionDiv() {
	//alert('test3:' + motionValue + ' / ' + motionStepValue);
	motionObj.style.pixelWidth += motionStepValue;
	++motionValue;

	if (motionValue <= presetStepValue) {
		setTimeout('executeHorizonLRMotionDiv()', 10);
	}
	else if (motionValue + 1 >= presetStepValue) {
		motionObj.style.pixelWidth = motionObj.scrollWidth;
	}
	else {
		motionObj.style.display = 'block';
	}
}

function executeHorizonRLMotionDiv() {
	//alert('test4:' + motionValue + ' / ' + motionStepValue);
	motionObj.style.pixelWidth -= motionStepValue;
	++motionValue;

	if (motionValue <= presetStepValue) {
		setTimeout('executeHorizonRLMotionDiv()', 10);
	}
	else {
		motionObj.style.display = 'none';
	}
}







// ½ÇÇàºÎºÐ

function toggleDivObj(pObj, pState, pHeight) {

	if (pState == 'open') {
		//pObj.style.height = pHeight;
		showMotionDiv(pObj, 'VUD', 1, pHeight, 20);
	}
	else if  (pState == 'close') {
		//pObj.style.height = 800;
		//hideDiv(Pop);
		showMotionDiv(pObj, 'VDU', 1, pHeight, 7);
	}
	else {
		pObj.style.height = pHeight;
		hideDiv(pObj);
	}
}

function extendDivObj(pObj, pHeight) {
	showMotionDiv(pObj, 'VUD', pObj.style.pixelHeight, pHeight, 20);
}

function setDivObjPosition(pSrcObj, pObj, pLeft, pTop) {
	pObj.left = getObjPos(pSrcObj).x + pLeft;
	pObj.top = getObjPos(pSrcObj).y + pTop;
}






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.01
  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 && d.getElementById) x=d.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];}
}