function on_oc(thisurl){

        msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=600,height=400,left=0,top=0');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
}

function checkwords(theform,thetextbox,maxlimit){
var words = theform.value;
var wordsarray = words.split(/\b[\s,\.-:;]*/);
var numwords = wordsarray.length;
  if (numwords > maxlimit)
      {alert('Error Max limit of words reached');
// .value = theform.value.substring(0, maxlimit);
}
      else
      {thetextbox.value = numwords;}
}

function bm(title, url){
if (document.all)
	window.external.AddFavorite(url, title);
else if (window.sidebar)
	window.sidebar.addPanel(title, url, "");
}

function fixit()
	{
		var original = document.theForm.theField.value;
		var o_split = original.split(" ");
		//this probably isn't a complete list of words that shouldn't be capitalized
		var special_words = new Array('and', 'the', 'to', 'for', 'is', 'in', 'a', 'at', 'an', 'from', 'by', 'if', 'of');
		for (i=0;i<o_split.length;i++) {
			if (i == 0) {
				//always capitalize the first word
				o_split[i] = (o_split[i].substring(0,1)).toUpperCase() + o_split[i].substring(1);
			}
			else if(special_words.indexOf(o_split[i]) < 0) { 
			  	o_split[i] = (o_split[i].substring(0,1)).toUpperCase() + o_split[i].substring(1);
			}
		}
		retval = o_split.join(' ');
		document.theForm.theField.value = retval;
	}



	var formerrormsg="You\'ve attempted to submit the form multiple times.\n Please reload page if you need to resubmit form."

	
	function checksubmit(submitbtn){
	checksubmit=blocksubmit
	submitbtn.form.submit()
	return false
	}
	
	function blocksubmit(){
	if (typeof formerrormsg != "undefined")
	alert(formerrormsg)
	return false
	}

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

function addToFavorite(title){
  window.external.AddFavorite(document.location,title)
}

function textCounter(field, countfield, maxlimit) {
  if (field.value.length > maxlimit)
      {field.value = field.value.substring(0, maxlimit);}
      else
      {countfield.value = maxlimit - field.value.length;}
  }

var ie4 = false; if(document.all) { ie4 = true; }
function getObject(id) {
        if (ie4) {
                return document.all[id];
        } else {
                return document.getElementById(id);
        }
}

function toggle(link, divId) {
        var lText = link.innerHTML;
        var d = getObject(divId);
        if (d.style.display == 'none') {
//                link.innerHTML = '--'; 
		d.style.display = 'block';
        } else {
                // link.innerHTML = '+'; 
		d.style.display = 'none';
        }
}
// for ajax chkusrname

function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}

var http = createRequestObject();

function sndReq(action) {
    http.open('get', '/chkusr.php?username='+action);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
   //         alert(update[1].replace(/(<([^>]+)>)/ig,""));
        }
    }
}


/***********************************************
* Dock Content script- Created by and © Dynamicdrive.com
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full script
***********************************************/

var offsetfromedge=0      //offset from window edge when content is "docked". Change if desired.
var dockarray=new Array() //array to cache dockit instances
var dkclear=new Array()   //array to cache corresponding clearinterval pointers

function dockit(el, duration){
this.source=document.all? document.all[el] : document.getElementById(el);
this.source.height=this.source.offsetHeight;
this.docheight=truebody().clientHeight;
this.duration=duration;
this.pagetop=0;
this.elementoffset=this.getOffsetY();
dockarray[dockarray.length]=this;
var pointer=eval(dockarray.length-1);
var dynexpress='dkclear['+pointer+']=setInterval("dockornot(dockarray['+pointer+'])",100);';
dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearInterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
eval(dynexpress);
}

dockit.prototype.getOffsetY=function(){
var totaloffset=parseInt(this.source.offsetTop);
var parentEl=this.source.offsetParent;
while (parentEl!=null){
totaloffset+=parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function dockornot(obj){
obj.pagetop=truebody().scrollTop;
if (obj.pagetop>obj.elementoffset) //detect upper offset
obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge+"px";
else if (obj.pagetop+obj.docheight<obj.elementoffset+parseInt(obj.source.height)) //lower offset
obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge+"px";
else
obj.source.style.top=0;
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

