function close_rwin()
{
    opener.location.reload();
    top.close();
}
function close_gwin(href)
{
    opener.location.href=href;
    top.close();
}
function innerFlash(url, width, height){
                document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '" VIEWASTEXT>');
        document.write('<param name="movie" value="' + url + '">');
        document.write('<param name="quality" value="high">');
        document.write('<param name="wmode" value="transparent">');
		document.write('<param name="menu" value="transparent">');
        document.write('<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
        document.write('</object>');
}

function pg_open(url,w,h)
{
    ww = w;
    wh = h;
    sw = (screen.width-ww)/2;
    sh = (screen.height-wh)/2;
    pgpop = window.open(url,"Window","width=" + ww + ",height=" + wh + ",left=" + sw + ",top=" + sh + ",scrollbars=no");
    pgpop.window.focus();
}
function popWindow(url,w,h)    
{
    ww = w;
    wh = h;
    sw = (screen.width-ww)/2;       
    sh = (screen.height-wh)/2;
    myWinCenter = window.open(url,"HandPhone_view","width=" + ww + ",height=" + wh + ",left=" + sw + ",top=" + sh + ",scrollbars=yes");
    myWinCenter.window.focus();
}
function win_open(table, src, x, y)
{
	width = (x>window.screen.width-100) ? window.screen.width-100 : x;
	height = (y>window.screen.height-100) ? window.screen.height-100 : y ;
	big = (width!=x || height!=y) ? 1 : 0 ;
	window.open('/bbs/image_review.php?table='+table+'&file='+src+'&x='+x+'&y='+y+'&big='+big,'','width='+width+' height='+height);

}
function popImage(src, x, y)
{
	width = (x>window.screen.width-100) ? window.screen.width-100 : x;
	height = (y>window.screen.height-100) ? window.screen.height-100 : y ;
	big = (width!=x || height!=y) ? 1 : 0 ;
	window.open('/malls/popImage.php?file='+src+'&x='+x+'&y='+y+'&big='+big,'','width='+width+' height='+height);

}
function get_mouse(e){
    var x=(nav)?e.pageX:event.x+document.body.scrollLeft;skn.left=x+Xoffset;
    var y=(nav)?e.pageY:event.y+document.body.scrollTop;skn.top=y+yyy;
}
function downWin(url, w, h) {
	var settings  ='height='+h+',';
		settings +='width='+w+',';
		settings +='top=2000,';
		settings +='left=2000,';
	downWin = window.open(url,'',settings,'marginwidth=0,marginheight=0');
	downWin.focus();
}
function newWindow(url, w, h, loca, resize, scroll) {
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings  ='height='+h+',';
		settings +='width='+w+',';
		settings +='top='+wint+',';
		settings +='left='+winl+',';
		settings +='location='+loca+',';
		settings +='resizable='+resize+',';
		settings +='scrollbars='+scroll+',';
	newwins = window.open(url,'',settings,'marginwidth=0,marginheight=0');
	newwins.focus();
}
function check_scinput()
{
	if(!sc_form.search_key.value) {
		alert("°Ë»öÇÒ ´Ü¾î¸¦ ÇÑ±ÛÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.");
		sc_form.search_key.focus();
		return false;
	}
	if(sc_form.search_name.checked == false &&
        sc_form.search_title.checked == false &&
        sc_form.search_content.checked == false) {
		alert("°Ë»ö ¿É¼ÇÀº ÇÏ³ªÀÌ»ó Ã¼Å© ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
		return false;
	}
	sc_form.submit();
}
// ÀÌ¹ÌÁö ¾÷·Îµå ¹Ì¸®º¸±â
var foto1;
function viewPic(img)
{
	if(img=='') {
		return;
	} else {
		foto1= new Image();
		foto1.src=(img);
		contImg(img);
	}
}
function contImg(img)
{
	if((foto1.width!=0)&&(foto1.height!=0)) {
		viewImg(img);
	} else {
		funzione="contImg('"+img+"')";
		intervallo=setTimeout(funzione,20);
	}
}
function viewImg(img)
{
	document.all["div2"].innerHTML = "";
	document.all["div1"].innerHTML="<font size=2 color=red>1/2 size image..<br><img name=img1 width=" + eval(foto1.width/2) + "src=#><br> °¡·Î : " + foto1.width + "px / ¼¼·Î : " + foto1.height + "px";
	document.img1.src = foto1.src;
}
function checksize()
{
	if(foto1.width <= 100) {
		document.all["bbb"].innerHTML = "°¡·Î 100pxÀÌ»óÀÇ ±×¸²¸¸ ¿Ã¸±¼ö ÀÖ½À´Ï´Ù";
	} else if((foto1.width <= 600) && (foto1.width > 100)) {
		return true;
	} else {
		document.all["bbb"].innerHTML = "°¡·Î 600pxÀÌÇÏÀÇ ±×¸²¸¸ ¿Ã¸±¼ö ÀÖ½À´Ï´Ù";
		return false;
	}
}
function sclayer(aEvent,thisLayer,UID,password)
{
    var NS4;
    var IE4;
    if(navigator.appName.indexOf('Microsoft Internet Explorer') == 0) {
        IE4 = true;
        NS4 = false;
    } else {
        IE4 = false;
        NS4 = true;
    }
    var hideok = true;
    var layer = document.getElementById(thisLayer);
    var myEvent = aEvent ? aEvent : window.event;
    xPos = (IE4) ? (document.body.scrollLeft+aEvent.clientX)-200 : aEvent.pageX;
    yPos = (IE4) ? (document.body.scrollTop+aEvent.clientY)-20 : aEvent.pageY;
    if (layer.style.display == 'none') {
        if (IE4) {
            layer.style.pixelTop = yPos;
            layer.style.pixelLeft = xPos;
        } else {
            layer.style.top = yPos + 'px';
            layer.style.left = xPos + 'px';
        }
        layer.style.display = '';
        document.comm_frm.input_layer_pass.focus();
        document.comm_frm.CUID.value = UID;
        document.comm_frm.input_layer_pass.value = password;
    } else {
        layer.style.display = 'none';
    }
}

function ChgPrice(str) {
	if (str == 'Y') {
		var idx = document.formlist.sale_price.selectedIndex ;
		document.formlist.opt_val1.selectedIndex = idx;
	}
}

function ChgOption(str,opt_num) {
	if (str == 'Y' && opt_num == '1') {
		var idx = document.formlist.opt_val1.selectedIndex ;
		document.formlist.sale_price.selectedIndex = idx;
	}
}
function ChgQty(str,stock) {
	if (beNumStr(document.formlist.qty.value) == false) {
		alert("ÇëÊäÈëÄúÒª¹ºÂòµÄÉÌÆ·ÊýÁ¿.");
		document.formlist.qty.value = 1;
		document.formlist.qty.focus();
		return;
	}
	else {
		if (str == 0) {
			if ((eval(document.formlist.qty.value) + 1) > stock) {
				alert("¶Ô²»Æð£¬ÄúÐí¶àÖ»ÄÜ¹ºÂò" + stock + "¼þ¸ÃÖÖÉÌÆ·.");
				document.formlist.qty.focus();
				return;
			}
			else {
				document.formlist.qty.value = eval(document.formlist.qty.value) + 1;
			}
		}
		else {
			if (eval(document.formlist.qty.value) != 1) {
				document.formlist.qty.value = eval(document.formlist.qty.value) - 1;
			}
		}
	}
}
function ChgQty1(stock) {
	if (document.formlist.qty.value == "") {
		document.formlist.qty.value = 1;
		document.formlist.qty.focus();
		return;
	}
	else {
		if (beNumStr(document.formlist.qty.value) == false) {
			alert("ÇëÊäÈëÄúÒª¹ºÂòµÄÊýÁ¿.");
			document.formlist.qty.value = 1;
			document.formlist.qty.focus();
			return;
		}
		else {
			if (document.formlist.qty.value == 0) {
				document.formlist.qty.value = 1;
				document.formlist.qty.focus();
				return;
			}
			else {
				if (document.formlist.qty.value > stock) {
					alert("¶Ô²»Æð£¬Äú×î¶àÖ»ÄÜ¹ºÂò " + stock + "¼þ¸ÃÖÖÉÌÆ·.");
					document.formlist.qty.value = 1;
					document.formlist.qty.focus();
					return;
				}
			}
		}
	}
}
function CheckField(str) {
	var opt1 = "»ö»ó";
	var opt2 = "»çÀÌÁî";
	var opt3 = "";
	var opt4 = "";

	if (opt1 != "") {
		if (document.formlist.opt_val1.value == "") {
			alert(opt1+"À»(¸¦) ¼±ÅÃÇÏ¼Å¾ß µË´Ï´Ù.");
			document.formlist.opt_val1.focus();
			return;
		}
	}
	if (opt2 != "") {
		if (document.formlist.opt_val2.value == "") {
			alert(opt2+"À»(¸¦) ¼±ÅÃÇÏ¼Å¾ß µË´Ï´Ù.");
			document.formlist.opt_val2.focus();
			return;
		}
	}
	if (opt3 != "") {
		if (document.formlist.opt_val3.value == "") {
			alert(opt3+"À»(¸¦) ¼±ÅÃÇÏ¼Å¾ß µË´Ï´Ù.");
			document.formlist.opt_val3.focus();
			return;
		}
	}
	if (opt4 != "") {
		if (document.formlist.opt_val4.value == "") {
			alert(opt4+"À»(¸¦) ¼±ÅÃÇÏ¼Å¾ß µË´Ï´Ù.");
			document.formlist.opt_val4.focus();
			return;
		}
	}

//	if (parseInt(1000) < document.form.qty.value) {
//		alert("ÇöÀç Àç°í ¼ö·®Àº " + parseInt(1000) + "°³ ÀÔ´Ï´Ù.");
//		document.form.qty[0].selected = true;
//		document.form.qty.focus();
//		return;
//	}

	var qty = alltrim(document.formlist.qty.value);
	if (qty.length == 0) {
		alert("¼ö·®À» ÀÔ·ÂÇÏÁö ¾ÊÀ¸¼ÌÀ¾´Ï´Ù.");
		document.formlist.qty.focus();
		return;
	}
	if (beNumStr(qty) == false) {
		alert("¼ö·®À» ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
		document.formlist.qty.focus();
		return;
	}


	if (str == "D") {
		document.formlist.action = "/order/order.asp";
		document.formlist.submit();
	}
	else {
		document.formlist.action = "/order/cart_insert.asp";
		document.formlist.submit();
	}
//	AEC_CALL_FUNC_DIV('119132','i',qty);
}

function image(id,name){
window.open('image.asp?id='+id+'&name='+name,'blank_','scrollbars=no,resizable=yes,width=1,height=1,left=150');
	}

function shopcart(id){
window.open('gouwu.asp?id='+id+'&action=add','blank_','scrollbars=yes,resizable=yes,width=630,height=350,left=150');
	}
	
function cartshow(){
window.open('gouwu.asp?action=show&lx=1','blank_','scrollbars=yes,resizable=yes,width=630,height=350,left=150');
	}
function cartcheck(){
window.open('jszx.asp','blank_','scrollbars=yes,resizable=yes,width=630,height=350,left=150');
	}

function gocart(id){
 var fm = document.forms[2];
 window.open ('about:blank','newwindow','height=360,width=630,top=0,left=150,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no') ;
 fm.action="gouwu.asp?action=add";
 fm.target="newwindow";
 fm.submit();
}


function checkbook()
{
   if(checkspace(document.formbook.name.value)) {
	document.formbook.name.focus();
    alert("¶Ô²»Æð£¬ÇëÌîÐ´Ãû×Ö£¨êÇ³Æ£©£¡");
	return false;
  }
   if(checkspace(document.formbook.content.value)) {
	document.formbook.content.focus();
    alert("¶Ô²»Æð£¬ÇëÌîÐ´ÁôÑÔÄÚÈÝ£¡");
	return false;
  }
  }

function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}




