/* base */
floating = 0;
minx = 0;
maxx = 0;
dtype = 0;
bdata = 0;

var glbImg = new Array();
var n = 8;
var iwk;

/* url set */
var impath="./share/images/";
var impath_lineup="./lineup/images/";


for (i=0; i<n; i++) {
	iwk=i+1;
	glbImg[i] = impath + "global_nv_0" + iwk + ".gif";
	preloadimg(glbImg[i]);
}

/* browser */
if (windows){
	if (opera){
		bdata=0;
	} else if (ie){
		bdata=1;
		//document.write('<link rel="stylesheet" type="text/css" href="./share/style/win_ie.css" media="all">');
	} else if (gecko){
		bdata=2;
	}
} else if (mac){
	if (opera){
		bdata=0;
	} else if (safari){
		bdata=2;
		//document.write('<link rel="stylesheet" type="text/css" href="./share/style/osx_safari.css" media="all">');
	} else if (gecko){
		bdata=2;
		//document.write('<link rel="stylesheet" type="text/css" href="./share/style/osx_gecko.css" media="all">');
	}
}


/* swap image */
function swapglb(num){
	img=impath+"global_nv_"+num+".gif";
	nm="global_nv_"+num.substring(0,2);
	swapimage(nm,img);
}
function swapcar(imgnm,num){
	img=impath_lineup+"index_bt_"+num+".gif";
	swapimage(imgnm,img);
}


/* for float */
if (document.all) {
}else{
window.captureEvents(Event.MOUSEMOVE);
}

function callglb(num){
if (bdata!=0){

if (num=="car1") {

}
if (num=="car2") {

}
if (num=="car3") {

}
if (num=="purchase1") {

}
if (num=="support1") {

}
if (num=="special1") {

}
if (num=="special2") {

}
if (num=="corporate1") {

}
if (num=="social1") {

}
floating = 1;
}else{
floating = 0;
}
}

function callglbs(fdata, fid){
if (bdata!=0){
getIndex(fdata, fid);
}
}

function writeglb(){
if (bdata!=0){
document.write('<div id="gn">');
document.write('<div id="gn11"></div>');
document.write('<div id="gn12"></div>');
document.write('<div id="gn13"></div>');
document.write('<div id="gn21"></div>');
document.write('<div id="gn31"></div>');
document.write('<div id="gn41"></div>');
document.write('<div id="gn51"></div>');
document.write('<div id="gn52"></div>');
document.write('<div id="gn61"></div>');
document.write('<div id="gn71"></div>');
document.write('</div>');
}
if (bdata!=0){
//window.document.onmousemove = mousepos;
}
}

function clearall(){

}

function resetall(){
if (bdata!=0){
document.getElementById('gn11').style.display = 'none';
document.getElementById('gn12').style.display = 'none';
document.getElementById('gn13').style.display = 'none';
document.getElementById('gn21').style.display = 'none';
document.getElementById('gn31').style.display = 'none';
document.getElementById('gn41').style.display = 'none';
document.getElementById('gn51').style.display = 'none';
document.getElementById('gn52').style.display = 'none';
document.getElementById('gn61').style.display = 'none';
document.getElementById('gn71').style.display = 'none';
document.getElementById('gn').style.display = 'none';
}
}
function resetinv(idata){
if (bdata!=0){
document.getElementById(idata).style.display = 'none';
if (idata=="gn13"){
minx=60;
maxx=437;
}
if (idata=="gn12"){
minx=60;
maxx=249;
}
if (idata=="gn52"){
minx=485;
maxx=674;
}
}
}

function gnon(idata){
if (bdata!=0){
if(idata){
document.getElementById(idata).style.backgroundImage = 'url(\'http://www.racinggear.co.jp/share/images/global_bg_03.gif\')';
}}
}
function gnof(idata){
if (bdata!=0){
if(idata){
document.getElementById(idata).style.backgroundImage = 'url(\'http://www.racinggear.co.jp/share/images/global_bg_02.gif\')';
}}
}

function mousepos(evt) {
if (document.all) {
X = event.clientX;
Y = event.clientY;
}else{
X = evt.clientX;
Y = evt.clientY;
}
if (floating==1){
		if (Y<60||Y>480){
			floating = 0;
			resetall();
		} else if (60<Y&&Y<91) {
				if(X<60||X>748){
					floating = 0;
					resetall();
				}
				if(394<X && X<484) {
					floating = 0;
					resetall();
				}
		} else if (X<minx||X>maxx) {
			floating = 0;
			resetall();
		}
}
}

function getIndex(getData, getID) {
document.getElementById(getID).innerHTML = getData;
}

function imgchg_irg() {
	if(document.getElementById && document.getElementsByTagName){
	//document.images['global_nv_08'].width = '120';
	if(document.images['global_nv_08']){
	document.images['global_nv_08'].alt = 'TEAM RACING GEAR';
	}
	}
}


window.onload = imgchg_irg;
