///////////////////////////////
function object(objectId){
  if(document.getElementById && document.getElementById(objectId)){	return document.getElementById(objectId);}
  else if (document.all && document.all(objectId)){return document.all(objectId); }
  else if (document.layers && document.layers[objectId]){return document.layers[objectId];}
  else {return false;}
}
function posinlist(pulldown, val) {if (val != "")for (var i=0; i<pulldown.options.length; i++){var opVal = ""+pulldown.options[i].value;if (opVal == "")opVal = pulldown.options[i].text;if (opVal.toLowerCase() == val.toLowerCase()) {return i;break;}}return -1;}
function setselect(pulldown, val) { var p = posinlist(pulldown,val); if (p != -1) pulldown.options.selectedIndex = p;}
function wordcount(txt_input){var count = new String(txt_input.value).length;count = count/6; object('wordcount').innerHTML= Math.round(count) ;}
function togglepanel(id){
    //closeall(id);
	var ele = object(id);
	ele.style.display = (ele.style.display=='none'?'block':'none');
}
function setAllFolders(how){
	var way = ""+how;
	if(way=="")way="block";
	if(way=="closed")way="none";
	if(way=="open")way="block";
	var divs = window.document.getElementsByTagName('div');
	for(var i=0;i<divs.length;i++){
		if(divs[i].getAttribute('isfolder')=='true')
			divs[i].style.display=way;
	}
	//last_toggle = way;
}
function toggleinline(anchor){
	var tgt = anchor.getElementsByTagName('div')[0];
	if(	tgt.style.display=='none' )	tgt.style.display='inline';
	else 	tgt.style.display='none';
}
var blockreq;
function blockloaded() {return blockreq.status == 200;}
function reqok(){return (blockreq && blockloaded());}
function sendurl(url){
	delete	blockreq;
	if (window.XMLHttpRequest) {

		blockreq = new XMLHttpRequest();
	    blockreq.open("get", url, false);
	    blockreq.send(null);

	} else if (window.ActiveXObject) {
		try { blockreq = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) {
	  		try {	blockreq = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) {
	    		// No HTTP request for you! I suppose a message about a browser upgrade should go here.
	  		}//second try
		}//first try
	 	if (blockreq) {

	        blockreq.open("get", url, false);
	        blockreq.send();
	    }
	}// if activex
}

function modflag(id){url = "http://tvtropes.org/pmwiki/review_flag.php?id="+id;sendurl(url);}

