var w = window;
function openwin(htm) {
	var wndname = "nwnd";
	os = navigator.platform;
	app = navigator.appName.charAt(0);
	//if( app != "N")   wndname = "_blank";
	if (w == window) {
		w = open(htm,wndname);
	}else{
		if (w.closed == true) {
			w = open(htm,wndname);
		}else{
			if( app == "N" ) {
				//if (os.indexOf("Mac") < 0)    w.close();
				w = open(htm,wndname);
			} else {
				//if (os.indexOf("Mac") >= 0) {
					//w.close();
					w = open(htm,wndname);
				//} else if( htm != w.location.href && htm != (w.location.pathname + w.location.search) ) {
					//alert("href:" + w.location.href + "\nhtm :" +
						//htm + "\npathname:" + w.location.pathname +
						//"\nsearch:" + w.location.search);
					//w.location.assign(htm);
					//w.location.replace(htm);
					//w.location.reload();
				//}
				w.focus();
			}
		}
	}
	if( app == "N" )    w.focus();
}

function wincache(htm) {
    var sys_date = new Date();
    var year   = sys_date.getYear();
    var month = sys_date.getMonth() + 1;
    var date = sys_date.getDate();
    var hours   = sys_date.getHours();
    var minutes = sys_date.getMinutes();
    var seconds = sys_date.getSeconds();
    var datetime =  String(year) + String(month) + String(date) + String(hours) + String(minutes) + String(seconds);

    htm = htm + "?now=" + datetime;
    w.location.href = htm;
    return false;
}

function winback() {
  os = navigator.platform;
  ver = navigator.appVersion.charAt(0);
  app = navigator.appName.charAt(0);

  // for safari
  var VarUsrAgt = navigator.userAgent.toLowerCase();

  if (app == "M" && os.indexOf("Mac") >= 0) {
	if( location.hostname.indexOf("siyaku.com") ) {
    	location.href = "http://www.siyaku.com/";
	} else {
    	location.href = "/";
	}
  } else {
    if (VarUsrAgt.indexOf("safari") != -1) {
        window.history.back();
    } else {
        if (app == "N" && ver >= 4) {
            window.back();
        } else {
            history.back();
        }
    }
  }
  return false;
}

function winback2(num) {
  os = navigator.platform;
  app = navigator.appName.charAt(0);
  if (app == "M" && os.indexOf("Mac") >= 0) {
	if( location.hostname.indexOf("siyaku.com") ) {
    	location.href = "http://www.siyaku.com/";
	} else {
    	location.href = "/";
	}
  } else {
    history.go(num);
  }
  return false;
}

function chkVersion(version) {
  ver = navigator.appVersion;
  app = navigator.appName.charAt(0);
  if (ver.charAt(0) < version) {
    msg = "Your browser cannot show this page \n" +
      "Netscape Navigator ver." + version + " or up\n" +
      "Internet Explorer  ver." + version + " or up";
    alert(msg);
    winback();
  } else if( app == 'N' && ver.charAt(0) == version && ver.substr(2,1) < '5' ) {
    msg = "Your browser cannot show this page \n" +
      "Netscape Navigator ver." + version + ".5 or up\n";
    alert(msg);
    winback();
  }
// 2003.05.21 naruse add start
  if(getCookie_wjs("EXECMODE") != '1'){
  	if(getCookie_wjs("SITE") == 'cxml'){
  	} else {
//  		if(self !=top){
//  			top.location.href = self.location.href;
//  		}
  	}
  }
// 2003.05.21 naruse add end
  return true;
}
// 2003.05.21 naruse add start
function setTarget(obj){
  	if(getCookie_wjs("SITE") == 'cxml'){
	} else {
//		obj.target="_top";
	}
}

function getCookie_wjs (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal_wjs (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}
function getCookieVal_wjs (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

// 2003.05.21 naruse add end
var wnd = window;
function popUp(htm, width, height) {
	var wndname = "WndPopUp";
	var sizebuf = "";
	os = navigator.platform;
  	app = navigator.appName.charAt(0);
	//if( app != "N")	wndname = "_blank";
	if( width > 0 )	sizebuf = ",width=" + width;
	if( height > 0 )	sizebuf = sizebuf + ",height=" + height;
	if (wnd == window) {
		wnd = open(htm,wndname,"scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no" + sizebuf);
	}else{
		if (wnd.closed == true) {
			wnd = open(htm,wndname,"scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no" + sizebuf);
		}else{
			if( app == "N" ) {
				if (os.indexOf("Mac") < 0)	wnd.close();
				wnd = open(htm,wndname,"scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no" + sizebuf);
			} else {
				//if (os.indexOf("Mac") >= 0) {
					//wnd.close();
					wnd = open(htm,wndname,"scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no" + sizebuf);
				//} else if( htm != wnd.location.href && htm != (wnd.location.pathname + wnd.location.search) ) {
					//alert("href:" + wnd.location.href + "\nhtm :" +
						//htm + "\npathname:" + wnd.location.pathname +
						//"\nsearch:" + wnd.location.search);
					//wnd.location.assign(htm);
					//wnd.location.replace(htm);
					//if( width > 0 && height > 0 )	wnd.resizeTo(width, height);
					//wnd.location.reload();
				//}
				wnd.focus();
			}
		}
	}
	if( app == "N" )	wnd.focus();
}
function cartPopup(url){
	var condition = "";
	condition += "width=888";
	condition += ",height=538";
	condition += ",location=no";
	condition += ",menubar=no";
	condition += ",toolbar=no";
	condition += ",resizable=yes";
	condition += ",scrollbars=yes";
	condition += ",status=yes";
	condition += ",left=0";
	condition += ",top=0";
	
	if(url != "" ){
		window.open(url,'shoppingcart',condition);
	}
}