
	
//====================================================================
// get browser
//-------------------------------------------------------------------
function getBrowser(){
	
	var ua = navigator.userAgent;

	this.NN4  = (document.layers);
	this.IE5 = (ua.indexOf("MSIE 5") != -1);
	this.IE50 = (ua.indexOf("MSIE 5.0") != -1);
	this.IE55 = (ua.indexOf("MSIE 5.5") != -1);
	this.IE6 = (ua.indexOf("MSIE 6") != -1);
	this.IE4  = (ua.indexOf("MSIE 4") != -1);
	this.IE   = (ua.indexOf("MSIE") != -1);
	this.Moz  = (ua.indexOf("Gecko") != -1);
	this.Op6  = (ua.match(/Opera.6/) != null); // Opera "6" only
	this.Omn  = (ua.indexOf("OmniWeb") != -1);
	this.Safari  = (ua.indexOf("Safari") != -1);
	this.FF   =  (ua.indexOf("Firefox") != -1);
	this.Win  = (ua.indexOf("Windows") != -1);
	this.Mac  = (ua.indexOf("Mac") != -1);
	if (this.Op6) this.IE50 = this.IE = false; 
	if (this.Omn) this.NN4            = false; 
	}
	
//====================================================================
//pngFix
//-------------------------------------------------------------------
$(document).ready(function(){
	$('div#wrapperAll').pngFix( );
});

//Change language
function langChange(url){
	if(url.indexOf('/en/') != -1){
		newURL=url.replace("/en/","/ja/");
		}else{
			newURL=url.replace("/ja/","/en/");
			}
	
	location.href=newURL;
	}

//======================================================
//Change Class
//------------------------------------------------------@
function ChClass(idName,className){
	//Object
	if(document.all){
		Obj=document.all(idName)
		}//IE
	if(document.getElementById){
		Obj=document.getElementById(idName)
		}
	
	Obj.className=className;
	}

//======================================================
//fontSize set
//------------------------------------------------------
function fontSize(){
	getBrowser();
	
	lang=document.getElementsByTagName('html')[0].getAttribute('lang')
	
	if(this.Mac){
		if (navigator.appVersion.indexOf("Safari") > -1){//Safari
				if(lang!="en"){//japanese
					document.getElementsByTagName("body")[0].style.fontSize='11px';
					}else{//english
						document.getElementsByTagName("body")[0].style.fontSize ='11px';
						}
		}else{//FF
			if(lang!="en"){//japanese
					document.body.style.fontSize='12px';
					}else{//english
						document.getElementsByTagName("body")[0].style.fontSize ='12px';
						}
		}
		
	}else{//Win
		if(lang=="en"){//english
			document.getElementsByTagName("body")[0].style.fontSize ='0.8em';
			
			}else{//japanese
				document.getElementsByTagName("body")[0].style.fontSize ='0.8em';
				}
		}
}

/**=========================================================
 * Font size will be made small if it is "Meirio".
 ----------------------------------------------------------*/
 function Meirio(size){
	 getBrowser();
    if(this.Win){
		
        var h = document.getElementsByTagName("BODY")[0];
        var d = document.createElement("DIV");
        var s = document.createElement("SPAN");
		
        d.appendChild(s);
        //d.style.fontFamily = "sans-serif";
        //s.style.fontFamily = "Meirio";
        s.style.fontSize   = "12px";            
        s.innerHTML        = "&#12354;1";
        h.appendChild(d);
        var defaultWidth   = s.offsetWidth;        
        var defaultHeight  = s.offsetHeight;    
        h.removeChild(d);
		
		 document.getElementsByTagName("body")[0].style.fontSize =parent.document.getElementsByTagName("body")[0].style.fontSize;
        //The width and the height of a character are compared and distinguished.
       
	   if((defaultWidth==19)&&(defaultHeight==20)){//when it is W19 and H20,it is Meirio
                document.getElementsByTagName("body")[0].style.fontSize =size;
                }else{
					document.getElementsByTagName("body")[0].style.fontSize
					
					}
        }
      }
/**=========================================================
 * layer show
 ----------------------------------------------------------*/

function Display(idName,cond,method){
	
	if(method!='visibility'){
		method='display';
		}
	
	//condition
	if(method=="display"){
		if(cond=='show'){
			cond='block';
			}else if(cond=='hide'){
				cond='none';
				}
		}else{
			if(cond=='show'){
				cond='visible';
				}else if(cond=='hide'){
					cond='hidden';
					}
				}
	
	//Object
	if(document.all){
		//IE
		Obj=document.all(idName);
		}
	if(document.getElementById){
		Obj=document.getElementById(idName);
		}
	
	//show or hide
	if(cond=='auto'){
		if(method=="display"){
			cond=Obj.style.display;
				if(cond == 'block'){
					Obj.style.display = 'none';
				}else{
					Obj.style.display = 'block';
					}
			}else{
			cond=Obj.style.visibility;
				if(cond == 'visible'){
					Obj.style.visibility = 'hidden';
				}else{
					Obj.style.visibility = 'visible';
					
					}
			}
		}
	//if toggle
	else{
		if(method=='display'){
			Obj.style.display = cond;
			}else if(method=='visibility'){
			Obj.style.visibility = cond;
			}
		}	
}

/**=========================================================
 * get cursor position
 ----------------------------------------------------------*/
function getMousePosX(e){
	if (window.createPopup){
		x = event.x + document.body.scrollLeft;
	}else{
	x = e.pageX;
	}
	return x;
  }
function getMousePosY(e){
	if (window.createPopup){
		//if Quirks mode
		//y = event.y + document.body.scrollTop;
		//if Standards mode
		y = event.y + document.documentElement.scrollTop;
	}else{
	y = e.pageY;
	}
	return y;
  }
 //======================================================
//booth hover
//------------------------------------------------------
function Booth(number,e,myObj){
	ChClass('sol'+number,'active');
	Balloon('balloon',e,myObj);
	
	document.getElementById('booth').src='img/booth'+number+'.gif';
		flg="on";
	myObj.onmouseout = function (){
		ChClass('sol'+number,'dummy');
		Display('balloon','hide','visibility');
		document.getElementById('booth').src='img/booth0.gif';
		
		flg="off";
		ChClass('sol72','dummy');
	}
	//erase link border
	myObj.onfocus = function (){
			myObj.blur();
			}
}

//======================================================
//show tooltip
//------------------------------------------------------
function Balloon(Target,e,myObj){
	//click position
	var X=getMousePosX(e);
	var Y=getMousePosY(e);
	document.getElementById(Target).style.left =(X-20)+"px";
	document.getElementById(Target).style.top =(Y-40)+"px";
	//show
	
	setTimeout(function(){if(flg=='on'){Display(Target,'show','visibility');}clearTimeout();},1200);
	
	//event

	/*myObj.onmouseout = function (){
		Display(Target,'hide','visibility');
		}*/
	}
//======================================================
//window.onload...
//------------------------------------------------------

window.onload =function(){
	//fontSize();
	lang=document.getElementsByTagName('html')[0].getAttribute('lang');
	if(lang=="ja"){
		
			Meirio('75%');
			}
	if(document.getElementById("push") != null){
		//Adjustment for CSS Sticky Footer
		imgH=document.getElementById("Photo").getElementsByTagName("img")[0].style.height;
			document.getElementById("contents").style.marginBottom="-"+imgH;
			document.getElementById("Photo").style.height=imgH;
			document.getElementById("push").style.height=imgH;
		}
		
}