
	var imgw = '800';
	var imgh = '640';
	var n = 0;

	function loadIntro(){

		if (tmoutf){
			if (rndmf){ n = Math.floor(Math.random()*introImages.length); }
			writeImg(introImages[n],'introImg','999.9（フォーナインズ）公式ウェブサイト ENTER','','');
			imageRoop();
		}else{
			if (rndmf){
				n = Math.floor(Math.random()*introImages.length);
			}else{
				var imgno = getCookie("No");

				if (imgno == ''){
					n = 0;
				}else{
					n = eval(imgno);
					n++;
					if (n == introImages.length){ n = 0; }
				}

				setCookie("No", n);
			}


			if (introImagesExt[n] == 'swf'){
				writeSwf(introImages[n],imgw,imgh);
			}else{
				writeImg(introImages[n],'introImg','999.9（フォーナインズ）公式ウェブサイト ENTER','','');
			}
		}

	}

	function loadHome(){

		if (home_ext == 'swf'){
			writeSwf('home_image.' + home_ext,'800','270');
		}else{
			writeImg('home_image.' + home_ext,'homeImg','999.9（フォーナインズ）公式ウェブサイト','800','270');
		}

		if (flip_f){
			if (flip_ext == 'swf'){
				writeSwf('home_image.' + flip_ext,'800','115');
			}else{
				if (flip_url != ''){ document.write('<a href="' + flip_url + '" target="_blank">'); }
				writeImg('home_image.' + flip_ext,'flipImg','flip','800','115');
				if (flip_url != ''){ document.write('</a>'); }
			}
		}

	}

	function loadPickup(){
		document.write(pickup);
	}

	function imageRoop(){

		if (rndmf){
			n = Math.floor(Math.random()*introImages.length);
		}else{
			n++;
			if (n == introImages.length){ n = 0; }
		}

		if (introImagesExt[n] == 'swf'){
			n++;
			if (n == introImages.length){ n = 0; }
		}


		changeImg(introImages[n],'introImg');

//		alert(introImages[n]);
		setTimeout( function(){ imageRoop() }, sec); 

	}

	function writeSwf(swfsrc,w,h){
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + location.protocol + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + w + '" height="' + h + '">');
		document.write('<param name=movie value="' + location.protocol + '//' + location.hostname + '/swf/' + swfsrc + '">');
		document.write('<param name=quality value=high>');
		document.write('<embed src="' + location.protocol + '//' + location.hostname + '/swf/' + swfsrc + '" quality="high" pluginspage="' + location.protocol + '://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed>');
		document.write('</object>');
	}

	function writeImg(imgsrc,ids,alts,w,h){
		var size = '';
		if (w != '' && h != ''){ size = ' width="' + w + '" height="' + h + '"'; }
		document.write('<img src="/images/' + imgsrc + '" alt="' + alts + '" border="0" id="' + ids + '"' + size + ' />');
	}

	function changeImg(imgsrc,ids){
		document.images[ids].src = '/images/' + imgsrc;
	}

	function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {

		tmp1 = " " + document.cookie + ";";
		xx1 = xx2 = 0;
		len = tmp1.length;
		while (xx1 < len) {
			xx2 = tmp1.indexOf(";", xx1);
			tmp2 = tmp1.substring(xx1 + 1, xx2);
			xx3 = tmp2.indexOf("=");

			if (tmp2.substring(0, xx3) == key) {
				return(decodeURL(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
			}
			xx1 = xx2 + 1;
		}
		return("");
	}

	function setCookie(key, val, tmp) {
		tmp = key + "=" + escape(val) + "; ";
		tmp += "path=/products; ";
		tmp += "expires=Tue, 31-Dec-2030 23:59:59; ";
		document.cookie = tmp;
	}

	function clearCookie(key) {
		document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
	}

	function decodeURL(str){
		var s0, i, j, s, ss, u, n, f;
		s0 = "";                // decoded str
		for (i = 0; i < str.length; i++){   // scan the source str
			s = str.charAt(i);
			if (s == "+"){
				s0 += " ";
			} else {
				if (s != "%"){s0 += s;}     // add an unescaped char
				else{               // escape sequence decoding

					u = 0;          // unicode of the character
					f = 1;          // escape flag, zero means end of this sequence
					while (true) {

						ss = "";        // local str to parse as int
						for (j = 0; j < 2; j++ ) {  // get two maximum hex characters for parse
							sss = str.charAt(++i);
							if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {
							ss += sss;      // if hex, add the hex character
						} else {--i; break;}    // not a hex char., exit the loop
					}

					n = parseInt(ss, 16);           // parse the hex str as byte

					if (n <= 0x7f){u = n; f = 1;}   // single byte format
					if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}   // double byte format
					if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}   // triple byte format
					if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}   // quaternary byte format (extended)
					if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}         // not a first, shift and add 6 lower bits
					if (f <= 1){break;}         // end of the utf byte sequence
					if (str.charAt(i + 1) == "%"){ i++ ;}                   // test for the next shift byte
					else {break;}                   // abnormal, format error
				}
					s0 += String.fromCharCode(u);           // add the escaped character
				}
			}
		}
		return s0;
	}
