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_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_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];}
}

function openWebUserInfoPopup(url)
{
    openPopup(url,'',500,450);
}


function openPopup(url, name, width, height)
{
	var oTarget = window.open(url, name, 'scrollbars=no, toolbar=no, resizable=yes, menubar=no, status=no, width=' + width + ', height=' + height + ', top=250, left=350');
	oTarget.focus();
	return false;
}

function openPopupWindow(url, name, width, height)
{
	var oTarget = window.open(url, name, 'scrollbars=no, toolbar=no, resizable=yes, menubar=no, status=no, width=' + width + ', height=' + height + ', top=250, left=350');
	oTarget.focus();
	return oTarget;
}

function openScrolledPopup(url, name, width, height)
{
	var oTarget = window.open(url, name, 'scrollbars=yes, toolbar=no, resizable=yes, menubar=no, status=no, width=' + width + ', height=' + height + ', top=250, left=350');
	oTarget.focus();
	return false;
}

function HideControl( id )
{
	document.getElementById( id ).style.display = 'none';
}

function ShowControl( id )
{
	document.getElementById( id ).style.display = 'inline';
}

function nextFieldFocus(curObj, prevObj, nextObj, length, event)
{
	if( event.keyCode == '37' || event.keyCode == '39' )
	{
		return;
	}
  if(nextObj != null && curObj.value.length == length && event.keyCode != '9' && event.keyCode != '16')
  {
    nextObj.focus();
    nextObj.select();
  }
  if(event.keyCode == '8' && curObj.value.length == 0)
  {
    prevObj.focus();
    rng = prevObj.createTextRange(); 
    rng.collapse(false); 
    rng.select(); 
    prevObj.click(); 
  }
}


function newImage(arg)
{
	if (document.images)
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages()
{
	if (document.images)
	{
		for (var i=0; i<changeImages.arguments.length; i+=2)
		{
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

//************************************************************* 
function Trim (str)  
{ 
	return RTrim(LTrim(str)); 
} 
//************************************************************* 	
function LTrim (str) { 
var ret_str = str; 
for (var i=0; i<str.length; i++){ 
	if (str.charAt(i) == ' ') {;} 
	else  
	{ 
		ret_str = str.substring(i); 
		return ret_str; 
	} 
} 
ret_str=''; 
return ret_str; 
} 
//************************************************************* 
function RTrim (str) { 
	var ret_str = str; 
	for (var i=(str.length-1); i>=0; i--) 
	{ 
		if (str.charAt(i) == ' ') {;} 
		else  
		{ 
			ret_str = str.substring(0,(i+1)); 
			return ret_str; 
		} 
	} 
	ret_str=''; 
	return ret_str; 
} 

//**************************************************************

/* fromlistmanip.js */
function moveUpList(listField) {
   if ( listField.length == -1) {  // If the list is empty
      /*alert("No item to move.");*/
   } else {
      var selected = listField.selectedIndex;
      if (selected == -1) {
         /*alert("No item selected.");*/
      } else {  // Something is selected
         if ( listField.length == 0 ) {  // If there's only one in the list
            /*alert("Only one item in the list. You can't move it.");*/
         } else {  // There's more than one in the list, rearrange the list order
            if ( selected == 0 ) {
               /*alert("First item in the list can't move up.");*/
            } else {
               // Get the text/value of the one directly above the hightlighted entry as
               // well as the highlighted entry; then flip them
               var moveText1 = listField[selected-1].text;
               var moveText2 = listField[selected].text;
               var moveValue1 = listField[selected-1].value;
               var moveValue2 = listField[selected].value;
               listField[selected].text = moveText1;
               listField[selected].value = moveValue1;
               listField[selected-1].text = moveText2;
               listField[selected-1].value = moveValue2;
               listField.selectedIndex = selected-1; // Select the one that was selected before
            }  // Ends the check for selecting one which can be moved
         }  // Ends the check for there only being one in the list to begin with
      }  // Ends the check for there being something selected
   }  // Ends the check for there being none in the list
}

function moveDownList(listField) {
   if ( listField.length == -1) {  // If the list is empty
      /*alert("No item to move.");*/
   } else {
      var selected = listField.selectedIndex;
      if (selected == -1) {
         /*alert("No item selected.");*/
      } else {  // Something is selected
         if ( listField.length == 0 ) {  // If there's only one in the list
            /*alert("Only one item in the list. You can't move it.");*/
         } else {  // There's more than one in the list, rearrange the list order
            if ( selected == listField.length-1 ) {
               /*alert("Last item in the list can't move down.");*/
            } else {
               // Get the text/value of the one directly below the hightlighted entry as
               // well as the highlighted entry; then flip them
               var moveText1 = listField[selected+1].text;
               var moveText2 = listField[selected].text;
               var moveValue1 = listField[selected+1].value;
               var moveValue2 = listField[selected].value;
               listField[selected].text = moveText1;
               listField[selected].value = moveValue1;
               listField[selected+1].text = moveText2;
               listField[selected+1].value = moveValue2;
               listField.selectedIndex = selected+1; // Select the one that was selected before
            }  // Ends the check for selecting one which can be moved
         }  // Ends the check for there only being one in the list to begin with
      }  // Ends the check for there being something selected
   }  // Ends the check for there being none in the list
}

function addToList(listField, newText, newValue) {
   if ( ( newValue == "" ) || ( newText == "" ) ) {
      /*alert("No added item.");*/
   } else {
      var len = listField.length++; // Increase the size of list and return the size
      listField.options[len].value = newValue;
      listField.options[len].text = newText;
      listField.selectedIndex = len; // Highlight the one just entered (shows the user that it was entered)
   } // Ends the check to see if the value entered on the form is empty
}

function removeFromList(listField) {
   if ( listField.length == -1) {  // If the list is empty
      /*alert("No item to remove.");*/
   } else {
      var selected = listField.selectedIndex;
      if (selected == -1) {
         /*alert("You shall select an item in the list.");*/
      } else {  // Build arrays with the text and values to remain
         var replaceTextArray = new Array(listField.length-1);
         var replaceValueArray = new Array(listField.length-1);
         for (var i = 0; i < listField.length; i++) {
            // Put everything except the selected one into the array
            if ( i < selected) { replaceTextArray[i] = listField.options[i].text; }
            if ( i > selected ) { replaceTextArray[i-1] = listField.options[i].text; }
            if ( i < selected) { replaceValueArray[i] = listField.options[i].value; }
            if ( i > selected ) { replaceValueArray[i-1] = listField.options[i].value; }
         }
         listField.length = replaceTextArray.length;  // Shorten the input list
         for (i = 0; i < replaceTextArray.length; i++) { // Put the array back into the list
            listField.options[i].value = replaceValueArray[i];
            listField.options[i].text = replaceTextArray[i];
         }
      } // Ends the check to make sure something was selected
   } // Ends the check for there being none in the list
}

/* from html page */

function changeList(item,action) {
	var f = document.getElementById(item);
	var blocId = "";
	if(f.selectedIndex != -1) {
		 blocId  = f.options[f.selectedIndex].value;
	} else {
	    return;
    }
	switch (action){
		case "moveup":
		    moveUpList(f);
		    break;
		case "movedown":
		    moveDownList(f);
    		break;
		case "delete":
		    var text = f.options[f.selectedIndex].text;
    		var value = f.options[f.selectedIndex].value;
    		removeFromList(f);
    		if(document.getElementById('used_' + blocId) && document.getElementById('link_' + blocId)) {
    			document.getElementById('used_' + blocId).style.display = 'none';
    			document.getElementById('link_' + blocId).style.display = 'inline';
    		}
			addToList(document.getElementById('Template:Content:ltbNone'), text, value);
    		break;
		case "moveleft":
    		var text = f.options[f.selectedIndex].text;
    		var value = f.options[f.selectedIndex].value;
    		removeFromList(f);
    		addToList(document.getElementById('Template:Content:ltbLeft'), text, value);
    		break;
		case "moveright":
	    	var text = f.options[f.selectedIndex].text;
    		var value = f.options[f.selectedIndex].value;
    		removeFromList(f);
    		addToList(document.getElementById('Template:Content:ltbRight'), text, value);
    		break;
	}
}

function addBlockToList(listField, newText, newValue) {
	var blocId = newValue;
	var ltbNone = document.getElementById('Template:Content:ltbNone');
	
	for(i=0;i<ltbNone.Length;i++)
	{
		if(listField.options[i].value == newValue)
		{
			ltbNone.options[i].selected = true;
			removeFromList(ltbNone);
			break;
		}
	}
	
	addToList(listField, newText, newValue);
	if(document.getElementById('used_' + blocId) && document.getElementById('link_' + blocId)) 
	{
		document.getElementById('used_' + blocId).style.display = 'inline';
		document.getElementById('link_' + blocId).style.display = 'none';
	}
}
//============= ÀÌ¹ÌÁö±³È¯ (ÀÛ¼ºÀÏÀÚ : 2006-01-05) by HR===============

//num : ±³È¯ÇÏ·Á´Â ÀÌ¹ÌÁö ¼ø¼­
//overall_num : ÃÑ ÀÌ¹ÌÁö ¼ö
//img_id : ¹Ù²Ù·Á´Â ÀÌ¹ÌÁöÀÇ id

var tmp_num
function ch_img (num, overall_num)
{
	for ( tmp_num=1 ; tmp_num <= overall_num ; tmp_num++)
	{
		if ( tmp_num == num)
		{
			eval("phone_img.src='../_images/product/img_design_0"+tmp_num+".gif';");
			eval("sphoto_"+tmp_num+".style.filter='alpha(opacity:100)'");
		}
		else
		{
			eval("sphoto_"+tmp_num+".style.filter='alpha(opacity:20)'");
		}
		}
}



//============= ÆÝÅ¬·´ ¿ìÃø»ó´Ü music zone ¸®½ºÆ®¹Ù²Ù±â (ÀÛ¼ºÀÏÀÚ : 2006-01-06) by HR===============

//list_on : Å¬¸¯µÈ ¸®½ºÆ® ÀÌ¸§

function ch_zone (list_on, list_off)
{
	eval(list_on+"_list.style.display=''");
	eval(list_on+"_bn.style.background='#545454'");

	eval(list_off+"_list.style.display='none'");
	eval(list_off+"_bn.style.background='#747474'");
}


function ch_zone2 (list_on, list_off)
{
	eval(list_on+"_list.style.display=''");
	eval(list_on+"_arrow.style.display=''");
	eval(list_on+"_bn.style.background='#5A4320'");

	eval(list_off+"_list.style.display='none'");
	eval(list_off+"_arrow.style.display='none'");
	eval(list_off+"_bn.style.background='#86704D'");
}

function ch_zone3 (list_on, list_off)
{
	eval(list_on+"_list.style.display=''");
	eval(list_on+"_bn.style.background='#5A4320'");

	eval(list_off+"_list.style.display='none'");
	eval(list_off+"_bn.style.background='#86704D'");
}


//============= ¸ð¹ÙÀÏ product - Features ÆäÀÌÁö ÇÃ·¡½Ã¹öÆ° ¹× BG ¹Ù²Ù±â (ÀÛ¼ºÀÏÀÚ : 2006-01-19) by HR===============

var tmp_num2;
function sel_img (sel_num)
{
	for ( tmp_num2 = 1 ; eval("document.all.bg_"+tmp_num2) ; tmp_num2++ )
	{
		if ( tmp_num2 == sel_num )
		{
			eval("bg_"+tmp_num2+".className='bg_feature_on'");
		}
		else
		{
			eval("bg_"+tmp_num2+".className='bg_feature_off'");
		}
	}
}

function play_3d()
{
	document.all.bn_3d_on.style.display="none";
	document.all.bn_3d_off.style.display="";
}

function stop_3d()
{
	document.all.bn_3d_on.style.display="";
	document.all.bn_3d_off.style.display="none";
}



//============= ¸ð¹ÙÀÏ showcase ÆäÀÌÁö mouseover border color ¹Ù²Ù±â (ÀÛ¼ºÀÏÀÚ : 2006-01-19) by HR===============

var tmp_num3;
function ch_border(sel_num)
{
	for ( tmp_num3 = 1 ; eval("document.all.show_"+tmp_num3) ; tmp_num3++ )
	{
		if ( tmp_num3 == sel_num )
		{
			eval("show_"+tmp_num3+".style.border='1px solid #ff8400'");
		}
		else
		{
			eval("show_"+tmp_num3+".style.border='1px solid #575757'");
		}
	}
}