	
	document.body.style.zoom = 1;
	document.body.style.padding = 0;
	document.body.style.margin = 0;
	var tumblr_api_read;

	if(navigator.appName != "Microsoft Internet Explorer"){
			 (function(){
			 
			  var events = ["mousedown", "mouseover", "mouseout", "mousemove",
			                "mousedrag", "click", "dblclick"];  
			  for (var i = 0; i < events.length; i++){
			   window.addEventListener(events[i], function(e){
			    window.event = e;
			   }, true);
			  }
			 }());
			};
	
	/*for inでエラーになる
	Array.prototype.omit = function(index)
	{
		return this.slice(0, index).concat(this.slice(index + 1, this.length));	
	}
	*/
	
	var TUMBprotojp =
	{
		id			:	[],
		type		:	"photo",
		size		:	100,
		cssClassName:	"tProtoJp",
		leftMargin	:	240,
		imgBlank	:	8,
		
		sizeArr		:	[0,100,250],
		defImgN		:	25,
		idCount		:	0,
		idCountCheck:	0,
		idTmpArr	:	[],
		idTmpHash	:	[],
		postsArr	:	[],
		tmvCookie	:	[],
		imgStartFlg	:	1,
		resizeFlg	:	true,
		
		ieJudg		:	/*@cc_on!@*/false,
		ieSpVale1	:	0,
		ieSpVale2	:	0,
		browserW	:	0,
		browserWf	:	function()
						{
							return 	document.body.clientWidth || innerWidth;
						},
		reImgNum	:	0,
		reImgNumF	:	function(bW,iW,iB)
						{
							this.reImgNum = Math.floor((bW-this.leftMargin)/(iW+iB));
							
							document.getElementById("BgDiv").style.width = this.reImgNum*(iW+iB)+this.imgBlank;
							
							return this.reImgNum;
						},
		imgPointArr	:	[],
		imgPointArrF:	function()
						{
							TUMBprotojp.imgStartFlg = 0;

							var rn = this.reImgNumF(this.browserWf(),this.size,this.imgBlank);

							this.imgPointArr = [];
							for(var i=0; i<rn;i++)
							{
								this.imgPointArr[i]={
													x	:	i*(this.size + this.imgBlank),
													y	:	0
													}
							}
						},
	imgLoadedFlg	:	false,
	jsonLoadedFlg	:	false,
	idTmpHashIn		:	function(a)
						{
							if(!a)return;
							
							var iArr = a.match(/http:\/\/[\S]+tumblr\.com/g);
							if(!iArr)return;
							
							var checkStrings = function(cs)
							{
								var banStrings = ["www","media","data"];
								var r = true;
								for(var i=0; i<banStrings.length; i++)
								{
									if(banStrings[i]==cs){r=false;break;}
								}
								return r;
							}
							for(var i=0,l=iArr.length; i<l; i++)
							{
								var e = iArr[i].indexOf("tumblr.com");
								e = iArr[i].slice(7,e-1);
								checkStrings(e)	?	this.idTmpHash[e]	?	this.idTmpHash[e]++
												 						:	this.idTmpHash[e]=1
												:	null;
							}
						},
	imgFadeIn		:	function(target)
						{
							target.style.opacity = 0;
							target.style.filter = "alpha(opacity=0)";
							
							var setOpacity = function(target, value)
							{
								target.style.opacity = value;
								target.style.filter = "alpha(opacity=" +value*100+")";//ie
							}
							
							var alpha = 1;
							
							var IntervalID = setInterval(function()
							{
								alpha = alpha*0.68;
								setOpacity(target, 1 - alpha);
								
								if(alpha<0.05){setOpacity(target, 1);clearInterval(IntervalID);}
							},100);
						},
	lodingBar		:	function(txt)
						{
							var LoadBg = document.getElementById("LoadBg");
							
							document.getElementById("LoadText").firstChild.nodeValue = txt;
							LoadBg.style.top = document.body.clientHeight-30 + document.body.scrollTop;
							LoadBg.style.display = "block";
						},
	createImgBlock	:	function(imgArr)
						{
							var PObj = TUMBprotojp;
							var idName = tumblr_api_read.tumblelog.name;
							
							if(PObj.reImgNum<2){ return;}
							
							var timeCount = 0;
							var maxtime = parseInt(this.size/100*imgArr.length/2*6)+20;
							var ArrayOmit = function(arr, index)
							{
								return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));	
							}
							
							var setID = setInterval(function()
							{
								PObj.imgLoadedFlg = false;
								PObj.lodingBar(idName);
								
								var imgPos = PObj.imgStartFlg;

								for(var i=0,l=imgArr.length; i<l; i++)
								{
									if(imgArr[i].complete)
									{
										imgArr[i].style.display = "block";
										imgArr[i].width = PObj.size;
										imgArr[i].style.left = PObj.imgPointArr[ imgPos ].x;
										imgArr[i].style.top = PObj.imgPointArr[ imgPos ].y;
										imgArr[i].width = PObj.size;
										imgArr[i].height = imgArr[i].height>imgArr[i].width*3	?	imgArr[i].width*3	:	imgArr[i].height;
										
										PObj.imgFadeIn(imgArr[i]);
										PObj.imgPointArr[ imgPos ].y += imgArr[i].height + PObj.imgBlank;
										
										imgArr = ArrayOmit(imgArr, i);
										
										document.getElementById("BgDiv").style.height = document.getElementById("popBg").style.height =  document.body.scrollHeight;
										
										var tempArrY = [];
										for(var i = 0; i < PObj.imgPointArr.length; i ++)
										{
											tempArrY[i] = PObj.imgPointArr[i].y;
										}
										
										for (i=0; i<tempArrY.length-1; i++) 
										{
											for (var j=0; j<tempArrY.length-i-1; j++)
											{ 
												if (tempArrY[j] >= tempArrY[j+1])
												{
													var t = tempArrY[j];
													tempArrY[j] = tempArrY[j+1];
													tempArrY[j+1] = t;
												}
											}
										}
																				
										for(i=0; l=PObj.imgPointArr.length, i<l; i++)
										{
											if(tempArrY[0] == PObj.imgPointArr[i].y)
											{
												PObj.imgStartFlg = i;
												break;	
											}
										}
										
										break;
									}
								}
								
								if(imgArr.length==0 || timeCount>maxtime)
								{
									if(imgArr.length > 0)
									{
										TUMBprotojp.id[TUMBprotojp.idCount].loaded = "error";
										window.stop	?	window.stop()	:	document.execCommand("Stop");
										
										var sDiv = document.getElementById("SelectDiv");
										var bg = sDiv.style.backgroundImage;
										sDiv.style.backgroundImage = 'url(null)';
										sDiv.style.backgroundImage = bg;
										
										sDiv = document.getElementById("LoadText");
										bg = sDiv.style.backgroundImage;
										sDiv.style.backgroundImage = 'url(null)';
										sDiv.style.backgroundImage = bg;

										var sDiv = document.getElementById(TUMBprotojp.id[TUMBprotojp.idCount].name);
										
										for(var i=0,l=imgArr.length; i<l; i++)
										{
											if(!imgArr[i].complete)
											{
												sDiv.removeChild(imgArr[i]);
											}
										}
										
									}

									PObj.imgLoadedFlg = true;
									document.getElementById("LoadBg").style.display = "none";
									TUMBprotojp.idCount++;
									
									clearInterval(setID);
								}
								else
								{
									timeCount++;
								}
								
							},	200);
						},
	createImgBlock2	:	function(imgArr)
						{
							var PObj = TUMBprotojp;
							
							if(PObj.reImgNum < 2){ return;}

							PObj.imgLoadedFlg = false;
							var imgPos = PObj.imgStartFlg;
							
							for(var j=0, k=PObj.imgStartFlg, l=imgArr.length; j<l; j++)
							{
								imgArr[j].style.display = "block";
								imgArr[j].width = PObj.size;
								imgArr[j].style.left = PObj.imgPointArr[imgPos].x;
								imgArr[j].style.top = PObj.imgPointArr[imgPos].y;
								imgArr[j].width = PObj.size;
								
								imgArr[j].height = imgArr[j].height>imgArr[j].width*3	?	imgArr[j].width*3	:	imgArr[j].height;
								
								PObj.imgPointArr[imgPos].y += imgArr[j].height + PObj.imgBlank;										
								imgPos / (PObj.reImgNum-1) == 1 ? imgPos = 0 : imgPos++;
							}
							
							PObj.imgStartFlg = imgPos;
							PObj.imgLoadedFlg = true;
							
							document.getElementById("BgDiv").style.height = document.body.clientHeight;
							document.getElementById("BgDiv").style.height = document.body.scrollHeight;
							
						},			
	parseTumbJson	:	function()
						{
							if(!tumblr_api_read){this.idCount++;this.imgLoadedFlg=true; return;};
										
							var TAR = tumblr_api_read;
							var idName = tumblr_api_read.tumblelog.name;
							var photo = 'photo-url-'+this.size;
							
							this.postsArr[idName] = TAR.posts;
							
							var div = document.createElement("div");
							div.id = idName;
							div.className = this.cssClassName + ' eNum'+TUMBprotojp.idCount;
							document.body.appendChild(div);
							document.getElementById(idName).style.zoom = 1;

							var imgArr =[];
							for (var i=0 ,l=TAR.posts.length; i<l; i++)
							{
								var img = document.createElement('img');
								imgArr[i] = img;
								imgArr[i].style.display = "none";
								imgArr[i].style.position = "absolute";
								imgArr[i].src = TAR.posts[i][photo];
								imgArr[i].id = idName+i;
								imgArr[i].className = "thumImg";
								
								var pc = TAR.posts[i]["photo-caption"];
								
								if(pc)
								{
									this.idTmpHashIn(pc);
									var c = pc.match(/">.*?<\/a/g);
									c = c ? c[c.length - 1].slice(2, -3) : "no title";
									document.getElementById("DummyDiv").innerHTML = c;
									imgArr[i].alt = imgArr[i].title = document.getElementById("DummyDiv").innerHTML;
								}
								document.getElementById(idName).appendChild(img);
							}
	
							this.createImgBlock(imgArr);
							var iD = this.id;
							var diN = this.defImgN;
							if (this.idTmpHash) 
							{
								var iTH = this.idTmpHash;
								
								for (var i in iTH) {
									var f = false;
									for (var j = 0, len = iD.length; j < len; j++)
									{
										if (iD[j].name == i) {
											iD[j].val += iTH[i];
											f = true;
										}
									}
									!f ? iD.push({
										name: i,
										val: iTH[i],
										num: diN,
										gain: false,
										loaded: false
									}) : null;
								}
								this.idTmpHash = [];
							}

							var gainDiv = document.getElementById("gainID");
							var tempDiv = document.getElementById("tempID");
							var gDiv = document.createElement('div');
							var tDiv = document.createElement('div');
							
							gainDiv.firstChild ? gainDiv.removeChild(gainDiv.firstChild) : null;
							tempDiv.firstChild ? tempDiv.removeChild(tempDiv.firstChild) : null;
	
							for(var i=0,l=iD.length; i<l; i++)
							{
								var a = document.createElement("a");
	
								a.title = iD[i].name;
								a.style.padding = "1px 2px";

								idName==iD[i].name ? iD[i].loaded = "true" : null;
	
								iD[i].loaded=="true"	?	a.className="imgLoaded"
														:	iD[i].loaded == "error"	?	a.className="imgError"
																					:	a.className="imgNormal";
	
								if(iD[i].gain)
								{
									a.appendChild(document.createTextNode(iD[i].name+"["+iD[i].num+"]"));
									a.href = "javascript:TUMBprotojp.setPopup('settingID','"+( i -this.urlHashLength)+"')";
									gDiv.appendChild(a);
									gDiv.appendChild(document.createTextNode(" "));
								}
								else
								{
									
									a.appendChild(document.createTextNode(iD[i].name));
									a.href = "javascript:TUMBprotojp.setPopup('addID','"+i+"')";
									
									iD[i].val = isNaN(iD[i].val)	?	1	:	iD[i].val;
									a.style.fontSize = (iD[i].val*10>120 ? 200 : iD[i].val*10+80)+ "%";
									
									tDiv.appendChild(a);
									tDiv.appendChild(document.createTextNode(" "));
									
								}
							}
							gainDiv.appendChild(gDiv);
							tempDiv.appendChild(tDiv);
						},
		PopClose	:	function(type)
						{
							document.getElementById("popBg").style.display = "none";
							
							if (type == "photo"||type == "Reblog")
							{
								document.getElementById("popPhoto").style.display = "none";
								document.getElementById("popClose").style.display = "none";
								document.getElementById("popFooter").style.display = "none";
								clearInterval(TUMBprotojp.popIntID);
							}
							else if (type == "addID" || type == "settingID" || type == "Setting")
							{
								document.getElementById("PopSetting").style.display = "none";
							}
							else if(type == "HttpReq")
							{
								document.getElementById("PopHttpReq").style.display = "none";
							}
						},
		objCenter	:	function(o)
						{
							o.style.top = (document.body.clientHeight-o.height)/2 + document.body.scrollTop;
							o.style.left = (document.body.clientWidth-o.width)/2;
						},
		popIntID	:	0,
		nameCheck	:	function(na)
						{
							var r=true;
							
							for(var i=0,l=this.id.length; i<l; i++  )
							{
								if(this.id[i].name == na && this.id[i].gain)
								{
									r = false;
									break;
								}
							}
							
							return r;
						},
		setPopup	:	function(type ,obj)
						{
							var pbg = document.getElementById("popBg");
							
							pbg.style.width = document.body.clientWidth;
							pbg.style.height = document.body.scrollHeight;
							pbg.style.display = "block";
							
							pbg.onclick = function(){TUMBprotojp.PopClose(type);}
						
							if (type == "photo")
							{
									pbg.onmouseover = function(){ document.getElementById("popFooter").style.display = "none" }
									
									var pp = document.getElementById("popPhoto");
									pp.firstChild ? pp.removeChild(pp.firstChild) : null;
									pp.width = pp.style.width = 100;
									pp.height = pp.style.height = 100;
									pp.style.backgroundImage = 'url(./img/ajax_loader.gif)';
									pp.style.padding = 0;
									
									pp.style.display = "block";
									this.objCenter(pp);

									var ImgSize	= ["_500.","_400.","_250.","_100."];
									var ImgSizeCount = 0;

									var img = document.createElement("img");
									img.src = obj.src.replace(/_100.|_250./, ImgSize[ImgSizeCount]);
									img.alt = img.title = obj.title;
									img.onclick = function(){TUMBprotojp.PopClose("photo");}
									
									var ieOnError = false;
									img.onerror = function(){if(TUMBprotojp.ieJudg){ieOnError = true; img.width =0;}};
									
									this.popIntID = setInterval(function()
									{
										if(img.complete || ieOnError)
										{
											clearInterval(TUMBprotojp.popIntID);
											ieOnError = false;
											
											if(!img.width && ImgSizeCount < ImgSize.length-1)
											{
												ImgSizeCount++;
												img.src = obj.src.replace(/_100.|_250./, ImgSize[ImgSizeCount]);
												TUMBprotojp.popIntID = setInterval(arguments.callee,200);
												return;
											}

											var Blank = TUMBprotojp.imgBlank;
											
											pp.style.padding = Blank;
											pp.width = pp.style.width = img.width;
											pp.height = pp.style.height = img.height;
											pp.style.backgroundImage = 'url()';
											TUMBprotojp.objCenter(pp);

											0 > parseInt(pp.style.top.slice(0, -2)) ? pp.style.top = 0 : null;
											
											pp.style.left = parseInt(pp.style.left.slice(0, -2)) - Blank;

											var pc = document.getElementById("popClose");
											pc.style.display = "block";
											pc.style.top = pp.offsetTop;
											pc.style.left = pp.offsetLeft + pp.width + Blank;

											var pf = document.getElementById("popFooter");
											pf.style.top = pp.offsetTop + pp.height - 48;
											pf.style.left = pp.offsetLeft + pp.width - 158;

											document.getElementById("popReblog").href="javascript:TUMBprotojp.setPopup('Reblog','"+TUMBprotojp.postsArr[obj.name][obj.num]["url"]+"')";
											document.getElementById("popPost").href= TUMBprotojp.postsArr[obj.name][obj.num]["url"];
											
											var a = TUMBprotojp.postsArr[obj.name][obj.num]["photo-caption"].match(/href=".*?"/g);
											
											document.getElementById("popSource").href=	a	?	a[a.length - 1].slice(6,-1)
																							:	"javascript:alert('no Source')";
	
											img.onmouseover = function(){pf.style.display = "block"};
											
											pp.appendChild(img);
										}
									}, 200)
								}
								else if(type=="addID")
								{
									obj = parseInt(obj);
																																	
									var ps = document.getElementById("PopSetting");
									ps.style.display = "block";
									ps.style.top = document.body.clientHeight/2-100+document.body.scrollTop;
									ps.style.left = document.body.clientWidth/2-135;
									
									var psid = document.getElementById("PopSetID");
									psid.style.display = "block";
									document.getElementById("PopSetAcc").style.display = "none";
									document.getElementById("PopSetDEL").style.display = "none";
									
									var thisTumblr = document.getElementById("thisTumblr");
									
									if(obj>-1)
									{
										document.SettingForm.tumbID.value = this.id[ obj ].name;
										document.SettingForm.tumbID.readOnly =true;
										document.SettingForm.imgNum.focus();
										
										thisTumblr.href = "http://"+this.id[ obj ].name + ".tumblr.com/";
										thisTumblr.style.display = "inline";
									}
									else
									{
										document.SettingForm.tumbID.value = "";
										document.SettingForm.tumbID.readOnly =false;
										document.SettingForm.tumbID.focus();
										
										thisTumblr.style.display = "none";
									}
									
									document.SettingForm.imgNum.value = "25";
									document.SettingForm.save.value = "Add List";
									
									document.getElementById("PopSetCAN").onclick = function()
									{
										TUMBprotojp.PopClose(type);
									};

									document.getElementById("PopSetSAV").onclick = function()
									{
										if(document.SettingForm.tumbID.value.length<1)
										{
											alert("input id!"); return;
										}
										else if(!TUMBprotojp.nameCheck(document.SettingForm.tumbID.value))
										{
											alert("this ID exist! change ID");return;
										}
										
										TUMBprotojp.tmvCookie[0].idList.push(
										{
											name: document.SettingForm.tumbID.value,
											val: 999,
											num: parseInt(document.SettingForm.imgNum.value),
											gain: true,
											loaded: false
										});
																											
										TUMBprotojp.tmvSetCookie();				
										location.reload();
									};
								}
								else if(type=="settingID")
								{
									obj = parseInt(obj);
									
									var thisID = this.tmvCookie[0].idList[ obj ];
									
									var ps = document.getElementById("PopSetting");
									ps.style.display = "block";
									ps.style.top = document.body.clientHeight/2-100+document.body.scrollTop;
									ps.style.left = document.body.clientWidth/2-135;
	
									var psid = document.getElementById("PopSetID");
									psid.style.display = "block";
									document.getElementById("PopSetAcc").style.display = "none";
									document.getElementById("PopSetDEL").style.display = "inline";
									
									var thisTumblr = document.getElementById("thisTumblr");
									thisTumblr.href = "http://"+thisID.name + ".tumblr.com/";
									thisTumblr.style.display  = "inline";
	
									document.SettingForm.tumbID.value = thisID.name;
									document.SettingForm.imgNum.value = thisID.num;
									document.SettingForm.save.value = "Save";
									document.SettingForm.tumbID.readOnly =true;
									document.SettingForm.tumbID.focus();
									
									var checkID = document.SettingForm.tumbID.value;
									
									document.getElementById("PopSetCAN").onclick = function()
									{
										TUMBprotojp.PopClose(type)
									};
									
									document.getElementById("PopSetSAV").onclick = function()
									{
										TUMBprotojp.tmvCookie[0].idList[obj].num = document.SettingForm.imgNum.value;
										TUMBprotojp.tmvSetCookie();				
										location.reload();
									};
									
									document.getElementById("PopSetDEL").onclick = function()
									{
										if (window.confirm('really delete?'))
										{
											var delIndex = function(arr, index){
												var a1 = arr.slice(0, index);
												var a2 = arr.slice(index);
												a2.shift()
												return a1.concat(a2);
											};
											
											TUMBprotojp.tmvCookie[0].idList = delIndex(TUMBprotojp.tmvCookie[0].idList, obj);
											TUMBprotojp.tmvSetCookie();				
											location.reload();
										}
									}
								}
								else if(type=="Setting")
								{
									var ps = document.getElementById("PopSetting");
									ps.style.display = "block";
									ps.style.top = document.body.clientHeight/2-100+document.body.scrollTop;
									ps.style.left = document.body.clientWidth/2-135;
	
									var psid = document.getElementById("PopSetAcc");
									psid.style.display = "block";
									document.getElementById("PopSetID").style.display = "none";
									document.getElementById("PopSetDEL").style.display = "none";
	
									document.SettingForm.defPhotoSize.value = this.tmvCookie[0].setting.defPhotoSize;
									document.SettingForm.defPhotoNum.value = this.tmvCookie[0].setting.defPhotoNum;
									document.SettingForm.save.value = "Save";
									document.SettingForm.defPhotoSize.focus();
									
									document.getElementById("PopSetCAN").onclick = function()
									{
										TUMBprotojp.PopClose(type)
									};
									
									document.getElementById("PopSetSAV").onclick = function()
									{
										TUMBprotojp.tmvCookie[0].setting.defPhotoSize = document.SettingForm.defPhotoSize.value;
										TUMBprotojp.tmvCookie[0].setting.defPhotoNum = document.SettingForm.defPhotoNum.value;									
										
										TUMBprotojp.tmvSetCookie();
										TUMBprotojp.PopClose(type)
									};
	
								}
								else if(type=="Reblog")
								{
									var wh = window.outerHeight	?	window.outerHeight	:	document.body.clientHeight;
									var h = wh-240<480	?	480	:	wh-240;

									var w = window.open("./reblog.php?post_url="+obj,
									"_blank","width=760,height="+h+",scrollbars=1,locationbar=0,menubar=0,resizable=1,status=1,toolbar=0,directories=0");
									!this.ieJudg	?	w.moveBy((document.body.clientWidth-640)/2,(wh-h)/2)
													:	null;
								}
								else if(type=="HttpReq")
								{
									var phr = document.getElementById("PopHttpReq")
									phr.style.display = "block";
									phr.style.top = document.body.clientHeight/2-240+document.body.scrollTop;
									phr.style.left = document.body.clientWidth/2-320;				
									
									phr.innerHTML = "<img src='./img/ajax_loader.gif' style='position:absolute; top:190px; left:270px;'>"
									
									function callBack(o)
									{
									  phr.innerHTML = o.responseText; 
									}
									sendRequest(callBack,'','GET',obj);
								}
						},
		callAPI		:	function()
						{
							if(this.idCount==this.id.length){alert("no list! prease add id"); return;}

							tumblr_api_read={};
							tumblr_api_read.tumblelog={};
							tumblr_api_read.tumblelog.name=0;
							
							var script = document.createElement("script");
							script.type = "text/javascript";
							script.src = "http://"+this.id[this.idCount].name+".tumblr.com/api/read/json?num="+this.id[this.idCount].num+"&type="+this.type;
							document.body.appendChild(script);
							
							TUMBprotojp.lodingBar( "{JSON} "+ this.id[this.idCount].name);
							
							TUMBprotojp.jsonLoadedFlg = false;
							var c = 0;
							var reID= setInterval(function()
								{
									c++;
									try
									{
										if (tumblr_api_read.tumblelog.name) 
										{
											var script2 = document.createElement("script");
											script2.type = "text/javascript";
											script2.src = "./tmv_go.js";
											document.body.appendChild(script2);
											TUMBprotojp.jsonLoadedFlg = true;
											clearInterval(reID);
										}
									} 
									catch (e) {}
									
									if(c>20)
									{
										TUMBprotojp.id[TUMBprotojp.idCount].loaded = "error";
										
										TUMBprotojp.idCount++;
										TUMBprotojp.jsonLoadedFlg = true;
										document.getElementById("LoadBg").style.display = "none";
										
										clearInterval(reID);
									}
								},200);
								
						},
				O2J	:	function(o)
						{
							var rt = "{";
					
							for(var j in o)
							{
								rt+= "'" + j + "'" + ":" + "'"+ o[j] +"',";
							}
							
							rt+="}";
							rt = rt.replace(/,}/,"}");
							return rt;
						},
			idO2J	:	function(ao)
						{
							var rt = "[";
					
							for(var i=0,l=ao.length; i<l; i++)
							{
								rt+="{";
								for(var j in ao[i])
								{
									rt+= "'" + j + "'" + ":" + "'"+ ao[i][j] +"',";
								}
								rt = rt.replace(/,}/,"}");
								rt+="},";
							}
							
							rt+="]";
							rt = rt.replace(/,},]/,"}]");
							return rt;
						},
		tmvCookie2J	:	function(o)
						{
							return "[{'setting':" + this.O2J(o.setting)+",'idList':" +this.idO2J(o.idList)+"}]"
						},
		tmvSetCookie:	function()
						{
							document.cookie = "_tmvProtoJpVale=" + this.tmvCookie2J(this.tmvCookie[0]) + "; expires=Tue, 1-Jan-2030 00:00:00 GMT;";
						},
	  urlHashLength	:	0,
		parseURLhash:	function(uh)
						{
							var r = false;
							var uhash = uh.replace(/ |　/g,"");
							
							if(uhash.indexOf("id=")==-1){return r;};
							
							uhash = uhash.split("&");
							
							var uNum = 25;
							for (var i=0; i<uhash.length; i++)
							{
								if(!uhash[i].indexOf("num="))
								{
									uNum = parseInt(uhash[i].slice(uhash[i].indexOf("num=")+4));									
									isNaN(uNum)	?	uNum=25
												:	uNum>50	?	uNum=50
															:	uNum<5	?	uNum=5
																		:	uNum=uNum;
								}
							}
							
							for (var i=0; i<uhash.length; i++)
							{
								if (!uhash[i].indexOf("id="))
								{
									r=[];
									var hArr = uhash[i].slice(3).split(",");
									for(var j=0,l=hArr.length; j<l; j++)
									{
										if(hArr[j].length>0)
										{
											var f=true;
											for(var k=0;k<r.length;k++)
											{
												hArr[j]==r[k].name	?	f=false	:	null;
											}
											f	?	r.push
													({
														name: hArr[j],
														val: 1,
														num: uNum,
														gain: false,
														loaded: false
													}):null;
										}
									}
								}
							}
							return r;
						},
		init		:	function()
						{
							var cookArr = document.cookie.split(";")
							var cookieTmp;
							
							for(var i=0,l=cookArr.length; i<l; i++ )
							{
								cookArr[i].indexOf("_tmvProtoJpVale=")!=-1	?	cookieTmp = cookArr[i]
																			:	null;								
							}
							var urlHashObj = location.hash.length>4	?	this.parseURLhash(location.hash.slice(1))
																	:	false;
							if(cookieTmp)
							{
								cookieTmp = cookieTmp.replace(/_tmvProtoJpVale=/,"");
								this.tmvCookie =  eval("("+ cookieTmp +")");
															
								if(this.tmvCookie[0].idList.length>0)
								{
									var tmpCookieId = eval("("+ this.idO2J(this.tmvCookie[0].idList) +")");
									
									if(urlHashObj)
									{
										var DelHashObjIndex = [];
										
										for(var i=0;i<tmpCookieId.length;i++)
										{
											for(var j=0;j<urlHashObj.length;j++)
											{
												if(tmpCookieId[i].name == urlHashObj[j].name)
												{
													DelHashObjIndex.push(j);
													break;
												}
											}
										}
										
										for(var i=0;i<urlHashObj.length;i++)
										{
											var f=true;
											for (var j=0; j<DelHashObjIndex.length; j++) 
											{
												i==DelHashObjIndex[j]	?	f=false	:	null;
											}
											
											f	?	this.id.push( urlHashObj[i] )	:	null;
										}
										this.urlHashLength = this.id.length;
										this.id = this.id.concat(tmpCookieId);
									}
									else
									{
										this.id = eval("("+ this.idO2J(this.tmvCookie[0].idList) +")");
									}
								}
								else if(urlHashObj)
								{
									this.id = urlHashObj;
								}
								else
								{
									this.id.push({
													name	:	"proto-jp",
													num		:	parseInt(this.tmvCookie[0].setting.defPhotoNum),
													val		:	1,
													gain	:	false,
													loaded	:	false
												});
								}
							}
							else
							{
								this.tmvCookie[0]=
								{
									setting	:	{
													email			:	"",
													pass			:	"",
													name			:	"Name0",
													defPhotoSize	:	1,
													defPhotoNum		:	25,
													type			:	"photo",
													selected		:	true
												},
									idList	:	[]	
								};
								
								
								urlHashObj	?	this.id = urlHashObj
											:	this.id.push(
												{
													name	:	"proto-jp",
													num		:	25,
													val		:	1,
													gain	:	false,
													loaded	:	false
												});
							}
							
							this.size = this.sizeArr[parseInt(this.tmvCookie[0].setting.defPhotoSize)];
							this.defImgN = parseInt(this.tmvCookie[0].setting.defPhotoNum);

							this.tmvCookie[0].setting.email="";
							this.tmvCookie[0].setting.pass="";		
							
							this.imgPointArrF();
							this.browserW = this.browserWf();

							document.write('<script type="text/javascript" src="http://'+this.id[TUMBprotojp.idCount].name +'.tumblr.com/api/read/json?num='+this.id[TUMBprotojp.idCount].num+'&type='+this.type+'"><\/script>');
							document.write('<script type="text/javascript" src="./tmv_go.js"><\/script>');
						}
						
	};
	
	var watch_scroll	=	function()
							{
								var sc = document.body.scrollTop;
								var total = (document.body.scrollHeight - document.body.clientHeight);
								var remain = total - sc;
	
								if(remain < 800 &&  TUMBprotojp.idCount > TUMBprotojp.idCountCheck)
								{
									TUMBprotojp.idCountCheck=TUMBprotojp.idCount;
									TUMBprotojp.callAPI();
								}
								
								var self = arguments.callee;
								setTimeout(self,300);
							};
	(function(){
		var div = document.createElement('div');
		div.id = "SelectDiv";
		div.style.position = "absolute";
		div.style.backgroundImage = 'url(./img/stripe12.gif)';
		div.style.backgroundColor = "#cc0000";
		div.style.zIndex = 20;
		div.style.display = "none";
		div.className = "mouseout_dummy";
		document.body.appendChild(div);
	})();
	(function(){
		var div = document.createElement('div');
		div.id = "DummyDiv";
		div.style.position = "absolute";
		div.style.display = "none";
		document.body.appendChild(div);
	})();
	(function(PObj){
		var div = document.createElement('div');
		div.id = "BgDiv";
		div.style.backgroundColor = "#EEE";
		div.style.position = "absolute";
		div.style.top = 0;
		div.style.left = PObj.leftMargin-PObj.imgBlank;
		div.style.height = "100%";
		div.style.zIndex = 10;
		document.body.appendChild(div);
	})(TUMBprotojp);
	(function(PObj){
		var div = document.createElement('div');
		div.id = "popPhoto";
		div.style.backgroundColor = "#FFF";
		div.style.position = "absolute";
		div.style.top = 0;
		div.style.left = PObj.leftMargin-PObj.imgBlank;
		
		div.style.width = 100;
		div.style.height =100;
		div.width = 100;
		div.height = 100;
		div.style.padding=PObj.imgBlank;
		
		div.style.zIndex = 205;
		div.style.display = "none";
		div.style.backgroundRepeat = "no-repeat";
		document.body.appendChild(div);
	})(TUMBprotojp);
	
	window.onresize = function()
	{
		var PObj = TUMBprotojp;	
		var pbg = document.getElementById("popBg");
		pbg.style.width = document.body.clientWidth
		pbg.style.height = document.body.scrollHeight;

		if(!PObj.imgLoadedFlg || !PObj.jsonLoadedFlg || PObj.browserW == PObj.browserWf() ){return;}
		PObj.browserW = PObj.browserWf();
		
		document.body.scrollTop = 0;
		
		var Fnc = function()
		{
			PObj.imgPointArrF();
			for(var i in PObj.postsArr )
			{
				PObj.createImgBlock2( document.getElementById(i).getElementsByTagName("img"));
			}
		}
		
		!PObj.ieJudg	?	Fnc()
						:	function()
							{
								if(PObj.ieSpVale1==0)
								{
									PObj.ieSpVale1++;
									var reID = setInterval(function()
										{
											if( PObj.ieSpVale1 > PObj.ieSpVale2 )
											{
												PObj.ieSpVale2 = PObj.ieSpVale1;
											}
											else
											{		
												PObj.ieSpVale1 = 0;
												PObj.ieSpVale2 = 0;
												Fnc();
												clearInterval(reID);
											}
										},200)
								}
								PObj.ieSpVale1++;
							}();
		
	};
	
	
	document.onmouseover = function()
	{
		var target = event.target || event.srcElement;
		
		if (target.className == "mouseout_dummy" )
		{
			document.getElementById("SelectDiv").style.display = "none";
			document.getElementById("thum_postUser").style.display = "none";
			document.getElementById("thum_reblog").style.display = "none";
		}
		else if(target.className == "thumImg")
		{
			var targetTop = parseInt(target.style.top.slice(0,-2));
			var targetLeft = parseInt(target.style.left.slice(0,-2));
			var iNum = parseInt(target.id.slice(target.parentNode.id.length));
	
			var iBlank = TUMBprotojp.imgBlank;
			var lMargin = TUMBprotojp.leftMargin;
			
			var sd = document.getElementById("SelectDiv");
			sd.style.top = targetTop - iBlank;
			sd.style.left = targetLeft - iBlank + lMargin;
			sd.style.width = target.width + iBlank*2;
			sd.style.height = target.height + iBlank*2;
			sd.style.display = "block";
			
			var tp = document.getElementById("thum_postUser");
			tp.href = TUMBprotojp.postsArr[target.parentNode.id][iNum]["url"];
			tp.target ="_blank";
			tp.title = target.parentNode.id;
			tp.style.top = targetTop;
			tp.style.left = targetLeft + lMargin;

			var n = target.parentNode.id.length>12	?	target.parentNode.id.slice(0,10)+".."
													:	target.parentNode.id;
			tp.removeChild(tp.firstChild);
			tp.appendChild(document.createTextNode(n));
			tp.style.display = "inline";
			
			var tr = document.getElementById("thum_reblog");
			tr.style.top = targetTop +target.height -24;
			tr.style.left = targetLeft +TUMBprotojp.leftMargin+4;
			tr.style.display = "inline";
			tr.href="javascript:TUMBprotojp.setPopup('Reblog','"+TUMBprotojp.postsArr[target.parentNode.id][iNum]["url"]+"')";
		}
	}
	
	document.onclick = function()
	{
		var target = event.target || event.srcElement;
		
		if(target.className == "thumImg")
		{
			var o = {};
				o.src = target.src;
				o.title = target.title;
				o.name = target.parentNode.id;
				o.num = parseInt(target.id.slice(target.parentNode.id.length));
			TUMBprotojp.setPopup("photo", o);
		}
	}
	
	TUMBprotojp.init();
	watch_scroll();