﻿// -------------------------------------------------------------------------
//
// 2011/03/28 Sukwoo Kim  ( 1) 일본리뉴얼. 메소드추가
//---------------------------------------------------------------------------

function viewFlash(sURL, sName, sFeatures)
{
   var FLASHCAB = "https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab";
   var FLASHCID = "CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000";
   var FLASHVER = "6,0,29,0";

   var sFeature;
   var sWidth  = "100%";
   var sHeight  = "100%";
   var pmBoolean = "false";
   var sTempArray;
   var sParamTag = "";

   sFeature = sFeatures.split(/\s*,\s*/);
   for (var i=0; i< sFeature.length ; i++)
   { 
      sTempArray = sFeature[i].split(/\s*=\s*/);
      if (sTempArray[0].toLowerCase() == "width")
      { 
         sWidth = sTempArray[1]; 
      }
      else if (sTempArray[0].toLowerCase() == "height")
      {
         sHeight = sTempArray[1]; 
      }
      else
      {
         if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true")
         {
            pmBoolean = "true";
         }
         else if (sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false")
         {
            pmBoolean = "false";
         }
         else
         {
            pmBoolean = sTempArray[1];
         } 
         sParamTag = "<param name='" + sTempArray[0] + "'value='" + pmBoolean + "'>\n" + sParamTag;
      } 
   } 
   document.write("<object vmode='transparent' id='" + sName + "' name='" + sName + "' classid='" + FLASHCID + "' codebase='" + FLASHCAB + "#version=" + FLASHVER + "' width='" + sWidth + "' height='" + sHeight+"'>");
   document.write("<param name='movie' value='" + sURL + "'>"); 
   document.write("<param name='wmode' value='transparent'>"); 
   document.write(sParamTag); 
   document.write("<embed wmode='transparent' src='" + sURL + "' menu='false' width='" + sWidth + "' height='" + sHeight + "' id='" + sName + "' name='" + sName + "' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />") 
   document.write("</object>"); 
}
function popUp(Title, Url, Width, Height, Left, Top, CenterYN)
{
   var X = parseInt(((document.body.clientWidth) / 2) - (Width / 2));
   var Y = ((document.body.clientHeight) / 2) - (Height / 2) + 100;
   if (CenterYN == "N")
   {
      X = Left;
      Y = Top;
   }
   var Config = "toolbar=no,directories=no,menubar=no,titlebar=no,status=no,scrollbars=no,width=" + Width + ",height=" + Height + ",left=" + X + ",top=" + Y;
   window.open(Url, Title, Config);
}
// ( 1)
function WishListPopUp(Title, Url, Width, Height, Left, Top, CenterYN)
{
   var X = ((document.body.clientWidth) / 2) - (Width / 2);
   var Y = ((document.body.clientHeight) / 2) - (Height / 2) + 100;
   if (CenterYN == "N")
   {
      X = Left;
      Y = Top;
   }
   config = "toolbar=no,directories=no,menubar=no,titlebar=no,status=no,scrollbars=yes,width=" + Width + ",height=" + Height + ",left=" + X + ",top=" + Y;
   parent.parent.window.open(Url, Title, config);
}
function setCookie(Name, Value, Expiredays)
{ 	
	var todayDate = new Date();
	var tmpDay = new Date(todayDate.getYear(),todayDate.getMonth(),todayDate.getDate()+Expiredays);
	document.cookie = Name + "=" + escape(Value) + "; path=/; expires=" + tmpDay.toGMTString() + ";"
}
function getCookie(Name)
{
	var nameOfCookie = Name + "=";
	var X = 0;
	while ( X <= document.cookie.length )
	{
		var Y = (X + nameOfCookie.length);
		if ( document.cookie.substring(X, Y) == nameOfCookie )
		{
			if ( (endOfCookie=document.cookie.indexOf( ";", Y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( Y, endOfCookie ) );
		}
		X = document.cookie.indexOf( " ", X ) + 1;
		if ( X == 0 )
			break;
	}
	return "";
}
function randNumber(N)
{
   var X;
   X = Math.round(Math.random()*100);
   X %= N;
   return X;
}
function CheckNumber(val)
{
    for(i = 0; i < val.length; i++)
    {
        if(val.charCodeAt(i) <= 47 || val.charCodeAt(i) >= 58)
            return false;
    }
    return true;
}
function emailReject()
{
   var browsertype = browserType();
   if(browsertype == "3")
      popUp("登録解除", "/Common/UnSubscribe.aspx", 400, 300, 0, 0, "N");
   else
      popUp("登録解除", "/Common/UnSubscribe.aspx", 400, 300, 0, 0, "Y");
}

function popupnews(idx)
{
   var X = ((document.body.clientWidth) / 2) - (550 / 2);
   var Y = ((document.body.clientHeight) / 2) - (250 / 2) + 50;
   var browsertype = browserType();
   if(browsertype == "3") 
   {
      X=0;
      Y=0;
   }
   config = "toolbar=no,directories=no,menubar=no,titlebar=no,status=no,scrollbars=yes,width=550,height=250,left=" + X + ",top=" + Y;
   window.open("/Etc/popupNews.aspx?idx="+idx, "ZipCode", config);   
}


function openLink()
{   
   var UrlInfo = document.getElementById("sUrlInfo");
   var UrlAddress = UrlInfo.options[UrlInfo.selectedIndex].value;
   var X = ((document.body.clientWidth) / 2) - (1024 / 2);
   var Y = ((document.body.clientHeight) / 2) - (768 / 2);
   var Config = "toolbar=yes,directories=yes,menubar=yes,titlebar=yes,status=yes,scrollbars=yes,width=1024,height=768,left=" + X + ",top=" + Y;
   if (UrlAddress != "")
      window.open(UrlAddress, "Forever21", Config);
} 
function browserType()
{
   var appname = navigator.appName;
   var useragent = navigator.userAgent;
   var browsertype; //1:IE, 2:FF, 3:SF
   if(useragent.toLowerCase().indexOf("firefox") != -1)
      browsertype = "2";
   else if(useragent.toLowerCase().indexOf("safari") != -1)
      browsertype = "3";
   else
      browsertype = "1";
   return browsertype;
}
function CheckInch(val)
{
    for(i=0;i<val.length;i++)
    {
        if((val.charCodeAt(i) != 46) && (val.charCodeAt(i) <= 47 || val.charCodeAt(i) >= 58))
            return false;
    }
    return true;
}
function ConvertCm()
{

   var tInch = document.getElementById("txtinch");
   var tCm = document.getElementById("txtcm");
   if(!CheckInch(tInch.value))
   {
      alert("数字のみ入力可能です。");
      tInch.focus();
      tInch.select();
      return false;
   }
   else
   {
      var num = tInch.value * 2.54;
      num.toFixed(1);
      tCm.value = num.toFixed(1);
      return true;
   }
}
function PopUpViewImg(Title, Url, Width, Height, Left, Top, CenterYN) {
    var X = ((document.body.clientWidth) / 2) - (Width / 2);
    var Y = ((document.body.clientHeight) / 2) - (Height / 2) + 100;
    if (CenterYN == "N") {
        X = Left;
        Y = Top;
    }
    config = "toolbar=no,directories=yes,menubar=no,titlebar=yes,status=no,scrollbars=yes,width=" + Width + ",height=" + Height + ",left=" + X + ",top=" + Y;
    window.open(Url, Title, config);
}


