LCB_version = 3.1;
_dom = document.all?(document.getElementById?2:1):(document.getElementById?4:(document.layers?3:0));

// ----------------------------------------
// Debug
// ----------------------------------------
function debugMes(str)
{
}

// ================================================================
//
// Object cmn
//
// ================================================================

// ----------------------------------------
// Array
if(!Array.prototype.push){
	Array.prototype.push = function(arg1){
		this[this.length] = arg1;
	}
}

// ----------------------------------------
// Position
function Position(x,y){
	this.x = x - 0;
	this.y = y - 0;
}
Position.prototype.set = function(x,y)
{
	this.x = x - 0;
	this.y = y - 0;
}
Position.prototype.toString = function()
{
	return '';
}

// ----------------------------------------
// Size
function Size(x,y){
  this.width	= x ? x - 0: 0;
  this.height	= y ? y - 0: 0;
}
Size.prototype.set = function( width, height )
{
	this.width  = width - 0;
	this.height = height - 0;
}
Size.prototype.toString = function()
{
	return '';
}

// ================================================================
//
// jQuery
//
// ================================================================

function xGetJQById(e, thisDocument)
{
	return _xGetJQ( e, thisDocument, '#');
}

function xGetJQByClass(e, thisDocument)
{
	return _xGetJQ( e, thisDocument, '.');
}

function _xGetJQ(e, thisDocument, jqstr)
{
	thisDocument = xThisDocument( thisDocument );
	if(typeof(e)!='string'){
		return $(e);
	}else{
		if( e.match(/^[\.\#]/) ){
			return $(thisDocument).find(e);
		}else{
			return $(thisDocument).find( jqstr + e);
		}
	}
}

// ================================================================
//
// Object prototypes
//
// ================================================================

function baseLang(){}

baseLang.prototype.addLangMesTbl = function(tbl, type)
{
	if( this.list_langmes == null ){ this.list_langmes = new Array(); };

	var obj_mes = new Object;
	obj_mes.tbl	 = tbl;
	obj_mes.type = type || 'cmn';

	this.list_langmes.push( obj_mes );
}

baseLang.prototype.getLangMesObj = function(type)
{
	if( !type ){ type = 'cmn'};
	for( var i = 0; i < this.list_langmes.length; i++ ){
		if( this.list_langmes[i].type == type ){
			return this.list_langmes[i];
		}
	}
	return null;
}

baseLang.prototype.getLangMes = function( mes, type, lang )
{
	if( !lang ){ lang = this.lang; };
	if( !lang ){ lang = 'en'; };

	var obj_mes = this.getLangMesObj(type)
	if( obj_mes ){
		if( 	obj_mes.tbl[lang]
			&&	obj_mes.tbl[lang][mes]
		){
			return obj_mes.tbl[lang][mes];
		}

		if( 	obj_mes.tbl['en']
			&&	obj_mes.tbl['en'][mes]
		){
			return obj_mes.tbl['en'][mes];
		}
	}
	return '';
}

// ================================================================
//
// Event Handler
//
// ================================================================

function JMap2EventHandler(thisObj, eventName, arg2, arg3, arg4, arg5)
{
	var thisObj2 = thisObj;
	thisObj = null;

	return function( thisEvent ){
		if( !thisEvent ){
			thisEvent = window.event;
		}
		if( thisEvent && !thisEvent.target){
			thisEvent.target = thisEvent.srcElement;
		}
		thisObj2[eventName](thisEvent, arg2, arg3, arg4, arg5)
	}
}

function JMap2AttachEvent(ra,w,Rb)
{
	$(ra).bind( w, Rb );
}

function JMap2DetachEvent(ra,w,Rb){
	$(ra).unbind( w, Rb );
}

function JMap2CancelBubble(b)
{
	if( obj_browser.browser == 'ie' ){
		window.event.cancelBubble=true
	}else{
		b.cancelBubble=true;
		b.preventDefault();
		b.stopPropagation()
	}
}

// ================================================================
//
// getElementsByClassName(className, tagName, parentElement)
//
// ================================================================
function getElementsByClassName(className, tagName, parentElement)
{
	tagName			= tagName || "*";
	parentElement	= parentElement || document;
	var elements	= new Array();
	var regExp		= new RegExp('(^|\\s)' + className + '(\\s|$)');
	var element		= parentElement.getElementsByTagName(tagName);

	for (var i=0, n=element.length; i<n; i++){
		if(regExp.test(element[i].className)){
			elements.push(element[i]);
		}
	}

	return elements;
}

// ================================================================
//
// xFunctions
//
// ================================================================
function xThisDocument( thisDocument )
{
	return thisDocument ? thisDocument : window.document;
}

function xDef()
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}
function xStr(s)
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])!='string') return false;}
  return true;
}
function xNum()
{
  for(var i=0; i<arguments.length; ++i){if(isNaN(arguments[i]) || typeof(arguments[i])!='number') return false;}
  return true;
}
function xDefNum( num )
{
	return num - 0;
}

// xGetElementById
function xGetElementById(e, thisDocument)
{
//  thisDocument = xThisDocument( thisDocument );
//
//  if(typeof(e)!='string') return e;
//  if(thisDocument.getElementById) e=thisDocument.getElementById(e);
//  else if(thisDocument.all) e=thisDocument.all[e];
//  else e=null;
//  return e;

	thisDocument = xThisDocument( thisDocument );
	if(typeof(e)!='string') return e;
	return $(thisDocument).find('#' + e).get(0);
}

// xPagePos
function xPageX(e)
{
	return xGetJQById(e).offset().left;
}
function xPageY(e)
{
	return xGetJQById(e).offset().top;
}

//function xPageX(e)
//{
//  if (!(e=xGetElementById(e))) return 0;
//  var x = 0;
//  while (e) {
//    if (xDef(e.offsetLeft)) x += e.offsetLeft;
//    e = xDef(e.offsetParent) ? e.offsetParent : null;
//  }
//  return x;
//}
//function xPageY(e)
//{
//  if (!(e=xGetElementById(e))) return 0;
//  var y = 0;
//  while (e) {
//    if (xDef(e.offsetTop)) y += e.offsetTop;
//    e = xDef(e.offsetParent) ? e.offsetParent : null;
//  }
//  return y;
//}

// xInnerHtml
function xInnerHtml(e,h)
{
	if(e){
		$(e).html(h);
	}
}

// xEvent
function xEvent(evt)
{
	var e = evt || window.event;

	if(!e) return;

	if(e.type) this.type = e.type;

	if(e.target)
		this.target = e.target;
	else if(e.srcElement)
		this.target = e.srcElement;

	if (e.keyCode) {
		this.keyCode = e.keyCode;
	}else if (xDef(e.which) && e.type.indexOf('key')!=-1) {
		this.keyCode = e.which;
	}

	this.shiftKey	= e.shiftKey;
	this.ctrlKey	= e.ctrlKey;
	this.altKey		= e.altKey;
}

// createDiv
function xCreateDiv( thisDocument )
{
	thisDocument = xThisDocument( thisDocument );
	return thisDocument.createElement("div");
}

// createIFrame
function xCreateIFrame( thisDocument )
{
	thisDocument = xThisDocument( thisDocument );
	return thisDocument.createElement("iframe");
}
// getIFrameHtml
function getIFrameHtml( src, iframeId )
{
	return "<div><IFRAME id='" + iframeId + "' name='" + iframeId + "' src='" + src + "'></IFRAME></div>";
}

function xScrollTop(e, bWin)
{
	return $("body").scrollTop() || $("html").scrollTop();
}

function xScrollMoveDivTop(div, num)
{
	if( xDef(div) ){
		div.scrollTop = num;
	}
}

function xScrollLeft(e, bWin)
{
	return $("body").scrollLeft() || $("html").scrollLeft();
}

function xScrollTo( x, y, e, bWin)
{
	if( !e ){ e = "body, html"; }
	$(e).scrollTop(y);
	$(e).scrollLeft(x);
}

function xClientWidth()
{
	return $(window).width();
}

function xClientHeight()
{
	return $(window).height();
}

// ================================================================
//
// Libs
//
// ================================================================

function never()
{
  return false
}

function getListArgs( arguments )
{
	var list = new Array();
	for (var i = 0; i < arguments.length; i++) {
		list[i] = arguments[i];
	}
	return list;
}

function getCopyArray( list )
{
	var list_new = new Array();
	for (var i = 0; i < list.length; i++) {
		list_new[i] = list[i];
	}
	return list_new;
}

function delSpaceTab(str)
{
	str = str.replace(/[\t\s]/g,"");
	str = str.replace(/[　]/g,"");
	return str;
}

function toHankakuSpace(str)
{
	str = str.replace(/　/g, ' ');
	return str;
}

function strToInt(str)
{
	str = str.replace(/０/g,"0");
	str = str.replace(/１/g,"1");
	str = str.replace(/２/g,"2");
	str = str.replace(/３/g,"3");
	str = str.replace(/４/g,"4");
	str = str.replace(/５/g,"5");
	str = str.replace(/６/g,"6");
	str = str.replace(/７/g,"7");
	str = str.replace(/８/g,"8");
	str = str.replace(/９/g,"9");
	str = str.replace(/．/g,".");
	str = str.replace(/ー/g,"-");
	str = str.replace(/－/g,"-");

	return str;
}

function strLen(str)
{
   len = 0;
   str = escape(str);
   for (i = 0; i < str.length; i++, len++) {
      if (str.charAt(i) == "%") {
         if (str.charAt(++i) == "u") {
            i += 3;
            len++;
         }
         i++;
      }
   }
   return len;
}

function revBool(bool)
{
	if( bool == false ){
		return true;
	}else{
		return false;
	}
}

// isNull
function isNull(str)
{
	if(str == "" || !str){
		return true;
	}
	if( str.match(/[\n\s　]/) ){
		if( str.match(/[^\n\s　]/) ){
			return false;
		}else{
			return true;
		}
	}

	return false;;
}
function isNotNull(str)
{
	return revBool( isNull(str) );
}

// isIdPass
function isIdPass(str)
{
	if( str.match(/[^a-zA-Z0-9]/) ){
        return false;
	}else{
		return true;
	}
}
function isNotIdPass(str)
{
	return revBool( isIdPass(str) );
}

// isRoman
function isRoman(str)
{
	if( str.match(/[^a-zA-Z0-9\-\_\s　]/) ){
        return false;
	}else{
		return true;
	}
}
function isNotRoman(str)
{
	return revBool( isRoman(str) );
}

// isNum
function isNum(str)
{
	if(	isNull(str) || (str.match(/[^0-9\.]/)) ){
		return false;
	}else{
		return true;
	}
}
function isNotNum(str)
{
	return revBool( isNum(str) );
}

// isEmail
function isEmail(str)
{
	if(		isNull(str)								// 未入力チェック
		||  (str.match(/[^a-zA-Z0-9\.@\-_]/))		// 特殊文字確認
		||	(str.match(/[\-\._@]$/) )				// 特殊文字が最後にきていないか確認
		||	(!str.match(/@/))						// @マークの存在を確認
		||	(str.match(/@[a-zA-Z0-9\.@\-_]*@/) )	// @マークの２度入力確認
		||	(str.match(/ /) )						// スペースが含まれていないか確認
		||	(!str.match(/\./) )						// .の有無を確認
	){
		return false;
	}else{
		return true;
	}
}
function isNotEmail(str)
{
	return revBool( isEmail(str) );
}
// incl
function checkListExistKey(list, str)
{
	for( var i = 0; i < list.length; i ++ ){
		var value = list[i];
		if( value == str ){
			return true;
		}
	}

	return false;
}

// ================================================================
//
// Div
//
// ================================================================

// -------------------------------
// pos
function initDivPos(div)
{
  if(_dom==4){
    div.style.left=div.offsetLeft+'px';
    div.style.top =div.offsetTop +'px';
  } else if(_dom==2 || _dom==1){
    div.style.pixelLeft=div.offsetLeft;
    div.style.pixelTop =div.offsetTop;
  }
	return div;
}
function setDivPosXY( div, x, y )
{
	setDivPosX( div, x );
	setDivPosY( div, y );
}
function setDivPosX( div, x )
{
	$(div).css('left', x + 'px');
}
function setDivPosY( div, y )
{
	$(div).css('top', y + 'px');
}
function setDivPos( div, objPos )
{
	setDivPosXY( div, objPos.x, objPos.y );
}
// -------------------------------
// size
function initDivSize(div)
{
	if(_dom==4){
//		div.style.width  = div.offsetWidth +'px';
//		div.style.height = div.offsetHeight+'px';
	} else if(_dom==2 || _dom==1){
		div.style.pixelWidth  = div.offsetWidth;
		div.style.pixelHeight = div.offsetHeight;
	}

//	if(_dom==2 || _dom==1){
//		div.style.pixelWidth  = div.offsetWidth;
//		div.style.pixelHeight = div.offsetHeight;
//	}

	return div;
}

function getDivWidth (div){
	return $(div).width();
}
function getDivHeight(div){
	return $(div).height();
}
function getDivSize(div)
{
	initDivSize(div);
	return new Size( getDivWidth(div), getDivHeight(div) );
}
function setDivSizeW( div, width )
{
	$(div).width(width + 'px');
}
function setDivSizeH( div, height )
{
	$(div).height(height + 'px');
}
function setDivSizeWH( div, width, height )
{
	setDivSizeW( div, width );
	setDivSizeH( div, height );
}
function setDivSize( div, objSize )
{
	setDivSizeW( div, objSize.width );
	setDivSizeH( div, objSize.height );
}

// z-index
function setDivZindex( div, zIndex )
{
	if(div){$(div).css('zIndex', zIndex);}
}

// -------------------------------
// show, hide
function showDiv(div)
{
	if(div){$(div).css('visibility', 'visible');}
}
function showDivBlock(div)
{
	if(div){$(div).css('display', 'block');}
}
function hideDiv(div)
{
	if(div){$(div).css('visibility', 'hidden');}
}
function hideDivBlock(div)
{
	if(div){$(div).css('display', 'none');}
}

// ================================================================
//
// Browser
//
// ================================================================
function xBrowser()
{
	var agent	= navigator.userAgent.toLowerCase();
	var appName = navigator.appName.toLowerCase();

	this.browser		 = "";
	this.bool_mozilla	 = null;
	this.browser_version = 0;
	this.os				 = "";

	if( agent.indexOf("opera") != -1 ){
		this.browser = 'opera';
	}else if( agent.indexOf("msie") != -1 && document.all ){
		this.browser = 'ie';
	}else if( agent.indexOf("firefox") != -1 ){
		this.browser = 'firefox';
		if( agent.indexOf("mozilla") != -1 ){
			this.bool_mozilla = 1;
		}
	}else if( agent.indexOf("safari") != -1 ){
		this.browser = 'safari';
	}else if( appName.indexOf("Netscape") !=-1 ){
		if( agent.indexOf("mozilla") != -1 ){
			this.bool_mozilla = 1;
		}
		if( agent.indexOf("mozilla/4") !=-1 ){
			this.browser = 'netscape';
		}else
		if( agent.indexOf("netscape") =-1 ){
			this.browser = 'Mozilla';
		}
	}
}
xBrowser.prototype.getMousePos = function( event )
{
	var posX, posY;

	if( this.browser == 'ie' ){
		posX = event.clientX + document.body.scrollLeft;
		posY = event.clientY + document.body.scrollTop;
	}else
	if(		this.browser == 'firefox'
		||	this.browser == 'netscape'
	){
		posX = event.pageX;
		posY = event.pageY;
	}
	return new Position( posX, posY );
}

xBrowser.prototype.isIE = function()
{
	if( this.browser == 'ie' ){
		return true;
	}
	return false;
}

var obj_browser = new xBrowser();

// ================================================================
//
// jLib
//
// ================================================================
function jLib()
{
	this.thisDocument = window.document;
}

// ---------------------------------
// Form
jLib.prototype.getFormObj = function( formName, thisDocument )
{
	if( thisDocument ){
		return thisDocument.forms[formName];
	}else{
		return this.thisDocument.forms[formName];
	}
}

jLib.prototype.getFormValue = function( form, keyname )
{
	if( form.elements[keyname] ){
		return form.elements[keyname].value;
	}else{
		return false;
	}
}

jLib.prototype.setFormValue = function( form, keyname, keyvalue )
{
	if( form != null ){
		if( this.checkExistFormTag( form, keyname ) ){
			form.elements[keyname].value = keyvalue;
		}else{
			this.appendForm_tag( form, this.createFormTag( keyname, keyvalue ) );
		}
	}
}

jLib.prototype.formValueCheckBox = function( form, property )
{
	var value = '';

	if( form.elements[property].length ){
		for(var i = 0; i < form.elements[property].length; i++ ){
			if ( form.elements[property][i].checked ) {
				value += form.elements[property][i].value;
			}
		}
	}else{
		if ( form.elements[property].checked ) {
			value = form.elements[property].value;
		}
	}

	return value;
}
jLib.prototype.boolTickCheckBox = function( form, property )
{
	return this.formValueCheckBox( form, property);
}
jLib.prototype.boolNotTickCheckBox = function( form, property )
{
	return revBool(this.boolTickCheckBox(form, property));
}

jLib.prototype.appendForm_tag = function( form, inputTag )
{
	form.appendChild( inputTag );
}

jLib.prototype.checkExistFormTag = function( form, keyname )
{
	if( form.elements[keyname] != null ){
		return true;
	}else{
		return false;
	}
}

jLib.prototype.createFormTag = function( keyname, keyvalue )
{
	var hiddenObj	= this.thisDocument.createElement("input");

	hiddenObj.type  = "hidden";
	hiddenObj.id	= keyname;
	hiddenObj.name  = keyname;
	hiddenObj.value = keyvalue;

	return hiddenObj;
}

jLib.prototype.importFormParam = function( from_FormName, from_KeyName, to_FormName, to_KeyName, thisDocument )
{
	thisDocument = xThisDocument( thisDocument );

	var obj_from	= this.getFormObj( from_FormName, thisDocument );
	var obj_to		= this.getFormObj( to_FormName, thisDocument );
	this.setFormValue( obj_to, to_KeyName, this.getFormValue(obj_from, from_KeyName) );
}

var jlib = new jLib();

//----------------------------------------------------------
function getLoadGMapArg()
{
	var arg = location.search;
	arg = arg.replace(/\?/, "");
	return arg.split(':');
}

//----------------------------------------------------------
function getAccUrl()
{
	var url = '/acc-bin/acc/acclog_json.cgi?';

	url += "referrer=" + document.referrer + "&";
	try{
		if( screen && screen.width ){
			url += "width=" + screen.width + "&";
			url += "height=" + screen.height + "&";
			url += "color=" + screen.colorDepth + "&";
		}
	}catch(e){
	};
	url += "url=" + escape(window.location.href) + "&";
	url += 'randam_link=' + Math.ceil( (Math.random() * 65535) + (Math.random() * 65535) );

	return url;
}

//----------------------------------------------------------
function getSubDomain( subdomain, lang, ccode )
{
	if( !ccode){ ccode = 'au'; };

	if( ccode == 'au' ){
		if( lang == 'jp' ){
			return subdomain;
		}else{
			return lang + '-' + subdomain;
		}
	}else{
		return lang + '-' + ccode + '-' + subdomain;
	}
}

// ================================================================
//
// JSonScript
//
// ================================================================

JSONscriptRequest.scriptCounter = 1;

function JSONscriptRequest(fullUrl) {
    this.fullUrl	= fullUrl; 
    this.noCacheIE	= '&noCacheIE=' + (new Date()).getTime();
    this.headLoc	= document.getElementsByTagName("head").item(0);
    this.scriptId	= 'YJscriptId' + JSONscriptRequest.scriptCounter++;
}

JSONscriptRequest.prototype.buildScriptTag = function () {

    this.scriptObj = document.createElement("script");

    this.scriptObj.setAttribute("charset",	"utf-8");
    this.scriptObj.setAttribute("type",		"text/javascript");
    this.scriptObj.setAttribute("src",		this.fullUrl + this.noCacheIE);
    this.scriptObj.setAttribute("id",		this.scriptId);
}

JSONscriptRequest.prototype.removeScriptTag = function () {
    this.headLoc.removeChild(this.scriptObj);  
}

JSONscriptRequest.prototype.addScriptTag = function () {
    this.headLoc.appendChild(this.scriptObj);
}

