var canFormat = 0;
if (document.selection)
    canFormat = 1;
var ua = navigator.userAgent;
if (ua.indexOf('Gecko') >= 0 && ua.indexOf('Safari') < 0)
    canFormat = 1;


	function getSelected (e) {
	    if (document.selection) {
	        e.focus();
	        var range = document.selection.createRange();
	        return range.text;
	    } else {
	        var length = e.textLength;
		if (length == undefined) return;
	        var start = e.selectionStart;
	        var end = e.selectionEnd;
	        if (end == 1 || end == 2) end = length;
	        return e.value.substring(start, end);
	    }
	}

	function setSelection (e, v) {
	    if (document.selection) {
	        e.focus();
	        var range = document.selection.createRange();
	        range.text = v;
	    } else {
	        var length = e.textLength;
	        var start = e.selectionStart;
	        var end = e.selectionEnd;
	        if (end == 1 || end == 2) end = length;
	        e.value = e.value.substring(0, start) + v + e.value.substr(end, length);
	        e.selectionStart = start + v.length;
	        e.selectionEnd = start + v.length;
	    }
	    e.focus();
	}
	
function formatStr (e, v) {
 document.write("hello");
   //if (!canFormat) return;
    var str = getSelected(e);
    if (!str) return;
    setSelection(e, '<' + v + '>' + str + '</' + v + '>');
    return false;
}

function tip(url,num){
	var req = null;
	var response = null;

	if (window.XMLHttpRequest) {
	　req = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
	　req = new ActiveXObject("Microsoft.XMLHTTP");
	}
     
	alert('投票ありがとう！\nまた応援してね。');
	//alert(url);
	req.open("GET", url, false);
	req.send(null);
	//response = req.responseText;	req.open("GET", url, false);
	//response = req.responseText;
	return null;
}

function deleteconfirm(){
	if(confirm('削除しますか？')){
		document.form1.submit();
	}
}
/*--------------------------------------------------------------------------*
 *  
 *  heightLine JavaScript Library beta1
 *  
 *  MIT-style license. 
 *  
 *  2007 Kazuma Nishihata 
 *  http://www.webcreativepark.net
 *  
 *--------------------------------------------------------------------------*/
new function(){
	
	function heightLine(){
	
		this.className="heightLine";
		this.parentClassName="heightLineParent"
		reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i");
		objCN =new Array();
		var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
		for(var i = 0; i < objAll.length; i++) {
			var eltClass = objAll[i].className.split(/\s+/);
			for(var j = 0; j < eltClass.length; j++) {
				if(eltClass[j] == this.className) {
					if(!objCN["main CN"]) objCN["main CN"] = new Array();
					objCN["main CN"].push(objAll[i]);
					break;
				}else if(eltClass[j] == this.parentClassName){
					if(!objCN["parent CN"]) objCN["parent CN"] = new Array();
					objCN["parent CN"].push(objAll[i]);
					break;
				}else if(eltClass[j].match(reg)){
					var OCN = eltClass[j].match(reg)
					if(!objCN[OCN]) objCN[OCN]=new Array();
					objCN[OCN].push(objAll[i]);
					break;
				}
			}
		}
		
		//check font size
		var e = document.createElement("div");
		var s = document.createTextNode("S");
		e.appendChild(s);
		e.style.visibility="hidden"
		e.style.position="absolute"
		e.style.top="0"
		document.body.appendChild(e);
		var defHeight = e.offsetHeight;
		
		changeBoxSize = function(){
			for(var key in objCN){
				if(key == "parent CN"){
					for(var i=0 ; i<objCN[key].length ; i++){
						var max_height=0;
						var CCN = objCN[key][i].childNodes;
						for(var j=0 ; j<CCN.length ; j++){
							if(CCN[j] && CCN[j].nodeType == 1){
								CCN[j].style.height="auto";
								max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;
							}
						}
						for(var j=0 ; j<CCN.length ; j++){
							if(CCN[j].style)CCN[j].style.height = max_height + "px";
						}
					}
				}else{
					var max_height=0;
					for(var i=0 ; i<objCN[key].length ; i++){
						objCN[key][i].style.height="auto";
						max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;
					}
					for(var i=0 ; i<objCN[key].length ; i++){
						objCN[key][i].style.height = max_height + "px";
					}
				}
			}
		}
		
		checkBoxSize = function(){
			if(defHeight != e.offsetHeight){
				changeBoxSize();
				defHeight= e.offsetHeight;
			}
		}
		changeBoxSize();
		setInterval(checkBoxSize,1000)
	}
	
	function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
	addEvent(window,"load",heightLine);
}