

/*
   ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┓
   ┃     JavaScript File                                ┃
   ┃                                                    ┃
   ┃     Author  : transcosmos inc.                     ┃
   ┃     Version : 1.5 ( Aug 2006 )                     ┃
   ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┛
*/






// ########## Delete Error Message
// ########## 2003.08.09
function HideError(){
	return true;
}
//window.onerror = HideError;



// ########## OS,Browser Info
// ########## 2003.08.09
var ua  = navigator.userAgent.toLowerCase();
var mie = (navigator.appName.indexOf('Micr') != -1);
var ns4 = (document.layers);
var opr = (navigator.userAgent.indexOf("Opera") != -1);
var gck = (navigator.userAgent.indexOf("Gecko") != -1);
var mac = (ua.indexOf('mac') != -1);
var win = (ua.indexOf('win') != -1);



// ########## Netscape 4.x Reload Bug Patch
// ########## 2003.08.09
function N4_Reload(init) {
	if (init==true) with (navigator) {
		if (ns4) {
			document.N4_pgW = innerWidth;
			document.N4_pgH = innerHeight;
			onresize = N4_Reload;
		}
	} else if (innerWidth != document.N4_pgW || innerHeight != document.N4_pgH) location.reload();
}
N4_Reload(true);



// ########## images PreLoad
// ########## 2003.08.09
function PreLoad() {
	var d = document;
	if(d.images){
		if(!d.My_IMG) d.My_IMG = new Array();
		var i , j = d.My_IMG.length , a = PreLoad.arguments;
		for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){
			d.My_IMG[j] = new Image;
			d.My_IMG[j++].src = a[i];
		}
	}
}



// ########## Get Object
// ########## 2003.08.09
function GetObj(n, d) {
	var p,i,x;
	if(!d) d = document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d = parent.frames[n.substring(p+1)].document;
		n = n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x = d.all[n];
	for(i=0; !x&&i<d.forms.length; i++) x = d.forms[i][n];
	for(i=0; !x&&d.layers&&i<d.layers.length; i++) x = GetObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}



// ########## Swap image
// ########## 2003.08.09
function ChgIMG() {
	var i , j = 0 , x , a = ChgIMG.arguments;
	document.My_sr = new Array;
	for(i=0; i<(a.length-2); i+=3) if ((x=GetObj(a[i]))!=null){
		document.My_sr[j++] = x;
		if(!x.oSrc) x.oSrc = x.src;
		x.src = a[i+2];
	}
}



// ########## Reset image
// ########## 2003.08.09
function ResetIMG() {
	var i , x , a = document.My_sr;
	for(i=0; a&&i<a.length&&(x=a[i])&&x.oSrc; i++) x.src = x.oSrc;
}



// ########## PullDown Menu Link
// ########## 2003.08.09
function JumpMenu(targ,selObj,restore){
	JumpLink = selObj.options[selObj.selectedIndex].value;
	if(JumpLink != "-"){
		if((JumpLink.indexOf('http:')== 0)||(JumpLink.indexOf('https:')== 0)){
			window.open(JumpLink,'_blank');
		}else{
			eval(targ + ".location='" + JumpLink + "'");
		}
	}
	if (restore) selObj.selectedIndex = 0;
}



// ########## Sub Window Open
// ########## 2003.08.09
function WinOpen(URL,WN,F) {
	if(sbwin_closed(window.WN)){
		newwin = window.open(URL,WN,F);
		newwin.focus();
	}else{
		newwin.location.href = URL;
		newwin.focus();
	}
}
function sbwin_closed(winVar) {
	var ua = navigator.userAgent;
	if( !!winVar ){
		if( gck || ( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1 ) ) return winVar.closed;
		else return typeof winVar.document != 'object';
	}else return true;
}



// ########## Switch Layer
// ########## 2003.08.09
function SHLayer() {
	var i,p,v,obj,args = SHLayer.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=GetObj(args[i]))!=null) {
		v = args[i+2];
		if (obj.style) {
			obj = obj.style;
			v = (v=='show')?'visible':(v=='hide')?'hidden':v;
		}
		obj.visibility=v;
	}
}



// ########## Page Top Scroll
// ########## 2003.08.09
function getScroll(){
	var x, y;
	if(mie){
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}else if(document.layers !== void 0 || (navigator.userAgent.indexOf("Opera") !== -1 || window.opera !== void 0)){
		x = window.pageXOffset;
		y = window.pageYOffset;
	}else if(navigator.userAgent.indexOf("Gecko") != -1){
		x = window.scrollX;
		y = window.scrollY;
	}else{
		x = y = 0;
	}
	return {x: x, y: y};
}
var SCROLL ;
var divCountScroller = 50 ;
function scroller( x, y, edging, count ){
	if( count === void 0 ){
		count = 0 ;
		SCROLL = getScroll();
	}
	if( count++ < divCountScroller ){
		var c = count/divCountScroller ;
		var nx = SCROLL.x+( x-SCROLL.x )*( c+edging/(100*Math.PI)*Math.sin( Math.PI*c ) );
		var ny = SCROLL.y+( y-SCROLL.y )*( c+edging/(100*Math.PI)*Math.sin( Math.PI*c ) );
		window.scrollTo( nx, ny );
		setTimeout( "scroller("+x+","+y+","+edging+","+count+");", 1 );
	}
}



// ########## Put NEW mark (for Product List)
// ########## 2007.03.30
function list_new(DelDate,PutDate) {
	DELday = new Date(DelDate);
	NOWday = new Date();
	d = (DELday - NOWday) / (1000 * 24 * 3600);
	if(0 <= d) {
		document.write('<p class="li-new">',PutDate,'</p>');
	}
}
// ########## Put NEW mark (for Product Detail)
// ########## 2007.03.30
function full_new(DelDate,PutDate) {
	DELday = new Date(DelDate);
	NOWday = new Date();
	d = (DELday - NOWday) / (1000 * 24 * 3600);
	if(0 <= d) {
		document.write('<p class="li-new">',PutDate,'　発売</p>');
	}
}



// ########## Check URL (replace HTTP by HTTPS)
// ########## 2005.11.30
// function ChkURL() {
//	docU = document.URL;
//	docP = location.protocol;
//	Arr1 = docU.split("://");
//	Arr2 = Arr1.join("s://");
//	if(docP == "file:"){
//	}else if (docP == "https:"){
//	}else if (docP == "http:"){
//		location.replace(Arr2);
//	}
// }



// ########## Open Quotation Window
// ########## 2006.10.12
function OpenQuotation() {
	WinOpen('','quotation','width=680,height=600,location=no,toolbar=no,status=no,resizable=yes,scrollbars=yes');
}


// ########## quote HTML Open Window (Modified by CTC)
// ########## 2007.1.12  New Creation
// ########## 2007.1.22  Add WinOpen
// ########## 2008.6.25  Mod for .com
function request(){
	//URL生成
	var url = "http://www.kao.com/html-webapp/do"
		+ "?param1=" + "http://www.kao.com"
//		+ "&param2=" + document.msgItem.param1.value
		+ "&param3=" + document.msgItem.param2.value
		+ "&param4=" + document.msgItem.param3.value
		+ "&param5=" + document.msgItem.param4.value
		+ "&param6=" + document.msgItem.param5.value
		+ "&param7=" + "kao_jp_ja"
		+ "&param8=" + "/jp";

	//小窓OPEN
//	window.open(url);  
	WinOpen(url,'quotation','width=680,height=600,location=no,toolbar=no,status=no,resizable=yes,scrollbars=yes');

}


// ########## quote HTML Open Window (Modified by CTC)
// ########## 2009.1.09  New Creation
function request_r(){
	//URL生成
	var url = "http://www.kao.com/html-webapp/htmlJsp/recipe.jsp"
		+ "?domain=" + "http://www.kao.com"
		+ "&path=" + document.msgItem.param1.value;

	//小窓OPEN
	WinOpen(url,'quotation','width=680,height=600,location=yes,toolbar=yes,status=no,resizable=yes,scrollbars=yes');
}


// E N D
