/* JavaScript Browser Sniffer. Eric Krok, Andy King, Michel Plungjan Jan. 31, 2002 */
function inAgt(str){return agt.indexOf(str);}	

var objClient = new Object();
var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();
var isT = true;
var isF = false;
var strAppleWebKit = "applewebkit/"

var intMinor = parseFloat(appVer);
var intMajor = parseInt(intMinor);

objClient.isOpera = (inAgt("opera") != -1);
objClient.intOperaVer = (objClient.isOpera ? agt.substr(inAgt("opera")+6) : undefined);

var iePos = appVer.indexOf('msie');
if (iePos !=-1) {
	intMinor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
	intMajor = parseInt(intMinor);
}

objClient.isKonq = isF;
var kqPos = inAgt('konqueror');
if (kqPos !=-1) {
	objClient.isKonq  = isT;
	intMinor = parseFloat(agt.substring(kqPos+10,inAgt(';',kqPos)));
	intMajor = parseInt(intMinor);
}                                 

objClient.isSafari = ((inAgt('safari')!=-1)&&(inAgt('mac')!=-1))?isT:isF;
objClient.isKhtml  = (objClient.isSafari || objClient.isKonq);

objClient.isAppleWebKit = (appVer.indexOf(strAppleWebKit) != -1);
objClient.strAppleWebKitVer = -1;
if (objClient.isAppleWebKit) {
	objClient.strAppleWebKitVer = appVer.substring(appVer.indexOf(strAppleWebKit)+strAppleWebKit.length,appVer.length);
	objClient.strAppleWebKitVer = objClient.strAppleWebKitVer.substring(0,objClient.strAppleWebKitVer.indexOf(" "));
	objClient.strAppleWebKitMajorVer = objClient.strAppleWebKitVer.split(".")[0];
	objClient.strAppleWebKitMinorVer = objClient.strAppleWebKitVer.split(".")[1];
}

objClient.isSafari131Up = (objClient.isSafari && (objClient.strAppleWebKitMajorVer > 312 || (objClient.strAppleWebKitMajorVer == 312 && objClient.strAppleWebKitMinorVer >= 5)) ? isT : isF);
objClient.isSafari203Up = (objClient.isSafari && (objClient.strAppleWebKitMajorVer > 417 || (objClient.strAppleWebKitMajorVer == 417 && objClient.strAppleWebKitMinorVer >= 7)) ? isT : isF);

objClient.isGecko = ((!objClient.isKhtml)&&(navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?isT:isF;
objClient.intGver  = 0;
if (objClient.isGecko) objClient.intGver=Number(navigator.productSub);

objClient.isMoz = ((inAgt('mozilla/5')!=-1) && (inAgt('spoofer')==-1) && (inAgt('compatible')==-1) && 
					(inAgt('opera')==-1) && (inAgt('webtv')==-1) && (inAgt('hotjava')==-1) && 
					(objClient.isGecko) && ((navigator.vendor=="")||(navigator.vendor=="Mozilla")||(navigator.vendor=="Debian")));
objClient.isFb = ((inAgt('mozilla/5')!=-1) && (inAgt('spoofer')==-1) &&
					(inAgt('compatible')==-1) && (inAgt('opera')==-1)  &&
					(inAgt('webtv')==-1) && (inAgt('hotjava')==-1)     &&
					(objClient.isGecko) && (navigator.vendor=="Firebird"));
objClient.isFx = ((inAgt('mozilla/5')!=-1) && (inAgt('spoofer')==-1) &&
					(inAgt('compatible')==-1) && (inAgt('opera')==-1)  &&
					(inAgt('webtv')==-1) && (inAgt('hotjava')==-1)     &&
					(objClient.isGecko) && (navigator.vendor=="Firefox"));

if ((objClient.isMoz)||(objClient.isFb)||(objClient.isFx)) {  // 032504 - dmr
	objClient.intMozVer = (navigator.vendorSub)?navigator.vendorSub:0;
	if(!(objClient.intMozVer)) {
		objClient.intMozVer = inAgt('rv:');
		objClient.intMozVer = agt.substring(objClient.intMozVer+3);
		is_paren   = objClient.intMozVer.indexOf(')');
		objClient.intMozVer = objClient.intMozVer.substring(0,is_paren);
	}
	intMinor = objClient.intMozVer;
	intMajor = parseInt(objClient.intMozVer);
}
objClient.intFbVer = objClient.intMozVer;
objClient.intFxVer = objClient.intMozVer;

objClient.isNav  = ((inAgt('mozilla')!=-1) && (inAgt('spoofer')==-1)
					&& (inAgt('compatible') == -1) && (inAgt('opera')==-1)
					&& (inAgt('webtv')==-1) && (inAgt('hotjava')==-1)
					&& (!objClient.isKhtml) && (!(objClient.isMoz)) && (!objClient.isFb) && (!objClient.isFx));

if ((navigator.vendor)&&((navigator.vendor=="Netscape6")||(navigator.vendor=="Netscape"))&&(objClient.isNav)) {
	intMajor = parseInt(navigator.vendorSub);
	intMinor = parseFloat(navigator.vendorSub);
}

objClient.isNav7   = (objClient.isNav && intMajor == 7);
objClient.isNav7up = (objClient.isNav && intMinor >= 7);

objClient.isIE   = ((iePos!=-1) && (!objClient.isOpera) && (!objClient.isKhtml));
objClient.isIE5_5  = (objClient.isIE && (inAgt("msie 5.5") !=-1)); // 020128 new - abk
objClient.isIE5_5up =(objClient.isIE && intMinor >= 5.5);                // 020128 new - abk

var ie6Pos = appVer.indexOf('msie 6');
var ie7Pos = appVer.indexOf('msie 7');
objClient.isIE6 = (ie6Pos!=-1);   // For CSS detection
objClient.isIE7 = (ie7Pos!=-1);   // For CSS detection


objClient.isIE6up = (objClient.isIE && intMinor >= 6);

objClient.isAOL   = (inAgt("aol") != -1);
objClient.isAOL5  = (inAgt("aol 5") != -1);
objClient.isAOL6  = (inAgt("aol 6") != -1);
objClient.isAOL7  = ((inAgt("aol 7")!=-1) || (inAgt("aol7")!=-1));
objClient.isAOL8  = ((inAgt("aol 8")!=-1) || (inAgt("aol8")!=-1));

objClient.isWin   = ( (inAgt("win")!=-1) || (inAgt("16bit")!=-1) );
objClient.isWin95 = ((inAgt("win95")!=-1) || (inAgt("windows 95")!=-1));

objClient.isWinME = ((inAgt("win 9x 4.90")!=-1));    // new 020128 - abk
objClient.isWin2k = ((inAgt("windows nt 5.0")!=-1) || (inAgt("windows 2000")!=-1)); // 020214 - dmr
objClient.isWinXP = ((inAgt("windows nt 5.1")!=-1) || (inAgt("windows xp")!=-1)); // 020214 - dmr
objClient.isWin98 = ((inAgt("win98")!=-1) || (inAgt("windows 98")!=-1));
objClient.isWinNT = ((inAgt("winnt")!=-1) || (inAgt("windows nt")!=-1) && !objClient.isWinXP);

objClient.isMac    = (inAgt("mac")!=-1);
if (objClient.isMac) objClient.isWin = !objClient.isMac; // dmr - 06/20/2002

objClient.isJava = (navigator.javaEnabled());

objClient.isFlash = isF;
objClient.intFlashVer = 0;

if ((objClient.isNav||objClient.isOpera||objClient.isMoz||objClient.isFb||objClient.isFx)||(objClient.isMac&&objClient.isIE5up)||(objClient.isSafari)) {
	var plugin = (navigator.mimeTypes && 
				navigator.mimeTypes["application/x-shockwave-flash"] &&
				navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) ?
				navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if (plugin) {
		objClient.isFlash = isT;
		objClient.intFlashVer = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1));
	}
}

if (objClient.isWin&&objClient.isIE5_5up) {
	document.write(
		'<scr' + 'ipt language=VBScript>' + '\n' +
		'Dim hasPlayer, playerversion' + '\n' +
		'hasPlayer = false' + '\n' +
		'playerversion = 10' + '\n' +
		'Do While playerversion > 0' + '\n' +
		'On Error Resume Next' + '\n' +
		'hasPlayer = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & playerversion)))' + '\n' +
		'If hasPlayer = true Then Exit Do' + '\n' +
		'playerversion = playerversion - 1' + '\n' +
		'Loop' + '\n' +
		'objClient.intFlashVer = playerversion' + '\n' +
		'objClient.isFlash = hasPlayer' + '\n' +
		'<\/sc' + 'ript>');
}
/*********************************** Browser End ************************************/
var sw = screen.availWidth;
var sh = screen.availHeight;
/// quickview location
var posLt = sw / 4;
var posTp = sh / 2;
			
objProductObjects = new Object();
var objPO = objProductObjects;
var objP = new Object();
objPO.objQuickLookLauncher = new Object();
objPO.objQuickView = new Object();

objPO.isQuickLookOpen = false;

objPO.isLoaded = false;

document.onmousemove = function(event0) {
	globalOnMouseMoveFunctions(event0);
}

function globalOnMouseMoveFunctions(event0) {
	objPO.checkQuickLookLauncher(event0);
}

function setImgSrc(targetID, strSrc) {
	if (typeof targetID == "string") var objImg = returnObjById(targetID);
	else if (typeof targetID == "object") var objImg = targetID;
	objImg.setAttribute("src",strSrc);
}

objPO.checkQuickLookLauncher = function(event0) {

	if (objPO.objQuickLookTarget.strProductId) {
		if (objPO.objQuickLookTarget.strProductId != 0) {
			var objImg = objPO.objQuickLookTarget.obj;
			var xmin = objPO.objQuickLookTarget.position.x + -20;
			var xmax = objPO.objQuickLookTarget.position.x + objImg.width;
			var ymin = objPO.objQuickLookTarget.position.y;
			var ymax = objPO.objQuickLookTarget.position.y + objImg.height;
			var scrollLeft = (document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
			var scrollTop = (document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
			if (objClient.isIE) {
				var x1 = event.clientX + scrollLeft;
				var y1 = event.clientY + scrollTop;
			} else {
				var x1 = event0.pageX;
				var y1 = event0.pageY;
			}
			if (x1 > xmax || x1 < xmin || y1 > ymax || y1 < ymin) {
				objPO.closeQuickLookLauncher();
			}
		}
	}
}

objPO.objQuickLookTarget = new function(strProductId,strDefaultStyleColor,strCategoryId,strVariantId,position,obj,strProductNo) {
	this.strProductId = strProductId;
	this.strDefaultStyleColor = strDefaultStyleColor;
	this.strCategoryId = strCategoryId;
	this.strVariantId = strVariantId;
	this.position = position; 
	this.obj = obj;
	this.strProductNo = strProductNo;	
}

function returnObjById(strId) {
	if (document.all){
		var tempObj = document.all[strId];
	} else if (document.layers){
		var tempObj = document.layers[strId];
	} else if (document.getElementById){
		var tempObj = document.getElementById(strId);		
	}

	return tempObj;
}

function returnObjPosition(target){
	var x = 0;
	var y = 0;
	var tempObj = new Object();
	var obj = (typeof target == "object" ? target : returnObjById(target));
	while (obj.offsetParent != null) {
		x += obj.offsetLeft;
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	x += obj.offsetLeft;
	y += obj.offsetTop;
	tempObj.x = x;
	tempObj.y = y;
	
	return tempObj;
}

function setObjPosition(objLayer,intX,intY) {
	strX = String(intX);
	strY = String(intY);
	objLayer.style.top = intY + (strY.indexOf("px") == -1 ? "px" : "");
	objLayer.style.left = intX + (strX.indexOf("px") == -1 ? "px" : "");
}

function setObjVisibility(objLayer,strState) {
	objLayer.style.visibility = strState;
}

function QuickViewOn(strProductId,targetImg,strProductNo) {
objPO.isLoaded = true;
objPO.isQuickLookOpen = true;

	if (objPO.isLoaded) { 
		var blnOpen = false;
		if (objPO.isQuickLookOpen) {
			if (objP.strProductId != strProductId) blnOpen = true;
		} else {
			blnOpen = true;
		}
		if (blnOpen) {
			objPO.objQuickLookTarget.strProductId = strProductId;
			objPO.objQuickLookTarget.strProductNo = strProductNo; 			 
			objPO.objQuickLookLauncher = returnObjById("quickLookLauncher");
			
			objPO.objQuickLookTarget.position = returnObjPosition(targetImg);

			objPO.objQuickLookTarget.obj = returnObjById(targetImg); 
			var objImg = objPO.objQuickLookTarget.obj;
			//// image up to button
			var xPosition = objPO.objQuickLookTarget.position.x + Math.round(objImg.width / 4);
			var yPosition = objPO.objQuickLookTarget.position.y + Math.round(objImg.height / 2);

//			alert(xPosition);
//			alert(yPosition);

//			if (!objPO.isQuickLookOpen) objPO.objQuickLookTarget.obj = returnObjById(targetImg);

//			alert(objPO.objQuickLookTarget.position.x);

			setObjPosition(objPO.objQuickLookLauncher,xPosition,yPosition);
			setObjVisibility(objPO.objQuickLookLauncher,"visible");
		}
	}
}

function QuickViewOn_btn(strProductId,targetImg,strProductNo) {
objPO.isLoaded = true;
objPO.isQuickLookOpen = true;

	if (objPO.isLoaded) { 
		var blnOpen = false;
		if (objPO.isQuickLookOpen) {
			if (objP.strProductId != strProductId) blnOpen = true;
		} else {
			blnOpen = true;
		}
		if (blnOpen) {
			objPO.objQuickLookTarget.strProductId = strProductId;
			objPO.objQuickLookTarget.strProductNo = strProductNo; 			 
			objPO.objQuickLookLauncher = returnObjById("quickLookLauncher");
			
			objPO.objQuickLookTarget.position = returnObjPosition(targetImg);

			objPO.objQuickLookTarget.obj = returnObjById(targetImg); 
			var objImg = objPO.objQuickLookTarget.obj;
			//// image up to button
			var xPosition = objPO.objQuickLookTarget.position.x + Math.round(objImg.width / 4);
			var yPosition = objPO.objQuickLookTarget.position.y + Math.round(objImg.height / 3);

//			alert(xPosition);
//			if (!objPO.isQuickLookOpen) objPO.objQuickLookTarget.obj = returnObjById(targetImg);

//			alert(objPO.objQuickLookTarget.position.x);

//			setObjPosition(objPO.objQuickLookLauncher,xPosition,yPosition);
//			setObjVisibility(objPO.objQuickLookLauncher,"visible");
	
			launchQuickView();
		}
	}
}

objPO.closeQuickLookLauncher = function() {
	setObjVisibility(objPO.objQuickLookLauncher,"hidden");
	setImgSrc('quickLook','/images/btn_quickview_on.gif');
	objPO.objQuickLookTarget.strProductId = 0;
}

objPO.closeQuickView = function() {
	objPO.objQuickView = returnObjById("quickLookWindow");	
	requrl='/blank.asp?ajaxmode=1';
	requrl=requrl+'&rand='+Math.random();
	getAjaxData(requrl,objPO.objQuickView);	
	
	setObjVisibility(objPO.objQuickView,"hidden");
	objPO.objQuickLookTarget.strProductId = 0;
}
///////////////////////////////////////////////////////////////////
/*
function launchQuickView()
{
	setTimeout("QuickView()",10);
}
*/

function launchQuickView()
{
strProductId = objPO.objQuickLookTarget.strProductId;
strProductNo = objPO.objQuickLookTarget.strProductNo;

objPO.isLoaded = true;
objPO.isQuickLookOpen = true;

	objPO.objQuickView = returnObjById("quickLookWindow");	
	requrl='/blank.asp?ajaxmode=1';
	requrl=requrl+'&rand='+Math.random();
	getAjaxData(requrl,objPO.objQuickView);	

	if (objPO.isLoaded) 
	{
		var blnOpen = false;
		if (objPO.isQuickLookOpen) 
		{
			if (objP.strProductId != strProductId) 
			{
				blnOpen = true;
			}
		} 
		else 
		{
			blnOpen = true;
		}
		if (blnOpen) {
			objPO.objQuickLookTarget.strProductId = strProductId;
			objPO.objQuickLookTarget.strProductNo = strProductNo; 			 
			objPO.objQuickView = returnObjById("quickLookWindow");

			objPO.objQuickLookTarget.position = returnObjPosition(strProductId);
			objPO.objQuickLookTarget.obj = returnObjById(strProductId); 

			////// QuickView location
			if(objPO.objQuickLookTarget.position.y <= 500) 
			{
				setObjPosition(objPO.objQuickView,posLt,(objPO.objQuickLookTarget.position.y));
			}
			else
			{
				setObjPosition(objPO.objQuickView,posLt,(objPO.objQuickLookTarget.position.y)-140);
			}
			setObjVisibility(objPO.objQuickView,"visible");		
			
			requrl='/product/quickView.asp?ajaxmode=1';
			requrl=requrl+'&ProductNo=' + objPO.objQuickLookTarget.strProductNo;
			requrl=requrl+'&rand='+Math.random();
			getAjaxData(requrl,objPO.objQuickView);			
		}
	}	
}

function quick_GoQNA(brandcode,code,color,size)
{
	document.quickForm.ProductColor.value = document.quickForm.ProductColorCode.options[document.quickForm.ProductColorCode.selectedIndex].text;
	if (document.quickForm.ProductSize.value=="" || document.quickForm.ProductColor.value=="") {alert("please select a size");return;}
	location.href = "/qna/qna.asp?BoardCategory=stock&BrandCode=" + brandcode + "&QNAProductCode=" + code + "&QNAProductColor=" + document.quickForm.ProductColor.value + "&QNAProductSize=" + document.quickForm.ProductSize.value;
}

function quick_AddToShoppingbag()
{
	var OrderCheck;

	OrderCheck = true;

	document.quickForm.ProductNo.value = document.quickForm.ProductColorCode.value;
	document.quickForm.ProductColor.value = document.quickForm.ProductColorCode.options[document.quickForm.ProductColorCode.selectedIndex].text;

	if (document.quickForm.ProductSize.value=="READY") {alert("\nSorry, This product size is nothing");OrderCheck = false;}	
	if (document.quickForm.ProductColor.value=="") {alert("\nPlease select a color");OrderCheck = false;}	
	if (document.quickForm.ProductSize.value=="") {alert("\nPlease select a size");OrderCheck = false;}

	if (OrderCheck)
	{
//		document.getElementById('Addcart').src = '/images/product_loading.gif';
//		MM_swapImage('Addcart','','/images/product_loading.gif')

		var strQuery;
		var url;
		var elementname;

		strQuery = "";

		for (i=0;i<document.quickForm.elements.length ; i++)
		{
			elementname = document.quickForm.elements[i].name;
				
			strQuery += '&' + elementname.toLowerCase() + '=' + String(encodeURIComponent(document.quickForm.elements[i].value));
		}
		url = "/product/put_cart_behind.asp?rand=" + Math.random() + strQuery  + "&" + new Date().getTime(); 
//		alert(url);
        var reqObj;
        reqObj=initXMLHttp();
		reqObj.open("GET",url,true);
        reqObj.onreadystatechange = function() {

            if(reqObj.readyState == 4)             {
                if(reqObj.status==200)                {
					eval("var response = (" + reqObj.responseText + ")");

					for(var i = 0; i < response.length;i++){				
						switch(response[i].title){
							case "type":
								type = response[i].value;
								break;
							case "total_qty":
								total_qty = response[i].value;
								break;
							default:
								break;
						}
					}

					if (type=='add')
					{
						message = "This item has been added to your shopping cart"
					}else if(type=='out'){
						message = "We're sorry. This item is out of stock"
					}else if(type=='error'){
						message = "We're sorry. Error"
					}		

					if (document.all){
						document.all['qMSG'].style.display = "block";
						document.all['qMSG'].style.backgroundColor = "#FFFF66";
						document.all['qMSG'].innerHTML = message;			
						document.all['CheckCartCount'].innerHTML = total_qty;												
					} else if (document.layers){
						document.layers['qMSG'].style.display = "block";
						document.layers['qMSG'].style.backgroundColor = "#FFFF66";
						document.layers['qMSG'].innerHTML = message;
						document.layers['CheckCartCount'].innerHTML = total_qty;						
					} else if (document.getElementById){
						document.getElementById('qMSG').style.display = "block";
						document.getElementById('qMSG').style.backgroundColor = "#FFFF66";
						document.getElementById('qMSG').innerHTML = message;
						document.getElementById('CheckCartCount').innerHTML = total_qty;
					}
					
					document.quickForm.ProductSize.value="";
					setTimeout("quick_win_close('qMSG')",4000);
                }				else				{					if (document.all){
						document.all['qMSG'].style.display = "block";
						document.all['qMSG'].innerHTML = "We're sorry. Error";		
						document.all['CheckCartCount'].innerHTML = total_qty;												
					} else if (document.layers){
						document.layers['qMSG'].style.display = "block";
						document.layers['qMSG'].innerHTML = "We're sorry. Error";
						document.layers['CheckCartCount'].innerHTML = total_qty;						
					} else if (document.getElementById){
						document.getElementById('qMSG').style.display = "block";										document.getElementById('qMSG').innerHTML = "We're sorry. Error";
						document.getElementById('CheckCartCount').innerHTML = total_qty;
					}				
					setTimeout("quick_win_close('qMSG')",4000);									}                
            }        }        
		reqObj.send(null);
	}else
		return;
}

function quick_win_close(id){
	if (document.all){
		document.all[id].style.display = "none";
		document.all[id].style.backgroundColor = "#FFFFFF";											
	} else if (document.layers){
		document.layers[id].style.display = "none";
		document.layers[id].style.backgroundColor = "#FFFFFF";					
	} else if (document.getElementById){
		document.getElementById(id).style.display = "none";
		document.getElementById(id).style.backgroundColor = "#FFFFFF";
	}	
}

function quick_checkout()
{
	location.href = "/product/list_cart.asp";
	/*
	document.quickForm.DirectBuy.value = 1;
	document.quickForm.ProductNo.value = document.quickForm.ProductColorCode.value;
	document.quickForm.ProductColor.value = document.quickForm.ProductColorCode.options[document.quickForm.ProductColorCode.selectedIndex].text;

	if (document.quickForm.ProductSize.value=="READY") {alert("\nSorry, This product size is nothing");return;}	
	if (document.quickForm.ProductColor.value=="") {alert("\nPlease select a color");return;}	
	if (document.quickForm.ProductSize.value=="") {alert("\nPlease select a size");return;}

	document.quickForm.target = "_self"
	document.quickForm.action = "/product/put_cart.asp"
	document.quickForm.submit();
	*/
}

function quick_AddWishList(brandcode,groupno)
{
	document.quickForm.ProductNo.value = document.quickForm.ProductColorCode.value;
	document.quickForm.ProductColor.value = document.quickForm.ProductColorCode.options[document.quickForm.ProductColorCode.selectedIndex].text;
	
	if (document.quickForm.ProductSize.value=="READY") {alert("\nSorry, This product size is nothing");return;}	
	if (document.quickForm.ProductColor.value=="") {alert("\nPlease select a color");return;}	
	if (document.quickForm.ProductSize.value=="") {alert("\nPlease select a size");return;}
	
	this.location.href = "/product/create_wishlist.asp?popupEnable=1&BrandCode=" + brandcode + "&GroupNo=" + groupno + "&CodeSexNo=2&ProductNo=" + document.quickForm.ProductNo.value + "&Color=" + document.quickForm.ProductColor.value + "&Size=" + document.quickForm.ProductSize.value;	
}

function quick_ClickChangeProduct(val)
{
	document.quickForm.ProductColorCode.value = val;
	quick_ChangeProduct();
}

function quick_ChangeProduct()
{
	var val = document.quickForm.ProductColorCode.value;
	requrl='/product/quickView.asp?ajaxmode=1';
	requrl=requrl+'&ProductNo=' + val;
	requrl=requrl+'&rand='+Math.random();
	getAjaxData(requrl,objPO.objQuickView);	
}

function quick_ChangeProduct()
{
	var val = document.quickForm.ProductColorCode.value;
	requrl='/product/quickView.asp?ajaxmode=1';
	requrl=requrl+'&ProductNo=' + val;
	requrl=requrl+'&rand='+Math.random();
	getAjaxData(requrl,objPO.objQuickView);	
}

function quick_Clickimage(url)
{
   document.qLargeimage.src= url;
}

function popup_login()
{
	loginWindow  =  window.open('/member/login_popup.asp', 'loginPopup', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=200,top=150,left=150');
	loginWindow.opener = self;
}

function SizeButton(nIndex,nValue,nValue2)
{
	var obj = document.getElementsByName("sizeBtn")
//	var obj2 = document.getElementsByName("priceBtn")	
	
	for(i = 0;i <= obj.length - 1; i++)
	{
		obj[i].style.border = "1px solid #c6b7ae";
		obj[i].style.backgroundColor = "#FFFFFF";		
	}

	obj[nIndex].style.border = "3px solid #B6A295";
	obj[nIndex].style.backgroundColor = "#FFF8F3";

//	for(i = 0;i <= obj2.length - 1; i++)
//	{
//		obj2[i].style.fontWeight = "normal";
//	}
	
//	obj2[nIndex2].style.fontWeight = "bold";

//	document.getElementById("sizeBtn").style.border = "3px solid #B6A295";
//	document.getElementById("sizeBtn").style.backgroundColor = "#FFF8F3";

	document.quickForm.ProductPrice.value = nValue2;
	document.quickForm.ProductSize.value = nValue;
	document.quickForm.ProductPriceSelected.value = "\\" + PrintComma(nValue2);
}

function PrintComma(srcNumber)
{
	var txtNumber = '' + srcNumber;
	var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
	var arrNumber = txtNumber.split('.');
	arrNumber[0] += '.';
	do 
	{
		arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
	} while (rxSplit.test(arrNumber[0]));
	
	if (arrNumber.length > 1) 
	{
		return arrNumber.join('');
	}
	else 
	{
		return arrNumber[0].split('.')[0];
    }
}