
function swichImg(str_Img, str_Url){
	document.images[str_Img].src = str_Url;	
}
function create_window(w,h,url) 
{ var options = "width=" + w + ",height=" + h + ",status=no"; new_window = window.open(url, "new_window", options);}

function popUp(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
self.name = "mainWin";
}
function popUpXmas(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=515,height=530');
self.name = "mainWin";
}

function create_window_option(w,h,url) 
{ var options = "scrollbars=yes, resizable=yes, width=" + w + ",height=" + h + ",status=no"; new_window = window.open(url, "new_window", options);}

function Call_Submit(str_Method, str_Action){
	with(document.frmMyForm)
	{
		method=str_Method;
		action=str_Action;
		submit();
	}
}

function Call_SubmitEx(str_Method, str_Action, str_Form){
	with(document.forms[str_Form])
	{
		method=str_Method;
		action=str_Action;
		submit();
	}
}

function Execute_Search(int_Mode, str_RelatePath){
	with(document.frmSearch)
	{
		method = 'get';
		if (int_Mode == 1){
			action = str_RelatePath + 'search.asp';
		}else{
			action = str_RelatePath + 'search_bike_model.asp';
		}
		submit();
	}
}

function Execute_Logon(int_Mode, str_RelatePath){
	with(document.memberLogin)
	{
		method = 'post';
		action = str_RelatePath + 'account.asp';
		submit();
	}
}

function getBrowser(){
	ua = new Object();
	var useragent = navigator.userAgent;

	// ▽ Opera ==> ua.Opera
	if ( useragent.match( /Opera[\/\s](\d+\.\d+)/ ) && RegExp.$1 >= 6 ){ ua.Opera = RegExp.$1; return true; }

	// ▽ Internet Explorer ==> ua.InternetExplorer
	if ( useragent.match( /MSIE (\d+\.\d+);/ ) && RegExp.$1 >= 5 ){ ua.InternetExplorer = RegExp.$1; return true; }

	// ▽ Netscape6 ==> ua.Netscape
	if ( useragent.match( /Netscape6\/(\d+\.\d+)/ ) ){ ua.Netscape = RegExp.$1; return true; }

	// ▽ Mozilla ==> ua.Mozilla
	if ( useragent.match( /^Mozilla\/5\.0.+rv:(\d+\.\d+).+Gecko/ ) && RegExp.$1 >= 1 ){ ua.Mozilla = RegExp.$1; return true; }

	ua.other = 1; return false; 
}


function convertFull2Half( str ){ 
ua = new Object();
var useragent = navigator.userAgent;
	
	if( ua.InternetExplorer || ua.Opera ){ // ブラウザ判別部分 
		str = escape( str ); 
	} else if( ua.Netscape || ua.Mozilla ){ // ブラウザ判別部分 
		str = _convertAscii2Unicode( str ); 
	}

	var re_char = new Array();
	re_char['2018'] = '0060'; 
	re_char['2019'] = '0027'; 
	re_char['201D'] = '0022'; 
	re_char['3000'] = '0020';

	str = str.replace( /%uFFE5/g , '%u005c' );
	while( str.match( /%u([A-E1-9][A-F0-9]{3})/ ) )
	{
		if( re_char[ RegExp.$1 ] ){ 
			str = str.replace( /%u[A-E1-9][A-F0-9]{3}/ , "%u" + re_char[ RegExp.$1 ] ); 
		} 
		else { return false; } 
	}
	while( str.match( /%u(FF[A-F0-9]{2})/ ) )
	{ 
		str = str.replace( /%uFF[A-F0-9]{2}/ , "%u00" + ( ( "0x" + RegExp.$1 ).toString( 10 ) - 65248 ).toString( 16 ) );
	}


	if( ua.Netscape || ua.Mozilla ){ // ブラウザ判別部分 
		str = str.replace( /%u00/g , '%' ); 
	}
	return( unescape( str ) ); 
}

function _convertAscii2Unicode( str ){ // For Netscape and Mozilla 
	var new_str = "";
	for ( i = 0 ; i < str.length ; i++ ){ 
		var temp_char = str.charCodeAt( i ).toString( 16 ).toUpperCase();
		new_str += "%u";
		for( j = 0 ; j < ( 4 - temp_char.length ) ; j++ ){ new_str += "0"; }
		new_str += temp_char; 
	} 
	return( new_str ); 
} 


//Old popImage-----------------------------------------------------------------------
// Autosize pop-up
// Set the horizontal and vertical position for the popup

PositionX = 20;
PositionY = 30;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 600;
defaultHeight = 800;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

Scroll = "no";
if (screen.width < 1024){Scroll = "yes";}

var AutoClose = true;

// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
}
var optNN='scrollbars=' + Scroll + ',width='+ defaultWidth +',height='+ defaultHeight +',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=' + Scroll + ',width=' + defaultWidth + ',height=' + defaultHeight + ',left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Loading...</title><style>body{margin:0px;padding:0px;}</style>');writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');
	writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');
	writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');	
	writeln('function reSizeToImage(){');
	writeln('moveTo(0,0);');
	writeln('if (isIE){');
	writeln('window.resizeTo(100,100);');
	writeln('width=100-(document.body.clientWidth-document.images[0].width) + 10;');
	writeln('if (screen.height < 100-(document.body.clientHeight-document.images[0].height)){height = screen.height; Scroll = "yes";}');
	writeln('else{height=100-(document.body.clientHeight-document.images[0].height); Scroll = "no";}');
	//writeln('height=100-(document.body.clientHeight-document.images[0].height) ;');
	writeln('window.resizeTo(width,height);}');
	writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["George"].width;');
	writeln('window.innerHeight=document.images["George"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');
	writeln('</sc'+'ript>');
	if (!AutoClose) writeln('</head><body bgcolor="#ffffff" scroll="' + Scroll + '" onload="reSizeToImage();doTitle();self.focus()">')
	else writeln('</head><body bgcolor="#ffffff" scroll="' + Scroll + '" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	writeln('<img name="George" src='+imageURL+' style="display:block" border=0></body></html>');
	close();
	}
}

//New popImage()-------------------------------------------------------------------------------
// Autosize pop-up
PositionX = 10;

PositionY = 10;

defaultWidth = 600;

defaultHeight = 400;

var AutoClose = true;

function popImage(imageURL,imageTitle){

var imgWin = window.open('','_blank','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);

if( !imgWin ) { return true; } //popup blockers should not cause errors

imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><script type="text\/javascript">\n'+
'function resizeWinTo() {\n'+
'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
'var oH = document.images[0].height, oW = document.images[0].width;\n'+
'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
'window.doneAlready = true;\n'+ //for Safari and Opera
'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
'x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+
'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
//'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
'if( !window.opera ) { x.moveTo(0,0); }\n'+
'}\n'+
'<\/script>'+
'<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+

(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;display:table;">'))+

'<img src='+imageURL+' alt="Loading image ..." title="" onload="resizeWinTo();">'+

(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');

imgWin.document.close();

}
