/*---------------------------------------------------------------
-----------------------------------------------------------------
geisai javascript
-----------------------------------------------------------------

.topPage News Event

-----------------------------------------------------------------
---------------------------------------------------------------*/

/*=================================================================
//
// .topPage News Event
//
=================================================================*/
function newsMouseEvent() {
	if(!$('top'))  return false;
	var newsList = document.getElementsByClassName("box", "div");
	//alert(newsList.length);
	for(i=0;i<newsList.length;i++){
		
		var checkNode = node_after(newsList[i]);
		var checkA = node_after(checkNode[0]);		
			if(checkA[0].href) {
				Element.addClassName(newsList[i], 'pointer');
				newsList[i].onclick = function (){
				var NodeArray = node_after(this);
				var thisHref = node_after(NodeArray[0]);
				clicklink(thisHref[0].href);
				}
			}
			newsList[i].onmouseover = function (){
				Element.addClassName(this, 'over');
			}
			newsList[i].onmouseout = function (){
				Element.removeClassName(this, 'over');
			}
	}
}

//addEvent(window, 'load', newsMouseEvent, false);

/*=================================================================
//
// .active navigation
//
=================================================================*/
function activeNavi(){
	var naviInfo = $('naviInfo');
	var naviEntry = $('naviEntry');
	var naviBlog = $('naviBlog');
	var naviMovie = $('naviMovie');
	var naviHis = $('naviHis');
	var naviArtist = $('naviArtist');
	var naviAbout = $('naviAbout');
	var naviMypage = $('naviMypage');
	
	if($('info')){
		naviInfo.addClassName('active');
	}else if($('entry')){
		naviEntry.addClassName('active');
	}else if($('blog')){
		naviBlog.addClassName('active');
	}else if($('movieArchive')){
		naviMovie.addClassName('active');
	}else if($('archive')){
		naviHis.addClassName('active');
	}else if($('search')){
		naviArtist.addClassName('active');
	}else if($('about')){
		naviAbout.addClassName('active');
	}else if($('mypage') || $('MypageBlog')){
		naviMypage.addClassName('active');
		menuswapinit();
	}
}

//addEvent(window, 'load', activeNavi, false);


/*=================================================================
//
// .active navigation mypage
//
=================================================================*/
function activeNaviMypage(){
	if(!$('mypage')) return false;
	var navi01 = $('myMenu-Top');
	var navi02 = $('myMenu-Conf');
	var navi03 = $('myMenu-Up');
	var navi04 = $('myMenu-Entry');
	var navi05 = $('myMenu-Add');
	var navi06 = $('menu-now');
	
	
	if($('mypageTop')){
		Element.addClassName(navi01, 'active');
	}else if($('userInfoConf')){
		Element.addClassName(navi02, 'active');
	}else if($('userInfoUp')){
		Element.addClassName(navi03, 'active');
	}else if($('entryNew')){
		Element.addClassName(navi04, 'active');
	}else if($('entryAdd')){
		Element.addClassName(navi05, 'active');
	}else if($('entryConfirm')){
		Element.addClassName(navi06, 'currentPage');
	}
}

/*=================================================================
//
// .mypage Entry form Event
//
=================================================================*/
//Global Variables
var entryforms = document.getElementsByTagName('form');
var inputs = new Array();
var labels = new Array(); 
var radios = new Array();
var radioLabels = new Array();
var selects = new Array();
var selectText = "please select";
var tPrice;

function init() {
	if(!document.getElementById) {return false;}
	if(!($('entryStep03') || $('entryStep02') || $('entryStep01') || $('miniStep01') || $('miniStep02') || $('entryStep05'))) return false;
	getElements();
	separateElements();
	addEventRadios();
	addEventSelects()
}


function getElements() {
	if($('price')){
		tPrice = numDelComma($('price').innerHTML);
	}
	var re = new RegExp('(^| )'+'entryForm'+'( |$)');
	for (var nf = 0; nf < document.getElementsByTagName('form').length; nf++) {
		if(re.test(entryforms[nf].className)) {
			for(var nfi = 0; nfi < document.forms[nf].getElementsByTagName('input').length; nfi++){
			 inputs.push(document.forms[nf].getElementsByTagName('input')[nfi]);
			 }
			for(var nfl = 0; nfl < document.forms[nf].getElementsByTagName('label').length; nfl++) {
			 labels.push(document.forms[nf].getElementsByTagName('label')[nfl]);
			}
			for(var nfs = 0; nfs < document.forms[nf].getElementsByTagName('select').length; nfs++){
			 selects.push(document.forms[nf].getElementsByTagName('select')[nfs]);
			}
		}
	}
}


function separateElements() {
	var r = 0; var rl = 0;
	for(var q = 0; q < inputs.length; q++) {
	   if(inputs[q].type == 'radio'){
	       radios[r] = inputs[q]; ++r;
	       for(var w = 0; w < labels.length;w++){
	           if(labels[w].htmlFor == inputs[q].id){
	               if(inputs[q].checked){
	                   labels[w].className = "chosen";
	               }
	               radioLabels[rl] = labels[w];
	               ++rl;
	           }
	       }
	   }
	}
}

function addEventRadios() {
    for(var q = 0; q < radios.length; q++){
        //alert(radios[q].parentNode.parentNode);
				var radioArea = radios[q].parentNode.parentNode;
				radioArea.radioNum = q;
				
				radios[q].rechangeRadioboxes2 = function() {
					var thisArea = this.parentNode.parentNode;
					if(this.checked) {
						for(var q = 0; q < radios.length; q++) {
							if(radios[q].name == this.name) {
									var radioArea = radios[q].parentNode.parentNode;
									Element.removeClassName(radioArea, 'radioAreaChecked');
							}
						}
						Element.addClassName(thisArea, 'radioAreaChecked');
					}
				}

				
				radios[q].onchange = function () {
					this.rechangeRadioboxes2();
				}
				
				radioArea.onclick = function () {
					rechangeRadioboxes(this);
				}
				radioArea.onmouseover = function (){
					overRadioboxes(this);
				}
				radioArea.onmouseout = function() {
					outRadioboxes(this);
				}
				
				radios[q].rechangeRadioboxes2();
    }
}

function overRadioboxes(_elem) {
	if(_elem.className != "radioAreaChecked") { 
		_elem.style.backgroundColor = "#ccc";
	}
}
function outRadioboxes(_elem) {
	if(_elem.className != "radioAreaChecked") {
		_elem.style.backgroundColor = "";
	}
}
function checkRadioboxes(_elem,_radio) {
	_radio.checked = true;
	Element.addClassName(_elem, 'radioAreaChecked');
}
function changeRadioboxes(who) {
	if(checkboxLabels[who].className == "chosen") {
		checkboxes[who].checked = true;
		checkboxLabels[who].className = "";
		checkCheckboxes(who, false);
	}
	else if(checkboxLabels[who].className == "") {
		checkboxes[who].checked = false;
		checkboxLabels[who].className = "chosen";
		checkCheckboxes(who, true);
	}
}
function rechangeRadioboxes(_elem) {
	var thisNum = _elem.radioNum;	
	var thisRadio = radios[thisNum];
	if(!radios[thisNum].checked) {
		//alert(_radio.checked);
		for(var q = 0; q < radios.length; q++) {
		  if(radios[q].name == radios[thisNum].name) {
		      radios[q].checked = false;
					var radioArea = radios[q].parentNode.parentNode;
					Element.removeClassName(radioArea, 'radioAreaChecked');
					//radioLabels[q].className = "";
		  }
		}
		//radios[who].checked = true; radioLabels[who].className = "chosen";
		checkRadioboxes(_elem,thisRadio);
	}
}





function addEventSelects() {
    for(var q = 0; q < selects.length; q++){
			//select要素それぞれの値段を保持する様の変数を作成
				selects[q].basisPrice = numDelComma(selects[q].title);
			
				var selectArea = selects[q].parentNode.parentNode;
				selectArea.selectNum = q;
				
				
				/*----------------------
				要素の現在の値を判別
				------------------------*/
				selects[q].elmPrice = function(){
					this.nowPrice;
					this.lastPrice;
					
					if(this.selectedIndex == 0){
						if(!this.nowPrice){
							this.nowPrice = 0;
						}
					}else{
						//直前の値段を保持
						this.lastPrice = this.nowPrice;
						//現在の値段を保持
						this.nowPrice = this.basisPrice * this.value;
					}
				}
				
				
				
				/*----------------------
				合計値段を計算する処理
				------------------------*/
				selects[q].addPrice = function () {
					
					if(this.selectedIndex == 0){
						//未選択にした場合は合計金額から直前の値段を引く
						tPrice = parseInt(tPrice) - parseInt(this.nowPrice);
						//現在の値段を0に設定
						this.nowPrice = 0;
					}else{
						//差分計算用
						var diff
						
						//現在の値が直前の値より小さい場合
						if(this.nowPrice < this.lastPrice){
							diff = this.lastPrice - this.nowPrice;
							tPrice = parseInt(tPrice) - parseInt(diff);
						}else{
						//現在の値が直前の値より大きい場合
							if(!this.lastPrice){
								this.lastPrice = 0;
							}
							diff = this.nowPrice - this.lastPrice;
							tPrice = parseInt(tPrice) + parseInt(diff);
						}
					}
					//合計値段を表示
					$('price').innerHTML = numAddComma(tPrice);
				}
				
				/*----------------------
				表示を変更する処理
				------------------------*/
				selects[q].changeStyle = function () {	
					//親の親の要素を格納
					var thisArea = this.parentNode.parentNode;
					if(this.selectedIndex != 0){
						Element.addClassName(thisArea, 'radioAreaChecked');
					} else {
						Element.removeClassName(thisArea, 'radioAreaChecked');
					}
				}
				
				selectArea.onmouseover = function (){
					overSelectboxes(this);
				}
				selectArea.onmouseout = function() {
					outSelectboxes(this);
				}
				
				selects[q].onchange = function() {
					this.elmPrice();
					this.addPrice();
					this.changeStyle();
				}
				
				/*----------------------
				reload用にまず始めに実行させる	
				------------------------*/
				selects[q].elmPrice();
				selects[q].changeStyle();			
				
    }
}

function overSelectboxes(_elem) {
	if(_elem.className != "radioAreaChecked") { 
		_elem.style.backgroundColor = "#ccc";
	}
}
function outSelectboxes(_elem) {
	if(_elem.className != "radioAreaChecked") {
		_elem.style.backgroundColor = "";
	}
}
function rechangeSelectboxes(_elem) {
	var thisNum = _elem.selectNum;	
	var thisSelect = selects[thisNum];
	if(!radios[thisNum].checked) {
		//alert(_radio.checked);
		for(var q = 0; q < radios.length; q++) {
		  if(radios[q].name == radios[thisNum].name) {
		      radios[q].checked = false;
					var radioArea = radios[q].parentNode.parentNode;
					Element.removeClassName(radioArea, 'radioAreaChecked');
					//radioLabels[q].className = "";
		  }
		}
		//radios[who].checked = true; radioLabels[who].className = "chosen";
		checkRadioboxes(_elem,thisRadio);
	}
}

addEvent(window, 'load', init, false);


/*=================================================================
//
// .comma add & del
//
=================================================================*/
//3桁区切書式に変換する。引数Numは任意の1バイト数字
	function numAddComma(_num){
		_num += '';
		
		//commaが入っていた場合は消す
		var Separator = _num.indexOf(',',0);
		while( Separator != -1 ){
			//comma位置の手前までの文字列と続く文字列を結合
			_num = _num.substring(0,Separator) + _num.substring(Separator+1,_num.length);
			//次のcommaを走査、なければ終了
			Separator = _num.indexOf(',',0);
		}
		
		//小数点を走査 小数点部分と整数部を分割して保持しておく
		var DecimalPoint = _num.lastIndexOf('.');
		if(DecimalPoint == -1){
			var Decimals = '';
			var Integers = _num + '';
		}else{
			//小数点以下を抽出
			var Decimals = _num.substring(DecimalPoint,_num.length);
			//整数部分を抽出
			var Integers = _num.substring(0,DecimalPoint) + '';
		}
		
		//整数部の文字列長を3の倍数にする。足りない分は手前に' 'を埋め込む
		Blanks = Integers.length % 3;
		if(Blanks !=0 ){
			for(var i = 0; 3 - Blanks > i ; i++){
				Integers = ' ' + Integers;
			}
		}
		
		//整数文字列先頭から3文字おきにcommaを挿入
		//先頭がマイナス符号の時は負数として処理する
		FigureInteger = Integers.substring(0,3);
		var j = 2;
		if(Integers.charAt(2) == '-'){
			FiqureInteger = FiqureInteger + Integers.substring(3,6);
			j=4;
		}
		for(i=j; Integers.length > i ; i++){
			if(i % 3 == 0) {
				FigureInteger = FigureInteger + ',' + Integers.substring(i,i+3);
			}
		}
		//臨時で入れていた' 'を削除
    while (FigureInteger.charAt(0) == ' '){
        FigureInteger = FigureInteger.substring(1,FigureInteger.length);
    }
		
			//整形済みの整数部と、待避してあった小数部を連結。連結した文字列を返して終了！
    	CommaNumber = FigureInteger + Decimals;
    	return CommaNumber;
		
	}
	
	/* 桁区切りのcommaを消す。引数_numはcomma入りの1バイト数字文字列*/
	function numDelComma(_num){
		var Numeric = _num;
		//del all comma
		var Separator = Numeric.indexOf(',',0);
		while(Separator != -1){
			Numeric = Numeric.substring(0,Separator) + Numeric.substring(Separator + 1,Numeric.length);
			Separator = Numeric.indexOf(',',0);
		}
		return Numeric;		
	}

/*=================================================================
//
// .general swap
//
=================================================================*/
function contentBlind(_target) {
	if($(_target)){
		if(!Element.visible(_target)){
			new Effect.BlindDown(_target,{duration:1,afterFinishInternal:function(effect) { rechageAbs('ft');}});
		}else{
			new Effect.BlindUp(_target,{duration:1,beforeFinish:function(effect) { rechageAbs('ft');}});
		}
		if(checkB.IE6){
			$('ft').style.display = "none";
		}
	}
}

/*=================================================================
//
// .MenuUtil Class
//
=================================================================*/
MenuUtil = Class.create();
MenuUtil.prototype = {
	initialize: function(_boolean){
		
		this.cookieBoolean = _boolean;
		
		if(!_boolean){
			//alert('cookie');
		  this.cookieManager = new CookieManager();
		}
	},
	/* うまくいなかないなぁ...
	swapList: function() {
		var swapArray = $A(arguments);
		swapArray.each(function(e){
		if($(e)){
			//alert(swap);
		 swap(e);
		}else{
		}
		});
	},
	*/
	swap: function(id,_boolean,_display){
		var swapElem = $(id);
		var container = swapElem.next('dd');				
		if(_display == 'show') {
			container.show();
			container.previous('dt').addClassName('current');
		}else{
		}
		
		if(!_boolean){
		  Event.observe(swapElem, 'click', this.onClickSwap.bind(this,swapElem));
		}else{
			Event.observe(swapElem, 'click', this.onClickLink.bind(this,swapElem));
		}
		
		if(!this.cookieBoolean){
			var menuCookie = this.cookieManager.getCookie(id);
			if(menuCookie){				
				this.initSwap(swapElem)
			}
	  }
		
	},
	onClickLink: function(e) {
		var firstElm = e.next().down(2);
		if(firstElm.href)
		location.href = firstElm.href;
		//alert(this.eltDisplay.inspect());
	},
	onClickSwap: function(e) {
		var container = e.id + '-container';
		
		if(Element.hasClassName(e, 'current') == false){	
			if (!Element.visible(container)) {			
				new Effect.BlindDown(container,{duration:0.4,afterFinishInternal:function(effect) { rechageAbs('ft');}});
			}
			//cycle through menu highlights and remove
			Element.addClassName(e, 'current');
			// set menu cookie
			if(!this.cookieBoolean){
			  this.cookieManager.setCookie(e.id,true);
			}
			
		} else {
			if (Element.visible(container)) {			
				new Effect.BlindUp(container,{duration:0.4,beforeFinish:function(effect) { rechageAbs('ft');}});
			}
			Element.removeClassName(e,'current');
			// clear menu cookie
			if(!this.cookieBoolean){
			  this.cookieManager.clearCookie(e.id);
			}
		}
	},
	initSwap: function(e){
		var container = e.id + '-container';
		if(e.hasClassName('current') == false){
			if(!Element.visible(container)){
				new Effect.BlindDown(container,{duration:0.4,afterFinishInternal:function(effect) { rechageAbs('ft');}});
			}
			e.addClassName('current');
			if(!this.cookieBoolean){
			  this.cookieManager.setCookie(e.id,true);
			}
		}
	},
	activeMenu: function(e){
		$(e).innerHTML = '<span class="active">' + $(e).innerHTML.stripTags() + '</span>';
	}
}

/*=================================================================
//
// .mypage menuswap (init func)
//
=================================================================*/
function menuswapinit() {
	if(!$('mypage')) return false;
	var menuUtil = new MenuUtil();
	if($('menu-now')){
		menuUtil.swap('menu-now');
	}	
	if($('menu-past')){
		menuUtil.swap('menu-past');
	}
	if($('menu-blog')){
		menuUtil.swap('menu-blog');
	}	
}

function menuswapinitWinner() {
	if(!$('archive')) return false;
	if($('menu-winner')){
		var menuUtil = new MenuUtil();
		menuUtil.swap('menu-winner');
	}	
}
//addEvent(window, 'load', menuswapinitWinner, false);

/*=================================================================
//
// .archive menuswap (page only func)
//
=================================================================*/
function archiveswapinit(_activeId) {
	if(!$('archive')) return false;
	var menuUtil = new MenuUtil(true);
	menuUtil.swap('menu-archive-gp');
	menuUtil.swap('menu-archive-gm');
	menuUtil.swap('menu-archive-gm2');
	menuUtil.swap('menu-archive-g1');
	menuUtil.swap('menu-archive-g2');
	menuUtil.swap('menu-archive-g3');
	menuUtil.swap('menu-archive-g4');
	menuUtil.swap('menu-archive-g5');
	menuUtil.swap('menu-archive-g6');
	menuUtil.swap('menu-archive-g7');
	menuUtil.swap('menu-archive-g8');
	menuUtil.swap('menu-archive-g9');
	menuUtil.swap('menu-archive-g10');
	menuUtil.swap('menu-archive-g11');
	menuUtil.activeMenu(_activeId);
	//alert($(_activeId).up('dd').previous('dt'));
	var activeId = $(_activeId);
	if(_activeId == 'menu-archive-all'){
	}else{
		activeId.up('dd').show();
		activeId.up('dd').previous('dt').addClassName('current');
	}
}

function menuswapinitWinner() {
	if(!$('archive')) return false;
	if($('menu-winner')){
		var menuUtil = new MenuUtil();
		menuUtil.swap('menu-winner');
	}	
}
//addEvent(window, 'load', menuswapinitWinner, false);

/*=================================================================
//
// .ie6 menuswap measure
//
=================================================================*/
function rechageAbs(_target) {
	if(checkB.IE6){
		if($(_target).style.bottom){
			$(_target).style.bottom = "";
			//alert('end');
		}else{
			$(_target).style.bottom = 0;
		}
		$(_target).style.display = "";
	}else{
		//alert('test');
	}
}


/*=================================================================
//
// .resv scroll 
//
=================================================================*/
function resvScroll(_id) {
	new Effect.ScrollTo(_id);
}


/*=================================================================
//
// .movie page new entry function
//
=================================================================*/
function newEntry() {
    //passage time 1week
    var pass = 14;
    
    //now time
    var currentDate = new Date();
		
		$$('dt.date').each(function(elm){
			var entryTime = elm.innerHTML.split(".");
			var entryDate = new Date(entryTime[0],entryTime[1]-1,entryTime[2].substr(0,2));
			var now = (entryDate.getTime() - currentDate.getTime())/(24*60*60*1000);
			now = Math.ceil(now);
			if(-now <= pass){
				elm.addClassName('new')
			}
		
		});
    
		
		/*
    var dateDt = document.getElementsByTagName('dt');
    
    var i;
		
    for(i = 0; i<dateDt.length;i++){
        if(dateDt[i].getAttribute('class') =='date' || dateDt[i].getAttribute('className') == 'date' ){
						
            var time = dateDt[i].childNodes[0].nodeValue.split(".");
						
						//alert(time[2].substr(0,2));
						
            var entryDate = new Date(time[0],time[1]-1,time[2].substr(0,2));
            var now = (entryDate.getTime() - currentDate.getTime())/(24*60*60*1000);
            
            now = Math.ceil(now);
												
            if(-now <= pass){
							Element.addClassName(dateDt[i], 'new');
            }
        }
    }
		*/
    
}


/*=================================================================
//
// .prototye 1.5 getElementByClassName
//
=================================================================*/

if (!document.getElementsByClassName) {
	if (Prototype.BrowserFeatures.XPath) {
  document._getElementsByXPath = function(expression, parentElement) {
    var results = [];
    var query = document.evaluate(expression, $(parentElement) || document,
      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    for (var i = 0, length = query.snapshotLength; i < length; i++)
      results.push(query.snapshotItem(i));
    return results;
  };

  document.getElementsByClassName = function(className, parentElement) {
    var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
    return document._getElementsByXPath(q, parentElement);
  }

} else document.getElementsByClassName = function(className, parentElement) {
  var children = ($(parentElement) || document.body).getElementsByTagName('*');
  var elements = [], child;
  for (var i = 0, length = children.length; i < length; i++) {
    child = children[i];
    if (Element.hasClassName(child, className))
      elements.push(Element.extend(child));
  }
  return elements;
};
}


/*=================================================================
//
// .mypage setMypgeMenu
//
=================================================================*/
function setMypgeMenu(_category, _target) {
	var url = '/mypage/menu_only.php';
	var ajax = new Ajax.Updater(_target,url,{
		postBody: 'blogedit=' + _category,
		onSuccess: function (request) {
			//alert('success');
		},
		onComplete: function(request) {
			var menuUtil = new MenuUtil();
			menuUtil.swap('menu-blog');
			menuUtil.swap('menu-now');
			menuUtil.swap('menu-past');
			rechageAbs('ft');
		}
		}
	);
}



/*=================================================================
//
// .mypageBlogEdit function
//
=================================================================*/

function mypageBlogEdit(){	
		//setup
	var textarea = new Control.TextArea('textareaForm');
	var toolbar = new Control.TextArea.ToolBar(textarea);
	toolbar.container.id = 'editor-content-toolbar'; //for css styles
	/*
	//preview of markdown text
	var converter = new Showdown.converter;
	var converter_callback = function(value){
		$('markdown_formatted').update(converter.makeHtml(value));
	}
	converter_callback(textarea.getValue());
	textarea.observe('change',converter_callback);
	*/
	
	
	//buttons
	/*
	toolbar.addButton('Italics',function(){
		this.wrapSelection('<em>','</em>');
	},{
		id: 'markdown_italics_button'
	});
	*/
	
	/*
	toolbar.addButton('Image',function(){
		var selection = this.getSelection();
		var response = prompt('Enter Image URL','');
		if(response == null)
			return;
		this.replaceSelection('![' + (selection == '' ? 'Image Alt Text' : selection) + '](' + (response == '' ? 'http://image_url/' : response).replace(/^(?!(f|ht)tps?:\/\/)/,'http://') + ')');
	},{
		id: 'markdown_image_button'
	});
	*/
	
	toolbar.addButton('Link',function(){
		var selection = this.getSelection();
		var response = prompt('URLを入れて下さい','');
		if(response == null)
			return;
		this.replaceSelection('<a href="' +  (response == '' ? 'http://link_url/' : response).replace(/^(?!(f|ht)tps?:\/\/)/,'http://') + '" rel="external">' + (selection == '' ? 'Link Text' : selection) + '</a>');
	},{
		id: 'command-insert-link',
		className: 'button'
	});
	
	toolbar.addButton('Center Text',function(){
		this.wrapSelection('<div class="center">','</div>');
	},{
		id: 'command-justify-center',
		className: 'button'
	});
	
	toolbar.addButton('small font',function(){
		this.wrapSelection('<span class="small">','</span>');
	},{
		id: 'command-font-size-smaller',
		className: 'button'
	});
	
	toolbar.addButton('large font',function(){
		this.wrapSelection('<span class="big">','</span>');
	},{
		id: 'command-font-size-larger',
		className: 'button'
	});
	
	toolbar.addButton('Bold',function(){
		this.wrapSelection('<strong>','</strong>');
	},{
		id: 'command-bold',
		className: 'button'
	});
	
	toolbar.addButton('font color #f40000',function(){
		this.wrapSelection('<span class="f-f40000">','</span>');
	},{
		id: 'command-color-f40000',
		className: 'button'
	});
	
	toolbar.addButton('font color #ff26a3',function(){
		this.wrapSelection('<span class="f-ff26a3">','</span>');
	},{
		id: 'command-color-ff26a3',
		className: 'button'
	});
	
	toolbar.addButton('font color #ff6f26',function(){
		this.wrapSelection('<span class="f-ff6f26">','</span>');
	},{
		id: 'command-color-ff6f26',
		className: 'button'
	});
	
	toolbar.addButton('font color #f5b500',function(){
		this.wrapSelection('<span class="f-f5b500">','</span>');
	},{
		id: 'command-color-f5b500',
		className: 'button'
	});
	
	toolbar.addButton('font color #93ca30',function(){
		this.wrapSelection('<span class="f-93ca30">','</span>');
	},{
		id: 'command-color-93ca30',
		className: 'button'
	});
	
	toolbar.addButton('font color #1aab3b',function(){
		this.wrapSelection('<span class="f-1aab3b">','</span>');
	},{
		id: 'command-color-1aab3b',
		className: 'button'
	});
	
	toolbar.addButton('font color #0dc7f1',function(){
		this.wrapSelection('<span class="f-0dc7f1">','</span>');
	},{
		id: 'command-color-0dc7f1',
		className: 'button'
	});
	
	toolbar.addButton('font color #007fff',function(){
		this.wrapSelection('<span class="f-007fff">','</span>');
	},{
		id: 'command-color-007fff',
		className: 'button'
	});
	
	toolbar.addButton('font color #6730ca',function(){
		this.wrapSelection('<span class="f-6730ca">','</span>');
	},{
		id: 'command-color-6730ca',
		className: 'button'
	});
	
	toolbar.addButton('help',function(){},{
		id: 'command-help',
		className: 'button'
	});
	
		//Modal Window
	//Relative Window / Content from Ajax
	
		var openWin = $('openWin');

		var modal = new Control.Modal(openWin,{
		overlayOpacity: 0.75
		,className: 'modal'
		,fade: true
		,beforeOpen: function(){
		}
		,afterClose: function(){
		}
	});	
}

function setEditerIcon() {
	//HoverBox 
	new Control.Window($('tip_toolbar_link'),{
   position: 'relative',
   hover: $('command-insert-link') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_center'),{
   position: 'relative',
   hover: $('command-justify-center') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_small'),{
   position: 'relative',
   hover: $('command-font-size-smaller') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_larger'),{
   position: 'relative',
   hover: $('command-font-size-larger') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_bold'),{
   position: 'relative',
   hover: $('command-bold') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_f40000'),{
   position: 'relative',
   hover: $('command-color-f40000') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_ff26a3'),{
   position: 'relative',
   hover: $('command-color-ff26a3') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_ff6f26'),{
   position: 'relative',
   hover: $('command-color-ff6f26') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_f5b500'),{
   position: 'relative',
   hover: $('command-color-f5b500') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_93ca30'),{
   position: 'relative',
   hover: $('command-color-93ca30') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_1aab3b'),{
   position: 'relative',
   hover: $('command-color-1aab3b') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_0dc7f1'),{
   position: 'relative',
   hover: $('command-color-0dc7f1') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_007fff'),{
   position: 'relative',
   hover: $('command-color-007fff') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_6730ca'),{
   position: 'relative',
   hover: $('command-color-6730ca') ,offsetTop: -37, offsetLeft: -30,
   width: 80,
   className: 'tooltip'
	 });
	 
	 new Control.Window($('tip_toolbar_help'),{
   position: 'relative',
   hover: $('command-help') ,offsetTop: -59, offsetLeft: -30,
   width: 100,
   className: 'tooltip'
	 });
}