// ½Ç elements ¹ÝÈ¯
function getReal(el, type, value) 
{
	temp = el;
	while ((temp != null) && (temp.tagName != "BODY")) {
		if (eval("temp." + type) == value) {
			el = temp;
			return el;
		}
		temp = temp.parentElement;
	}
	return el;
}

// Å¬·¡½º¸í¿¡ µû¸¥ elements array ¹ÝÈ¯
function getElementsByClassName(class_name, obj)
{
  var all_obj,ret_obj=new Array(),j=0;

  if(document.all)all_obj=document.all;
  else if(document.getElementsByTagName && !document.all)all_obj=document.getElementsByTagName("*");

  if(obj)
	  all_obj = all_obj[obj].all;

  for(i=0;i<all_obj.length;i++)
  {
    if(all_obj[i].className==class_name)
    {
      ret_obj[j]=all_obj[i];
      j++;
    }
  }
  return ret_obj;
}


function addCart()
{
	if(productCode)
	{
//		alert(productCode);
		var url = '../cart.php?mode=counsel&post_code=1&product_code=' + productCode		
		if(sectionCode)
			url += '&section_code=' + sectionCode;

		if(cat_no)
			url += '&cat_no=' + cat_no;

		//document.getElementById("cart").setAttribute("src",url);
		var newWin = window.open(url,"counsel","width=630, height=680, scrollbars=yes");
		newWin.focus();
	}
}

function showCartControl()
{
	if(document.all.cartControl)
		document.all.cartControl.style.display = 'block';
}

function printProductInfo()
{
	if(document.all.productInfo)
	{
		var win = window.open('','printPage','width=640,height=580,scrollbars=yes,status=yes');
		win.document.write(document.all.productInfo.innerHTML);
		win.document.write("<script>window.print();</script>");
		win.document.close();
		win.close();
	}
	else
		alert('Product information not found for print');
}
