﻿function bluring(){
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;

function flashWrite(url,w,h,id,bg,vars,win){ 

 var flashStr= 
 "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+ 
 "<param name='allowScriptAccess' value='always' />"+ 
 "<param name='movie' value='"+url+"' />"+ 
 "<param name='FlashVars' value='"+vars+"' />"+ 
 "<param name='wmode' value='"+win+"' />"+ 
 "<param name='wmode' value='opaque'>"+  
 "<param name='menu' value='false' />"+ 
 "<param name='quality' value='high' />"+ 
 "<param name='bgcolor' value='"+bg+"' />"+ 
 "<param name='wmode' value='transparent'>"+
 "<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' value='opaque' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+ 
 "</object>"; 

 document.write(flashStr); 

} 

function moviePlay(src,w,h) { 
document.write('<embed src="'+src+'" width='+w+' height='+h+' Volume="0" Showtracker="0" ShowPositionControls="0" Showstatusbar="0" AUTOSTART="-1" style="FILTER: gray()alpha(opacity=40,style=1,finishopacity=40)">') 
}

function VR(uri, w, h){
	html  = "";
	html += "<OBJECT ID='PLUGIN1' style=\"WIDTH: "+w+"px; HEIGHT: "+h+"px\"    codeBase=http://www.devalvr.com/instalacion/plugin/devalocx.cab#version=0,3,1,4 width="+w+"  height="+h+" classid=clsid:5D2CF9D0-113A-476B-986F-288B54571614>";
	html += "	<PARAM NAME=\"src\"				VALUE=\""+uri+"\">";
	html += "	<PARAM NAME=\"rotationx\"       VALUE=\"0\">";
	html += "	<PARAM NAME=\"rotationy\"       VALUE=\"100\">";
	html += "	<PARAM NAME=\"zoom\"            VALUE=\"0.6\">";
	html += "	<PARAM NAME=\"minzoom\"         VALUE=\"0.4\">";
	html += "	<PARAM NAME=\"maxzoom\"         VALUE=\"1.3\">";
	//html += "	<PARAM NAME=\"grayscale\"       VALUE=\"1\">";
	html += "	<PARAM NAME=\"language\"		VALUE=\"korean\">";
	html += "	<PARAM NAME=\"abouturl\"		VALUE=\"http://www.design-boom.com\">";
	html += "	<EMBED NAME=\"PLUGIN1\"   TYPE='application/x-devalvrx' 	PLUGINSPAGE='http://www.devalvr.com/instalacion/plugin/install.html' src='"+uri+"'	width='"+w+"' height='"+h+"'></EMBED>";
	html += "</OBJECT>";
	
	document.write(html);
}

function AutoPlayVR(){
     document.PLUGIN1.Commands("menu","play");
}


function GetVRNewObject(uri){
	html  = "";
	html += "<OBJECT ID='PLUGIN1' style=\"WIDTH: 576px; HEIGHT: 340px\"    codeBase=http://www.devalvr.com/instalacion/plugin/devalocx.cab#version=0,3,1,4 width=700  height=550 classid=clsid:5D2CF9D0-113A-476B-986F-288B54571614>";
	html += "	<PARAM NAME=\"src\"				VALUE=\""+uri+"\">";
	html += "	<PARAM NAME=\"rotationx\"       VALUE=\"0\">";
	html += "	<PARAM NAME=\"rotationy\"       VALUE=\"100\">";
	html += "	<PARAM NAME=\"zoom\"            VALUE=\"0.6\">";
	html += "	<PARAM NAME=\"minzoom\"         VALUE=\"0.4\">";
	html += "	<PARAM NAME=\"maxzoom\"         VALUE=\"1.3\">";
	//html += "	<PARAM NAME=\"grayscale\"       VALUE=\"1\">";
	html += "	<PARAM NAME=\"language\"		VALUE=\"korean\">";
	html += "	<PARAM NAME=\"abouturl\"		VALUE=\"http://www.design-boom.com\">";
	html += "	<EMBED NAME=\"PLUGIN1\"   TYPE='application/x-devalvrx' 	PLUGINSPAGE='http://www.devalvr.com/instalacion/plugin/install.html' src='"+uri+"'	width='700' height='550'></EMBED>";
	html += "</OBJECT>";
	
	document.write(html);
}

function AutoplayOnOff(){
     document.PLUGIN1.Commands("menu","play");
}

function popupLayer(s,w,h){
	if (!w) w = 600;
	if (!h) h = 400;

	var pixelBorder = 3;
	var titleHeight = 12;
	w += pixelBorder * 2;
	h += pixelBorder * 2 + titleHeight;

	var bodyW = document.body.clientWidth;
	var bodyH = document.body.clientHeight;

	var posX = (bodyW - w) / 2;
	var posY = (bodyH - h) / 2;

	hiddenSelectBox('hidden');

	/*** ׶ ̾ ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		zIndex = 3;
		left = 0;
		top = 0;
		width = "100%";
		height = document.body.scrollHeight;
		backgroundColor = "#FFFFFF";
		filter = "Alpha(Opacity=50)";
		opacity = "0.5";
	}
	obj.id = "objPopupLayerBg";
	document.body.appendChild(obj);

	/***  ̾ ***/
	var obj = document.createElement("div");
	with (obj.style){
		position = "absolute";
		zIndex = 4;
		left = posX + document.body.scrollLeft;
		top = posY + document.body.scrollTop;
		width = w;
		height = h;		
		backgroundColor = "#000000";
		border = "3px solid #000000";
	}
	obj.id = "objPopupLayer";
	document.body.appendChild(obj);

	/*** ŸƲ ̾ ***/
	var bottom = document.createElement("div");
	with (bottom.style){
		position = "absolute";
		zIndex = 4;
		width = w - pixelBorder * 2;
		height = titleHeight;
		left = 0;
		top = h - titleHeight - pixelBorder * 3;
		padding = "4px 0 0 0";
		textAlign = "right";
		backgroundColor = "#000000";
		color = "#ffffff";
		font = "11px ";
	}
	bottom.innerHTML = "<a href='javascript:closeLayer()'><font color='FFFFFF'><b>close</b></font></a>&nbsp;&nbsp;&nbsp;";
	obj.appendChild(bottom);

	/***  ***/
	var ifrm = document.createElement("iframe");
	with (ifrm.style){
		width = w - 6;
		height = h - pixelBorder * 2 - titleHeight - 3;
		//border = "3 solid #000000";
	}
	ifrm.frameBorder = 0;
	ifrm.src = s;
	//ifrm.className = "scroll";
	obj.appendChild(ifrm);
}

function _ID(obj){
	return document.getElementById(obj)
}

function hiddenSelectBox(mode){
	var obj = document.getElementsByTagName('select');
	for (i=0;i<obj.length;i++){
		obj[i].style.visibility = mode;
	}
}

function closeLayer(){
	hiddenSelectBox('visible');
	_ID('objPopupLayer').parentNode.removeChild( _ID('objPopupLayer') );
	_ID('objPopupLayerBg').parentNode.removeChild( _ID('objPopupLayerBg') );
}

function VR1(){
	popupLayer("vr/VR.html?no=1", 576, 340);
}

function VR2(){
	popupLayer("vr/VR.html?no=2", 576, 304);
}

function VR3(){
	popupLayer("vr/VR.html?no=3", 576, 304);
}

function VR4(){
	popupLayer("vr/VR.html?no=4", 576, 304);
}

function VR5(){
	popupLayer("vr/VR.html?no=5", 576, 304);
}

function VR6(){
	popupLayer("vr/VR.html?no=6", 576, 304);
}

function VR7(){
	popupLayer("vr/VR.html?no=7", 576, 304);
}
