/*
	--------------------------------
	Last Modified: 2011.12.27
	--------------------------------
	- Table of Contents -

	サイトルート

	ロールオーバー

	MM_Behavior
	--------------------------------
*/



/* --------------------------------
	サイトルート
-------------------------------- */

var siteRoot = getSiteRoot('script', 'common/js/base.js');

function getSiteRoot(tagName, str) {
	var elms = document.getElementsByTagName(tagName);
	for (var i = 0, l = elms.length; i < l; i++) {
		if (elms[i].src.match(str + '([\?].*|$)')) return $(elms[i]).attr('src').split(str)[0];
	}
	return false;
}



/* --------------------------------
	おすすめ　インクルード
-------------------------------- */

$(function() {
	setRecommend();
});


function setRecommend(){
	
// ---- banners -----------------------------------

	var br_CM = '';
//	var br_CM = '<dd class="icon"><a href="' +siteRoot+ 'cm/index.html"><img src="' +siteRoot+ 'common/img/recom_cm_musashi.png" alt="CM情報　この国には、底力がある。 漫画家井上雄彦氏の代表作「バガボンド」の主人公 武蔵が新CMに登場！" width="212" height="143" class="alpha" /></a></dd>';
	var br_SP = '';
	
//	var cm_light = '<dd class="icon"><a href="' +siteRoot+ 'cm/index.html"><img src="' +siteRoot+ 'common/img/recom_cm_light2.png" alt="CM情報" width="212" height="143" class="alpha" /></a></dd>';
	var cm_gundam = '<dd class="icon"><a href="' +siteRoot+ 'cm/index.html"><img src="' +siteRoot+ 'common/img/recom_cm_gundam.png" alt="CM情報　この国には、底力がある。 日本が世界に誇れるジャパニメーション、「ガンダム」が登場" width="212" height="143" class="alpha" /></a></dd>';
	var cm_milksf = '<dd class="icon"><a href="' +siteRoot+ 'cm/index.html"><img src="' +siteRoot+ 'common/img/recom_cm_milksf.png" alt="CM情報　大政絢さん出演 ミルクシーフードヌードル「知ってほしい篇」公開中！" width="212" height="143" class="alpha" /></a></dd>';
	
//	var sp_light = '<dd class="icon"><a href="javascript:void(0);" onclick="popupSpLight();"><img src="' +siteRoot+ 'common/img/recom_sp_light2.png" alt="SPECIAL　トリオでおいしい198kcal" width="212" height="143" class="alpha" /></a></dd>';
	
	var camp_robo = '<dd><a href="' +siteRoot+ 'robotimer/" target="_blank"><img src="' +siteRoot+ 'common/img/recom_camp_robo.png" alt="カップヌードル ロボタイマー プレゼントキャンペーン　ロボタイマーCM 4篇一挙公開中！" width="196" height="131" class="alpha" /></a></dd>';
	var camp_election = '<dd><a href="http://senkyo.cupnoodle.jp/?xadid=0103c" target="_blank"><img src="' +siteRoot+ 'common/img/recom_camp_election.png" alt="歴代カップヌードル復活総選挙　ついに1位が決定！ 開票結果発表！" width="196" height="131" class="alpha" /></a></dd>';
	var camp_nothing = '<dd><img src="' +siteRoot+ 'common/img/recom_nocamp.png" alt="現在実施中のキャンペーンはありません。" width="196" height="131" /></dd>';

	
	var refill = '<dd><a href="' +siteRoot+ 'refill/index.html" target="_blank"><img src="' +siteRoot+ 'common/img/recom_refill.png" alt="eco style つくって楽しい使ってエコ つくろうマイカップヌードル　カップヌードルRefill" width="196" height="131" class="alpha" /></a></dd>';
	var factory = '<dd><a href="' +siteRoot+ 'game/factory/index.html"><img src="' +siteRoot+ 'common/img/recom_factory.png" alt="自分だけのオリジナルカップヌードルを作ろう！　MY CUPNOODLE FACTORY" width="196" height="131" class="alpha" /></a></dd>';
		
	
	var museum = '<dd><a href="http://www.cupnoodles-museum.jp/" target="_blank"><img src="' +siteRoot+ 'common/img/recom_museum.png" alt="CUPNOODLES MUSEUM 体験型ミュージアムへようこそ！" width="196" height="131" class="alpha" /></a></dd>';

	var gunpla = '<dd><a href="' +siteRoot+ 'gundam/cupgunpla/" target="_blank"><img src="' +siteRoot+ 'common/img/recom_gunpla.png" alt="CUP NOODLE 40th ANNIVERSARY　CUP GUNPLA ＆ CUP NOODLE　2011.9.20 ON SALE!" width="196" height="131" class="alpha" /></a></dd>';
	
	var ev_40th = '<dd><a href="' +siteRoot+ 'event/40th_anniversary/index.html" target="_blank"><img src="' +siteRoot+ 'common/img/recom_ev_40th.png" alt="9月18日は40回目のカップヌードルバースデー　「40th Anniversary CUP NOODLE EXPO」イベントレポート掲載中" width="196" height="131" class="alpha" /></a></dd>';
	
	var boiljapan = '<dd><a href="' +siteRoot+ 'boiljapan/" target="_blank"><img src="' +siteRoot+ 'common/img/recom_boiljapan.png" alt="BOIL JAPAN.　ヨーダ オリジナル壁紙がもらえる！" width="196" height="131" class="alpha" /></a></dd>';


// ------------------------------------------------

	var bodyid = $('body').attr('id');
	
//製品情報
	if($('body').hasClass('product')){
		switch( bodyid ){
			case 'productTop'	: unitBnrCamp( camp_election ); break;
			//case 'cupnoodle_l': unitBnr( ev_40th, museum, camp_election, camp_robo, gunpla, cm_gundam, br_CM, br_SP, cm_light, sp_light ); break;
			default			: unitBnr( boiljapan, ev_40th, museum, camp_election, br_CM, br_SP );
		}
	}
//キャンペーン
	else if($('body').hasClass('campaign')) { unitBnr( boiljapan, ev_40th, museum, br_CM ); }
//CMギャラリー
	else if($('body').hasClass('cmgallery')) { unitBnr( boiljapan, ev_40th, museum, camp_election ); }
//ゲーム＆ダウンロード
	else if($('body').hasClass('game')) { unitBnr( boiljapan, ev_40th, museum, camp_election, br_CM, refill );
		//switch( bodyid ){
		//	case 'factory'		: unitBnr( boiljapan, cm_milksf, ev_40th, museum, camp_election, camp_robo, gunpla, cm_gundam, br_CM, refill ); break;
		//	default			: unitBnr( boiljapan, cm_milksf, ev_40th, museum, camp_election, camp_robo, gunpla, cm_gundam, br_CM, refill, factory );
		//}
	}
//誕生秘話・歴史
	else if($('body').hasClass('story')) { unitBnr( boiljapan, ev_40th, museum, camp_election, br_CM, br_SP ); }


//組み合わせ→書き出し
	function unitBnr() {
		var src;
		var bnrs = [];
		for(i=0,l=arguments.length; i<l; i++){
			bnrs[i] = arguments[i];
		}
		
		src = '<dl>\n';
		src += '<dt><img src="' + siteRoot + 'common/img/recom_tit.png" alt="RECOMMEND　おすすめコンテンツ" width="205" height="28" class="alpha" /></dt>\n';
		src += bnrs.join('\n');
		src += '\n</dl>';
		
		//clickTag
		src = src.replace('__clickTag_quest__',"javascript:ac_tracer(6009,'cop_quest');");

		$('div#recommendBnr').append(src);
	}
	function unitBnrCamp() {
		var src;
		var bnrs = [];
		for(i=0,l=arguments.length; i<l; i++){
			bnrs[i] = arguments[i];
		}
		
		src = '<dl>\n';
		src += '<dt><img src="' + siteRoot + 'common/img/camp_tit.png" alt="CAMPAIGN　キャンペーン" width="206" height="27" class="alpha" /></dt>\n';
		src += bnrs.join('\n');
		src += '\n</dl>';
		
		//clickTag
		src = src.replace('__clickTag_quest__',"javascript:ac_tracer(6009,'cop_quest');");

		$('div#campaignBnr').append(src);
	}
}
		



/* --------------------------------
	UI
-------------------------------- */

$(function() {
	cupnoodleUI.rollover('#globalNav a img', '_ov', '_cr', '_ac');
	cupnoodleUI.rollover('#launcher a img', '_ov', '_cr');
	cupnoodleUI.rollover('.rollover', '_ov', '_ov');
	
	cupnoodleUI.launcher.init();
	if($("body").attr('id') == "productTop") cupnoodleUI.launcher.info();
	
	if($("body").hasClass('product')) cupnoodleUI.productDetail.init();
	if($("body").attr('id') == "cmTop") cupnoodleUI.cmGallery.init();
});



var cupnoodleUI = {
	
// rollover --------------------------------
	rollover : function(target, hover, current, focus) {
		$(target).each(function() {
			var isCurrent = current && this.src.match(current + '(\.gif|\.jpg|\.png)([\?].*|$)');
			this.src.match('(\.gif|\.jpg|\.png)([\?].*|$)');
			var ext = RegExp.$1;
			var search = (isCurrent) ? current + ext : ext;
			var replace_over = (isCurrent) ? current + ext : hover + ext;
			if(focus) var replace_down = (isCurrent) ? focus + ext : focus + ext;
			
			var out = this.src;
			var over = this.src.replace(search, replace_over);
			if(focus) var down = this.src.replace(search, replace_down);
	
			// preload
			new Image().src = over;
			if(focus) new Image().src = down;
	
			// イベントの追加
			$(this).bind('mouseover', function() { this.src = over; })
				.bind('mouseout', function() { this.src = out; });
			
			if(focus) $(this).bind('mousedown', function() { this.src = down; });
				
		});
	},
	
	

	
// launcher --------------------------------
	launcher : {
		e : null,
		hov1: null,
		hov2: null,
		
		// onmouseover / onmouseout
		init : function(){
			var self = this;
			self.e = $("#launcher");
			self.hov1 = $("#launchBg");

			self.e.attr('class','closed').css("left","-219px");
			self.e.append('<div id="pull"></div>');
			self.e.append('<div id="launchBgBtm"></div>');

			self.hov2 = $("#launcher div#pull");
			
			self.e.hover(function(){ self.op(); }, function(){ self.cl(); }).css('cursor','pointer');
			self.hov2.hover(function(){ self.op(); }, function(){ self.cl(); }).css('cursor','pointer');
			if(typeof(alphafilterpng) == 'function'){ alphafilterpng('#launchBgBtm'); }
		},
		
		// open launcher
		op : function(){
			var self = this;
			if(self.e.attr('class') == 'closed') {
				self.e.attr('class','opened').animate(
					{ left: "0"},
					{ duration : 400 }
				);
			}
		},
		
		// close launcher
		cl : function(){
			var self = this;
			var clTimer;
			
			if(self.e.attr('class') != 'closed') {
				clTimer = setTimeout(function(){
					self.e.animate(
						{ left: "-219px"},
						{ duration : 400, complete: function(){ $(this).attr('class','closed'); } }
					);
				}, 400);
				self.hov1.mouseover(function(){ clearTimeout(clTimer); })
				self.hov2.mouseover(function(){ clearTimeout(clTimer); })
			}
		},
		
		// open -> close
		info : function(){
			var self = this;
			var clTimer2;
			
			self.op();
			clTimer2 = setTimeout( function(){ self.cl(); }, 1500);
			self.hov1.mouseover(function(){ clearTimeout(clTimer2); });
			self.hov2.mouseover(function(){ clearTimeout(clTimer2); });
		}
	},


// product --------------------------------
	productDetail : {
		init : function(){
			var tabs = $('body.product div#tab li img');
			var details = $('body.product div.detail');
			
			if(tabs.length>1){
				tabs.each(function(){
					// preload
					new Image().src = $(this).attr('src').replace('.gif','_ov.gif');
				});
				
				tabs.css(
					'cursor', 'pointer'
				).hover(
					function(){
					// mouseover
						if(!($(this).hasClass('current'))){
							$(this).attr('src',this.src.replace('.gif','_ov.gif'));
						}
					},
					function(){
					// mouseout
						if(!($(this).hasClass('current'))){
							$(this).attr('src',this.src.replace('_ov.gif','.gif'));
						}
					}
					
				).click(function(){
					// click
					var idx = tabs.index(this);
					
					// close all
					tabs.removeClass('current').each(function(){
						$(this).attr('src',this.src.replace('_ov.gif','.gif'));
					});
					details.css('display','none');
					
					// open current
					$(this).addClass('current').attr('src',this.src.replace('.gif','_ov.gif'));
					details.eq(idx).css('display','block');
				});
				
				
				var hash = cupnoodleUI.getHash();
				
				if((hash=='detail_2')&&($('div#detail_2'))) {
					this.show(1);
				} else if((hash=='detail_3')&&($('div#detail_3'))) {
					this.show(2);
				} else {
					this.show(0);
				}
			}
		},
		
		show : function(openIdx){
			var tabs = $('body.product div#tab li img');
			var details = $('body.product div.detail');
			
			if(tabs.get(openIdx)){
				
				var openTab = tabs.eq(openIdx);
				// close all
				tabs.removeClass('current').each(function(){
					$(this).attr('src',this.src.replace('_ov.gif','.gif'));
				});
				details.css('display','none');
				
				// open current
				openTab.addClass('current').attr('src',openTab.attr('src').replace('.gif','_ov.gif'));
				details.eq(openIdx).css('display','block');
			}
			
		}
	},
	
	
	
// CM --------------------------------
	cmGallery : {
		init : function(){
			$('body#cmTop div.cm').each(function() {
				var _this = this;
				var tabs = $(_this).find('div.tab li img');
				var btns = $(_this).find('p.closeBtn');
				var details = $(_this).find('div.detail');
				
				tabs.each(function(){
					// preload
					new Image().src = $(this).attr('src').replace('.gif','_ov.gif');
				});
				
				tabs.css(
					'cursor', 'pointer'
				).hover(
					function(){
					// mouseover
						if(!($(this).hasClass('current'))){
							$(this).attr('src',this.src.replace('.gif','_ov.gif'));
						}
					},
					function(){
					// mouseout
						if(!($(this).hasClass('current'))){
							$(this).attr('src',this.src.replace('_ov.gif','.gif'));
						}
					}
					
				).click(function(){
					// click
					var idx = tabs.index(this);
					
					// close all
					tabs.removeClass('current').each(function(){
						$(this).attr('src',this.src.replace('_ov.gif','.gif'));
					});
					details.css('display','none');
					
					// open current
					$(this).addClass('current').attr('src',this.src.replace('.gif','_ov.gif'));
					details.eq(idx).css('display','block');
				});
				
				btns.css(
					'cursor', 'pointer'
				).click(function(){
					// close all
					tabs.removeClass('current').each(function(){
						$(this).attr('src',this.src.replace('_ov.gif','.gif'));
					});
					details.css('display','none');
				});
				
			})
		},
		
		show : function(cmId,openIdx){
			var cm = $('body#cmTop div#'+cmId);
			var tabs = cm.find('div.tab li img');
			var details = cm.find('div.detail');
			
			if(cm.get(0) && tabs.get(openIdx)){
				
				var openTab = tabs.eq(openIdx);
				// close all
				tabs.removeClass('current').each(function(){
					$(this).attr('src',this.src.replace('_ov.gif','.gif'));
				});
				details.css('display','none');
				
				// open current
				openTab.addClass('current').attr('src',openTab.attr('src').replace('.gif','_ov.gif'));
				details.eq(openIdx).css('display','block');
			}
			
		}
	},
	
	getHash : function(){
		var aUrl = location.href.split('#');
		return aUrl.pop();
	}

}




/* --------------------------------
	PAGE SCROLL
-------------------------------- */

//*********************************************************************************************
//
// Coded by wonder-boys, 2009.03.12, Ver.1.1.1
// http://blog.wonder-boys.net/
// If you want to use this code, feel free to do so, however; please leave this message intact.
// Copyright(C) wonder-boys.net All rights reserved.
//
//*********************************************************************************************

var scrollUp = {
  speed: 40,
  easing: 3,
  
  _x: function(){
    return document.documentElement.scrollLeft || document.body.scrollLeft;
  },
  _y: function(){
    return document.documentElement.scrollTop || document.body.scrollTop;
  },
  bottom_y: function(){
    var allh = document.documentElement.scrollHeight || document.body.scrollHeight;
	var displayh = document.documentElement.clientHeight || document.body.clientHeight;
	return (allh - displayh);
  },
  _gotox: function(elm){
    var element = document.getElementById(elm);
    var px = 0;
    while(element){
        px += element.offsetLeft;
        element = element.offsetParent;
    }
    return px;
  },
  _gotoy: function(elm){
    var element = document.getElementById(elm);
    var px = 0;
    while(element){
        px += element.offsetTop;
        element = element.offsetParent;
    }
	var v = scrollUp.bottom_y();
	if(v-px < 0){ px=v; return px; }
	return px;
  },
  setScroll: function(tag){
    var i;
    var alist = document.getElementsByTagName(tag);
	for(i=0;i<alist.length;i++){
      var att = alist[i].href;
	  var hrefname = att.split("#");
	  var host = location.href.replace("#","");
	  if(hrefname[0] == host){
		if(hrefname[1] == ""){
          base.addevent(alist[i],"click",function(e){ scrollUp.movescroll(e,0,0); });
        }
	    else {
		  var x = scrollUp._gotox(hrefname[1]);
		  var y = scrollUp._gotoy(hrefname[1]);
		  (function(x,y){
		    base.addevent(alist[i],"click",function(e){ scrollUp.movescroll(e,x,y); });
		  })(x,y);
	    }
	  }
    }
  },
  movescroll: function(e,to_x,to_y) {
	var x_value = (to_x - scrollUp._x())/scrollUp.easing;
    var y_value = (to_y - scrollUp._y())/scrollUp.easing;
    window.scrollBy(x_value,y_value);
    if(Math.abs(y_value) > 1){
      var tid = setTimeout("scrollUp.movescroll('"+e+"',"+to_x+","+to_y+")",scrollUp.speed);
    }else {
      clearTimeout(tid);
    }
    base.preventDefault(e);
  }
};

var base = {
  preventDefault: function(e){
    if(e.preventDefault){
      e.preventDefault();
    }
    else if(window.event){
      window.event.returnValue = false;
    }
  },
  addevent: function(node,evt,func){
	if(node.addEventListener){
		node.addEventListener(evt,func,false);	
	} else if(node.attachEvent){
		node.attachEvent("on"+evt,func);	
	}
  }
};

base.addevent(window,'load',function(){ scrollUp.setScroll("a"); });






/* --------------------------------
	MM_Behavior
-------------------------------- */

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}






/* --------------------------------
	clicktag.js
-------------------------------- */

var _gif="tracer.a-cast.jp/actag";
var _click_type = "";
function _void() { 
	return; 
}
function _acGetCookie(cn) {
   var get_data = document.cookie;
   var cv = new Array();
   var gd = get_data.split(";");
   var i;
   for (i = 0; i < gd.length; i++) { 
      var a = gd[i].split("=");
      a[0] = a[0].replace(" ","");
      cv[a[0]] = a[1];
   }
   if (cv[cn]) return cv[cn];
   else return "";
}
function _acSetCookie(cn,val) {
   document.cookie = cn + "=" + val + "; path=/; expires=Thu, 1-Jan-2030 00:00:00 GMT;";
}
function _encodeURL(str){
    var s0, i, s, u;
    s0 = "";                
    for (i = 0; i < str.length; i++){  
        s = str.charAt(i);
        u = str.charCodeAt(i);          
        if (s == " "){s0 += "+";}    
        else {
            if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){   
                s0 = s0 + s;            
            }
            else {                  
                if ((u >= 0x0) && (u <= 0x7f)){     
                    s = "0"+u.toString(16);
                    s0 += "%"+ s.substr(s.length-2);
                }
                else if (u > 0x1fffff){     
                    s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else if (u > 0x7ff){        
                    s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
                else {                     
                    s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
            }
        }
    }
    return s0;
}
function _clickTag(_cid, _page, _title) {
	var now = new Date();
	var x = Math.round(Math.random() * (now.getTime() / 2147483647)) + now.getTime();
    var _proto=location.protocol;
    if (_proto != "http:" && _proto != "https:") {
		return;
	}
	var id;
	if(!navigator.cookieEnabled){    
		id = 'N/A';
	} else {
   		id = _acGetCookie('ac');
   		if (id == "") {
   			id = 'N/A';
   		}
	} 
	if (id != 'N/A') { 
	 	_acSetCookie('ac', id); 
	} else {
		_acSetCookie('ac', x);
		id = x; 
	}
	var url = window.location;
	var str = new String(url);
	var point = str.indexOf("#",0);
	if (point != -1) {
		url = str.substring(0, point);
	}
	if (_page != undefined && _page != '') {
		// page option setting here!
		if (_page.charAt(0) != "/") {
			_page = "/" + _page;
		}
		url = _proto+"//"+location.hostname+_page;
	}
	var ref = document.referrer;
	var ua = navigator.userAgent;
	var title = document.title;
	if (_title != undefined && _title != '') {
		title = _title;
	}
	if (url == "") url = 'N/A';
	if (ref == "") ref = 'N/A';
        if (ua == "") { ua = 'N/A'; } else { ua = _encodeURL(ua); }
	if (title == "") title = 'N/A';
    
	var _path=_proto + '//' + _gif + '?' + _cid + '*' + '0' + '*' + now.getTime() 
	+ '*'+ url + '*' + ref + '*' + ua + '*' + id + '*' + _encodeURL(title); 
	var _img=new Image(1,1);
	_img.src=_path;
	_img.onload=function() {_void();}

	if (_click_type != "t") {
		return;
	}

	if (navigator.userAgent.indexOf("Safari") >  0) {
		doHttpRead(_proto+"//"+location.hostname+"/robot.txt?"+(new Date()).getTime());
		return;
	}

	if (navigator.userAgent.indexOf("MSIE") < 0  && navigator.userAgent.indexOf("Safari") < 0 ) {
                var _stopTime = (new Date()).getTime() + 5000;
		while (_img.complete == false) {
			doHttpRead(_proto+"//"+location.hostname+"/robot.txt?"+(new Date()).getTime());
                       	var _curTime = (new Date()).getTime() ;
        	       	if ( _stopTime <= _curTime ) break ;
		}
	}

}
function _flashTag(_cid, _page) {
        _click_type = "f";
	_clickTag(_cid, _page, _page);
}


function ac_tracer(_cid, _page) {
        _click_type = "t";
	_clickTag(_cid, _page, _page);
}

function createXMLHttpRequest() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}
	try {
		return new ActiveXObject("MSXML2.XMLHTTP");
	} catch(e) {
		try {
			return new ActiveXObject("Microsoft.XMLHTTP");
		} catch(f) {
			return null;
		}
	}
}

function URLReader(url) {
	this.url = url;
	this.complete = false;
	this.req = createXMLHttpRequest();
	if (this.req == null) {
		// throw new Error("XMLHTTPRequestを初期化できません。");
		return null;
	}
	this.req.open("GET", this.url, false);  
}

URLReader.prototype.read = function() {
	this.req.send("");
	if (this.req.status == 200 && this.req.readyState== 4) {
		this.complete = true;
	} else {
		this.complete = false;
		// throw new Error("サーバーと通信中にエラーが発生しました。");
	}
}

function doHttpRead(url) {
	try {
		var urlReader = new URLReader(url);
		if (urlReader == null) {
			return false;
		}
		urlReader.read();
	} catch (e) {
		// alert("サーバー通信中にエラーが発生しました。: " + url);
		return false;
	}
	return true;
}




