try{
	document.execCommand('BackgroundImageCache',false,true);
}
catch(e){}

//check browser
var isie=(/msie/i).test(navigator.userAgent); //ie
var isie6=(/msie 6/i).test(navigator.userAgent); //ie 6
var isie7=(/msie 7/i).test(navigator.userAgent); //ie 7
var isie8=(/msie 8/i).test(navigator.userAgent); //ie 8
var isie9=(/msie 9/i).test(navigator.userAgent); //ie 9
var isfirefox=(/firefox/i).test(navigator.userAgent); //firefox
var isapple=(/applewebkit/i).test(navigator.userAgent); //safari,chrome
var isopera=(/opera/i).test(navigator.userAgent); //opera
var isios=(/(ipod|iphone|ipad)/i).test(navigator.userAgent);//ios
var isipad=(/(ipad)/i).test(navigator.userAgent);//ipad
var isandroid=(/android/i).test(navigator.userAgent);//android
if(isie7 || isie8 || isie9) isie6=false;
if(isie9) isie=false;


//language
//var language=((/language=eng/).test(location.href))? 'eng' : 'kor';
var language= 'kor';
//image root
var imageroot='./files/images';

//menu code
var menu=0;
var prevmenu=0;


//util
var util={

	//create element
	create : function(opts){
		//galleryimg='no';
		var rv=(isie)? '' : document.createElement(opts.tagname);
		for(var i in opts){
			if(i!='tagname'){
				if(isie) rv+=' '+((i=='classname')? 'class' : i)+'="'+opts[i]+'"';
				else rv.setAttribute((i=='classname')? 'class' : i,opts[i]);
			}
		}
		return (isie)? document.createElement('<'+opts.tagname+rv+'>') : rv;
	},

	//add events
	addevent : function(tg,name,func){
		if(tg.attachEvent) tg.attachEvent('on'+name,func);
		else tg.addEventListener(name,func,false);
	},

	//remove events
	removeevent : function(tg,name,func){
		if(tg.detachEvent) tg.detachEvent('on'+name,func);
		else tg.removeEventListener(name,func,false);
	},

	//get document size
	getdocumentsize : function(){
		return [document.documentElement.offsetWidth,document.documentElement.offsetHeight];
	},

	//get scroll
	getscroll : function(){
		if(isapple) return [document.body.scrollLeft,document.body.scrollTop,document.body.scrollWidth,document.body.scrollHeight];
		else return [document.documentElement.scrollLeft,document.documentElement.scrollTop,document.documentElement.scrollWidth,document.documentElement.scrollHeight];
	},

	//set scroll
	setscroll : function(v){
		if(isapple) document.body.scrollTop=v;
		else document.documentElement.scrollTop=v;
	},

	//set opacity
	setopacity : function(tg,v){
		if(isie) tg.style.filter='alpha(opacity='+(v*100)+')';
		else tg.style.opacity=v;
	},

	//add focusing event to form items
	formfocusing : function(){
		var item=[];
		var ip=document.getElementsByTagName('input');
		for(var i=0,max=ip.length; i<max; i++) if(ip[i].type=='text') item.push(ip[i]);
		var ta=document.getElementsByTagName('textarea');
		for(var i=0,max=ta.length; i<max; i++) item.push(ta[i]);
		for(var i=0,max=item.length; i<max; i++){
			util.addevent(item[i],'focus',function(e){
				ani.set({target:(e.target)? e.target : e.srcElement,to:'border-color:#61563B',time:0.5,fps:36});
			});
			util.addevent(item[i],'blur',function(e){
				ani.set({target:(e.target)? e.target : e.srcElement,to:'border-color:#CFC9BA',time:0.5,fps:36});
			});
		}
	},

	//form check
	formcheck : function(tg){
		var item=[];
		var ip=tg.getElementsByTagName('input');
		for(var i=0,max=ip.length; i<max; i++) if(ip[i].type=='text') item.push(ip[i]);
		var ta=tg.getElementsByTagName('textarea');
		for(var i=0,max=ta.length; i<max; i++) item.push(ta[i]);
		var sel=tg.getElementsByTagName('select');
		for(var i=0,max=sel.length; i<max; i++) item.push(sel[i]);
		for(var i=0,r,max=item.length; i<max; i++){
			r=(item[i].required || (/required/).test(item[i].className))? true : false;
			if(r && (!item[i].value)){
				item[i].focus();
				return false;
			}
		}		
		return true;
	}

}

/* crea.m object */
var nm={

	loaded : false,

	height : 580,

	//set object's
	header : util.create({tagname:'header'}),
	h1 : util.create({tagname:'h1'}),
	nav : util.create({tagname:'nav'}),
	navi : [],
	section : util.create({tagname:'section'}),
	article : {
		0 : [],//main
		1 : [],//company
		2 : [],//business
		3 : [],//portfolio
		4 : []//contact
	},
	pfdata : [],
	footer : util.create({tagname:'footer'}),
	device : util.create({tagname:'p'}),
	lang : [],
	fnavi : [],
	address : util.create({tagname:'address'}),

	isshowtime : false,

	preloader : null

}

//resize
nm.resize=function(f){

	if(isipad && parent){
		var hs=[594,1460,1027,594,594];
		parent.document.getElementsByTagName('iframe')[0].style.height=Math.max(parent.document.documentElement.clientHeight,hs[menu])+'px';
	}

	var hp=580;

	if(nm.devices.cur=='phone') nm.height=850;
	else if(menu==1) nm.height=hp+(433*(nm.article[menu].length-1));
	else if(menu==2) nm.height=hp+433;
	else nm.height=hp;

	var ds=util.getdocumentsize();
	var top=(ds[1]>nm.height)? Math.round((ds[1]-nm.height)/2) : 0;
	if(menu==0) top=0;
	var foot=(nm.devices.cur=='phone')? top+753 : top+500;
	if(nm.devices.cur!='phone'){
		//if(menu==1) foot=foot+(433*(nm.article[menu].length-1));
		//else if(menu==2) foot=foot+433;
		
		switch(menu)
		{
			case 0 :
				foot=63+((433*(nm.article[menu].length))/3)
			break;
			
			case 1 : 
				foot=foot+(433*(nm.article[menu].length-1))
			break;
			
			case 2 :
				foot=foot+433;
			break;
			
			case 3 :
				
			break;
			
			case 4 :
				
			break;
			
			case 5 :
				
			break;
			
			case 6 :
				
			break;
		}
	}
	
	ani.set({target:nm.footer,to:'padding-top: 0px; left:'+Math.round((ds[0]/2)-160)+'px;top:'+foot,easing:'easeOutExpo',onupdate:(nm.devices.cur=='pc')? '' : function(tg){
		nm.devices.wall.style.height=1500;

	}});

	if(nm.devices.cur=='phone'){
		nm.section.style.height='433px';
		var easing=(nm.devices.falling)? 'easeOutBounce' : 'easeOutExpo';
		if(nm.devices.falling){

		}
		ani.set({target:nm.devices.phone,to:'left:'+Math.round((ds[0]/2)-610)+'px;top:'+top+20,time:1,easing:easing,
			onupdate : function(tg){
				nm.devices.phonerf.style.left=tg.style.left;
				//nm.devices.phonerf.style.top=(parseInt(tg.style.top)+729)+'px';
				nm.devices.phonerf.style.top=(parseInt(tg.style.top)+775)+'px';
			},
			onend:(!nm.devices.falling)? '' : function(){
				nm.devices.falling=false;
			}
		});
		return;
	}
	
	ani.set({target:nm.header,to:'left:'+Math.round((menu==0) ? (ds[0]/2)-160 : (ds[0]/2)-160)+'px;top:'+top,easing:'easeOutExpo'});
	if(nm.nmreel.logo != undefined) ani.set({target:nm.nmreel.logo ,to:'left:'+Math.round(ds[0]/2 - 86)+'px;top:10px',easing:'easeOutExpo'});
	//reset section
	var secleft=(menu==1 || menu==5 || menu==6)? Math.round((ds[0]/2)-160) : (menu==2 || menu==4 || menu==7)? Math.round((ds[0]/2)-320) : 0;
	var secwidth=(menu==1 || menu==5 || menu==6)? '320px' : (menu==2 || menu==4 || menu==7)? '640px' : '100%';
	var secheight;
	
	switch(menu)
	{
		case 0 :
			secheight=(433*(nm.article[menu].length))/3;
		break;
		
		case 1 : 
			secheight=433*(nm.article[menu].length);
		break;
		
		case 2 :
			secheight=433*2;
		break;
		
		case 3 :
			secheight=433;
		break;
		
		case 4 :
			secheight=433;
		break;
		
		case 5 :
			secheight=433;
		break;
		
		case 6 :
			secheight=433;
		break;
	}	

	nm.section.style.width=secwidth;
	nm.section.style.height=secheight+'px';

	if(menu==prevmenu){
		ani.set({target:nm.section,to:'left:'+secleft+'px;top:'+(top+63)+'px',time:1,easing:'easeOutExpo'});
	}else{
		nm.section.style.left=secleft+'px';
		ani.set({target:nm.section,to:'top:'+(top+63)+'px',time:1,easing:'easeOutExpo'});
		prevmenu=menu;
	}

	nm.isshowtime=true;
	nm.setarticles('fromresize');

	//add scroll section event
	//if((menu==0 && 1280>nm.section.offsetWidth) || (menu==3 && nm.pfslider.dpea>2 && nm.pfslider.dpea*320>nm.section.offsetWidth)){
	if((menu==3 && nm.pfslider.dpea>2 && nm.pfslider.dpea*320>nm.section.offsetWidth)){
		if(!nm.section.eset){
			util.addevent(nm.section,'mousemove',nm.scrollsection.move);
			util.addevent(nm.section,'mouseout',nm.scrollsection.out);
			//ck('add');
			nm.section.eset=true;
		}
	}else{
		nm.scrollsection.kill();
	}
}

//set article's
nm.setarticles=function(f,v){

	var sv,ds=util.getdocumentsize();
	var heightDep=0;

	for(var i=0,max=nm.article[menu].length; i<max; i++){
		//main
		if(menu==0){
			sv=(f=='fromnavi')? v : (ds[0]-960)/2;
			if(f=='showing'){
				//nm.article[menu][i].style.left=(i*320+sv)+'px';
				//nm.article[menu][i].style.top='-433px';
				nm.article[menu][i].style.left=((i%3==0)? 0+sv : (320*(i%3))+sv)+'px';
				nm.article[menu][i].style.top=((i<3)? 0+sv : (433*i)+sv)+'px';
				util.setopacity(nm.article[menu][i].img,1);
			}
			
			if(i%3==0 && i!=0)
			{
				heightDep++;
			}
			
			ani.set({target:nm.article[menu][i],to:'left:'+((i%3==0)? 0+sv : (320*(i%3))+sv)+'px;top:'+(433*heightDep)+'px;',time:1,delay:(f=='fromnavi')? 0.1 : 0,fps:48,easing:'easeOutExpo',onend:(i!=max-1)? '' : function(){
				nm.navigation.wait=false;
				nm.isshowtime=false;
			}});

		//company
		}else if(menu==1 && f!='fromresize'){
			sv=[ds[0]/2-160,i*433];
			nm.article[menu][i].style.left=0;
			ani.set({target:nm.article[menu][i],to:'top:'+sv[1]+'px',time:1,fps:48,easing:'easeOutExpo'});

		//business
		}else if(menu==2 && f!='fromresize'){
			nm.article[menu][i].style.left=((i%2==0)? 0 : 320)+'px';
			nm.article[menu][i].style.top=((i<2)? 0 : 433)+'px';
			util.setopacity(nm.article[menu][i].img,0);
			ani.set({target:nm.article[menu][i].img,to:'opacity:1',time:0.7,fps:48,delay:i*0.2,easing:0});

		//portfolio
		}else if(menu==3){
			sv=(ds[0]-nm.pfslider.dpea*320)/2;
			if(f=='showing'){
				nm.article[menu][i].style.left=(ds[0]+320*i)+'px';
				nm.article[menu][i].style.top=0;
			}
			ani.set({target:nm.article[menu][i],to:'left:'+(i*320+sv)+'px;top:0;',time:1,fps:48,delay:(f!='showing')? 0 : i*0.2,easing:'easeOutExpo',onend:(i!=max-1)? '' : function(){
				nm.navigation.wait=false;
				nm.isshowtime=false;
			}});
			if(!nm.pfslider.setted) nm.pfslider.show();

		//contact
		}else if(menu==4 && f!='fromresize'){
			nm.article[menu][i].style.left='160px';
			nm.article[menu][i].style.top='433px';
			ani.set({target:nm.article[menu][i],to:'top:0;',time:0.7,fps:48,easing:'easeOutExpo',onend:function(tg){
				ani.set({target:tg,to:'left:'+((tg.img.f==0)? 320 : 0),time:0.7,fps:48,easing:'easeOutExpo'});
			}});

		///etc
		}else if(f!='fromresize'){
			nm.article[menu][i].style.left=(i*320)+'px';
			nm.article[menu][i].style.top='-433px';
			ani.set({target:nm.article[menu][i],to:'top:0;',time:1,fps:72,easing:'easeOutBounce'});
			//ani.set({target:nm.article[menu][i],to:'top:0;',time:0.8,fps:48,easing:'easeOutExpo'});

		}

		//main article over
		if(menu==0 || menu==3){
			if(!nm.article[menu][i].img.eset){
				nm.article[menu][i].img.eset=true;
				util.addevent(nm.article[menu][i].img,'mouseover',nm.articlefocus.over);
				util.addevent(nm.article[menu][i].img,'mouseout',nm.articlefocus.out);
				if(menu==0){
					//nm.article[menu][i].img.style.cursor='pointer';
					util.addevent(nm.article[menu][i].img,'click',nm.articlefocus.click);
				}
			}
		}

	}

}

//hide article's
nm.hidearticles=function(){
	var heightDep=0;

	nm.navigation.wait=true;

	nm.scrollsection.kill();

	for(var i=0,max=nm.article[menu].length; i<max; i++){

		if(i%3==0 && i!=0)
		{
			heightDep++;
		}

		if(menu==0){
			ani.set({target:nm.article[menu][i],to:'top:-433px;',time:0.8,delay:heightDep*0.1,easing:'easeOutExpo',onend:(i!=max-1)? '' : nm.afterhidearticles});
		}else if(menu==1){
			ani.set({target:nm.article[menu][i],to:'left:'+((i%2)? -320 : 320),time:0.6,delay:i%2*0.1,easing:'easeInBack',onend:(i!=max-1)? '' : nm.afterhidearticles});
		}else if(menu==2){
			ani.set({target:nm.article[menu][i].img,to:'opacity:0;',time:0.5,delay:i*0.2,onend:(i!=max-1)? function(tg){
				util.setopacity(tg,1);
				tg.parentNode.style.top='-433px';
			} : function(tg){
				util.setopacity(tg,1);
				tg.parentNode.style.top='-433px';
				nm.afterhidearticles();
			}});
		}else if(menu==3){
			ani.set({target:nm.article[menu][i],to:'left:'+(-320-(320*(3-i))),time:0.7,delay:i*0.1,easing:'easeInExpo',onend:(i!=max-1)? '' : nm.afterhidearticles});
			if(nm.pfslider.setted) nm.pfslider.hide();
		}else if(menu==4){
			ani.set({target:nm.article[menu][i],to:'left:160px',time:0.5,easing:'easeOutExpo',onend:function(tg){
				ani.set({target:tg,to:'top:-433px',time:0.5,easing:'easeOutExpo',onend:(tg.img.f==0)? '' : nm.afterhidearticles});
			}});
		}else{
			ani.set({target:nm.article[menu][i],to:'top:433px',time:0.8,easing:'easeInExpo',onend:(i!=max-1)? '' : nm.afterhidearticles});
		}
	}

}

nm.afterhidearticles=function(){
	for(var i in nm.article){
		for(var j=0,jmax=nm.article[i].length; j<jmax; j++){
			nm.article[i][j].style.top='-433px';
		}
	}
	nm.resize();
	nm.setarticles('showing');
}


//scroll section
nm.scrollsection={
	timer : null
}

nm.scrollsection.kill=function(){
	if(nm.section.eset){
		util.removeevent(nm.section,'mousemove',nm.scrollsection.move);
		util.removeevent(nm.section,'mouseout',nm.scrollsection.out);
		nm.section.eset=false;
	}
}

nm.scrollsection.move=function(e){
	clearTimeout(nm.scrollsection.timer);
	if(!e) e=window.event;
	if(!nm.pfslider.moving && !nm.isshowtime){
		var f=nm.section.offsetWidth/2;
		var ds=util.getdocumentsize();
		var sw=(menu==3)? nm.pfslider.dpea*320+200 : 1480
		var sv=-Math.floor(((sw-ds[0])/2)*(e.clientX/f)-100);
		ani.set({target:nm.article[menu][0],to:'left:'+sv,time:0.75,fps:48,easing:'easeOutCirc',onupdate:function(tg){
			for(var i=1; i<2; i++){
				clearTimeout(nm.article[menu][i].timer);
				nm.article[menu][i].style.left=(parseInt(tg.style.left)+320*i)+'px';
			}
		}});
		return;
	}
}

nm.scrollsection.out=function(){
	if(!nm.isshowtime) nm.scrollsection.timer=setTimeout(nm.setarticles,100);
}

//article focus when mouse over
nm.articlefocus={};

nm.articlefocus.over=function(e){
	if(!nm.pfslider.moving){
		var tg=(e.target)? e.target : e.srcElement;
		for(var i=0,max=nm.article[menu].length; i<max; i++){
			ani.set({target:nm.article[menu][i].img,to:'opacity:'+((tg==nm.article[menu][i].img)? 1 : 0.5),time:0.5});
		}
	}
}

nm.articlefocus.out=function(e){
	for(var i=0,max=nm.article[menu].length; i<max; i++){
		ani.set({target:nm.article[menu][i].img,to:'opacity:1',time:0.5});
	}
}

nm.articlefocus.click=function(e){
	var tg=(e.target)? e.target : e.srcElement;
	//nm.navigation.click(tg.f);
}


//wheel info
nm.wheelinfo={
	info : null,
	bg : null,
	img : null
}

nm.wheelinfo.show=function(){
	nm.wheelinfo.info.style.display='block';
	ani.set({target:nm.wheelinfo.bg,to:'opacity:0.5',time:0.8,delay:2});
	ani.set({target:nm.wheelinfo.img,to:'opacity:1',time:0.8,delay:2});
}

nm.wheelinfo.hide=function(){
	ani.set({target:nm.wheelinfo.bg,to:'opacity:0',time:0.5});
	ani.set({target:nm.wheelinfo.img,to:'opacity:0',time:0.5,onend:function(){
		nm.wheelinfo.info.style.display='none';
	}});
}


//portfolio slider
nm.pfslider={

	timer : null,

	setted : false,

	showing : false,
	moving : false,

	box : null,
	marker : null,
	bar : null,
	x : 0,
	point : 0,
	size : 318,

	isoutside : false,

	max : 0,
	markerw : 0,

	dpea : 2,
	nowp : 0,
	newp : 0,
	preimages : [new Image(),new Image(),new Image(), new Image()],


	show : function(){
		nm.pfslider.setted=true;
		nm.pfslider.showing=true;
		nm.pfslider.box.style.display='block';
		ani.set({target:nm.pfslider.box,to:'top:-42px;opacity:0.3;',time:0.7,fps:60,delay:1,easing:'easeOutCirc',onend:function(){
			nm.pfslider.showing=false;
			if(isipad){
				nm.section.ontouchstart=nm.pfslider.touchstart;
				nm.section.ontouchmove=nm.pfslider.touchmove;
				nm.section.ontouchend=nm.pfslider.touchend;
			}else{
				if(isie) nm.section.onmousewheel=nm.pfslider.wheel;
				else nm.section.addEventListener(((isfirefox)? 'DOMMouseScroll' : 'mousewheel'),nm.pfslider.wheel,false);
				if(isie) nm.wheelinfo.img.onmousewheel=nm.pfslider.wheel;
				else nm.wheelinfo.img.addEventListener(((isfirefox)? 'DOMMouseScroll' : 'mousewheel'),nm.pfslider.wheel,false);
			}
		}});
	},

	hide : function(){
		nm.pfslider.showing=true;
		if(isie) nm.section.onmousewheel=null;
		else nm.section.removeEventListener(((isfirefox)? 'DOMMouseScroll' : 'mousewheel'),nm.pfslider.wheel,false);
		ani.set({target:nm.pfslider.box,to:'top:-25px;opacity:0;',time:0.7,fps:48,delay:0.5,easing:'easeInExpo',onend:function(){
			nm.pfslider.box.style.display='none';
			nm.pfslider.showing=false;
			nm.pfslider.setted=false;
		}});
	},

	over : function(){
		nm.pfslider.isoutside=false;
		if(!nm.pfslider.showing) ani.set({target:nm.pfslider.box,to:'opacity:1',time:0.7});
	},

	out : function(){
		nm.pfslider.isoutside=true;
		if(!nm.pfslider.showing && !nm.pfslider.moving) ani.set({target:nm.pfslider.box,to:'opacity:0.3',time:0.7});
	},

	wheel : function(e){
		nm.wheelinfo.hide();
		if(!e) e=window.event;
		var wv=(e.wheelDelta)? e.wheelDelta : e.detail;
		wv=(isfirefox)? (wv<0)? 'up' : 'down' : (wv>0)? 'up' : 'down';
		var np=(wv=='up')? nm.pfslider.nowp-1 : nm.pfslider.nowp+1;
		if((wv=='up' && np<0) || (wv=='down' && np>=nm.pfslider.max)) return true;
		else{
			nm.isshowtime=true;
			nm.pfslider.setpage('wheel',np);
			ani.set({target:nm.pfslider.marker,to:'margin-left:'+(np*nm.pfslider.markerw),time:1,fps:48,easing:'easeOutCirc'});
			if(e.preventDefault) e.preventDefault();
			return false;
		}
	},

	down : function(e){
		if(isipad) return true;
		nm.wheelinfo.hide();
		nm.pfslider.moving=true;
		nm.isshowtime=true;
		if(!e) e=window.event;
		nm.pfslider.point=e.clientX;
		nm.pfslider.x=(e.offsetX)? e.offsetX : e.layerX;
		nm.pfslider.x-=nm.pfslider.markerw/2;
		if(nm.pfslider.x<0) nm.pfslider.x=0;
		else if(nm.pfslider.x+nm.pfslider.markerw>nm.pfslider.size) nm.pfslider.x=nm.pfslider.size-nm.pfslider.markerw;
		ani.set({target:nm.pfslider.marker,to:'margin-left:'+nm.pfslider.x,time:0.5,fps:48,easing:'easeOutExpo'});
		nm.pfslider.timer=setTimeout(nm.pfslider.setpage,200);
		document.onmousemove=nm.pfslider.move;
		document.onmouseup=nm.pfslider.up;
	},

	move : function(e){
		nm.isshowtime=true;
		clearTimeout(nm.pfslider.timer);
		clearTimeout(nm.pfslider.marker.timer);
		if(!e) e=window.event;
		var nv=nm.pfslider.x-(nm.pfslider.point-e.clientX);
		if(nv<0) nv=0;
		else if(nv+nm.pfslider.markerw>nm.pfslider.size) nv=nm.pfslider.size-nm.pfslider.markerw;
		nm.pfslider.marker.style.marginLeft=nv+'px';
		nm.pfslider.timer=setTimeout(nm.pfslider.setpage,200);
		e.returnValue=false;
	},

	up : function(e){
		nm.pfslider.moving=false;
		document.onmousemove=null;
		document.onmouseup=null;
		if(nm.pfslider.isoutside) nm.pfslider.out();
	},

	setpage : function(f,v){
		if(f=='wheel') nm.pfslider.newp=v;
		else{
			var v=parseInt(nm.pfslider.marker.style.marginLeft);
			nm.pfslider.newp=Math.floor((v+nm.pfslider.markerw/2)/(nm.pfslider.size/nm.pfslider.max));
		}
		if(nm.pfslider.newp!=nm.pfslider.nowp){
			nm.pfslider.dpea=(nm.pfdata.length-nm.pfslider.newp*2<2)? nm.pfdata.length-nm.pfslider.newp*2 : 2;
			for(var i=0; i<nm.pfslider.dpea; i++){
				nm.pfslider.preimages[i].src=nm.pfdata[nm.pfslider.newp*2+i][0];
			}
			var ds=util.getdocumentsize();
			nm.preloader.left=ds[0]/2;
			nm.preloader.top=ds[1]/2;
			nm.preloader.show();
			nm.pfslider.loader();
		}
	},

	loader : function(){
		for(var i=0; i<nm.pfslider.dpea; i++){
			if(!nm.pfslider.preimages[i].complete){
				setTimeout(nm.pfslider.loader,100);
				return false;
			}
		}
		nm.preloader.hide();
		nm.pfslider.change();
	},

	change : function(){
		clearTimeout(nm.scrollsection.timer);
		nm.navigation.wait=true;
		var d=(nm.pfslider.newp>nm.pfslider.nowp)? 'l' : 'r';
		var ds=util.getdocumentsize();
		for(var i=0,max=nm.article[menu].length; i<max; i++){
			clearTimeout(nm.article[menu][i]);
			ani.set({target:nm.article[menu][(d=='l')? i : 1-i],to:'left:'+((d=='l')? (-320-(320*(1-i))) : ds[0]+320*(1-i)),time:0.7,fps:48,delay:i*0.1,easing:'easeInExpo',onend:(i!=nm.pfslider.dpea-1)? '' : function(){
				for(var i=0,cloneimg,max=nm.pfslider.dpea; i<max; i++){
					//nm.article[menu][i].img.src=nm.pfslider.preimages[i].src;
					cloneimg=nm.pfslider.preimages[i].cloneNode(true);
					nm.article[menu][i].replaceChild(cloneimg,nm.article[menu][i].img);
					nm.article[menu][i].img=nm.article[menu][i].getElementsByTagName('img')[0];
					util.setopacity(nm.article[menu][i].img,1);
					if(nm.pfdata[nm.pfslider.newp*2+i][1]){
						nm.article[menu][i].a.style.display='block';
						nm.article[menu][i].a.href=nm.pfdata[nm.pfslider.newp*2+i][1];
					}else{
						nm.article[menu][i].a.style.display='none';
					}
				}
				nm.resize();
				var d=(nm.pfslider.newp>nm.pfslider.nowp)? 'l' : 'r';
				nm.pfslider.nowp=nm.pfslider.newp;
				var ds=util.getdocumentsize();
				sv=(ds[0]-(nm.pfslider.dpea*320))/2;
				for(var i=0,max=nm.article[menu].length; i<max; i++){
					if(nm.pfslider.dpea-1<i){
						nm.article[menu][i].style.display='none';
					}else{
						nm.article[menu][(d=='l')? i : 1-i].style.left=((d=='r')? -(320*(i+1)) : (ds[0]+320*i))+'px';
						nm.article[menu][i].style.display='block';
						ani.set({target:nm.article[menu][(d=='l')? i : 1-i],to:'left:'+((d=='l')? i*320+sv : (1-i)*320+sv),time:0.7,fps:48,delay:i*0.1,easing:'easeOutExpo',onend:(i!=nm.pfslider.dpea-1-1)? '' : function(){
							nm.isshowtime=false;
						}});
					}
				}
			}});
		}
	},

	pos :null,
	npos:null,
	nl:null,
	moved:false,

	touchstart : function(e){
		nm.pfslider.pos=nm.pfslider.npos=[e.touches[0].screenX,e.touches[0].screenY];
	},

	touchmove : function(e){
		nm.pfslider.moved=true;
		nm.pfslider.npos=[e.touches[0].screenX,e.touches[0].screenY];
	},

	touchend : function(e){
		var px=nm.pfslider.npos[0]-nm.pfslider.pos[0];
		var py=nm.pfslider.npos[1]-nm.pfslider.pos[1];
		var degree=Math.abs((Math.atan2(px,py)*180)/Math.PI);
		if((degree>75 && degree<110) || !degree){
			if(Math.abs(px)>100 && nm.pfslider.moved==true){
				var np=(nm.pfslider.pos[0]>nm.pfslider.npos[0])? nm.pfslider.nowp+1 : nm.pfslider.nowp-1;
				if(((nm.pfslider.pos[0]>nm.pfslider.npos[0]) && np<0) || ((nm.pfslider.pos[0]<nm.pfslider.npos[0]) && np>=nm.pfslider.max)){
					return true;
				}else{
					nm.wheelinfo.hide();
					nm.isshowtime=true;
					nm.pfslider.setpage('wheel',np);
					ani.set({target:nm.pfslider.marker,to:'margin-left:'+(np*nm.pfslider.markerw),time:1,fps:48,easing:'easeOutCirc'});
					if(e.preventDefault) e.preventDefault();
					return false;
				}
				moved=false;
			}
			if(e.preventDefault) e.preventDefault();
			e.returnValue=false;
			return false;
		}else{
			return true;
		}
	}

}



/* navigation */
nm.navigation={
	wait : false
}

nm.navigation.initialize=function(){
	nm.h1.onclick=nm.navigation.logoclick;
	for(var i=0,max=nm.navi.length; i<max; i++){
		util.addevent(nm.navi[i].img,'mouseover',nm.navigation.over);
		util.addevent(nm.navi[i].img,'mouseout',nm.navigation.reset);
		util.addevent(nm.navi[i].img,'click',nm.navigation.click);
	}
}

nm.navigation.logoclick=function(e){
	nm.wheelinfo.hide();
	if(menu!=0){
		nm.hidearticles();
		menu=0;
		nm.navigation.reset();
	}
}

nm.navigation.over=function(e){
	clearTimeout(nm.scrollsection.timer);
	var no=(e.target)? e.target.f : e.srcElement.f;
	for(var i=0,max=nm.navi.length; i<max; i++){
		ani.set({target:nm.navi[i].img,to:'opacity:'+((i==no)? 1 : 0),time:0.6});
	}
	if(!nm.navigation.wait){
		//if(menu==0) nm.setarticles('fromnavi',parseInt(nm.header.style.left)-(no*320));
	}
}

nm.navigation.reset=function(){
	for(var i=0,max=nm.navi.length; i<max; i++){
		ani.set({target:nm.navi[i].img,to:'opacity:'+((i==menu-1)? 1 : 0),time:0.6});
	}
	if(!nm.navigation.wait){
		if(menu==0 || menu==3) nm.setarticles();
	}
}

nm.navigation.click=function(e){
	var no=(typeof(e)=='number')? e : (e.target)? e.target.f : e.srcElement.f;
	if((menu-1)!=no){
		nm.hidearticles();
		menu=no+1;
		nm.navigation.reset();
	}
	if(menu==3) nm.wheelinfo.show();
	else if(menu!=3) nm.wheelinfo.hide();
}


//show nm reel
nm.nmreel={
	layer : null,
	dimmed : null,
	iframe : null,
	close : null
}

nm.nmreel.show=function(w, h, ch, url, ce){
	var ds=util.getdocumentsize();

	if(!nm.nmreel.layer){
		
		nm.nmreel.layer=util.create({tagname:'div',classname:'nmreel'});
		nm.nmreel.dimmed=util.create({tagname:'div',classname:'nmreeldimmed'});
		nm.nmreel.logo=util.create({tagname:'img',src:imageroot+'/img_logo.gif',classname:'nmreellogo'});
		nm.nmreel.close=util.create({tagname:'img',src:imageroot+'/btn_reelclose.gif',classname:'nmreelclose'});
		
		nm.nmreel.layer.innerHTML='<iframe src="about:blank" width="'+w+'" height="'+h+'" frameborder="0" scrolling="no" onload="nm.nmreel.iframeshow();"></iframe>';
		nm.nmreel.iframe=nm.nmreel.layer.getElementsByTagName('iframe')[0];
		
		util.setopacity(nm.nmreel.iframe,0);
		util.setopacity(nm.nmreel.dimmed,0);
		util.setopacity(nm.nmreel.logo,0);

		nm.nmreel.logo.style.left=ds[0]/2-76 + 'px';
		nm.nmreel.logo.style.top='10px';

		nm.nmreel.close.onclick=function(){
			nm.nmreel.hide();
		}
		document.body.appendChild(nm.nmreel.layer);
		document.body.appendChild(nm.nmreel.dimmed);
		document.body.appendChild(nm.nmreel.logo);
		document.body.appendChild(nm.nmreel.close);

		if(isie6){
			util.addevent(window,'scroll',function(){
				nm.nmreel.dimmed.style.top=document.documentElement.scrollTop+'px';
			});
		}
	}
	
	if(ce)
	{
		nm.nmreel.layer.style.top="50%";
		nm.nmreel.close.style.top="50%";
	}
	else
	{
		nm.nmreel.layer.style.top="63px";
		nm.nmreel.close.style.top="63px";
	}
	
	nm.nmreel.layer.style.display=nm.nmreel.dimmed.style.display=nm.nmreel.logo.style.display='block';
	ani.set({target:nm.nmreel.dimmed,to:'opacity:1',time:0.5, onend:function(){
		ani.set({target:nm.nmreel.logo ,to:'left:'+Math.round(ds[0]/2 - 86)+'px;top:10px;opacity:1',easing:'easeOutExpo'});
	}});
	ani.set({target:nm.nmreel.layer,to:'width:'+w+'px;margin-left:-320px;',time:0.7,easing:'easeOutExpo',onend:function(){
		ani.set({target:nm.nmreel.layer,to:'height:'+h+'px;margin-top:'+ ch +'px;',time:0.7,easing:'easeOutExpo',onend:function(){
			nm.nmreel.iframe.src=url;
			nm.nmreel.iframe.style.height=h+'px';
			nm.nmreel.iframe.onload=nm.nmreel.iframeshow;
			//nm.nmreel.iframeshow();
			nm.nmreel.close.style.display='block';
			nm.nmreel.close.style.marginTop=ch +'px';
			ani.set({target:nm.nmreel.close,to:'margin-left:320px;',time:0.7,easing:'easeOutExpo'});
		}});
	}});
}

nm.nmreel.iframeshow=function(){
	ani.set({target:nm.nmreel.iframe,to:'opacity:1',time:0.7});
}

nm.nmreel.hide=function(){
	ani.set({target:nm.nmreel.iframe,to:'opacity:0',time:0.5});
	ani.set({target:nm.nmreel.close,to:'margin-left:290px;',time:0.7,easing:'easeOutExpo',onend:function(){
		ani.set({target:nm.nmreel.dimmed,to:'opacity:0',time:0.5,delay:0.8,onend:function(){
			nm.nmreel.dimmed.style.display='none';
		}});
		ani.set({target:nm.nmreel.logo,to:'opacity:0',time:0.5,onend:function(){
			nm.nmreel.logo.style.display='none';
		}});
		ani.set({target:nm.nmreel.layer,to:'height:1px;margin-top:0;',time:0.5,easing:'easeOutExpo',onend:function(){
			ani.set({target:nm.nmreel.layer,to:'width:1px;margin-left:0;',time:0.5,easing:'easeOutExpo',onend:function(){
				nm.nmreel.layer.style.display='none';
				nm.nmreel.iframe.src='about:blank';
				
			}});
		}});
		nm.nmreel.close.style.display='none';
	}});
}


//change device
nm.devices={
	cur : 'pc',
	wall : null,
	mobileurl : 'http://e.withsolution.com/ipad',
	iframe : null,
	phone : null,
	falling : true,
	moving : false
};

nm.devices.initialize=function(){
	for(var i=0; i<2; i++){
		nm.device.appendChild(nm.device.img[i]);
	}
	
	nm.devices.wall=util.create({tagname:'div',classname:'devicewall'});
	util.setopacity(nm.devices.wall,0);
	document.body.appendChild(nm.devices.wall);
	nm.devices.phone=util.create({tagname:'div',classname:'devicephone'});
	nm.devices.phone.innerHTML='<iframe src="about:blank" width="1024" height="672" frameborder="no" scrolling="no"></iframe>';
	nm.devices.phonerf=util.create({tagname:'div',classname:'devicephonerf'});

	nm.devices.iframe=nm.devices.phone.getElementsByTagName('iframe')[0];
	nm.devices.phone.endbtn=util.create({tagname:'span'});
	nm.devices.phone.appendChild(nm.devices.phone.endbtn);
	nm.devices.phone.endbtn.onclick=nm.devices.click;
	
	document.body.appendChild(nm.devices.phone);
	document.body.appendChild(nm.devices.phonerf);

}

nm.devices.click=function(){
	if(isipad) return false;
	nm.devices.moving=true;
	if(nm.devices.cur=='pc'){
		var ds=util.getdocumentsize();
		nm.devices.phone.style.left=Math.round((ds[0]/2)-610)+'px';
		nm.devices.iframe.src=nm.devices.mobileurl;
		nm.devices.phonerf.style.display='block';
		nm.devices.wall.style.display='block';
		nm.devices.wall.onclick = nm.devices.click;
		if(isie6) nm.devices.wall.style.height=0;
		ani.set({target:nm.devices.wall,to:'opacity:0.7',time:0.5,onend:function(){
			nm.devices.phone.style.left=Math.round((ds[0]/2)-610)+'px';
			nm.resize();
		}});
		nm.devices.cur='phone';
	}else{
		ani.set({target:nm.devices.phone,to:'top:-1025px;',time:0.5,easing:'easeOutExpo',
			onupdate : function(tg){
				nm.devices.phonerf.style.left=tg.style.left;
				nm.devices.phonerf.style.top=(parseInt(tg.style.top)+729)+'px';
			},
			onend:function(){
				nm.devices.falling=true;
				nm.devices.iframe.src='about:blank';
				ani.set({target:nm.devices.wall,to:'opacity:0',time:0.5,onend:function(){
					nm.devices.wall.style.display='none';
					nm.devices.phonerf.style.display='none';
				}});
				nm.resize();
			}
		});
		nm.devices.cur='pc';
	}
}



//write html
nm.writehtml=function(){

	nm.initialize();

	var html='';
	var ds=util.getdocumentsize();


	document.write(html);

	
}

window.onload=function(){
	nm.loaded=true;
}

nm.getpfdata=function(){
nm.initialize();
}


//initialize
nm.initialize=function(){
	
	var ds=util.getdocumentsize();

	//device selector
	nm.device.img=[
		util.create({tagname:'img',src:imageroot+'/btn_foot_phone.jpg',alt:''}),
		util.create({tagname:'img',src:imageroot+'/btn_foot_pc.jpg',alt:'',style:'top:43px;'})
	];
	nm.device.appendChild(util.create({tagname:'span'}));
	nm.footer.appendChild(nm.device);

	

	nm.devices.initialize();


	util.formfocusing();
	fakeselect.initialize();

	nm.resize();
	
}


//ajax control
var ajax;
function ajaxcontrol(){
	this.send=function(method,url,query,afterfunc){
		ajax=(window.ActiveXObject)? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
		if(method=='get'){
			ajax.open('GET',url+'?'+query,true);
			ajax.onreadystatechange=function(){messenger.readystatechange(afterfunc)};
			ajax.send(null);
		}else if(method=='post'){
			ajax.open('POST',url,true);
			ajax.onreadystatechange=function(){messenger.readystatechange(afterfunc)};
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8");
			ajax.send(query);
		}
	}
	this.readystatechange=function(afterfunc){
		if(ajax.readyState==4){
			if(ajax.status==200){
				eval(afterfunc);
			}
		}
	}
}
var messenger=new ajaxcontrol();



//for check values
function ck(){
	var data='';
	for(var i=0,max=arguments.length; i<max; i++){
		data+=arguments[i];
		if(i!=max-1) data+='<br />';
	}
	var container=document.getElementById('asdf');
	if(!container){
		container=document.body.appendChild(util.create({tagname:'p',id:'asdf',style:'position:absolute;left:0;top:0;font-family:tahoma;font-size:10px;line-height:1.25em;color:#000;padding:1px 4px 2px;background:#FFF;z-index:1000;'}));
		util.setopacity(container,0.5);
	}
	container.innerHTML+=data+'<br />';
}
