function ButtonControl() {
	var bCopyObjectLoaded = false;
	var bOpenNewWindow = true; // bug in true.

	var windowSize = {
		popup1:{width:595, height:575},
		popup2:{width:690, height:600},
		popup3:{width:360, height:370},
		popup4:{width:690, height:687},
		popup5:{width:434, height:239},
		popup6:{width:450, height:600}
	};

	var gLanguageResources = new Array();
	gLanguageResources['successToCopy'] = '해당주소가 클립보드에 복사되었습니다.';
	gLanguageResources['failToCopy'] = '해당주소를 클립보드에 복사하지 못했습니다.';

	var initialize = function () {
		var objLinks = document.getElementsByTagName('body')[0].getElementsByTagName('a');
		var currentNode = null;

		for (var i=0; i<objLinks.length; i++) {
			currentNode = objLinks[i];

			if (currentNode.className.indexOf('closebtn') != -1) {
				currentNode.onclick = closePopup;
			} else if (currentNode.className.indexOf('resetbtn') != -1) {
				currentNode.onclick = resetForm;
			} else if (currentNode.className.indexOf('popup1btn') != -1) { // print popup
				currentNode.onclick = openPrintPopup;
			} else if (currentNode.className.indexOf('popup2btn') != -1) { // photo gallery popup
				currentNode.onclick = openPhotoGalleryPopup;
			} else if (currentNode.className.indexOf('popup3btn') != -1) { // popular tag list popup
				currentNode.onclick = openPopularTagListPopup;
			} else if (currentNode.className.indexOf('popup4btn') != -1) { // popular tag list popup
				currentNode.onclick = openContactUsPopup;
			} else if (currentNode.className.indexOf('copybtn') != -1) { // copy button
				if (!bCopyObjectLoaded)
					bCopyObjectLoaded = loadCopyObject();
				currentNode.onclick = copyThisURL;
			} else if (currentNode.className.indexOf('friendbtn') != -1) { // recommend to friend button
				currentNode.onclick = openRecommendToFriendPopup;
			} else if (currentNode.className.indexOf('refusalbtn') != -1) { // email illegal collecting refusal button
				currentNode.onclick = openEmailCollectingRefusalPopup;
			} else if (currentNode.className.indexOf('listbtn') != -1) { // list  button
				currentNode.onclick = function () { return this.href }
			} else if (currentNode.className.indexOf('popup') != -1) { // list  button
				currentNode.onclick = function () { return openPopup(this.href, null, {}) }
			} else if (currentNode.className.indexOf('confirmbtn') != -1) { // confirmbtn  button
				currentNode.onclick = function () { return this.href }
//			} else {
//				currentNode.onclick = function () { return this.href; }
//			} else if (bOpenNewWindow && currentNode.getAttribute('href').match('^https?://.+')) {
//				currentNode.onclick = function () { return openPopup(this.href, null, {}) }
			}
		}
	}

	var closePopup = function () {
		self.close();
		return false;
	}

	var openEmailCollectingRefusalPopup = function () {
		return openPopup(this.href, 'refusalPopup', {
			status:1,
			toolbar:0,
			location:0,
			menubar:0,
			directories:0,
			resizable:0,
			scrollbars:0,
			width:windowSize.popup5.width,
			height:windowSize.popup5.height
		});
	}

	var openPrintPopup = function () {
		return openPopup(this.href, 'printPopup', {
			status:1,
			toolbar:0,
			location:0,
			menubar:0,
			directories:0,
			resizable:0,
			scrollbars:0,
			width:windowSize.popup1.width,
			height:windowSize.popup1.height
		});
	}

	var openPhotoGalleryPopup = function () {
		return openPopup(this.href, 'photoGalleryPopup', {
			status:0,
			toolbar:0,
			location:0,
			menubar:0,
			directories:0,
			resizable:0,
			scrollbars:0,
			width:windowSize.popup2.width,
			height:windowSize.popup2.height
		});
	}

	var openPopularTagListPopup = function () {
		return openPopup(this.href, 'popularTagListPopup', {
			status:0,
			toolbar:0,
			location:0,
			menubar:0,
			directories:0,
			resizable:0,
			scrollbars:0,
			width:windowSize.popup3.width,
			height:windowSize.popup3.height
		});
	}

	var openPopup = function (url, id, props) {
		try {
			window.open(url, id, inspect(props));
		} catch (e) {
			return true;
		}

		return false;
	}

	var openRecommendToFriendPopup = function () {
		return openPopup(this.href, 'recommendToFriendPopup', {
			status:0,
			toolbar:0,
			location:0,
			menubar:0,
			directories:0,
			resizable:0,
			scrollbars:0,
			width:windowSize.popup4.width,
			height:windowSize.popup4.height
		});
	}

	var openContactUsPopup = function () {
		return openPopup(this.href, 'contactUsPopup', {
			status:0,
			toolbar:0,
			location:0,
			menubar:0,
			directories:0,
			resizable:0,
			scrollbars:0,
			width:windowSize.popup6.width,
			height:windowSize.popup6.height
		});
	}

	var resetForm = function () {
		Object.getParentNode(this, 'form').reset();
		return false;
	}

	var inspect = function (data) {
		var temp = new Array();

		for (var name in data) {
			temp.push(name + '=' + data[name]);
		}

		return temp.join(',');
	}

	// inspired from Textcube(under GPL license).
	var copyThisURL = function () {
		var url = this.href;

		try {
			thisMovie('clipboardPoter').setClipBoard(url);
		} catch(e) {
			if(objBrowser.isIE) {
				window.clipboardData.setData('Text', url);
				window.alert(gLanguageResources['successToCopy']);
			}
		} finally {
			return false;
		}
	}

	var thisMovie = function (movieName) {
	    if (navigator.appName.indexOf('Microsoft') != -1) {
	        return window[movieName]
	    }
	    else {
	        return document[movieName]
	    }
	}

	var onClipBorad = function (result) {
		alert(result ? gLanguageResources['successToCopy'] : gLanguageResources['failToCopy']);
	}

	var loadCopyObject = function () {
		var objFlash = new Flash();
		objFlash.generateCode({
			codebase:'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			width:1,
			height:1,
			id:'clipboardPoter',
			src:'/ko/scripts/flash/clipboardPoter',
			wmode:'transparent',
			name:'clipboardPoter',
			allowscriptaccess:'sameDomain',
			pluginspage:'http://www.macromedia.com/go/getflashplayer',
			movie:'/ko/scripts/flash/clipboardPoter',
			flashvars:'callback=onClipBorad'
		});
		window.clipboardPoter = document.getElementById('clipboardPoter');

		return true;
	}

	initialize();
}