﻿//	아래 주석부분은 각 페이지 상단에 적당한 값으로 넣어준다.
//	var googleSearchIframeName = "cse-search-results";
//	var googleSearchFormName = "cse-search-box";
//	var googleSearchFrameWidth = 1024;
//	var googleSearchPath = "/cse";
	var googleSearchDomain = "www.google.co.kr";

	var e=null,a=window,l="sitesearch",r=a.googleSearchResizeIframe||a.googleSearchPath&&a.googleSearchPath=="/cse"&&typeof a.googleSearchResizeIframe=="undefined",p,n,i;
	
	function s(c,b,j,m)
	{
		var f={},g=c.split(j);
		
		for (var d=0;d<g.length;d++)
		{
			var h=g[d],o=h.indexOf(b);
			
			if(o>0)
			{
				var k=h.substring(0,o);
				k=m?k.toUpperCase():k.toLowerCase();
				var u=h.substring(o+1,h.length);
				f[k]=u
			}
		}
		
		return f
	}
	
	function v(googleQueryString)
	{
		var c=document.location.search;

		c = googleQueryString;

		if(c.length<1) return"";
		
		c=c.substring(1,c.length);
		
		var b=s(c,"=","&",false);
		
		if(a.googleSearchQueryString!="q"&&b[a.googleSearchQueryString])
		{
			b.q=b[a.googleSearchQueryString];
			delete b[a.googleSearchQueryString]
		}
		
//		b.q = encodeURIComponent(searchValue) + "+";	// 동휘
		
		if(b.cof)
		{
			var j=s(decodeURIComponent(b.cof),":",";",true),m=j.FORID;
			
			if(m) p=parseInt(m,10)
		}
		
		var f=document.getElementById(a.googleSearchFormName);
		
		if(f)
		{
			if(f.q&&b.q&&(!b.ie||b.ie.toLowerCase()=="utf-8"))f.q.value=decodeURIComponent(b.q.replace(/\+/g," "));
			
			if(f[l]) for(var g=0;g<f[l].length;g++)f[l][g].checked=b[l]==e&&f[l][g].value==""?true:(f[l][g].value==b[l]?true:false)
		}
		
		var d="";
		
		for(var h in b)d+="&"+h+"="+b[h];
		
		return d.substring(1,d.length)
	}
	
	function q(c,b)
	{
		return b?"&"+c+"="+encodeURIComponent(b):""
	}
	
	function t(c,b)
	{
		return c?Math.max(c,b):b
	}
	
	function w(googleQueryString)
	{
		var c="http://";
		
		c+=a.googleSearchDomain?a.googleSearchDomain:"www.google.com";
		
		c+=a.googleSearchPath?a.googleSearchPath:"/custom";
		
		c+="?";
		
		if(a.googleSearchQueryString)a.googleSearchQueryString=a.googleSearchQueryString.toLowerCase();
		
		c+=v(googleQueryString);
		c+=q("ad","w"+n);
		c+=q("num",i);
		c+=q("adtest",a.googleAdtest);

		if(r)
		{
//			var b=a.location.href,j=b.indexOf("#");
			var b=a.location.href;
			if (a.location.search.length > 0)
			{
				b = b + googleQueryString;
			}
			else
			
			{
				b = b + googleQueryString.substring(1, googleQueryString.length);
			}

			var j=b.indexOf("#");
			
			if(j!=-1)b=b.substring(0,j);
			
			c+=q("rurl",b)
		}
		
		return c
	}
	
	function searchGoogleX(googleQueryString)
	{
		// 동휘 추가
		if ($("googleSearchFrame") != null)
		{
			//$("googleSearchFrame").removeNode(true);
			$("googleSearchFrame").parentNode.removeChild($("googleSearchFrame"));
		}
		// 추가 끝

		n=a.googleSearchNumAds;
		
		if(!n)n=9;
		
		i=a.googleNumSearchResults;
		
		i=i?Math.min(i,20):10;
		
		var c={};
		
		c[9]=795;
		c[10]=795;
		c[11]=500;
		var b={};
		b[9]=300+90*i;
		b[10]=300+50*Math.min(n,4)+90*i;
		b[11]=300+50*n+90*i;
		
		var j=w(googleQueryString);
		
		if(!a.googleSearchFrameborder)a.googleSearchFrameborder="0";
		
		var m=document.getElementById(a.googleSearchIframeName);
		if(m&&c[p])
		{
			a.googleSearchFrameHeight = 1800;	// 동휘 강제로 프레임 높이 지정
			
			var f=t(a.googleSearchFrameWidth,c[p]),g=t(a.googleSearchFrameHeight,b[p]),d=document.createElement("iframe"),h={id:"googleSearchFrame",name:"googleSearchFrame",src:j,frameBorder:a.googleSearchFrameborder,width:f,height:g,marginWidth:"0",marginHeight:"0",hspace:"0",vspace:"0",allowTransparency:"true",scrolling:"no"};
			
			for(var o in h)d.setAttribute(o,h[o]);
			
			m.appendChild(d);
			
			if(d.attachEvent)d.attachEvent("onload",function(){window.scrollTo(0,0)});
			else d.addEventListener("load",function(){window.scrollTo(0,0)},false);
			
			if(r)a.setInterval(function(){if(a.location.hash&&a.location.hash!="#"){var k=a.location.hash.substring(1)+"px";if(d.height!=k&&k!="0px")d.height=k}},10)
		}
		
		// 동휘 삭제
//		a.googleSearchIframeName=e;
//		a.googleSearchFormName=e;
//		a.googleSearchResizeIframe=e;
//		a.googleSearchQueryString=e;
//		a.googleSearchDomain=e;
//		a.googleSearchPath=e;
//		a.googleSearchFrameborder=e;
//		a.googleSearchFrameWidth=e;
//		a.googleSearchFrameHeight=e;
//		a.googleSearchNumAds=e;
//		a.googleNumSearchResults=e;
//		a.googleAdtest=e
	}


/*
//	아래 주석부분은 각 페이지 상단에 적당한 값으로 넣어준다.
//   var googleSearchIframeName = 'layerDISPMainLayout';
//   var googleSearchFrameWidth = 680;
//   var googleSearchFrameborder = 0 ;
   var googleSearchDomain = 'www.google.co.kr';


	//// 구글 검색 스크립트 약간 수정 시작
	var f=null,a=window,i="sitesearch",r=a.googleSearchResizeIframe||a.googleSearchPath&&a.googleSearchPath=="/cse"&&typeof a.googleSearchResizeIframe=="undefined",p,n,j;
	function s(c,b,l,m)
	{
		var d={},g=c.split(l);
		for (var e=0;e<g.length;e++)
		{
			var h=g[e],o=h.indexOf(b);
			if(o>0)
			{
				var k=h.substring(0,o);
				
				if (m) k=k.toUpperCase();
				else k = k.toLowerCase();

				var u=h.substring(o+1,h.length);
				
				d[k]=u
			}
		}
		
		return d
	}

	function v(searchValue)
	{
		var c=document.location.search;

		if(c.length<1) return"";
		c = c.substring(1,c.length);

		var b = s(c,"=","&",false);

		if (a.googleSearchQueryString!="q"
			&& b[a.googleSearchQueryString])
		{
			b.q=b[a.googleSearchQueryString];
			delete b[a.googleSearchQueryString]
		}

		b.q = encodeURIComponent(searchValue) + "+";	// 동휘

		
		if (b.cof)
		{
			var l = s(decodeURIComponent(b.cof),":",";",true),m=l.FORID;
			if (m) p=parseInt(m,10)
		}
		var d = document.getElementById(a.googleSearchFormName);
		if (d) 
		{
			if (d.q && b.q && (!b.ie||b.ie.toLowerCase()=="utf-8")) d.q.value = decodeURIComponent(b.q.replace(/\+/g," "));
			
			if (d[i]) for(var g=0;g<d[i].length;g++) if(b[i]==f&&d[i][g].value=="") d[i][g].checked=true;
			else if (d[i][g].value==b[i])d[i][g].checked=true;
			else d[i][g].checked=false
		}
		var e="";
		for (var h in b)
		{
			e += "&"+h+"="+b[h];
		}

		return e.substring(1,e.length)
	}

	function q(c,b)
	{
		if(b) return "&"+c+"="+encodeURIComponent(b);
		else return ""
	}

	function t(c,b)
	{
		if (c) return Math.max(c,b);
		else return b
	}

	function w(searchValue)
	{
		var c="http://";
		if (a.googleSearchDomain) c+=a.googleSearchDomain;
		else c+="www.google.com";

		if (a.googleSearchPath) c+=a.googleSearchPath;
		else c+="/custom";c+="?";

		if (a.googleSearchQueryString) a.googleSearchQueryString=a.googleSearchQueryString.toLowerCase();

		c+=v(searchValue);
		c+=q("ad","w"+n);
		c+=q("num",j);
		c+=q("adtest",a.googleAdtest);

		if (r) 
		{
			var b=a.location.href,l=b.indexOf("#");
			if (l!=-1) b=b.substring(0,l);
			c+=q("rurl",b)
		}
		
		return c
	}

	function searchGoogleX(searchValue)
	{
		// 동휘 추가
		if (document.all.googleSearchFrame != null)
		{
			//document.all.googleSearchFrame.removeNode(true);
			document.all.googleSearchFrame.parentNode.removeChild(document.all.googleSearchFrame);
		}
		// 추가 끝
	
		n=a.googleSearchNumAds;
		if (!n) n=9;

		j=a.googleNumSearchResults;

		if (j) j=Math.min(j,20);
		else j=10;

		var c={};
		c[9]=795;
		c[10]=795;
		c[11]=500;
		var b={};
		b[9]=300+90*j;
		b[10]=300+50*Math.min(n,4)+90*j;
		b[11]=300+50*n+90*j;
		var l=w(searchValue);
		if (!a.googleSearchFrameborder) a.googleSearchFrameborder="0";
		var m=document.getElementById(a.googleSearchIframeName);

		if (m&&c[p])
		{
			a.googleSearchFrameHeight = 1800;	// 동휘 강제로 프레임 높이 지정

			var d=t(a.googleSearchFrameWidth,c[p]),g=t(a.googleSearchFrameHeight,b[p]),e=document.createElement("iframe"),h={id:"googleSearchFrame",name:"googleSearchFrame",src:l,frameBorder:a.googleSearchFrameborder,width:d,height:g,marginWidth:"0",marginHeight:"0",hspace:"0",vspace:"0",allowTransparency:"true",scrolling:"no"};
			// 동휘 id:"googleSearchFrame" 추가

			for (var o in h) e.setAttribute(o,h[o]);
			
			m.appendChild(e);
			
			if (e.attachEvent) e.attachEvent("onload",function(){window.scrollTo(0,0)});
			else e.addEventListener("load",function(){window.scrollTo(0,0)},false);

			if (r) a.setInterval(function(){if(a.location.hash&&a.location.hash!="#"){var k=a.location.hash.substring(1)+"px";if(e.height!=k&&k!="0px")e.height=k}},10)
		}
		// 동휘 삭제
		//	a.googleSearchIframeName=f;
		//	a.googleSearchFormName=f;
		//	a.googleSearchResizeIframe=f;
		//	a.googleSearchQueryString=f;
		//	a.googleSearchDomain=f;
		//	a.googleSearchPath=f;
		//	a.googleSearchFrameborder=f;
		//	a.googleSearchFrameWidth=f;
		//	a.googleSearchFrameHeight=f;
		//	a.googleSearchNumAds=f;
		//	a.googleNumSearchResults=f;
		//	a.googleAdtest=f;
	}

	//// 구글 검색 스크립트 약간 수정 끝
	
*/
	
	
	
	
	
// 공유포토 영역에서 구글 검색 시작

	var googleSearchFormName = "cse-search-box";
	var googleSearchIframeName = "layerDISPGoogleSearchResult";
	var googleSearchFrameWidth = 680;
	var googleSearchFrameborder = 0
	var googleSearchPath = "/cse";

	function searchGooglePhotoShare(searchValue, searchValue2, isAdult)
	{
		googleSearchFrameWidth = 680;
		
		if (searchValue == null) searchValue = "";
		if (searchValue2 == null) searchValue2 = "";
		if (isAdult == null) isAdult = false;
		
		var googleSearchValue = searchValue;
		if (searchValue2.length > 0)
		{
			googleSearchValue = makeAndKeyword(searchValue, searchValue2);
		}
		
		var googleQueryString = "?client=pub-5596726866224187&forid=1&channel=5865053163&ie=UTF-8&oe=UTF-8&safe=active&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BFORID%3A11&hl=ko&q=" + encodeURIComponent(googleSearchValue);
		if (isAdult)
		{
			googleQueryString = "?client=pub-5596726866224187&forid=1&channel=3854200856&ie=UTF-8&oe=UTF-8&safe=active&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BFORID%3A11&hl=ko&q=" + encodeURIComponent(googleSearchValue);
		}
		
		var layerDISPMainContentsObj = document.getElementById(googleSearchIframeName);
		if (layerDISPMainContentsObj != null)
		{
			layerDISPMainContentsObj.innerHTML = "";
		}
		
		searchGoogleX(googleQueryString);
	}
	
	function searchGoogleLargeView(searchValue, searchValue2)
	{
		googleSearchFrameWidth = 970;
		
		if (searchValue == null) searchValue = "";
		if (searchValue2 == null) searchValue2 = "";
		
		var googleSearchValue = searchValue;
		if (searchValue2.length > 0)
		{
			googleSearchValue = makeAndKeyword(searchValue, searchValue2);
		}
		
		var googleQueryString = "?cx=partner-pub-5596726866224187%3At8odbl-p90v&cof=FORID%3A10&q=" + encodeURIComponent(googleSearchValue);
		
		var layerDISPMainContentsObj = document.getElementById(googleSearchIframeName);
		if (layerDISPMainContentsObj != null)
		{
			layerDISPMainContentsObj.innerHTML = "";
		}
		
		searchGoogleX(googleQueryString);
	}
	
	
	function searchGoogleTwoBox(searchValue, searchValue2)
	{
		googleSearchIframeName = 'layerDISPGoogleSearchResult';
		var googleSearchIframeName2 = "layerDISPMainContents"
		googleSearchFrameWidth = 680;
		googleSearchFrameborder = 0
		
		if (searchValue == null) searchValue = "";
		if (searchValue2 == null) searchValue2 = "";
		
		var googleSearchValue = searchValue;
		if (searchValue2.length > 0)
		{
			googleSearchValue = makeAndKeyword(searchValue, searchValue2);
		}

		var googleQueryString = "?sa=Google+%EA%B2%80%EC%83%89&client=pub-5596726866224187&forid=1&channel=0799452535&ie=utf-8&oe=utf-8&cof=GALT%3A%23008000%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3AFFFFFF%3BLBGC%3A336699%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3BGIMP%3A0000FF%3BFORID%3A11&hl=ko&q=" + encodeURIComponent(googleSearchValue);
		
		var layerDISPMainContentsObj = document.getElementById(googleSearchIframeName);
		if (layerDISPMainContentsObj == null) 
		{
			layerDISPMainContentsObj = document.getElementById(googleSearchIframeName2);
			
			if (layerDISPMainContentsObj != null)
			{
				googleSearchIframeName = googleSearchIframeName2;
			}
		}

		if (layerDISPMainContentsObj != null)
		{
			layerDISPMainContentsObj.innerHTML = "";
		}

		searchGoogleX(googleQueryString);
	}
	
	function makeAndKeyword(searchValue, searchValue2)
	{
		return searchValue + " " + searchValue2;
	}
// 공유포토 영역에서 구글 검색 끝


//한주
	function searchGoogleADDetail()
	{
	    if ($("googleADDetailFrame") != null)
		{
			//$("googleADDetailFrame").removeNode(true);
			$("googleADDetailFrame").parentNode.removeChild($("googleADDetailFrame"));
		}
		var layerDISPMainContentsObj = document.getElementById("layerDISPGoogleAD");
		var j="/GoogleADView.htm";
		if (layerDISPMainContentsObj != null)
		{
			layerDISPMainContentsObj.innerHTML = "";
			var d=document.createElement("iframe");
			var h={id:"googleADDetailFrame",name:"googleADDetailFrame",src:j,frameBorder:"0",width:"250px",height:"250px",marginWidth:"0",marginHeight:"0",hspace:"0",vspace:"0",allowTransparency:"true",scrolling:"no"};
			for(var o in h)
			{
				d.setAttribute(o,h[o]);
			}
			layerDISPMainContentsObj.appendChild(d);
		}
		//====================
		if ($("googleADCol3Frame") != null)
		{
			//$("googleADCol3Frame").removeNode(true);
			$("googleADCol3Frame").parentNode.removeChild($("googleADCol3Frame"));
		}
		layerDISPMainContentsObj = document.getElementById("layerDISPGoogleADCol3");
		j="/GoogleADCol3.htm";
		if (layerDISPMainContentsObj != null)
		{
			layerDISPMainContentsObj.innerHTML = "";
			var d=document.createElement("iframe");
			//var h={id:"googleADCol3Frame",name:"googleADCol3Frame",src:j,frameBorder:"0",width:"728px",height:"90px",marginWidth:"0",marginHeight:"0",hspace:"0",vspace:"0",allowTransparency:"true",scrolling:"no"};
			var h={id:"googleADCol3Frame",name:"googleADCol3Frame",src:j,frameBorder:"0",width:"690px",height:"90px",marginWidth:"0",marginHeight:"0",hspace:"0",vspace:"0",allowTransparency:"true",scrolling:"no"};
			for(var o in h)
			{
				d.setAttribute(o,h[o]);
			}
			layerDISPMainContentsObj.appendChild(d);
		}
	}
	
	function searchGoogleADDetailTwoBox()
	{
		//====================현우
		
		if ($("googleADDetailFrameTwoBox") != null)
		{
		    //$("googleADDetailFrameTwoBox").removeNode(true);
		    $("googleADDetailFrameTwoBox").parentNode.removeChild($("googleADDetailFrameTwoBox"));
		}
		var layerDISPMainContentsObj = document.getElementById("layerDISPGoogleADTwoBox");
		var j="/GoogleADViewTwoBox.htm";
		if (layerDISPMainContentsObj != null)
		{
		    layerDISPMainContentsObj.innerHTML = "";
			var d=document.createElement("iframe");
			var h={id:"googleADDetailFrameTwoBox",name:"googleADDetailFrameTwoBox",src:j,frameBorder:"0",width:"250px",height:"250px",marginWidth:"0",marginHeight:"0",hspace:"0",vspace:"0",allowTransparency:"true",scrolling:"no"};
			for(var o in h)
			{
				d.setAttribute(o,h[o]);
			}
			layerDISPMainContentsObj.appendChild(d);
		}
	}
	//한주 끝